From 4a0bf40431842211361118d413d37eab4415dd97 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 6 Feb 2025 12:44:19 -0800 Subject: [PATCH] reloadWhileCharging (#6889) * reloadWhileCharging * stat? should include or nah? * hshchqqqjwvejqwoofpvoeqviwfojpieqwvwcqekpoivmopijr * Update core/src/mindustry/world/blocks/defense/turrets/Turret.java --------- Co-authored-by: Anuken --- .../world/blocks/defense/turrets/Turret.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/src/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/mindustry/world/blocks/defense/turrets/Turret.java index e08c0b54202..69bff48fda2 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java @@ -68,10 +68,12 @@ public class Turret extends ReloadTurret{ public float minRange = 0f; /** Minimum warmup needed to fire. */ public float minWarmup = 0f; - /** If true, this turret will accurately target moving targets with respect to charge time. */ + /** If true, this turret will accurately target moving targets with respect to shoot.firstShotDelay. */ public boolean accurateDelay = true; /** If false, this turret can't move while charging. */ public boolean moveWhileCharging = true; + /** If false, this turret can't reload while charging */ + public boolean reloadWhileCharging = true; /** How long warmup is maintained even if this turret isn't shooting. */ public float warmupMaintainTime = 0f; /** pattern used for bullets */ @@ -159,7 +161,7 @@ public void setStats(){ super.setStats(); stats.add(Stat.inaccuracy, (int)inaccuracy, StatUnit.degrees); - stats.add(Stat.reload, 60f / (reload) * shoot.shots, StatUnit.perSecond); + stats.add(Stat.reload, 60f / (reload + !reloadWhileCharging ? shoot.firstShotDelay : 0f) * shoot.shots, StatUnit.perSecond); stats.add(Stat.targetsAir, targetAir); stats.add(Stat.targetsGround, targetGround); if(ammoPerShot != 1) stats.add(Stat.ammoUse, ammoPerShot, StatUnit.perShot); @@ -422,7 +424,10 @@ public void updateTile(){ } //turret always reloads regardless of whether it's targeting something - updateReload(); + if(reloadWhileCharging || !charging()){ + updateReload(); + updateCooling(); + } if(state.rules.fog){ float newRange = hasAmmo() ? peekAmmo().rangeChange : 0f; @@ -478,10 +483,6 @@ public void updateTile(){ updateShooting(); } } - - if(coolant != null){ - updateCooling(); - } } @Override