node, core range display done

This commit is contained in:
sharlotte
2021-07-30 17:51:56 +09:00
parent 0260af1586
commit ffce630280
6 changed files with 48 additions and 17 deletions

View File

@@ -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);