Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reloadWhileCharging #6889

Merged
merged 5 commits into from
Feb 6, 2025
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Anuken marked this conversation as resolved.
Show resolved Hide resolved
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){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did the coolant check go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReloadTurret#updateCooling already checks for coolant

updateCooling();
}
}

@Override
Expand Down