mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
node, core range display done
This commit is contained in:
@@ -40,6 +40,8 @@ setting.uiopacity.description = use the slider to set opacity of ui background.
|
||||
|
||||
setting.scan.name = Enable Block Scanner
|
||||
setting.scan.description = toggle to enable scanner that shows nearly turret and wall hp.
|
||||
setting.coreRange.name = Display Core Range
|
||||
setting.coreRange.description = display enemy core build-limit range
|
||||
setting.rangemax.name = Block Scanner Range
|
||||
setting.rangemax.description = set scan radius of scanner.\nSelect the pencil and enter a number.
|
||||
setting.rangeNearby.name = Display Near Range
|
||||
|
||||
@@ -36,6 +36,8 @@ setting.scan.name = 블록 스캐너 활성화
|
||||
setting.scan.description = 주변 포탑과 벽의 체력을 표시하는 스캐터를 활성화합니다.
|
||||
setting.rangemax.name = 블록 스캐너 사거리
|
||||
setting.rangemax.description = 연필 아이콘을 눌러서 스캐너 사거리를 설정합니다.
|
||||
setting.coreRange.name = 코어 사거리 표시
|
||||
setting.coreRange.description = 적 코어 건설제한 사거리를 표시합니다.
|
||||
setting.rangeNearby.name = 주변 사거리 표시
|
||||
setting.rangeNearby.description = 적 사거리에 접근했을 경우 사거리를 표시합니다.
|
||||
setting.unitRange.name = 유닛 사거리 표시
|
||||
|
||||
@@ -25,6 +25,8 @@ import mindustry.world.blocks.units.*;
|
||||
import mindustry.world.consumers.*;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static arc.Core.bundle;
|
||||
import static mindustry.Vars.content;
|
||||
import static mindustry.Vars.state;
|
||||
@@ -40,7 +42,7 @@ public class BarInfo {
|
||||
return Strings.fixed(number, 1);
|
||||
}
|
||||
|
||||
public static <T extends Teamc> void getInfo(T target){
|
||||
public static <T extends Teamc> void getInfo(T target) throws IllegalAccessException, NoSuchFieldException {
|
||||
for(int i = 0; i < 6; i++) { //init
|
||||
strings.set(i, "[lightgray]<Empty>[]");
|
||||
colors.set(i, Color.clear);
|
||||
@@ -97,9 +99,12 @@ public class BarInfo {
|
||||
numbers.set(1, (float) mend.sense(LAccess.progress));
|
||||
}
|
||||
else if(target instanceof OverdriveProjector.OverdriveBuild over){
|
||||
strings.set(1, Core.bundle.format("shar-stat.progress", Strings.fixed((float) over.sense(LAccess.progress) * 100f, 2)));
|
||||
colors.set(1, Pal.heal);
|
||||
numbers.set(1, (float) over.sense(LAccess.progress));
|
||||
Field ohno = OverdriveProjector.OverdriveBuild.class.getDeclaredField("charge");
|
||||
ohno.setAccessible(true);
|
||||
float charge = (float) ohno.get(over);
|
||||
strings.set(1, Core.bundle.format("shar-stat.progress", Strings.fixed(Mathf.clamp(charge/((OverdriveProjector)over.block).reload) * 100f, 2)));
|
||||
colors.set(1, Color.valueOf("feb380"));
|
||||
numbers.set(1, Mathf.clamp(charge/((OverdriveProjector)over.block).reload));
|
||||
}
|
||||
else if(target instanceof Drill.DrillBuild drill){
|
||||
strings.set(1, bundle.format("shar-stat.progress", Strings.fixed((float) drill.sense(LAccess.progress) * 100f, 2)));
|
||||
@@ -181,6 +186,13 @@ public class BarInfo {
|
||||
colors.set(3, Pal.power);
|
||||
numbers.set(3, factory.unit() == null ? 0f : (float)factory.team.data().countType(factory.unit()) / Units.getCap(factory.team));
|
||||
}
|
||||
else if(target instanceof Reconstructor.ReconstructorBuild reconstruct){
|
||||
strings.set(3, reconstruct.unit() == null ? "[lightgray]" + Iconc.cancel :
|
||||
Core.bundle.format("bar.unitcap", Fonts.getUnicodeStr(reconstruct.unit().name), format(reconstruct.team.data().countType(reconstruct.unit())), format(Units.getCap(reconstruct.team))));
|
||||
colors.set(3, Pal.power);
|
||||
numbers.set(3, reconstruct.unit() == null ? 0f : (float)reconstruct.team.data().countType(reconstruct.unit()) / Units.getCap(reconstruct.team));
|
||||
|
||||
}
|
||||
else if(target instanceof Drill.DrillBuild e){
|
||||
strings.set(3, bundle.format("bar.drillspeed", Strings.fixed(e.lastDrillSpeed * 60 * e.timeScale, 2)));
|
||||
colors.set(3, Pal.ammo);
|
||||
|
||||
@@ -19,7 +19,6 @@ import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.Renderer;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.bullet.MassDriverBolt;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -34,12 +33,11 @@ import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.defense.turrets.*;
|
||||
import mindustry.world.blocks.distribution.MassDriver;
|
||||
import mindustry.world.blocks.power.PowerGraph;
|
||||
import mindustry.world.blocks.power.PowerNode;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
|
||||
import java.io.PipedWriter;
|
||||
import java.util.Objects;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import static arc.Core.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -153,15 +151,22 @@ public class HudUi {
|
||||
}
|
||||
}
|
||||
|
||||
public Seq<Building> getPowerLinkedBuilds(Building build){
|
||||
public Seq<Building> getPowerLinkedBuilds(Building build) {
|
||||
Seq<Building> linkedBuilds = new Seq<>();
|
||||
linkedBuilds.add(build.front(), build.back(), build.right(), build.left());
|
||||
/*
|
||||
Field ohno = PowerGraph.class.getDeclaredField("all");
|
||||
ohno.setAccessible(true);
|
||||
((Seq<Building>) ohno.get(build.power.graph)).each(linkedBuilds::add);
|
||||
*/
|
||||
build.power.links.each(i -> linkedBuilds.add(world.build(i)));
|
||||
build.proximity().each(linkedBuilds::add);
|
||||
linkedBuilds.filter(b -> b != null && b.power != null);
|
||||
if(!build.block.outputsPower && !(build instanceof PowerNode.PowerNodeBuild))
|
||||
linkedBuilds.filter(b -> b.block.outputsPower || b instanceof PowerNode.PowerNodeBuild);
|
||||
return linkedBuilds;
|
||||
}
|
||||
|
||||
public void drawNodeLink(Building node){
|
||||
public void drawNodeLink(Building node) {
|
||||
if(node.power == null) return;
|
||||
if(!linkedNodes.contains(node)) {
|
||||
linkedNodes.add(node);
|
||||
@@ -661,7 +666,11 @@ public class HudUi {
|
||||
}).padRight(Scl.scl(24 * 8f));
|
||||
table.row();
|
||||
table.update(() -> {
|
||||
BarInfo.getInfo(getTarget());
|
||||
try {
|
||||
BarInfo.getInfo(getTarget());
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
strings = BarInfo.strings;
|
||||
numbers = BarInfo.numbers;
|
||||
colors = BarInfo.colors;
|
||||
|
||||
@@ -137,11 +137,16 @@ public class Main extends Mod {
|
||||
});
|
||||
}
|
||||
}
|
||||
if(!state.rules.polygonCoreProtection && settings.getBool("coreRange") && player != null){
|
||||
state.teams.eachEnemyCore(player.team(), core -> {
|
||||
if(Core.camera.bounds(Tmp.r1).overlaps(Tmp.r2.setCentered(core.x, core.y, state.rules.enemyCoreBuildRadius * 2f))){
|
||||
Draw.color(Color.darkGray);
|
||||
Lines.circle(core.x, core.y - 2, state.rules.enemyCoreBuildRadius);
|
||||
Draw.color(Pal.accent, core.team.color, 0.5f + Mathf.absin(Time.time, 10f, 0.5f));
|
||||
Lines.circle(core.x, core.y, state.rules.enemyCoreBuildRadius);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadContent(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,6 +293,7 @@ public class Setting {
|
||||
addGraphicCheckSetting("emptywave", true);
|
||||
addGraphicCheckSetting("scan", false);
|
||||
addGraphicSlideSetting("rangemax", 10, 0, 100, 1, s -> s + "tiles");
|
||||
addGraphicCheckSetting("coreRange", true);
|
||||
addGraphicCheckSetting("rangeNearby", true);
|
||||
addGraphicCheckSetting("allTeamRange", false);
|
||||
addGraphicCheckSetting("allTargetRange", false);
|
||||
|
||||
Reference in New Issue
Block a user