mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 22:12:16 -08:00
Fixed ammo multiplier for ContinuousLiquidTurret
This commit is contained in:
parent
f5f2951d26
commit
5dd77ef08f
4 changed files with 19 additions and 10 deletions
|
|
@ -4811,7 +4811,7 @@ public class Blocks{
|
|||
afflict = new PowerTurret("afflict"){{
|
||||
requirements(Category.turret, with(Items.surgeAlloy, 125, Items.silicon, 200, Items.graphite, 250, Items.oxide, 40));
|
||||
buildCostMultiplier = 1.5f;
|
||||
|
||||
|
||||
shootType = new BasicBulletType(){{
|
||||
shootEffect = new MultiEffect(Fx.shootTitan, new WaveEffect(){{
|
||||
colorTo = Pal.surge;
|
||||
|
|
|
|||
|
|
@ -348,6 +348,8 @@ public class BulletType extends Content implements Cloneable{
|
|||
|
||||
/** Whether to display the ammo multiplayer for this bullet type in its stats. */
|
||||
public boolean displayAmmoMultiplier = true;
|
||||
/** If >0, this is displayed divided by the ammo multiplier. */
|
||||
public float statLiquidConsumed;
|
||||
|
||||
/** Radius of light emitted by this bullet; <0 to use defaults. */
|
||||
public float lightRadius = -1f;
|
||||
|
|
|
|||
|
|
@ -31,21 +31,23 @@ public class ContinuousLiquidTurret extends ContinuousTurret{
|
|||
@Override
|
||||
public void setStats(){
|
||||
super.setStats();
|
||||
//mirror stats onto each bullet (purely visual)
|
||||
ammoTypes.each((l, b) -> b.statLiquidConsumed = liquidConsumed);
|
||||
|
||||
stats.remove(Stat.ammo);
|
||||
//TODO looks bad
|
||||
stats.add(Stat.ammo, table -> {
|
||||
table.row();
|
||||
StatValues.number(liquidConsumed * 60f, StatUnit.perSecond, true).display(table);
|
||||
});
|
||||
stats.add(Stat.ammo, StatValues.ammo(ammoTypes));
|
||||
stats.replace(Stat.ammo, StatValues.ammo(ammoTypes));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
//TODO display ammoMultiplier.
|
||||
consume(new ConsumeLiquidFilter(i -> ammoTypes.containsKey(i), liquidConsumed){
|
||||
|
||||
{
|
||||
multiplier = b -> {
|
||||
var ammo = ammoTypes.get(b.liquids.current());
|
||||
return ammo == null ? 1f : 1f / ammo.ammoMultiplier;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(Stats stats){
|
||||
|
||||
|
|
|
|||
|
|
@ -625,7 +625,12 @@ public class StatValues{
|
|||
if(!compact && !(t instanceof Turret)){
|
||||
bt.table(title -> {
|
||||
title.image(icon(t)).size(3 * 8).padRight(4).right().scaling(Scaling.fit).top().with(i -> withTooltip(i, t, false));
|
||||
|
||||
title.add(t.localizedName).padRight(10).left().top();
|
||||
|
||||
if(type.displayAmmoMultiplier && type.statLiquidConsumed > 0f){
|
||||
title.add("[stat]" + fixValue(type.statLiquidConsumed / type.ammoMultiplier * 60f) + " [lightgray]" + StatUnit.perSecond.localized());
|
||||
}
|
||||
});
|
||||
bt.row();
|
||||
}
|
||||
|
|
@ -654,7 +659,7 @@ public class StatValues{
|
|||
sep(bt, Core.bundle.format("bullet.splashdamage", (int)type.splashDamage, Strings.fixed(type.splashDamageRadius / tilesize, 1)));
|
||||
}
|
||||
|
||||
if(!compact && !Mathf.equal(type.ammoMultiplier, 1f) && type.displayAmmoMultiplier && (!(t instanceof Turret turret) || turret.displayAmmoMultiplier)){
|
||||
if(type.statLiquidConsumed <= 0f && !compact && !Mathf.equal(type.ammoMultiplier, 1f) && type.displayAmmoMultiplier && (!(t instanceof Turret turret) || turret.displayAmmoMultiplier)){
|
||||
sep(bt, Core.bundle.format("bullet.multiplier", (int)type.ammoMultiplier));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue