Skip to content

Commit

Permalink
reloadWhileCharging (#6889)
Browse files Browse the repository at this point in the history
* reloadWhileCharging

* stat?

should include or nah?

* hshchqqqjwvejqwoofpvoeqviwfojpieqwvwcqekpoivmopijr

* Update core/src/mindustry/world/blocks/defense/turrets/Turret.java

---------

Co-authored-by: Anuken <[email protected]>
  • Loading branch information
MEEPofFaith and Anuken authored Feb 6, 2025
1 parent 556b2aa commit 4a0bf40
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core/src/mindustry/world/blocks/defense/turrets/Turret.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -478,10 +483,6 @@ public void updateTile(){
updateShooting();
}
}

if(coolant != null){
updateCooling();
}
}

@Override
Expand Down

0 comments on commit 4a0bf40

Please sign in to comment.