Ammo/shot display
This commit is contained in:
@@ -113,6 +113,7 @@ public class Turret extends ReloadTurret{
|
||||
stats.add(Stat.reload, 60f / reloadTime * (alternate ? 1 : shots), StatUnit.none);
|
||||
stats.add(Stat.targetsAir, targetAir);
|
||||
stats.add(Stat.targetsGround, targetGround);
|
||||
if(ammoPerShot != 1) stats.add(Stat.ammoUse, ammoPerShot, StatUnit.perShot);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SolidPump extends Pump{
|
||||
stats.remove(Stat.output);
|
||||
stats.add(Stat.output, result, 60f * pumpAmount, true);
|
||||
if(attribute != null){
|
||||
stats.add(baseEfficiency > 0.0001f ? Stat.affinities : Stat.tiles, attribute);
|
||||
stats.add(baseEfficiency > 0.0001f ? Stat.affinities : Stat.tiles, attribute, floating, 1f, baseEfficiency <= 0.001f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ public enum Stat{
|
||||
targetsGround(StatCat.function),
|
||||
damage(StatCat.function),
|
||||
ammo(StatCat.function),
|
||||
ammoUse(StatCat.function),
|
||||
shieldHealth(StatCat.function),
|
||||
cooldownTime(StatCat.function),
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ public enum StatUnit{
|
||||
minutes,
|
||||
perSecond,
|
||||
perMinute,
|
||||
perShot,
|
||||
timesSpeed(false),
|
||||
percent(false),
|
||||
shieldHealth,
|
||||
|
||||
@@ -55,22 +55,22 @@ public class Stats{
|
||||
}
|
||||
|
||||
public void add(Stat stat, Attribute attr){
|
||||
add(stat, attr, false, 1f);
|
||||
add(stat, attr, false, 1f, false);
|
||||
}
|
||||
|
||||
public void add(Stat stat, Attribute attr, float scale){
|
||||
add(stat, attr, false, scale);
|
||||
add(stat, attr, false, scale, false);
|
||||
}
|
||||
|
||||
public void add(Stat stat, Attribute attr, boolean floating){
|
||||
add(stat, attr, floating, 1f);
|
||||
add(stat, attr, floating, 1f, false);
|
||||
}
|
||||
|
||||
public void add(Stat stat, Attribute attr, boolean floating, float scale){
|
||||
public void add(Stat stat, Attribute attr, boolean floating, float scale, boolean startZero){
|
||||
for(var block : Vars.content.blocks()
|
||||
.select(block -> block instanceof Floor f && f.attributes.get(attr) != 0 && !(f.isLiquid && !floating))
|
||||
.<Floor>as().with(s -> s.sort(f -> f.attributes.get(attr)))){
|
||||
add(stat, new FloorEfficiencyValue(block, block.attributes.get(attr) * scale));
|
||||
add(stat, new FloorEfficiencyValue(block, block.attributes.get(attr) * scale, startZero));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,16 +10,18 @@ import mindustry.world.meta.*;
|
||||
public class FloorEfficiencyValue implements StatValue{
|
||||
private final Floor floor;
|
||||
private final float multiplier;
|
||||
private final boolean startZero;
|
||||
|
||||
public FloorEfficiencyValue(Floor floor, float multiplier){
|
||||
public FloorEfficiencyValue(Floor floor, float multiplier, boolean startZero){
|
||||
this.floor = floor;
|
||||
this.multiplier = multiplier;
|
||||
this.startZero = startZero;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Table table){
|
||||
table.stack(new Image(floor.icon(Cicon.medium)).setScaling(Scaling.fit), new Table(t -> {
|
||||
t.top().right().add((multiplier < 0 ? "[scarlet]" : "[accent]+") + (int)((multiplier) * 100) + "%").style(Styles.outlineLabel);
|
||||
t.top().right().add((multiplier < 0 ? "[scarlet]" : startZero ? "[accent]" : "[accent]+") + (int)((multiplier) * 100) + "%").style(Styles.outlineLabel);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user