From 2b05264093856ec633212bc8d2fde89530b8cde5 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 12 Aug 2023 13:09:21 -0400 Subject: [PATCH] Fixed #8921 --- core/src/mindustry/type/Weapon.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 0b25fd66f1..97ac3b45da 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -396,6 +396,7 @@ public class Weapon implements Cloneable{ //shoot if applicable if(mount.shoot && //must be shooting can && //must be able to shoot + !(bullet.killShooter && mount.totalShots > 0) && //if the bullet kills the shooter, you should only ever be able to shoot once (!useAmmo || unit.ammo > 0 || !state.rules.unitAmmo || unit.team.rules().infiniteAmmo) && //check ammo (!alternate || wasFlipped == flipSprite) && mount.warmup >= minWarmup && //must be warmed up @@ -436,6 +437,9 @@ public class Weapon implements Cloneable{ } shoot.shoot(mount.barrelCounter, (xOffset, yOffset, angle, delay, mover) -> { + //this is incremented immediately, as it is used for total bullet creation amount detection + mount.totalShots ++; + if(delay > 0f){ Time.run(delay, () -> bullet(unit, mount, xOffset, yOffset, angle, mover)); }else{ @@ -478,7 +482,6 @@ public class Weapon implements Cloneable{ mount.recoils[mount.barrelCounter % recoils] = 1f; } mount.heat = 1f; - mount.totalShots++; } //override to do special things to a bullet after spawning