mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
clean code up
This commit is contained in:
@@ -19,31 +19,15 @@ shar-stat.waveItem = [lightgray]Item:[]
|
|||||||
#Settings
|
#Settings
|
||||||
setting.barstyle.name = Unit UI: Change Bar Style
|
setting.barstyle.name = Unit UI: Change Bar Style
|
||||||
setting.barstyle.description = Changes the bar sprite in the unit information interface.
|
setting.barstyle.description = Changes the bar sprite in the unit information interface.
|
||||||
setting.infoUiScale.name = Information UI Scale
|
|
||||||
setting.infoUiScale.description = Sets the scale of the UnitInfo information interface.
|
|
||||||
setting.coreItemCheckRate.name = Resource UI: Update Rate
|
|
||||||
setting.coreItemCheckRate.description = Sets how often the core resources are checked.\nThe slower rate, the better gameplay performance gets.
|
|
||||||
setting.wavemax.name = Wave UI: Wave Amount To Display
|
setting.wavemax.name = Wave UI: Wave Amount To Display
|
||||||
setting.wavemax.description = Sets the limit of visible waves in the wave list.
|
setting.wavemax.description = Sets the limit of visible waves in the wave list.
|
||||||
setting.infoui.name = Display Information UI
|
|
||||||
setting.infoui.description = Enables the information interface on the left to display.\nWhen disabled, all associated updates will be stopped.
|
|
||||||
setting.waveui.name = Display Wave UI
|
|
||||||
setting.waveui.description = Enables the top-left wave interface to display.\nWhen disabled, all associated updates will be stopped.
|
|
||||||
setting.pastwave.name = Wave UI: Display Previous Wave
|
setting.pastwave.name = Wave UI: Display Previous Wave
|
||||||
setting.pastwave.description = Displays the previous wave in the wave list.\nThe current wave is highlighted with red color.
|
setting.pastwave.description = Displays the previous wave in the wave list.\nThe current wave is highlighted with red color.
|
||||||
setting.emptywave.name = Wave UI: Display Empty Wave
|
setting.emptywave.name = Wave UI: Display Empty Wave
|
||||||
setting.emptywave.description = Displays empty waves in the wave list.
|
setting.emptywave.description = Displays empty waves in the wave list.
|
||||||
setting.itemcal.name = Resource UI: Calculate item inc/dec speed.
|
|
||||||
setting.itemcal.description = Calculate increase/decrease speed of core item and display results.
|
|
||||||
setting.schem.name = Display Schematic HUD
|
setting.schem.name = Display Schematic HUD
|
||||||
setting.schem.description = Displays schem hud on right-side, which helps quick select.
|
setting.schem.description = Displays schem hud on right-side, which helps quick select.
|
||||||
|
|
||||||
setting.rangeRadius.name = Near Range Margin
|
|
||||||
setting.rangeRadius.description = Sets the range detection distance.
|
|
||||||
setting.rangeNearby.name = Display Near Range
|
|
||||||
setting.rangeNearby.description = Enables automatic range display.\nIf you approach the range by a certain distance, the range is displayed in advance.
|
|
||||||
setting.allTargetRange.name = Display All Target Ranges
|
|
||||||
setting.allTargetRange.description = Displays all target ranges.\nThe range of targets that cannot be aimed at themselves is shown as gray.
|
|
||||||
setting.aliceRange.name = Display Alice Range
|
setting.aliceRange.name = Display Alice Range
|
||||||
setting.aliceRange.description = Displays alice turret range too.
|
setting.aliceRange.description = Displays alice turret range too.
|
||||||
setting.RangeShader.name = Enable Animation
|
setting.RangeShader.name = Enable Animation
|
||||||
@@ -53,51 +37,44 @@ setting.selectopacity.name = Select Arrow Opacity
|
|||||||
setting.selectopacity.description = Sets the opacity of selection arrow.
|
setting.selectopacity.description = Sets the opacity of selection arrow.
|
||||||
setting.baropacity.name = Health Bar Opacity
|
setting.baropacity.name = Health Bar Opacity
|
||||||
setting.baropacity.description = Sets the opacity of the unit health bar.
|
setting.baropacity.description = Sets the opacity of the unit health bar.
|
||||||
setting.uiopacity.name = UI Background Opacity
|
|
||||||
setting.uiopacity.description = Sets the opacity of the interface background.
|
|
||||||
setting.softRangeOpacity.name = Range Opacity
|
|
||||||
setting.softRangeOpacity.description = Sets the opacity of range circle.
|
|
||||||
|
|
||||||
setting.pathlinelimit.name = Path Line Limit
|
setting.blockStatus.name = enable Block Status
|
||||||
setting.pathlinelimit.description = Too many lines may cause significant device lag.\nIt must be adjusted to the device environment.
|
setting.blockStatus.description = display enemy block status too
|
||||||
setting.unitlinelimit.name = Unit Line Limit
|
setting.powerNode.name = enable Power Node
|
||||||
setting.unitlinelimit.description = Too many lines may cause significant device lag.\nIt must be adjusted to the device environment.
|
setting.powerNode.description = display power node link lines
|
||||||
setting.logiclinelimit.name = Logic Line Limit
|
setting.massDriver.name = enable Mass Driver
|
||||||
setting.logiclinelimit.description = Too many lines may cause significant device lag.\nIt must be adjusted to the device environment.
|
setting.massDriver.description = display mass driver link lines
|
||||||
setting.spawnarrowlimit.name = Spawn Arrow Limit
|
setting.airRange.name = enable air range
|
||||||
setting.spawnarrowlimit.description = Too many arrows may cause significant device lag.\nIt must be adjusted to the device environment.
|
setting.airRange.description = display turret range that can target air units
|
||||||
setting.gaycursor.name = Enable Mouse Trail Effect
|
setting.groundRange.name = enable ground range
|
||||||
setting.gaycursor.description = Creates a rainbow effect under the mouse cursor.
|
setting.groundRange.description = display turret range that can target ground units
|
||||||
setting.unithealthui.name = Display Unit Bar
|
setting.pathLine.name = enable Path Line
|
||||||
setting.unithealthui.description = Displays brief information about health, ammo, shield, status effect, and payload in each unit.
|
setting.pathLine.description = display wave ground unit's ai path lineline
|
||||||
setting.blockfont.name = Display Block Info
|
setting.logicLine.name = enable Logic Line
|
||||||
setting.blockfont.description = Displays brief information about health, shield, reload, etc., in each block.
|
setting.logicLine.description = display lines between logic processor and controlled units
|
||||||
setting.linkedMass.name = Display Mass Driver Link Line
|
setting.unitLine.name = enable Unit Line
|
||||||
setting.linkedMass.description = Indicates the mass drives associated with the selected mass driver(s) by drawing lines.
|
setting.unitLine.description = display ai path each ground units
|
||||||
setting.linkedNode.name = Display Node Link Line
|
setting.unitItem.name = enable Unit Item
|
||||||
setting.linkedNode.description = Indicates the blocks electrically connected to the selected block(s) by drawing lines.
|
setting.unitItem.description = display item amount under each units
|
||||||
setting.select.name = Display Selection Arrow
|
setting.unitBar.name = enable Unit Bar
|
||||||
setting.select.description = Shows which unit or block is selected.
|
setting.unitBar.description = display health bar under each units
|
||||||
setting.deadTarget.name = Keep Target Locked After Its Death
|
setting.autoShooting.name = Enable Auto Shooting
|
||||||
setting.deadTarget.description = Continues to display the coordinates and target information even after the locked target(s) dies.
|
setting.autoShooting.description = no don't do hack
|
||||||
setting.distanceLine.name = Display Distance Line From Selected Target
|
|
||||||
setting.distanceLine.description = Displays dotted lines and numbers to indicate how far away the target is.
|
|
||||||
setting.spawnerarrow.name = Indicate Wave Spawn-Point
|
setting.spawnerarrow.name = Indicate Wave Spawn-Point
|
||||||
setting.spawnerarrow.description = Displays arrow pointing to wave spawn-points.
|
setting.spawnerarrow.description = Displays arrow pointing to wave spawn-points.
|
||||||
|
setting.select.name = Display Selection Arrow
|
||||||
|
setting.select.description = Shows which unit or block is selected.
|
||||||
|
setting.distanceLine.name = Display Distance Line From Selected Target
|
||||||
|
setting.distanceLine.description = Displays dotted lines and numbers to indicate how far away the target is.
|
||||||
setting.elementdebug.name = Element Debug
|
setting.elementdebug.name = Element Debug
|
||||||
setting.elementdebug.description = Show all Element outline
|
setting.elementdebug.description = Show all Element outline
|
||||||
setting.hiddenElem.name = Display hidden element
|
setting.hiddenElem.name = Display hidden element
|
||||||
setting.hiddenElem.description = display hidden element outline too.
|
setting.hiddenElem.description = display hidden element outline too.
|
||||||
|
|
||||||
setting.autoShooting.name = Enable Auto Shooting
|
|
||||||
setting.autoShooting.description = no don't do hack
|
|
||||||
|
|
||||||
setting.shar-title = UnitInfo Settings
|
setting.shar-title = UnitInfo Settings
|
||||||
setting.shar-ui = Overlay UI Settings
|
setting.shar-ui = Overlay UI Settings
|
||||||
setting.shar-range = Auto Range Settings
|
|
||||||
setting.shar-opacity = Opacity Settings
|
|
||||||
setting.shar-draw = Overdrawing Settings
|
setting.shar-draw = Overdrawing Settings
|
||||||
setting.shar-etc = Other
|
|
||||||
|
|
||||||
#Hud
|
#Hud
|
||||||
hud.schematic-list = Schematic List
|
hud.schematic-list = Schematic List
|
||||||
|
|||||||
@@ -3,17 +3,56 @@ package UnitInfo;
|
|||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.Mathf;
|
import arc.math.Mathf;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
|
import arc.struct.Seq;
|
||||||
|
import arc.util.Nullable;
|
||||||
import arc.util.Strings;
|
import arc.util.Strings;
|
||||||
|
import mindustry.Vars;
|
||||||
import mindustry.core.UI;
|
import mindustry.core.UI;
|
||||||
import mindustry.entities.bullet.BulletType;
|
import mindustry.entities.bullet.BulletType;
|
||||||
import mindustry.entities.bullet.LightningBulletType;
|
import mindustry.entities.bullet.LightningBulletType;
|
||||||
|
import mindustry.gen.BlockUnitUnit;
|
||||||
|
import mindustry.gen.Groups;
|
||||||
|
import mindustry.gen.Teamc;
|
||||||
|
import mindustry.gen.Unit;
|
||||||
import mindustry.type.UnitType;
|
import mindustry.type.UnitType;
|
||||||
import mindustry.type.weapons.PointDefenseWeapon;
|
import mindustry.type.weapons.PointDefenseWeapon;
|
||||||
import mindustry.type.weapons.RepairBeamWeapon;
|
import mindustry.type.weapons.RepairBeamWeapon;
|
||||||
|
import mindustry.world.Tile;
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
|
|
||||||
|
import static UnitInfo.SVars.locked;
|
||||||
|
import static UnitInfo.SVars.target;
|
||||||
|
import static arc.Core.input;
|
||||||
|
import static arc.Core.settings;
|
||||||
|
import static mindustry.Vars.player;
|
||||||
|
|
||||||
public class SUtils {
|
public class SUtils {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T extends Teamc> T getTarget(){
|
||||||
|
if(locked && target != null) {
|
||||||
|
if(settings.getBool("deadTarget") && !Groups.all.contains(e -> e == target)) {
|
||||||
|
target = null;
|
||||||
|
locked = false;
|
||||||
|
}
|
||||||
|
else return (T) target; //if there is locked target, return it first.
|
||||||
|
}
|
||||||
|
|
||||||
|
Seq<Unit> units = Groups.unit.intersect(input.mouseWorldX(), input.mouseWorldY(), 4, 4); // well, 0.5tile is enough to search them
|
||||||
|
if(units.size > 0)
|
||||||
|
return (T) units.peek(); //if there is unit, return it.
|
||||||
|
else if(getTile() != null && getTile().build != null)
|
||||||
|
return (T) getTile().build; //if there isn't unit but there is build, return it.
|
||||||
|
else if(player.unit() instanceof BlockUnitUnit b && b.tile() != null)
|
||||||
|
return (T)b.tile();
|
||||||
|
return (T) player.unit(); //if there aren't unit and not build, return player.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static Tile getTile(){
|
||||||
|
return Vars.world.tileWorld(input.mouseWorldX(), input.mouseWorldY());
|
||||||
|
}
|
||||||
|
|
||||||
public static Drawable getDrawable(TextureAtlas.AtlasRegion region, int left, int right, int top, int bottom){
|
public static Drawable getDrawable(TextureAtlas.AtlasRegion region, int left, int right, int top, int bottom){
|
||||||
int[] splits = {left, right, top, bottom};
|
int[] splits = {left, right, top, bottom};
|
||||||
int[] pads = region.pads;
|
int[] pads = region.pads;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import static arc.Core.settings;
|
|||||||
|
|
||||||
public class SVars {
|
public class SVars {
|
||||||
public static HudUi hud = new HudUi();
|
public static HudUi hud = new HudUi();
|
||||||
public static float modUiScale = settings.getInt("infoUiScale");
|
|
||||||
public static TextureRegion clear = atlas.find("clear");
|
public static TextureRegion clear = atlas.find("clear");
|
||||||
public static TextureRegion error = atlas.find("error");
|
public static TextureRegion error = atlas.find("error");
|
||||||
public static RangeShader turretRange;
|
public static RangeShader turretRange;
|
||||||
@@ -19,4 +18,5 @@ public class SVars {
|
|||||||
public static Teamc target;
|
public static Teamc target;
|
||||||
public static boolean locked;
|
public static boolean locked;
|
||||||
public static boolean jsonGen = false;
|
public static boolean jsonGen = false;
|
||||||
|
public static float uiResumeRate = 3 * 60f; //default 3s
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,150 +1,68 @@
|
|||||||
package UnitInfo.core;
|
package UnitInfo.core;
|
||||||
|
|
||||||
import UnitInfo.ui.windows.*;
|
import UnitInfo.ui.windows.*;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
|
||||||
import arc.input.*;
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
|
||||||
import arc.scene.style.*;
|
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
|
||||||
import mindustry.*;
|
|
||||||
import mindustry.entities.Units;
|
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.logic.Ranged;
|
import mindustry.graphics.Pal;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
|
||||||
import mindustry.world.blocks.*;
|
|
||||||
import mindustry.world.blocks.defense.turrets.*;
|
|
||||||
|
|
||||||
|
import static UnitInfo.SUtils.*;
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class HudUi {
|
public class HudUi {
|
||||||
public Table waveInfoTable = new Table();
|
|
||||||
public SchemDisplay schemTable;
|
public SchemDisplay schemTable;
|
||||||
|
|
||||||
public Teamc shotTarget;
|
|
||||||
public Teamc lockedTarget;
|
|
||||||
public boolean locked = false;
|
|
||||||
|
|
||||||
public boolean waveShown;
|
public boolean waveShown;
|
||||||
|
|
||||||
public float a;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T extends Teamc> T getTarget(){
|
|
||||||
if(locked && lockedTarget != null) {
|
|
||||||
if(settings.getBool("deadTarget") && !Groups.all.contains(e -> e == lockedTarget)) {
|
|
||||||
lockedTarget = null;
|
|
||||||
locked = false;
|
|
||||||
}
|
|
||||||
else return (T) lockedTarget; //if there is locked target, return it first.
|
|
||||||
}
|
|
||||||
|
|
||||||
Seq<Unit> units = Groups.unit.intersect(input.mouseWorldX(), input.mouseWorldY(), 4, 4); // well, 0.5tile is enough to search them
|
|
||||||
if(units.size > 0)
|
|
||||||
return (T) units.peek(); //if there is unit, return it.
|
|
||||||
else if(getTile() != null && getTile().build != null)
|
|
||||||
return (T) getTile().build; //if there isn't unit but there is build, return it.
|
|
||||||
else if(player.unit() instanceof BlockUnitUnit b && b.tile() != null)
|
|
||||||
return (T)b.tile();
|
|
||||||
return (T) player.unit(); //if there aren't unit and not build, return player.
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable Tile getTile(){
|
|
||||||
return Vars.world.tileWorld(input.mouseWorldX(), input.mouseWorldY());
|
|
||||||
}
|
|
||||||
|
|
||||||
float heat = 0;
|
float heat = 0;
|
||||||
public void setEvents() {
|
public void setEvents() {
|
||||||
Events.run(EventType.Trigger.update, ()->{
|
Events.run(EventType.Trigger.update, ()->{
|
||||||
target = getTarget();
|
target = getTarget();
|
||||||
if(settings.getBool("deadTarget") && locked && lockedTarget != null && !Groups.all.contains(e -> e == lockedTarget)) {
|
|
||||||
lockedTarget = null;
|
|
||||||
locked = false;
|
|
||||||
}
|
|
||||||
heat += Time.delta;
|
heat += Time.delta;
|
||||||
if(heat > 60) {
|
if(heat > 60) {
|
||||||
heat = 0;
|
heat = 0;
|
||||||
schemTable.setSchemTable();
|
schemTable.setSchemTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Scl.scl(modUiScale) != settings.getInt("infoUiScale") / 100f){
|
|
||||||
modUiScale = settings.getInt("infoUiScale") / 100f;
|
|
||||||
if(modUiScale <= 0) {
|
|
||||||
Log.warn("ui scaling reached zero");
|
|
||||||
modUiScale = 0.25f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(settings.getBool("autoShooting")) {
|
|
||||||
Unit unit = player.unit();
|
|
||||||
if (unit.type == null) return;
|
|
||||||
boolean omni = unit.type.omniMovement;
|
|
||||||
boolean validHealTarget = unit.type.canHeal && shotTarget instanceof Building b && b.isValid() && b.damaged() && shotTarget.team() == unit.team && shotTarget.within(unit, unit.type.range);
|
|
||||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
|
||||||
if ((unit.type != null && Units.invalidateTarget(shotTarget, unit, unit.type.range) && !validHealTarget) || state.isEditor()) {
|
|
||||||
shotTarget = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());
|
|
||||||
boolean aimCursor = omni && player.shooting && unit.type.hasWeapons() && unit.type.faceTarget && !boosted && unit.type.rotateShooting;
|
|
||||||
unit.lookAt(aimCursor ? mouseAngle : unit.prefRotation());
|
|
||||||
|
|
||||||
//update shooting if not building + not mining
|
|
||||||
if(!player.unit().activelyBuilding() && player.unit().mineTile == null) {
|
|
||||||
if(input.keyDown(KeyCode.mouseLeft)) {
|
|
||||||
player.shooting = !boosted;
|
|
||||||
unit.aim(player.mouseX = input.mouseWorldX(), player.mouseY = input.mouseWorldY());
|
|
||||||
} else if(shotTarget == null) {
|
|
||||||
player.shooting = false;
|
|
||||||
if(unit instanceof BlockUnitUnit b) {
|
|
||||||
if(b.tile() instanceof ControlBlock c && !c.shouldAutoTarget()) {
|
|
||||||
Building build = b.tile();
|
|
||||||
float range = build instanceof Ranged ? ((Ranged) build).range() : 0f;
|
|
||||||
boolean targetGround = build instanceof Turret.TurretBuild && ((Turret) build.block).targetAir;
|
|
||||||
boolean targetAir = build instanceof Turret.TurretBuild && ((Turret) build.block).targetGround;
|
|
||||||
shotTarget = Units.closestTarget(build.team, build.x, build.y, range, u -> u.checkTarget(targetAir, targetGround), u -> targetGround);
|
|
||||||
}
|
|
||||||
else shotTarget = null;
|
|
||||||
} else if(unit.type != null) {
|
|
||||||
float range = unit.hasWeapons() ? unit.range() : 0f;
|
|
||||||
shotTarget = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(unit.type.targetAir, unit.type.targetGround), u -> unit.type.targetGround);
|
|
||||||
|
|
||||||
if(unit.type.canHeal && shotTarget == null) {
|
|
||||||
shotTarget = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(Team.sharded));
|
|
||||||
if (shotTarget != null && !unit.within(shotTarget, range)) {
|
|
||||||
shotTarget = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
player.shooting = !boosted;
|
|
||||||
unit.rotation(Angles.angle(unit.x, unit.y, shotTarget.x(), shotTarget.y()));
|
|
||||||
unit.aim(shotTarget.x(), shotTarget.y());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unit.controlWeapons(player.shooting && !boosted);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeftUnitTable(Table table) {
|
public void addSchemTable() {
|
||||||
table.table(t -> {
|
Table table = ((Table) scene.find("minimap/position")).row();
|
||||||
t.center();
|
schemTable = new SchemDisplay();
|
||||||
|
table.add(schemTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addWaveInfoTable() {
|
||||||
|
Table waveInfoTable = new Table(Tex.buttonEdge4, table -> {
|
||||||
|
table.center();
|
||||||
|
table.table(head -> {
|
||||||
|
head.table(image -> {
|
||||||
|
image.left();
|
||||||
|
image.image(() -> getTile() == null || getTile().floor().uiIcon == error ? clear : getTile().floor().uiIcon).size(iconSmall);
|
||||||
|
image.image(() -> getTile() == null || getTile().overlay().uiIcon == error ? clear : getTile().overlay().uiIcon).size(iconSmall);
|
||||||
|
image.image(() -> getTile() == null || getTile().block().uiIcon == error ? clear : getTile().block().uiIcon).size(iconSmall);
|
||||||
|
});
|
||||||
|
head.label(() -> Strings.format("(@, @)", getTile() == null ? "NaN" : getTile().x, getTile() == null ? "NaN" : getTile().y)).center();
|
||||||
|
});
|
||||||
|
table.row();
|
||||||
|
table.image().height(4f).color(Pal.gray).growX().row();
|
||||||
|
/*
|
||||||
|
table.table(tttt -> {
|
||||||
|
tttt.center();
|
||||||
int[] i = {0};
|
int[] i = {0};
|
||||||
|
|
||||||
content.units().each(type -> Groups.unit.contains(u -> u.type == type && (state.rules.pvp ? (u.team != player.team()) : (u.team == state.rules.waveTeam)) && u.isBoss()), type -> {
|
content.units().each(type -> Groups.unit.contains(u -> u.type == type && (state.rules.pvp ? (u.team != player.team()) : (u.team == state.rules.waveTeam)) && u.isBoss()), type -> {
|
||||||
t.table(tt ->
|
tttt.table(stt ->
|
||||||
tt.stack(
|
stt.stack(
|
||||||
new Table(ttt -> ttt.image(type.uiIcon).size(iconSmall)),
|
new Table(ttt -> ttt.image(type.uiIcon).size(iconSmall)),
|
||||||
new Table(ttt -> {
|
new Table(ttt -> {
|
||||||
ttt.right().bottom();
|
ttt.right().bottom();
|
||||||
@@ -157,18 +75,18 @@ public class HudUi {
|
|||||||
ttt.top().right();
|
ttt.top().right();
|
||||||
Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit);
|
Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit);
|
||||||
image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f))));
|
image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f))));
|
||||||
ttt.add(image).size(Scl.scl(modUiScale) * 12f);
|
ttt.add(image).size(12f);
|
||||||
ttt.pack();
|
ttt.pack();
|
||||||
})
|
})
|
||||||
).pad(6)
|
).pad(6)
|
||||||
);
|
);
|
||||||
if(++i[0] % 6 == 0) t.row();
|
if(++i[0] % 6 == 0) tttt.row();
|
||||||
});
|
});
|
||||||
t.row();
|
tttt.row();
|
||||||
i[0] = 0;
|
i[0] = 0;
|
||||||
content.units().each(type -> Groups.unit.contains(u -> u.type == type && (state.rules.pvp ? (u.team != player.team()) : (u.team == state.rules.waveTeam)) && !u.isBoss()), type -> {
|
content.units().each(type -> Groups.unit.contains(u -> u.type == type && (state.rules.pvp ? (u.team != player.team()) : (u.team == state.rules.waveTeam)) && !u.isBoss()), type -> {
|
||||||
t.table(tt ->
|
tttt.table(ttt ->
|
||||||
tt.add(new Stack() {{
|
ttt.add(new Stack() {{
|
||||||
add(new Table(ttt -> ttt.add(new Image(type.uiIcon)).size(iconSmall)));
|
add(new Table(ttt -> ttt.add(new Image(type.uiIcon)).size(iconSmall)));
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
ttt.right().bottom();
|
ttt.right().bottom();
|
||||||
@@ -179,41 +97,10 @@ public class HudUi {
|
|||||||
}));
|
}));
|
||||||
}}).pad(6)
|
}}).pad(6)
|
||||||
);
|
);
|
||||||
if(++i[0] % 6 == 0) t.row();
|
if(++i[0] % 6 == 0) tttt.row();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
*/
|
||||||
|
|
||||||
public void setTile(Table table){
|
|
||||||
table.table(t ->
|
|
||||||
t.table(Tex.underline2, head -> {
|
|
||||||
head.table(image -> {
|
|
||||||
image.left();
|
|
||||||
image.image(() -> getTile() == null ? clear : getTile().floor().uiIcon == error ? clear : getTile().floor().uiIcon).size(iconSmall);
|
|
||||||
image.image(() -> getTile() == null ? clear : getTile().overlay().uiIcon == error ? clear : getTile().overlay().uiIcon).size(iconSmall);
|
|
||||||
image.image(() -> getTile() == null ? clear : getTile().block().uiIcon == error ? clear : getTile().block().uiIcon).size(iconSmall);
|
|
||||||
});
|
|
||||||
Label label = new Label(() -> getTile() == null ? "(null, null)" : "(" + getTile().x + ", " + getTile().y + ")");
|
|
||||||
head.add(label).center();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addSchemTable() {
|
|
||||||
Table table = ((Table) scene.find("minimap/position")).row();
|
|
||||||
schemTable = new SchemDisplay();
|
|
||||||
table.add(schemTable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addWaveInfoTable() {
|
|
||||||
waveInfoTable = new Table(Tex.buttonEdge4, t -> {
|
|
||||||
t.defaults().width(34 * 8f).center();
|
|
||||||
t.table().update(tt -> {
|
|
||||||
tt.clear();
|
|
||||||
setTile(tt);
|
|
||||||
tt.row();
|
|
||||||
setLeftUnitTable(tt);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Table waveTable = (Table) scene.find("waves");
|
Table waveTable = (Table) scene.find("waves");
|
||||||
|
|||||||
@@ -5,18 +5,15 @@ import UnitInfo.ui.*;
|
|||||||
import UnitInfo.ui.draws.OverDraws;
|
import UnitInfo.ui.draws.OverDraws;
|
||||||
import UnitInfo.ui.windows.*;
|
import UnitInfo.ui.windows.*;
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.scene.ui.Dialog;
|
import arc.struct.*;
|
||||||
import arc.struct.Seq;
|
|
||||||
import arc.util.Log;
|
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.mod.*;
|
import mindustry.mod.*;
|
||||||
|
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
import static UnitInfo.ui.windows.UnitDisplay.getTarget;
|
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
import static mindustry.Vars.mobile;
|
import static mindustry.Vars.*;
|
||||||
import static mindustry.Vars.ui;
|
import static UnitInfo.SUtils.*;
|
||||||
|
|
||||||
public class Main extends Mod {
|
public class Main extends Mod {
|
||||||
@Override
|
@Override
|
||||||
@@ -51,17 +48,15 @@ public class Main extends Mod {
|
|||||||
hud.addSchemTable();
|
hud.addSchemTable();
|
||||||
hud.setEvents();
|
hud.setEvents();
|
||||||
OverDrawer.setEvent();
|
OverDrawer.setEvent();
|
||||||
if(jsonGen) ContentJSON.save();
|
|
||||||
|
|
||||||
scene.add(new ElementDisplay());
|
Seq.with(scene.root,
|
||||||
Seq.with(
|
|
||||||
ui.picker, ui.editor, ui.controls, ui.restart, ui.join, ui.discord,
|
ui.picker, ui.editor, ui.controls, ui.restart, ui.join, ui.discord,
|
||||||
ui.load, ui.custom, ui.language, ui.database, ui.settings, ui.host,
|
ui.load, ui.custom, ui.language, ui.database, ui.settings, ui.host,
|
||||||
ui.paused, ui.about, ui.bans, ui.admins, ui.traces, ui.maps, ui.content,
|
ui.paused, ui.about, ui.bans, ui.admins, ui.traces, ui.maps, ui.content,
|
||||||
ui.planet, ui.research, ui.mods, ui.schematics, ui.logic
|
ui.planet, ui.research, ui.mods, ui.schematics, ui.logic
|
||||||
).each(dialog-> dialog.add(new ElementDisplay(dialog)));
|
).each(dialog-> dialog.addChild(new ElementDisplay(dialog)));
|
||||||
|
|
||||||
|
|
||||||
|
if(jsonGen) ContentJSON.save();
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(WorldLoadEvent.class, e -> {
|
Events.on(WorldLoadEvent.class, e -> {
|
||||||
|
|||||||
@@ -1,32 +1,17 @@
|
|||||||
package UnitInfo.core;
|
package UnitInfo.core;
|
||||||
|
|
||||||
import UnitInfo.ui.*;
|
|
||||||
import UnitInfo.ui.draws.OverDraw;
|
import UnitInfo.ui.draws.OverDraw;
|
||||||
import UnitInfo.ui.draws.OverDraws;
|
import UnitInfo.ui.draws.OverDraws;
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.graphics.gl.*;
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.scene.ui.layout.*;
|
|
||||||
import arc.struct.*;
|
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.*;
|
|
||||||
import mindustry.ai.*;
|
|
||||||
import mindustry.ai.types.*;
|
|
||||||
import mindustry.entities.units.*;
|
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.logic.*;
|
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
|
||||||
import mindustry.world.blocks.defense.turrets.*;
|
|
||||||
import mindustry.world.blocks.storage.*;
|
|
||||||
import mindustry.world.blocks.units.*;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
@@ -36,11 +21,9 @@ public class OverDrawer {
|
|||||||
|
|
||||||
public static void setEvent(){
|
public static void setEvent(){
|
||||||
Events.run(EventType.Trigger.draw, () -> {
|
Events.run(EventType.Trigger.draw, () -> {
|
||||||
|
|
||||||
float sin = Mathf.absin(Time.time, 6f, 1f);
|
float sin = Mathf.absin(Time.time, 6f, 1f);
|
||||||
|
|
||||||
Draw.z(Layer.max);
|
Draw.z(Layer.max);
|
||||||
//local drawing, drawn on player/camera position
|
|
||||||
if(settings.getBool("spawnerarrow")) {
|
if(settings.getBool("spawnerarrow")) {
|
||||||
float leng = (player.unit() != null && player.unit().hitSize > 4 * 8f ? player.unit().hitSize * 1.5f : 4 * 8f) + sin;
|
float leng = (player.unit() != null && player.unit().hitSize > 4 * 8f ? player.unit().hitSize * 1.5f : 4 * 8f) + sin;
|
||||||
Tmp.v1.set(camera.position);
|
Tmp.v1.set(camera.position);
|
||||||
|
|||||||
@@ -103,65 +103,32 @@ public class SettingS {
|
|||||||
settingUi.button(bundle.get("setting.shar-title"), Styles.cleart, dialog::show);
|
settingUi.button(bundle.get("setting.shar-title"), Styles.cleart, dialog::show);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Seq<Seq<SharSetting>> settingSeq = new Seq<>();
|
Seq<Seq<SharSetting>> settingSeq = new Seq<>();
|
||||||
Seq<SharSetting> tapSeq = new Seq<>();
|
Seq<SharSetting> tapSeq = new Seq<>();
|
||||||
addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? bundle.get("default-bar") : s + bundle.get("th-bar"), tapSeq);
|
addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? bundle.get("default-bar") : s + bundle.get("th-bar"), tapSeq);
|
||||||
addGraphicSlideSetting("infoUiScale", mobile ? 25 : 50, 25, 100, 5, s -> s + "%", tapSeq);
|
|
||||||
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + bundle.get("sec"), tapSeq);
|
|
||||||
addGraphicTypeSetting("wavemax", 0, 200,100, true, () -> true, s -> s + "waves", tapSeq);
|
addGraphicTypeSetting("wavemax", 0, 200,100, true, () -> true, s -> s + "waves", tapSeq);
|
||||||
addGraphicCheckSetting("infoui", true, tapSeq);
|
|
||||||
addGraphicCheckSetting("pastwave", false, tapSeq);
|
addGraphicCheckSetting("pastwave", false, tapSeq);
|
||||||
addGraphicCheckSetting("emptywave", true, tapSeq);
|
addGraphicCheckSetting("emptywave", true, tapSeq);
|
||||||
addGraphicCheckSetting("itemcal", false, tapSeq);
|
|
||||||
addGraphicCheckSetting("schem", !mobile, tapSeq);
|
addGraphicCheckSetting("schem", !mobile, tapSeq);
|
||||||
|
|
||||||
//TODO: remove all drawing settings
|
//TODO: remove all drawing settings
|
||||||
Seq<SharSetting> rangeSeq = new Seq<>();
|
|
||||||
//addGraphicTypeSetting("rangeRadius", 0, 500, 70, true, () -> true, s -> s + "tiles", rangeSeq);
|
|
||||||
//addGraphicCheckSetting("rangeNearby", true, rangeSeq);
|
|
||||||
//addGraphicCheckSetting("allTargetRange", false, rangeSeq);
|
|
||||||
addGraphicCheckSetting("aliceRange", false, rangeSeq);
|
|
||||||
addGraphicCheckSetting("RangeShader", false, rangeSeq);
|
|
||||||
|
|
||||||
Seq<SharSetting> opacitySeq = new Seq<>();
|
|
||||||
addGraphicSlideSetting("selectopacity", 50, 0, 100, 5, s -> s + "%", opacitySeq);
|
|
||||||
addGraphicSlideSetting("baropacity", 50, 0, 100, 5, s -> s + "%", opacitySeq);
|
|
||||||
addGraphicSlideSetting("uiopacity", 50, 0, 100, 5, s -> s + "%", opacitySeq);
|
|
||||||
addGraphicSlideSetting("softRangeOpacity", 60, 0, 100, 10, s -> s + "%", opacitySeq);
|
|
||||||
|
|
||||||
Seq<SharSetting> drawSeq = new Seq<>();
|
Seq<SharSetting> drawSeq = new Seq<>();
|
||||||
/*
|
addGraphicSlideSetting("selectopacity", 50, 0, 100, 5, s -> s + "%", drawSeq);
|
||||||
addGraphicTypeSetting("pathlinelimit", 0, 5000, 50, true, () -> true, s -> s + "lines", drawSeq);
|
addGraphicSlideSetting("baropacity", 50, 0, 100, 5, s -> s + "%", drawSeq);
|
||||||
addGraphicTypeSetting("unitlinelimit", 0, 5000, 50, true, () -> true, s -> s + "lines", drawSeq);
|
addGraphicCheckSetting("aliceRange", false, drawSeq);
|
||||||
addGraphicTypeSetting("logiclinelimit", 0, 5000, 50, true, () -> true, s -> s + "lines", drawSeq);
|
addGraphicCheckSetting("RangeShader", false, drawSeq);
|
||||||
addGraphicTypeSetting("spawnarrowlimit", 0, 5000, 50, true, () -> true, s -> s + "arrows", drawSeq);
|
|
||||||
addGraphicCheckSetting("gaycursor", false, drawSeq);
|
|
||||||
addGraphicCheckSetting("unithealthui", true, drawSeq);
|
|
||||||
addGraphicCheckSetting("blockfont", false, drawSeq);
|
|
||||||
addGraphicCheckSetting("linkedMass", true, drawSeq);
|
|
||||||
addGraphicCheckSetting("linkedNode", false, drawSeq);
|
|
||||||
addGraphicCheckSetting("deadTarget", false, drawSeq);
|
|
||||||
*/
|
|
||||||
addGraphicCheckSetting("select", false, drawSeq);
|
addGraphicCheckSetting("select", false, drawSeq);
|
||||||
addGraphicCheckSetting("distanceLine", false, drawSeq);
|
addGraphicCheckSetting("distanceLine", false, drawSeq);
|
||||||
addGraphicCheckSetting("spawnerarrow", false, drawSeq);
|
addGraphicCheckSetting("spawnerarrow", false, drawSeq);
|
||||||
addGraphicCheckSetting("elementdebug", false, drawSeq);
|
addGraphicCheckSetting("elementdebug", false, drawSeq);
|
||||||
addGraphicCheckSetting("hiddenElem", false, drawSeq);
|
addGraphicCheckSetting("hiddenElem", false, drawSeq);
|
||||||
|
|
||||||
Seq<SharSetting> etcSeq = new Seq<>();
|
settingSeq.add(tapSeq, drawSeq);
|
||||||
addGraphicCheckSetting("autoShooting", false, etcSeq);
|
|
||||||
|
|
||||||
settingSeq.add(tapSeq, rangeSeq, opacitySeq);
|
|
||||||
settingSeq.add(drawSeq, etcSeq);
|
|
||||||
|
|
||||||
sharset.table(t -> {
|
sharset.table(t -> {
|
||||||
Seq<TextButton> buttons = new Seq<>();
|
Seq<TextButton> buttons = new Seq<>();
|
||||||
buttons.add(new TextButton(bundle.get("setting.shar-ui"), Styles.clearToggleMenut));
|
buttons.add(new TextButton(bundle.get("setting.shar-ui"), Styles.clearToggleMenut));
|
||||||
buttons.add(new TextButton(bundle.get("setting.shar-range"), Styles.clearToggleMenut));
|
|
||||||
buttons.add(new TextButton(bundle.get("setting.shar-opacity"), Styles.clearToggleMenut));
|
|
||||||
buttons.add(new TextButton(bundle.get("setting.shar-draw"), Styles.clearToggleMenut));
|
buttons.add(new TextButton(bundle.get("setting.shar-draw"), Styles.clearToggleMenut));
|
||||||
buttons.add(new TextButton(bundle.get("setting.shar-etc"), Styles.clearToggleMenut));
|
|
||||||
buttons.each(b -> b.clicked(() -> buttons.each(b1 -> b1.setChecked(b1 == b))));
|
buttons.each(b -> b.clicked(() -> buttons.each(b1 -> b1.setChecked(b1 == b))));
|
||||||
t.table(Styles.black8, bt -> {
|
t.table(Styles.black8, bt -> {
|
||||||
bt.top().align(Align.top);
|
bt.top().align(Align.top);
|
||||||
|
|||||||
@@ -9,13 +9,10 @@ import arc.math.*;
|
|||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.scene.*;
|
import arc.scene.*;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.layout.*;
|
|
||||||
import arc.util.Align;
|
import arc.util.Align;
|
||||||
import arc.util.Tmp;
|
import arc.util.Tmp;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.Fonts;
|
||||||
|
|
||||||
import static UnitInfo.SVars.modUiScale;
|
|
||||||
|
|
||||||
public class SBar extends Element{
|
public class SBar extends Element{
|
||||||
static final Rect scissor = new Rect();
|
static final Rect scissor = new Rect();
|
||||||
|
|||||||
@@ -9,40 +9,22 @@ import mindustry.gen.Groups;
|
|||||||
import mindustry.ui.Styles;
|
import mindustry.ui.Styles;
|
||||||
|
|
||||||
import static UnitInfo.core.OverDrawer.isInCamera;
|
import static UnitInfo.core.OverDrawer.isInCamera;
|
||||||
|
import static arc.Core.settings;
|
||||||
|
|
||||||
public class BlockDraw extends OverDraw {
|
public class BlockDraw extends OverDraw {
|
||||||
boolean status = false;
|
boolean status = false;
|
||||||
|
|
||||||
BlockDraw(String name, TextureRegionDrawable icon) {
|
BlockDraw(String name, TextureRegionDrawable icon) {
|
||||||
super(name, icon);
|
super(name, icon);
|
||||||
|
registerOption("blockStatus");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw() {
|
public void draw() {
|
||||||
super.draw();
|
super.draw();
|
||||||
Groups.build.each(b->{
|
Groups.build.each(b->{
|
||||||
if(isInCamera(b.x, b.y, b.block.size/2f) && Vars.player.team() == b.team) b.drawStatus();
|
//this is shit.. VERY SHIT OH GOD
|
||||||
|
if(isInCamera(b.x, b.y, b.block.size/2f) && settings.getBool("blockStatus") && enabled) b.drawStatus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayStats(Table parent) {
|
|
||||||
super.displayStats(parent);
|
|
||||||
|
|
||||||
parent.background(Styles.squaret.up);
|
|
||||||
|
|
||||||
parent.check("enable block status", status&&enabled, b->status=b&&enabled).disabled(!enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> void onEnabled(T param) {
|
|
||||||
super.onEnabled(param);
|
|
||||||
|
|
||||||
if(param instanceof Table t) {
|
|
||||||
for (int i = 0; i < t.getChildren().size; i++) {
|
|
||||||
Element elem = t.getChildren().get(i);
|
|
||||||
if (elem instanceof CheckBox cb) cb.setDisabled(!enabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import mindustry.world.blocks.distribution.MassDriver;
|
|||||||
import mindustry.world.blocks.payloads.PayloadMassDriver;
|
import mindustry.world.blocks.payloads.PayloadMassDriver;
|
||||||
|
|
||||||
import static arc.Core.atlas;
|
import static arc.Core.atlas;
|
||||||
|
import static arc.Core.settings;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
|
|
||||||
@@ -31,10 +32,11 @@ public class LinkDraw extends OverDraw {
|
|||||||
Seq<MassDriver.MassDriverBuild> linkedMasses = new Seq<>();
|
Seq<MassDriver.MassDriverBuild> linkedMasses = new Seq<>();
|
||||||
Seq<PayloadMassDriver.PayloadDriverBuild> linkedPayloadMasses = new Seq<>();
|
Seq<PayloadMassDriver.PayloadDriverBuild> linkedPayloadMasses = new Seq<>();
|
||||||
Seq<Building> linkedNodes = new Seq<>();
|
Seq<Building> linkedNodes = new Seq<>();
|
||||||
boolean node = false, mass = false;
|
|
||||||
|
|
||||||
LinkDraw(String name, TextureRegionDrawable icon) {
|
LinkDraw(String name, TextureRegionDrawable icon) {
|
||||||
super(name, icon);
|
super(name, icon);
|
||||||
|
registerOption("powerNode");
|
||||||
|
registerOption("massDriver");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -43,11 +45,11 @@ public class LinkDraw extends OverDraw {
|
|||||||
|
|
||||||
Draw.z(Layer.max);
|
Draw.z(Layer.max);
|
||||||
if(target instanceof Building b){
|
if(target instanceof Building b){
|
||||||
if(node) {
|
if(settings.getBool("powerNode") && enabled) {
|
||||||
linkedNodes.clear();
|
linkedNodes.clear();
|
||||||
drawNodeLink(b);
|
drawNodeLink(b);
|
||||||
}
|
}
|
||||||
if(mass) {
|
if(settings.getBool("massDriver") && enabled) {
|
||||||
if (target instanceof MassDriver.MassDriverBuild mass) {
|
if (target instanceof MassDriver.MassDriverBuild mass) {
|
||||||
linkedMasses.clear();
|
linkedMasses.clear();
|
||||||
drawMassLink(mass);
|
drawMassLink(mass);
|
||||||
@@ -59,28 +61,6 @@ public class LinkDraw extends OverDraw {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayStats(Table parent) {
|
|
||||||
super.displayStats(parent);
|
|
||||||
|
|
||||||
parent.background(Styles.squaret.up);
|
|
||||||
|
|
||||||
parent.check("enable power node", node&&enabled, b->node=b&&enabled).disabled(!enabled).row();
|
|
||||||
parent.check("enable mass driver", mass&&enabled, b->mass=b&&enabled).disabled(!enabled).row();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> void onEnabled(T param) {
|
|
||||||
super.onEnabled(param);
|
|
||||||
|
|
||||||
if(param instanceof Table t) {
|
|
||||||
for (int i = 0; i < t.getChildren().size; i++) {
|
|
||||||
Element elem = t.getChildren().get(i);
|
|
||||||
if (elem instanceof CheckBox cb) cb.setDisabled(!enabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawMassPayloadLink(PayloadMassDriver.PayloadDriverBuild from){
|
void drawMassPayloadLink(PayloadMassDriver.PayloadDriverBuild from){
|
||||||
float sin = Mathf.absin(Time.time, 6f, 1f);
|
float sin = Mathf.absin(Time.time, 6f, 1f);
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,53 @@
|
|||||||
package UnitInfo.ui.draws;
|
package UnitInfo.ui.draws;
|
||||||
|
|
||||||
|
import arc.scene.Element;
|
||||||
import arc.scene.style.TextureRegionDrawable;
|
import arc.scene.style.TextureRegionDrawable;
|
||||||
|
import arc.scene.ui.CheckBox;
|
||||||
import arc.scene.ui.layout.Table;
|
import arc.scene.ui.layout.Table;
|
||||||
|
import arc.struct.ObjectMap;
|
||||||
|
import arc.struct.Seq;
|
||||||
|
import mindustry.ui.Styles;
|
||||||
|
|
||||||
|
import static arc.Core.bundle;
|
||||||
|
import static arc.Core.settings;
|
||||||
|
|
||||||
public class OverDraw {
|
public class OverDraw {
|
||||||
public TextureRegionDrawable icon;
|
public TextureRegionDrawable icon;
|
||||||
public String name;
|
public String name;
|
||||||
public boolean enabled = false;
|
public boolean enabled = false;
|
||||||
|
public Seq<String> options = new Seq<>();
|
||||||
|
|
||||||
|
|
||||||
OverDraw(String name, TextureRegionDrawable icon) {
|
OverDraw(String name, TextureRegionDrawable icon) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayStats(Table parent) {}
|
public void displayStats(Table parent) {
|
||||||
public void draw() {}
|
if(options.isEmpty()) return;
|
||||||
public <T> void onEnabled(T param) {}
|
parent.background(Styles.squaret.up);
|
||||||
|
|
||||||
|
options.each(name-> parent.check(bundle.get("setting."+name+".name"), settings.getBool(name), b->settings.put(name, b)).tooltip(t->t.background(Styles.black8).add(bundle.get("setting."+name+".description"))).disabled(!enabled).row());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {}
|
||||||
|
|
||||||
|
public <T> void onEnabled(T param) {
|
||||||
|
if(param instanceof Table t) {
|
||||||
|
for (int i = 0; i < t.getChildren().size; i++) {
|
||||||
|
Element elem = t.getChildren().get(i);
|
||||||
|
if (elem instanceof CheckBox cb) cb.setDisabled(!enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerOption(String name) {
|
||||||
|
registerOption(name, settings.has(name) && settings.getBool(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerOption(String name, boolean defaults) {
|
||||||
|
options.add(name);
|
||||||
|
settings.put(name, defaults);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package UnitInfo.ui.draws;
|
|||||||
import mindustry.gen.Icon;
|
import mindustry.gen.Icon;
|
||||||
|
|
||||||
public class OverDraws {
|
public class OverDraws {
|
||||||
public static OverDraw range, link, unit, block;
|
public static OverDraw range, link, unit, block, util;
|
||||||
public static OverDraw[] all = {};
|
public static OverDraw[] all = {};
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
@@ -11,6 +11,7 @@ public class OverDraws {
|
|||||||
link = new LinkDraw("Link Draws", Icon.line);
|
link = new LinkDraw("Link Draws", Icon.line);
|
||||||
unit = new UnitDraw("Unit Draws", Icon.units);
|
unit = new UnitDraw("Unit Draws", Icon.units);
|
||||||
block = new BlockDraw("Block Draws", Icon.crafting);
|
block = new BlockDraw("Block Draws", Icon.crafting);
|
||||||
all = new OverDraw[]{range, link, unit, block};
|
util = new UtilDraw("Utils", Icon.github);
|
||||||
|
all = new OverDraw[]{range, link, unit, block, util};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
package UnitInfo.ui.draws;
|
package UnitInfo.ui.draws;
|
||||||
|
|
||||||
import arc.graphics.Color;
|
import arc.graphics.Color;
|
||||||
import arc.graphics.g2d.Draw;
|
import arc.graphics.g2d.*;
|
||||||
import arc.graphics.g2d.Fill;
|
|
||||||
import arc.graphics.g2d.Lines;
|
|
||||||
import arc.graphics.gl.FrameBuffer;
|
import arc.graphics.gl.FrameBuffer;
|
||||||
import arc.scene.Element;
|
import arc.scene.Element;
|
||||||
import arc.scene.Group;
|
|
||||||
import arc.scene.style.TextureRegionDrawable;
|
import arc.scene.style.TextureRegionDrawable;
|
||||||
import arc.scene.ui.CheckBox;
|
import arc.scene.ui.CheckBox;
|
||||||
import arc.scene.ui.layout.Table;
|
import arc.scene.ui.layout.Table;
|
||||||
import arc.struct.ObjectMap;
|
import arc.struct.ObjectMap;
|
||||||
import arc.struct.Seq;
|
import arc.struct.Seq;
|
||||||
import mindustry.game.Team;
|
import mindustry.game.Team;
|
||||||
import mindustry.gen.Groups;
|
import mindustry.gen.*;
|
||||||
import mindustry.gen.Unit;
|
|
||||||
import mindustry.graphics.Drawf;
|
import mindustry.graphics.Drawf;
|
||||||
import mindustry.ui.Styles;
|
import mindustry.ui.Styles;
|
||||||
import mindustry.world.blocks.defense.turrets.BaseTurret;
|
import mindustry.world.blocks.defense.turrets.BaseTurret;
|
||||||
@@ -23,17 +19,17 @@ import mindustry.world.blocks.defense.turrets.Turret;
|
|||||||
|
|
||||||
import static UnitInfo.SVars.turretRange;
|
import static UnitInfo.SVars.turretRange;
|
||||||
import static UnitInfo.core.OverDrawer.isInCamera;
|
import static UnitInfo.core.OverDrawer.isInCamera;
|
||||||
import static arc.Core.graphics;
|
import static arc.Core.*;
|
||||||
import static arc.Core.settings;
|
|
||||||
import static mindustry.Vars.player;
|
import static mindustry.Vars.player;
|
||||||
|
|
||||||
public class RangeDraw extends OverDraw {
|
public class RangeDraw extends OverDraw {
|
||||||
FrameBuffer effectBuffer = new FrameBuffer();
|
FrameBuffer effectBuffer = new FrameBuffer();
|
||||||
ObjectMap<Team, Seq<BaseTurret.BaseTurretBuild>> tmpbuildobj = new ObjectMap<>();
|
ObjectMap<Team, Seq<BaseTurret.BaseTurretBuild>> turrets = new ObjectMap<>();
|
||||||
boolean ground = false, air = false;
|
|
||||||
|
|
||||||
RangeDraw(String name, TextureRegionDrawable icon) {
|
RangeDraw(String name, TextureRegionDrawable icon) {
|
||||||
super(name, icon);
|
super(name, icon);
|
||||||
|
registerOption("airRange");
|
||||||
|
registerOption("groundRange");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -43,13 +39,13 @@ public class RangeDraw extends OverDraw {
|
|||||||
effectBuffer.resize(graphics.getWidth(), graphics.getHeight());
|
effectBuffer.resize(graphics.getWidth(), graphics.getHeight());
|
||||||
|
|
||||||
Unit unit = player.unit();
|
Unit unit = player.unit();
|
||||||
tmpbuildobj.clear();
|
turrets.clear();
|
||||||
for(Team team : Team.baseTeams) {
|
for(Team team : Team.baseTeams) {
|
||||||
Draw.drawRange(166 + (Team.baseTeams.length-team.id) * 3, 1, () -> effectBuffer.begin(Color.clear), () -> {
|
Draw.drawRange(166 + (Team.baseTeams.length-team.id) * 3, 1, () -> effectBuffer.begin(Color.clear), () -> {
|
||||||
effectBuffer.end();
|
effectBuffer.end();
|
||||||
effectBuffer.blit(turretRange);
|
effectBuffer.blit(turretRange);
|
||||||
});
|
});
|
||||||
tmpbuildobj.put(team, new Seq<>());
|
turrets.put(team, new Seq<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
Groups.build.each(b-> settings.getBool("aliceRange") || player.team() != b.team, b -> {
|
Groups.build.each(b-> settings.getBool("aliceRange") || player.team() != b.team, b -> {
|
||||||
@@ -59,6 +55,8 @@ public class RangeDraw extends OverDraw {
|
|||||||
int index = b.team.id;
|
int index = b.team.id;
|
||||||
Draw.color(b.team.color);
|
Draw.color(b.team.color);
|
||||||
|
|
||||||
|
boolean air = settings.getBool("airRange") && enabled;
|
||||||
|
boolean ground = settings.getBool("groundRange") && enabled;
|
||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
if (unit == null) valid = true;
|
if (unit == null) valid = true;
|
||||||
else if (b instanceof Turret.TurretBuild build) {
|
else if (b instanceof Turret.TurretBuild build) {
|
||||||
@@ -84,26 +82,4 @@ public class RangeDraw extends OverDraw {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayStats(Table parent) {
|
|
||||||
super.displayStats(parent);
|
|
||||||
|
|
||||||
parent.background(Styles.squaret.up);
|
|
||||||
|
|
||||||
parent.check("enable ground", ground&&enabled, b->ground=b&&enabled).disabled(!enabled).row();
|
|
||||||
parent.check("enable air", air&&enabled, b->air=b&&enabled).disabled(!enabled).row();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> void onEnabled(T param) {
|
|
||||||
super.onEnabled(param);
|
|
||||||
|
|
||||||
if(param instanceof Table t) {
|
|
||||||
for (int i = 0; i < t.getChildren().size; i++) {
|
|
||||||
Element elem = t.getChildren().get(i);
|
|
||||||
if (elem instanceof CheckBox cb) cb.setDisabled(!enabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,15 +34,20 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import static UnitInfo.core.OverDrawer.isInCamera;
|
import static UnitInfo.core.OverDrawer.isInCamera;
|
||||||
import static UnitInfo.core.OverDrawer.isOutCamera;
|
import static UnitInfo.core.OverDrawer.isOutCamera;
|
||||||
|
import static arc.Core.settings;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class UnitDraw extends OverDraw {
|
public class UnitDraw extends OverDraw {
|
||||||
Seq<Tile> pathTiles = new Seq<>();
|
Seq<Tile> pathTiles = new Seq<>();
|
||||||
int otherCores;
|
int otherCores;
|
||||||
boolean pathLine = false, unitLine = false, logicLine = false, bar = false, item = false;
|
|
||||||
|
|
||||||
UnitDraw(String name, TextureRegionDrawable icon) {
|
UnitDraw(String name, TextureRegionDrawable icon) {
|
||||||
super(name, icon);
|
super(name, icon);
|
||||||
|
registerOption("pathLine");
|
||||||
|
registerOption("logicLine");
|
||||||
|
registerOption("unitLine");
|
||||||
|
registerOption("unitItem");
|
||||||
|
registerOption("unitBar");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,14 +58,14 @@ public class UnitDraw extends OverDraw {
|
|||||||
UnitController c = u.controller();
|
UnitController c = u.controller();
|
||||||
UnitCommand com = u.team.data().command;
|
UnitCommand com = u.team.data().command;
|
||||||
|
|
||||||
if(logicLine && c instanceof LogicAI ai && (ai.control == LUnitControl.approach || ai.control == LUnitControl.move)) {
|
if(settings.getBool("logicLine") && c instanceof LogicAI ai && (ai.control == LUnitControl.approach || ai.control == LUnitControl.move)) {
|
||||||
Lines.stroke(1, u.team.color);
|
Lines.stroke(1, u.team.color);
|
||||||
Lines.line(u.x(), u.y(), ai.moveX, ai.moveY);
|
Lines.line(u.x(), u.y(), ai.moveX, ai.moveY);
|
||||||
Lines.stroke(0.5f + Mathf.absin(6f, 0.5f), Tmp.c1.set(Pal.logicOperations).lerp(Pal.sap, Mathf.absin(6f, 0.5f)));
|
Lines.stroke(0.5f + Mathf.absin(6f, 0.5f), Tmp.c1.set(Pal.logicOperations).lerp(Pal.sap, Mathf.absin(6f, 0.5f)));
|
||||||
Lines.line(u.x(), u.y(), ai.controller.x, ai.controller.y);
|
Lines.line(u.x(), u.y(), ai.controller.x, ai.controller.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(unitLine && !u.type.flying && com != UnitCommand.idle && !(c instanceof MinerAI || c instanceof BuilderAI || c instanceof RepairAI || c instanceof DefenderAI || c instanceof FormationAI || c instanceof FlyingAI)) {
|
if(settings.getBool("unitLine") && !u.type.flying && com != UnitCommand.idle && !(c instanceof MinerAI || c instanceof BuilderAI || c instanceof RepairAI || c instanceof DefenderAI || c instanceof FormationAI || c instanceof FlyingAI)) {
|
||||||
Lines.stroke(1, u.team.color);
|
Lines.stroke(1, u.team.color);
|
||||||
|
|
||||||
otherCores = Groups.build.count(b -> b instanceof CoreBlock.CoreBuild && b.team != u.team);
|
otherCores = Groups.build.count(b -> b instanceof CoreBlock.CoreBuild && b.team != u.team);
|
||||||
@@ -75,16 +80,16 @@ public class UnitDraw extends OverDraw {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bar) FreeBar.draw(u);
|
if(settings.getBool("unitBar")) FreeBar.draw(u);
|
||||||
|
|
||||||
if(item && !renderer.pixelator.enabled() && u.item() != null && u.itemTime > 0.01f)
|
if(settings.getBool("unitItem") && !renderer.pixelator.enabled() && u.item() != null && u.itemTime > 0.01f)
|
||||||
Fonts.outline.draw(u.stack.amount + "",
|
Fonts.outline.draw(u.stack.amount + "",
|
||||||
u.x + Angles.trnsx(u.rotation + 180f, u.type.itemOffsetY),
|
u.x + Angles.trnsx(u.rotation + 180f, u.type.itemOffsetY),
|
||||||
u.y + Angles.trnsy(u.rotation + 180f, u.type.itemOffsetY) - 3,
|
u.y + Angles.trnsy(u.rotation + 180f, u.type.itemOffsetY) - 3,
|
||||||
Pal.accent, 0.25f * u.itemTime / Scl.scl(1f), false, Align.center);
|
Pal.accent, 0.25f * u.itemTime / Scl.scl(1f), false, Align.center);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(pathLine) spawner.getSpawns().each(t -> {
|
if(settings.getBool("pathLine")) spawner.getSpawns().each(t -> {
|
||||||
Team enemyTeam = state.rules.waveTeam;
|
Team enemyTeam = state.rules.waveTeam;
|
||||||
Lines.stroke(1, enemyTeam.color);
|
Lines.stroke(1, enemyTeam.color);
|
||||||
for(int p = 0; p < (Vars.state.rules.spawns.count(g->g.type.naval)>0?3:2); p++) {
|
for(int p = 0; p < (Vars.state.rules.spawns.count(g->g.type.naval)>0?3:2); p++) {
|
||||||
@@ -113,29 +118,4 @@ public class UnitDraw extends OverDraw {
|
|||||||
return tile1;
|
return tile1;
|
||||||
return getNextTile(tile1, cost, team, finder);
|
return getNextTile(tile1, cost, team, finder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayStats(Table parent) {
|
|
||||||
super.displayStats(parent);
|
|
||||||
|
|
||||||
parent.background(Styles.squaret.up);
|
|
||||||
|
|
||||||
parent.check("enable path line", pathLine&&enabled, b->pathLine=b&&enabled).disabled(!enabled).row();
|
|
||||||
parent.check("enable logic line", logicLine&&enabled, b->logicLine=b&&enabled).disabled(!enabled).row();
|
|
||||||
parent.check("enable unit line", unitLine&&enabled, b->unitLine=b&&enabled).disabled(!enabled).row();
|
|
||||||
parent.check("enable unit item", item&&enabled, b->item=b&&enabled).disabled(!enabled).row();
|
|
||||||
parent.check("enable unit bar", bar&&enabled, b->bar=b&&enabled).disabled(!enabled).row();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> void onEnabled(T param) {
|
|
||||||
super.onEnabled(param);
|
|
||||||
|
|
||||||
if(param instanceof Table t) {
|
|
||||||
for (int i = 0; i < t.getChildren().size; i++) {
|
|
||||||
Element elem = t.getChildren().get(i);
|
|
||||||
if (elem instanceof CheckBox cb) cb.setDisabled(!enabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
80
src/UnitInfo/ui/draws/UtilDraw.java
Normal file
80
src/UnitInfo/ui/draws/UtilDraw.java
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
package UnitInfo.ui.draws;
|
||||||
|
|
||||||
|
import arc.input.KeyCode;
|
||||||
|
import arc.math.Angles;
|
||||||
|
import arc.math.geom.Geometry;
|
||||||
|
import arc.scene.style.TextureRegionDrawable;
|
||||||
|
import mindustry.entities.Units;
|
||||||
|
import mindustry.game.Team;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
import mindustry.logic.Ranged;
|
||||||
|
import mindustry.world.blocks.ControlBlock;
|
||||||
|
import mindustry.world.blocks.defense.turrets.Turret;
|
||||||
|
|
||||||
|
import static arc.Core.*;
|
||||||
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
|
public class UtilDraw extends OverDraw {
|
||||||
|
Teamc shotTarget;
|
||||||
|
|
||||||
|
UtilDraw(String name, TextureRegionDrawable icon) {
|
||||||
|
super(name, icon);
|
||||||
|
registerOption("autoShooting");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw() {
|
||||||
|
super.draw();
|
||||||
|
|
||||||
|
if(!enabled) return;
|
||||||
|
if(settings.getBool("autoShooting")) {
|
||||||
|
Unit unit = player.unit();
|
||||||
|
if (unit.type == null) return;
|
||||||
|
boolean omni = unit.type.omniMovement;
|
||||||
|
boolean validHealTarget = unit.type.canHeal && shotTarget instanceof Building b && b.isValid() && b.damaged() && shotTarget.team() == unit.team && shotTarget.within(unit, unit.type.range);
|
||||||
|
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||||
|
if ((unit.type != null && Units.invalidateTarget(shotTarget, unit, unit.type.range) && !validHealTarget) || state.isEditor()) {
|
||||||
|
shotTarget = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY());
|
||||||
|
boolean aimCursor = omni && player.shooting && unit.type.hasWeapons() && unit.type.faceTarget && !boosted && unit.type.rotateShooting;
|
||||||
|
unit.lookAt(aimCursor ? mouseAngle : unit.prefRotation());
|
||||||
|
|
||||||
|
//update shooting if not building + not mining
|
||||||
|
if(!player.unit().activelyBuilding() && player.unit().mineTile == null) {
|
||||||
|
if(input.keyDown(KeyCode.mouseLeft)) {
|
||||||
|
player.shooting = !boosted;
|
||||||
|
unit.aim(player.mouseX = input.mouseWorldX(), player.mouseY = input.mouseWorldY());
|
||||||
|
} else if(shotTarget == null) {
|
||||||
|
player.shooting = false;
|
||||||
|
if(unit instanceof BlockUnitUnit b) {
|
||||||
|
if(b.tile() instanceof ControlBlock c && !c.shouldAutoTarget()) {
|
||||||
|
Building build = b.tile();
|
||||||
|
float range = build instanceof Ranged ? ((Ranged) build).range() : 0f;
|
||||||
|
boolean targetGround = build instanceof Turret.TurretBuild && ((Turret) build.block).targetAir;
|
||||||
|
boolean targetAir = build instanceof Turret.TurretBuild && ((Turret) build.block).targetGround;
|
||||||
|
shotTarget = Units.closestTarget(build.team, build.x, build.y, range, u -> u.checkTarget(targetAir, targetGround), u -> targetGround);
|
||||||
|
}
|
||||||
|
else shotTarget = null;
|
||||||
|
} else if(unit.type != null) {
|
||||||
|
float range = unit.hasWeapons() ? unit.range() : 0f;
|
||||||
|
shotTarget = Units.closestTarget(unit.team, unit.x, unit.y, range, u -> u.checkTarget(unit.type.targetAir, unit.type.targetGround), u -> unit.type.targetGround);
|
||||||
|
|
||||||
|
if(unit.type.canHeal && shotTarget == null) {
|
||||||
|
shotTarget = Geometry.findClosest(unit.x, unit.y, indexer.getDamaged(Team.sharded));
|
||||||
|
if (shotTarget != null && !unit.within(shotTarget, range)) {
|
||||||
|
shotTarget = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
player.shooting = !boosted;
|
||||||
|
unit.rotation(Angles.angle(unit.x, unit.y, shotTarget.x(), shotTarget.y()));
|
||||||
|
unit.aim(shotTarget.x(), shotTarget.y());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unit.controlWeapons(player.shooting && !boosted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ public class PlayerDisplay extends WindowTable implements Updatable {
|
|||||||
TextField search;
|
TextField search;
|
||||||
@Nullable Player target;
|
@Nullable Player target;
|
||||||
float heat;
|
float heat;
|
||||||
|
ImageButton.ImageButtonStyle ustyle;
|
||||||
|
|
||||||
public PlayerDisplay() {
|
public PlayerDisplay() {
|
||||||
super("Player Display", Icon.players, t -> {});
|
super("Player Display", Icon.players, t -> {});
|
||||||
@@ -36,6 +37,14 @@ public class PlayerDisplay extends WindowTable implements Updatable {
|
|||||||
search = Elem.newField(null, f->{});
|
search = Elem.newField(null, f->{});
|
||||||
search.setMessageText(Core.bundle.get("players.search"));
|
search.setMessageText(Core.bundle.get("players.search"));
|
||||||
|
|
||||||
|
ustyle = new ImageButton.ImageButtonStyle(){{
|
||||||
|
down = Styles.none;
|
||||||
|
up = Styles.none;
|
||||||
|
imageDownColor = Pal.accent;
|
||||||
|
imageUpColor = Color.white;
|
||||||
|
imageOverColor = Color.lightGray;
|
||||||
|
}};
|
||||||
|
|
||||||
top();
|
top();
|
||||||
topBar();
|
topBar();
|
||||||
|
|
||||||
@@ -66,13 +75,6 @@ public class PlayerDisplay extends WindowTable implements Updatable {
|
|||||||
public Table rebuild(){
|
public Table rebuild(){
|
||||||
return new Table(table -> {
|
return new Table(table -> {
|
||||||
float h = 74f;
|
float h = 74f;
|
||||||
ImageButton.ImageButtonStyle ustyle = new ImageButton.ImageButtonStyle(){{
|
|
||||||
down = Styles.none;
|
|
||||||
up = Styles.none;
|
|
||||||
imageDownColor = Pal.accent;
|
|
||||||
imageUpColor = Color.white;
|
|
||||||
imageOverColor = Color.lightGray;
|
|
||||||
}};
|
|
||||||
|
|
||||||
Seq<Player> players = Groups.player.copy(new Seq<>());
|
Seq<Player> players = Groups.player.copy(new Seq<>());
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ import mindustry.world.blocks.distribution.MassDriver;
|
|||||||
import mindustry.world.blocks.payloads.Payload;
|
import mindustry.world.blocks.payloads.Payload;
|
||||||
import mindustry.world.blocks.power.*;
|
import mindustry.world.blocks.power.*;
|
||||||
|
|
||||||
import static UnitInfo.SVars.clear;
|
import static UnitInfo.SVars.*;
|
||||||
import static UnitInfo.SVars.modUiScale;
|
import static UnitInfo.SUtils.*;
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public class UnitDisplay extends WindowTable implements Updatable {
|
|||||||
else if (target instanceof Building b && b.block != null) ui.content.show(b.block);
|
else if (target instanceof Building b && b.block != null) ui.content.show(b.block);
|
||||||
});
|
});
|
||||||
ttt.add(imagebt).update((i) -> {
|
ttt.add(imagebt).update((i) -> {
|
||||||
i.getStyle().imageUp = reg.get().tint(Tmp.c1.set(SVars.hud.locked ? Color.red.cpy().shiftHue(2 * Time.time) : Color.white));
|
i.getStyle().imageUp = reg.get().tint(Tmp.c1.set(locked ? Color.red.cpy().shiftHue(2 * Time.time) : Color.white));
|
||||||
i.getStyle().imageDown = reg.get().tint(Tmp.c1.mul(Color.darkGray));
|
i.getStyle().imageDown = reg.get().tint(Tmp.c1.mul(Color.darkGray));
|
||||||
i.layout();
|
i.layout();
|
||||||
}).size(4 * 8f).get().parent = null;
|
}).size(4 * 8f).get().parent = null;
|
||||||
@@ -161,13 +161,9 @@ public class UnitDisplay extends WindowTable implements Updatable {
|
|||||||
resizeButton();
|
resizeButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Teamc getTarget() {
|
|
||||||
return SVars.hud == null ? null : SVars.hud.getTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void lockTarget() {
|
public void lockTarget() {
|
||||||
SVars.hud.locked = !SVars.hud.locked;
|
locked = !locked;
|
||||||
SVars.hud.lockedTarget = SVars.hud.locked ? getTarget() : null;
|
target = locked ? getTarget() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showMoving() {
|
public void showMoving() {
|
||||||
@@ -337,10 +333,10 @@ public class UnitDisplay extends WindowTable implements Updatable {
|
|||||||
if(getDrawable() != null)
|
if(getDrawable() != null)
|
||||||
getDrawable().draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
getDrawable().draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
||||||
}
|
}
|
||||||
}).size(Scl.scl(modUiScale) * iconLarge);
|
}).size(iconLarge);
|
||||||
}),
|
}),
|
||||||
new Table(h -> {
|
new Table(h -> {
|
||||||
h.defaults().growX().height(Scl.scl(modUiScale) * 9f).width(Scl.scl(modUiScale) * iconLarge).padTop(Scl.scl(modUiScale) * 18f);
|
h.defaults().growX().height(9f).width(iconLarge).padTop(18f);
|
||||||
h.add(new SBar(
|
h.add(new SBar(
|
||||||
() -> "",
|
() -> "",
|
||||||
() -> Pal.accent.cpy().lerp(Color.orange, mount.reload / weapon.reload),
|
() -> Pal.accent.cpy().lerp(Color.orange, mount.reload / weapon.reload),
|
||||||
|
|||||||
Reference in New Issue
Block a user