mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
This commit is contained in:
@@ -4,11 +4,7 @@ set PATH_FROM=C:\Users\user\Documents\GitHub\UnitInfo
|
|||||||
@rem put your mindustry local path into PATH_TO
|
@rem put your mindustry local path into PATH_TO
|
||||||
setlocal
|
setlocal
|
||||||
set PATH_TO=C:\Users\user\AppData\Roaming\Mindustry
|
set PATH_TO=C:\Users\user\AppData\Roaming\Mindustry
|
||||||
@rem put your minudstry *jar* path into MINDUSTRY
|
|
||||||
setlocal
|
|
||||||
set MINDUSTRY=C:\Users\user\Downloads\Mindustry.jar
|
|
||||||
|
|
||||||
if exist %PATH_TO%\mods\UnitInfo.jar del %PATH_TO%\mods\UnitInfo.jar
|
if exist %PATH_TO%\mods\UnitInfo.jar del %PATH_TO%\mods\UnitInfo.jar
|
||||||
xcopy %PATH_FROM%\build\libs\UnitInfo.jar %PATH_TO%\mods\ /k
|
xcopy %PATH_FROM%\build\libs\UnitInfo.jar %PATH_TO%\mods\ /k
|
||||||
del %PATH_FROM%\build\libs\UnitInfo.jar
|
del %PATH_FROM%\build\libs\UnitInfo.jar
|
||||||
java -jar %MINDUSTRY%
|
|
||||||
@@ -8,7 +8,6 @@ import arc.graphics.g2d.*;
|
|||||||
import arc.input.KeyCode;
|
import arc.input.KeyCode;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.scene.*;
|
import arc.scene.*;
|
||||||
import arc.scene.event.ClickListener;
|
|
||||||
import arc.scene.event.HandCursorListener;
|
import arc.scene.event.HandCursorListener;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
@@ -29,9 +28,7 @@ import mindustry.type.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.defense.turrets.*;
|
import mindustry.world.blocks.defense.turrets.*;
|
||||||
import mindustry.world.blocks.power.*;
|
|
||||||
import mindustry.world.blocks.storage.*;
|
import mindustry.world.blocks.storage.*;
|
||||||
import mindustry.world.consumers.*;
|
|
||||||
|
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -51,7 +48,6 @@ public class HudUi {
|
|||||||
|
|
||||||
|
|
||||||
@Nullable UnitType type;
|
@Nullable UnitType type;
|
||||||
@Nullable Unit unit;
|
|
||||||
Element image;
|
Element image;
|
||||||
Color lastItemColor = Pal.items;
|
Color lastItemColor = Pal.items;
|
||||||
float heat;
|
float heat;
|
||||||
@@ -63,28 +59,33 @@ public class HudUi {
|
|||||||
int maxwave;
|
int maxwave;
|
||||||
int coreamount;
|
int coreamount;
|
||||||
|
|
||||||
public Unit getUnit(){
|
public Object getUnit(){
|
||||||
|
Log.info("h");
|
||||||
Seq<Unit> units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4);
|
Seq<Unit> units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4);
|
||||||
if(units.size <= 0) return player.unit();
|
if(units.size > 0) {
|
||||||
Unit unit = units.peek();
|
if(units.peek() == null){
|
||||||
if(unit == null) return player.unit();
|
if(getTile() != null && getTile().build != null) return getTile().build;
|
||||||
else return unit;
|
return player.unit();
|
||||||
|
}
|
||||||
|
else return units.peek();
|
||||||
|
}
|
||||||
|
else return player.unit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable Tile getTile(){
|
public @Nullable Tile getTile(){
|
||||||
return Vars.world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY());
|
return Vars.world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY());
|
||||||
};
|
}
|
||||||
|
|
||||||
public void setEvent(){
|
public void setEvent(){
|
||||||
Events.run(EventType.Trigger.draw, () -> {
|
Events.run(EventType.Trigger.draw, () -> {
|
||||||
if(!Core.settings.getBool("select")) return;
|
if(!(getUnit() instanceof Posc) || !Core.settings.getBool("select")) return;
|
||||||
Unit unit = getUnit();
|
|
||||||
|
|
||||||
|
Posc entity = (Posc)getUnit();
|
||||||
for(int i = 0; i < 4; i++){
|
for(int i = 0; i < 4; i++){
|
||||||
float rot = i * 90f + 45f + (-Time.time) % 360f;
|
float rot = i * 90f + 45f + (-Time.time) % 360f;
|
||||||
float length = unit.hitSize * 1.5f + 2.5f;
|
float length = (entity instanceof Unit ? ((Unit)entity).hitSize : ((Building)entity).block.size) * 1.5f + 2.5f;
|
||||||
Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)).a(settings.getInt("uiopacity") / 100f));
|
Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)).a(settings.getInt("uiopacity") / 100f));
|
||||||
Draw.rect("select-arrow", unit.x + Angles.trnsx(rot, length), unit.y + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
|
Draw.rect("select-arrow", entity.x() + Angles.trnsx(rot, length), entity.y() + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -213,31 +214,43 @@ public class HudUi {
|
|||||||
});
|
});
|
||||||
baseTable = table.table(tt -> tt.stack(unitTable, coreTable, waveTable, labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).get();
|
baseTable = table.table(tt -> tt.stack(unitTable, coreTable, waveTable, labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).get();
|
||||||
table.fillParent = true;
|
table.fillParent = true;
|
||||||
table.visibility = () -> (
|
|
||||||
ui.hudfrag.shown && !ui.minimapfrag.shown()
|
table.visibility = () -> (ui.hudfrag.shown && !ui.minimapfrag.shown()
|
||||||
&& (!Vars.mobile ||
|
&& (!Vars.mobile ||
|
||||||
!(getUnit().isBuilding() || Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
|
!(Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
|
||||||
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
|
||||||
});
|
});
|
||||||
ui.hudGroup.addChild(mainTable);
|
ui.hudGroup.addChild(mainTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBars(){
|
public void addBars(){
|
||||||
|
Log.info("hh");
|
||||||
bars.clear();
|
bars.clear();
|
||||||
|
|
||||||
bars.add(
|
bars.add(
|
||||||
new SBar(
|
new SBar(
|
||||||
() -> Core.bundle.format("shar-stat.health", Mathf.round(getUnit().health, 1)),
|
() -> {
|
||||||
|
float hp = 0f;
|
||||||
|
if(getUnit() instanceof Healthc) hp = Mathf.round(((Healthc)getUnit()).health(), 1);
|
||||||
|
return Core.bundle.format("shar-stat.health", hp);
|
||||||
|
},
|
||||||
() -> Pal.health,
|
() -> Pal.health,
|
||||||
() -> Mathf.clamp(getUnit().health / getUnit().type.health)
|
() -> {
|
||||||
|
float hp = 0f;
|
||||||
|
|
||||||
|
if(getUnit() instanceof Healthc) hp = ((Healthc)getUnit()).healthf();
|
||||||
|
return Mathf.clamp(hp);
|
||||||
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
SBar secondBar = new SBar(
|
SBar secondBar = new SBar(
|
||||||
() -> {
|
() -> {
|
||||||
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit)getUnit()).tile() instanceof Turret.TurretBuild) {
|
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit)getUnit()).tile() instanceof Turret.TurretBuild) {
|
||||||
float value = Mathf.clamp(((Turret.TurretBuild)((BlockUnitUnit)getUnit()).tile()).reload / ((Turret)((BlockUnitUnit)getUnit()).tile().block).reloadTime) * 100f;
|
float value = Mathf.clamp(((Turret.TurretBuild)((BlockUnitUnit)getUnit()).tile()).reload / ((Turret)((BlockUnitUnit)getUnit()).tile().block).reloadTime) * 100f;
|
||||||
return Core.bundle.format("shar-stat.reload", Strings.fixed(value, (Math.abs((int)value - value) <= 0.001f ? 0 : Math.abs((int)(value * 10) - value * 10) <= 0.001f ? 1 : 2)));
|
return Core.bundle.format("shar-stat.reload", Strings.fixed(value, (Math.abs((int)value - value) <= 0.001f ? 0 : Math.abs((int)(value * 10) - value * 10) <= 0.001f ? 1 : 2)));
|
||||||
}
|
}
|
||||||
return Core.bundle.format("shar-stat.shield", Mathf.round(getUnit().shield,1));
|
return Core.bundle.format("shar-stat.shield", Mathf.round(getUnit() instanceof Shieldc ? ((Shieldc)getUnit()).shield() : 0,1));
|
||||||
},
|
},
|
||||||
() ->{
|
() ->{
|
||||||
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit)getUnit()).tile() instanceof Turret.TurretBuild) {
|
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit)getUnit()).tile() instanceof Turret.TurretBuild) {
|
||||||
@@ -251,8 +264,9 @@ public class HudUi {
|
|||||||
}
|
}
|
||||||
float max1 = ((ShieldRegenFieldAbility)content.units().copy().filter(ut -> ut.abilities.find(abil -> abil instanceof ShieldRegenFieldAbility) != null).sort(ut -> ((ShieldRegenFieldAbility)ut.abilities.find(abil -> abil instanceof ShieldRegenFieldAbility)).max).peek().abilities.find(abil -> abil instanceof ShieldRegenFieldAbility)).max;
|
float max1 = ((ShieldRegenFieldAbility)content.units().copy().filter(ut -> ut.abilities.find(abil -> abil instanceof ShieldRegenFieldAbility) != null).sort(ut -> ((ShieldRegenFieldAbility)ut.abilities.find(abil -> abil instanceof ShieldRegenFieldAbility)).max).peek().abilities.find(abil -> abil instanceof ShieldRegenFieldAbility)).max;
|
||||||
float max2 = 0f;
|
float max2 = 0f;
|
||||||
if(getUnit().type.abilities.find(abil -> abil instanceof ForceFieldAbility) != null) max2 = ((ForceFieldAbility) getUnit().type.abilities.find(abil -> abil instanceof ForceFieldAbility)).max;
|
if(!(getUnit() instanceof Unitc)) return 0f;
|
||||||
return Mathf.clamp(getUnit().shield / Math.max(max1, max2));
|
if(((Unitc)getUnit()).type().abilities.find(abil -> abil instanceof ForceFieldAbility) != null) max2 = ((ForceFieldAbility) ((Unitc)getUnit()).type().abilities.find(abil -> abil instanceof ForceFieldAbility)).max;
|
||||||
|
return Mathf.clamp(((Unitc)getUnit()).shield() / Math.max(max1, max2));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
bars.add(secondBar);
|
bars.add(secondBar);
|
||||||
@@ -284,7 +298,8 @@ public class HudUi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bundle.format("shar-stat.itemCapacity", getUnit().stack.amount, getUnit().type.itemCapacity);
|
if(getUnit() instanceof Unitc) return bundle.format("shar-stat.itemCapacity", ((Unitc)getUnit()).stack().amount, ((Unitc)getUnit()).type().itemCapacity);
|
||||||
|
return "";
|
||||||
},
|
},
|
||||||
() -> {
|
() -> {
|
||||||
if(getUnit() instanceof BlockUnitUnit){
|
if(getUnit() instanceof BlockUnitUnit){
|
||||||
@@ -303,8 +318,8 @@ public class HudUi {
|
|||||||
lastItemColor = Pal.powerBar;
|
lastItemColor = Pal.powerBar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(getUnit().stack.item != null && getUnit().stack.amount > 0)
|
else if(getUnit() instanceof Unitc && ((Unitc)getUnit()).stack().item != null && ((Unitc)getUnit()).stack().amount > 0)
|
||||||
lastItemColor = getUnit().stack.item.color.cpy().lerp(Color.white, 0.15f);
|
lastItemColor = ((Unitc)getUnit()).stack().item.color.cpy().lerp(Color.white, 0.15f);
|
||||||
|
|
||||||
return lastItemColor;
|
return lastItemColor;
|
||||||
},
|
},
|
||||||
@@ -327,7 +342,8 @@ public class HudUi {
|
|||||||
return v/max;
|
return v/max;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Mathf.clamp(getUnit().stack.amount / (getUnit().type.itemCapacity * 1f));
|
if(getUnit() instanceof Unitc) return Mathf.clamp(((Unitc)getUnit()).stack().amount / (((Unitc)getUnit()).type().itemCapacity * 1f));
|
||||||
|
return 0f;
|
||||||
}
|
}
|
||||||
)).growX().left();
|
)).growX().left();
|
||||||
}));
|
}));
|
||||||
@@ -415,7 +431,8 @@ public class HudUi {
|
|||||||
|
|
||||||
t.add(new Image(){{
|
t.add(new Image(){{
|
||||||
update(() -> {
|
update(() -> {
|
||||||
setDrawable(getUnit().stack.item == null || getUnit().stack.amount <= 0 ? Core.atlas.find("clear") : getUnit().stack.item.uiIcon);
|
if(getUnit() instanceof Unitc)
|
||||||
|
setDrawable((((Unitc)getUnit()).stack().item == null || ((Unitc)getUnit()).stack().amount <= 0) ? Core.atlas.find("clear") : ((Unitc)getUnit()).stack().item.uiIcon);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,28 +452,34 @@ public class HudUi {
|
|||||||
float value = Mathf.clamp(heat2 / ((Turret)entity.block).chargeTime) * 100f;
|
float value = Mathf.clamp(heat2 / ((Turret)entity.block).chargeTime) * 100f;
|
||||||
return Core.bundle.format("shar-stat.charge", Strings.fixed(value, (Math.abs((int)value - value) <= 0.001f ? 0 : Math.abs((int)(value * 10) - value * 10) <= 0.001f ? 1 : 2)));
|
return Core.bundle.format("shar-stat.charge", Strings.fixed(value, (Math.abs((int)value - value) <= 0.001f ? 0 : Math.abs((int)(value * 10) - value * 10) <= 0.001f ? 1 : 2)));
|
||||||
}
|
}
|
||||||
return Core.bundle.format("shar-stat.commandUnits", Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()), getUnit().type().commandLimit);
|
if(getUnit() instanceof Unitc)
|
||||||
|
return Core.bundle.format("shar-stat.commandUnits", Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()), ((Unitc)getUnit()).type().commandLimit);
|
||||||
|
else return "";
|
||||||
},
|
},
|
||||||
() -> {
|
() -> {
|
||||||
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit) getUnit()).tile() instanceof Turret.TurretBuild){
|
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit) getUnit()).tile() instanceof Turret.TurretBuild){
|
||||||
Turret.TurretBuild entity = ((Turret.TurretBuild)((BlockUnitUnit) getUnit()).tile());
|
Turret.TurretBuild entity = ((Turret.TurretBuild)((BlockUnitUnit) getUnit()).tile());
|
||||||
return Pal.surge.cpy().lerp(Pal.accent, heat2 / ((Turret)entity.block).chargeTime);
|
return Pal.surge.cpy().lerp(Pal.accent, heat2 / ((Turret)entity.block).chargeTime);
|
||||||
}
|
}
|
||||||
return Pal.powerBar.cpy().lerp(Pal.surge.cpy().mul(Pal.lighterOrange), Mathf.absin(Time.time, 7f / (1f + Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()) / (getUnit().type().commandLimit * 1f))), 1f));
|
if(getUnit() instanceof Unitc)
|
||||||
|
return Pal.powerBar.cpy().lerp(Pal.surge.cpy().mul(Pal.lighterOrange), Mathf.absin(Time.time, 7f / (1f + Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()) / (((Unitc)getUnit()).type().commandLimit * 1f))), 1f));
|
||||||
|
else return Color.clear;
|
||||||
},
|
},
|
||||||
() -> {
|
() -> {
|
||||||
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit) getUnit()).tile() instanceof Turret.TurretBuild){
|
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit) getUnit()).tile() instanceof Turret.TurretBuild){
|
||||||
Turret.TurretBuild entity = ((Turret.TurretBuild)((BlockUnitUnit) getUnit()).tile());
|
Turret.TurretBuild entity = ((Turret.TurretBuild)((BlockUnitUnit) getUnit()).tile());
|
||||||
return heat2 / ((Turret)entity.block).chargeTime;
|
return heat2 / ((Turret)entity.block).chargeTime;
|
||||||
}
|
}
|
||||||
return Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()) / (getUnit().type().commandLimit * 1f));
|
if(getUnit() instanceof Unit)
|
||||||
|
return Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()) / (((Unitc)getUnit()).type().commandLimit * 1f));
|
||||||
|
else return 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
));
|
));
|
||||||
bars.add(new SBar(
|
if(getUnit() instanceof Unitc) bars.add(new SBar(
|
||||||
() -> Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(Mathf.sqrt(((Payloadc)getUnit()).payloadUsed())), Mathf.round(Mathf.sqrt(getUnit().type().payloadCapacity))),
|
() -> Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(Mathf.sqrt(((Payloadc)getUnit()).payloadUsed())), Mathf.round(Mathf.sqrt(((Unitc)getUnit()).type().payloadCapacity))),
|
||||||
() -> Pal.items,
|
() -> Pal.items,
|
||||||
() -> Mathf.clamp(((Payloadc)getUnit()).payloadUsed() / getUnit().type().payloadCapacity),
|
() -> Mathf.clamp(((Payloadc)getUnit()).payloadUsed() / ((Unitc)getUnit()).type().payloadCapacity),
|
||||||
() -> getUnit() instanceof Payloadc
|
() -> getUnit() instanceof Payloadc
|
||||||
));
|
));
|
||||||
bars.add(new Stack(){{
|
bars.add(new Stack(){{
|
||||||
@@ -464,10 +487,10 @@ public class HudUi {
|
|||||||
t.defaults().width(Scl.scl(23 * 8f));
|
t.defaults().width(Scl.scl(23 * 8f));
|
||||||
t.defaults().height(Scl.scl(4f * 8f));
|
t.defaults().height(Scl.scl(4f * 8f));
|
||||||
t.top();
|
t.top();
|
||||||
t.add(new SBar(
|
if(getUnit() instanceof Unitc) t.add(new SBar(
|
||||||
() -> Core.bundle.format("shar-stat.ammos", getUnit().ammo, getUnit().type.ammoCapacity),
|
() -> Core.bundle.format("shar-stat.ammos", ((Unitc)getUnit()).ammo(), ((Unitc)getUnit()).type().ammoCapacity),
|
||||||
() -> getUnit().dead() || getUnit() instanceof BlockUnitc ? Pal.ammo : getUnit().type.ammoType.color,
|
() -> ((Unitc)getUnit()).dead() || getUnit() instanceof BlockUnitc ? Pal.ammo : ((Unitc)getUnit()).type().ammoType.color,
|
||||||
() -> getUnit().ammof(),
|
() -> ((Unitc)getUnit()).ammof(),
|
||||||
() -> Vars.state.rules.unitAmmo
|
() -> Vars.state.rules.unitAmmo
|
||||||
)).growX().left();
|
)).growX().left();
|
||||||
}));
|
}));
|
||||||
@@ -480,9 +503,9 @@ public class HudUi {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TextureRegion region = Items.copper.uiIcon;
|
TextureRegion region = Items.copper.uiIcon;
|
||||||
if(getUnit().type != null){
|
if(getUnit() instanceof Unitc && ((Unitc)getUnit()).type() != null){
|
||||||
if(getUnit().type.ammoType == AmmoTypes.thorium) region = Items.thorium.uiIcon;
|
if(((Unitc)getUnit()).type().ammoType == AmmoTypes.thorium) region = Items.thorium.uiIcon;
|
||||||
if(getUnit().type.ammoType == AmmoTypes.power || getUnit().type.ammoType == AmmoTypes.powerLow || getUnit().type.ammoType == AmmoTypes.powerHigh) region = Icon.powerSmall.getRegion();
|
if(((Unitc)getUnit()).type().ammoType == AmmoTypes.power || ((Unitc)getUnit()).type().ammoType == AmmoTypes.powerLow || ((Unitc)getUnit()).type().ammoType == AmmoTypes.powerHigh) region = Icon.powerSmall.getRegion();
|
||||||
}
|
}
|
||||||
setDrawable(region);
|
setDrawable(region);
|
||||||
});
|
});
|
||||||
@@ -496,21 +519,15 @@ public class HudUi {
|
|||||||
weapon = new Table(tx -> {
|
weapon = new Table(tx -> {
|
||||||
tx.left().defaults().minSize(Scl.scl(12 * 8f));
|
tx.left().defaults().minSize(Scl.scl(12 * 8f));
|
||||||
|
|
||||||
if(settings.getBool("weaponui") && type != null && type.weapons.size != 0) tx.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, tt -> {
|
if(getUnit() instanceof Unit && settings.getBool("weaponui") && ((Unit)getUnit()).type != null && ((Unit)getUnit()).type.weapons.size != 0)
|
||||||
|
tx.add(new Table(scene.getStyle(Button.ButtonStyle.class).up, tt -> {
|
||||||
|
tt.left().top().defaults().width(Scl.scl(24/3f * 8f)).minHeight(Scl.scl(12/3f * 8f));
|
||||||
|
|
||||||
tt.defaults().width(Scl.scl(24/3f * 8f));
|
for(int r = 0; r < ((Unit)getUnit()).type.weapons.size; r++){
|
||||||
tt.defaults().minHeight(Scl.scl(12/3f * 8f));
|
Weapon weapon = ((Unit)getUnit()).type.weapons.get(r);
|
||||||
tt.left();
|
WeaponMount mount = ((Unit)getUnit()).mounts[r];
|
||||||
tt.top();
|
TextureRegion region = !weapon.name.equals("") && weapon.outlineRegion.found() ? weapon.outlineRegion : ((Unit)getUnit()).type.uiIcon;
|
||||||
|
if(((Unit)getUnit()).type.weapons.size > 1 && r % 3 == 0) tt.row();
|
||||||
int amount = 0;
|
|
||||||
if(type != null) amount = type.weapons.size;
|
|
||||||
|
|
||||||
for(int r = 0; r < amount; r++){
|
|
||||||
Weapon weapon = type.weapons.get(r);
|
|
||||||
WeaponMount mount = unit.mounts[r];
|
|
||||||
TextureRegion region = !weapon.name.equals("") && weapon.outlineRegion.found() ? weapon.outlineRegion : type.uiIcon;
|
|
||||||
if(type.weapons.size > 1 && r % 3 == 0) tt.row();
|
|
||||||
else if(r % 3 == 0) tt.row();
|
else if(r % 3 == 0) tt.row();
|
||||||
tt.table(weapontable -> {
|
tt.table(weapontable -> {
|
||||||
weapontable.left();
|
weapontable.left();
|
||||||
@@ -589,8 +606,12 @@ public class HudUi {
|
|||||||
add(new Table(ttt -> ttt.add(new Image(){{
|
add(new Table(ttt -> ttt.add(new Image(){{
|
||||||
update(() -> {
|
update(() -> {
|
||||||
TextureRegion region = Core.atlas.find("clear");
|
TextureRegion region = Core.atlas.find("clear");
|
||||||
if(getUnit() instanceof BlockUnitUnit && getUnit().type != null) region = ((BlockUnitUnit)getUnit()).tile().block.uiIcon;
|
if(getUnit() instanceof Unitc){
|
||||||
else if(getUnit() != null && getUnit().type != null) region = getUnit().type.uiIcon;
|
if(getUnit() instanceof BlockUnitUnit && ((Unitc)getUnit()).type() != null)
|
||||||
|
region = ((BlockUnitUnit)getUnit()).tile().block.uiIcon;
|
||||||
|
else if(getUnit() != null && ((Unitc)getUnit()).type() != null)
|
||||||
|
region = ((Unitc)getUnit()).type().uiIcon;
|
||||||
|
}
|
||||||
setDrawable(region);
|
setDrawable(region);
|
||||||
});
|
});
|
||||||
}}.setScaling(Scaling.fit)).size(Scl.scl(4f * 8f))));
|
}}.setScaling(Scaling.fit)).size(Scl.scl(4f * 8f))));
|
||||||
@@ -609,11 +630,11 @@ public class HudUi {
|
|||||||
});
|
});
|
||||||
add(new Table(temp -> {
|
add(new Table(temp -> {
|
||||||
temp.left();
|
temp.left();
|
||||||
Label label = new Label(() -> (int)(getUnit().type == null ? 0 : getUnit().type.armor) + "");
|
Label label = new Label(() -> ((int) (getUnit() instanceof Unitc && ((Unitc)getUnit()).type() != null ? ((Unitc)getUnit()).type().armor : 0)) + "");
|
||||||
label.setColor(Pal.surge);
|
label.setColor(Pal.surge);
|
||||||
label.setSize(0.6f);
|
label.setSize(0.6f);
|
||||||
label.setFontScale(Scl.scl());
|
label.setFontScale(Scl.scl());
|
||||||
temp.add(label).center().padLeft(getUnit().type == null || getUnit().type.armor < Scl.scl(10) ? Scl.scl(-4f) : Scl.scl(0f));
|
temp.add(label).center().padLeft(getUnit() instanceof Unitc ? ((((Unitc)getUnit()).type() == null || ((Unitc)getUnit()).type().armor < Scl.scl(10)) ? Scl.scl(-4f) : Scl.scl(0f)) : Scl.scl(0f));
|
||||||
temp.pack();
|
temp.pack();
|
||||||
}){
|
}){
|
||||||
@Override
|
@Override
|
||||||
@@ -628,16 +649,22 @@ public class HudUi {
|
|||||||
|
|
||||||
Label label = new Label(() -> {
|
Label label = new Label(() -> {
|
||||||
String name = "";
|
String name = "";
|
||||||
if(getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit)getUnit()).tile() instanceof Turret.TurretBuild) name = "[accent]" + ((BlockUnitUnit)getUnit()).tile().block.localizedName + "[]";
|
if(getUnit() instanceof Unitc) {
|
||||||
else if(getUnit() != null && getUnit().type != null) name = "[accent]" + getUnit().type.localizedName + "[]";
|
if (getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit) getUnit()).tile() instanceof Turret.TurretBuild)
|
||||||
|
name = "[accent]" + ((BlockUnitUnit) getUnit()).tile().block.localizedName + "[]";
|
||||||
|
else if (getUnit() != null && ((Unitc) getUnit()).type() != null)
|
||||||
|
name = "[accent]" + ((Unitc) getUnit()).type().localizedName + "[]";
|
||||||
|
}
|
||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
|
|
||||||
label.setFontScale(Scl.scl());
|
label.setFontScale(Scl.scl());
|
||||||
TextButton button = Elem.newButton("?", Styles.clearPartialt, () -> {
|
TextButton button = Elem.newButton("?", Styles.clearPartialt, () -> {
|
||||||
if(getUnit().type != null && getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit)getUnit()).tile() instanceof Turret.TurretBuild) ui.content.show(((BlockUnitUnit)getUnit()).tile().block);
|
if(getUnit() instanceof Unitc) {
|
||||||
else if(getUnit().type != null) ui.content.show(getUnit().type);
|
if (((Unitc) getUnit()).type() != null && getUnit() instanceof BlockUnitUnit && ((BlockUnitUnit) getUnit()).tile() instanceof Turret.TurretBuild)
|
||||||
|
ui.content.show(((BlockUnitUnit) getUnit()).tile().block);
|
||||||
|
else if (((Unitc) getUnit()).type() != null) ui.content.show(((Unitc) getUnit()).type());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tt.top();
|
tt.top();
|
||||||
@@ -683,13 +710,10 @@ public class HudUi {
|
|||||||
heat += Time.delta;
|
heat += Time.delta;
|
||||||
if (heat >= 6) {
|
if (heat >= 6) {
|
||||||
heat = 0f;
|
heat = 0f;
|
||||||
type = getUnit().type;
|
if(getUnit() instanceof Unitc) type = ((Unitc)getUnit()).type();
|
||||||
unit = getUnit();
|
|
||||||
|
|
||||||
table.removeChild(weapon);
|
table.removeChild(weapon);
|
||||||
addWeapon();
|
addWeapon();
|
||||||
table.row();
|
table.row();
|
||||||
|
|
||||||
table.add(weapon);
|
table.add(weapon);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import arc.Core;
|
|||||||
import arc.Events;
|
import arc.Events;
|
||||||
import arc.graphics.Color;
|
import arc.graphics.Color;
|
||||||
import arc.graphics.g2d.Draw;
|
import arc.graphics.g2d.Draw;
|
||||||
|
import arc.graphics.g2d.Fill;
|
||||||
import arc.graphics.g2d.Lines;
|
import arc.graphics.g2d.Lines;
|
||||||
import arc.math.Angles;
|
import arc.math.Angles;
|
||||||
import arc.math.Mathf;
|
import arc.math.Mathf;
|
||||||
@@ -17,9 +18,11 @@ import mindustry.content.Fx;
|
|||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.game.Team;
|
import mindustry.game.Team;
|
||||||
import mindustry.gen.Groups;
|
import mindustry.gen.Groups;
|
||||||
|
import mindustry.graphics.Layer;
|
||||||
import mindustry.graphics.Pal;
|
import mindustry.graphics.Pal;
|
||||||
import mindustry.mod.Mod;
|
import mindustry.mod.Mod;
|
||||||
import mindustry.ui.Fonts;
|
import mindustry.ui.Fonts;
|
||||||
|
import mindustry.world.Block;
|
||||||
|
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
@@ -56,6 +59,23 @@ public class Main extends Mod {
|
|||||||
|
|
||||||
|
|
||||||
Events.run(Trigger.draw, () -> {
|
Events.run(Trigger.draw, () -> {
|
||||||
|
if(settings.getBool("blockstatus")) Groups.build.each(build -> {
|
||||||
|
if(Vars.player != null && Vars.player.team() == build.team) return;
|
||||||
|
|
||||||
|
Block block = build.block;
|
||||||
|
if(block.enableDrawStatus && block.consumes.any()){
|
||||||
|
float multiplier = block.size > 1 ? 1 : 0.64f;
|
||||||
|
float brcx = build.x + (block.size * tilesize / 2f) - (tilesize * multiplier / 2f);
|
||||||
|
float brcy = build.y - (block.size * tilesize / 2f) + (tilesize * multiplier / 2f);
|
||||||
|
|
||||||
|
Draw.z(Layer.power + 1);
|
||||||
|
Draw.color(Pal.gray);
|
||||||
|
Fill.square(brcx, brcy, 2.5f * multiplier, 45);
|
||||||
|
Draw.color(build.status().color);
|
||||||
|
Fill.square(brcx, brcy, 1.5f * multiplier, 45);
|
||||||
|
Draw.color();
|
||||||
|
}
|
||||||
|
});
|
||||||
if(Core.settings.getBool("unithealthui"))
|
if(Core.settings.getBool("unithealthui"))
|
||||||
Groups.unit.each(unit -> new FreeBar().draw(unit));
|
Groups.unit.each(unit -> new FreeBar().draw(unit));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user