Reset burst counter if ReloadDelay has passed since last shot
This fixes the following issues: - units like mammoth tanks sometimes at first only fired 1 shot on new encounter because they only depleted 1 burst before previous target was killed - weapons that use strafing logic would not reset the offset multiplier after passing the target once, leading to wrong offsets on following attacks
This commit is contained in:
@@ -113,6 +113,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
IEnumerable<int> damageModifiers;
|
IEnumerable<int> damageModifiers;
|
||||||
IEnumerable<int> inaccuracyModifiers;
|
IEnumerable<int> inaccuracyModifiers;
|
||||||
|
|
||||||
|
int ticksSinceLastShot;
|
||||||
|
|
||||||
List<Pair<int, Action>> delayedActions = new List<Pair<int, Action>>();
|
List<Pair<int, Action>> delayedActions = new List<Pair<int, Action>>();
|
||||||
|
|
||||||
public WDist Recoil;
|
public WDist Recoil;
|
||||||
@@ -169,6 +171,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (ticksSinceLastShot < Weapon.ReloadDelay)
|
||||||
|
++ticksSinceLastShot;
|
||||||
|
|
||||||
if (FireDelay > 0)
|
if (FireDelay > 0)
|
||||||
--FireDelay;
|
--FireDelay;
|
||||||
|
|
||||||
@@ -221,6 +226,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!Weapon.IsValidAgainst(target, self.World, self))
|
if (!Weapon.IsValidAgainst(target, self.World, self))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (ticksSinceLastShot >= Weapon.ReloadDelay)
|
||||||
|
Burst = Weapon.Burst;
|
||||||
|
|
||||||
|
ticksSinceLastShot = 0;
|
||||||
|
|
||||||
var barrel = Barrels[Burst % Barrels.Length];
|
var barrel = Barrels[Burst % Barrels.Length];
|
||||||
Func<WPos> muzzlePosition = () => self.CenterPosition + MuzzleOffset(self, barrel);
|
Func<WPos> muzzlePosition = () => self.CenterPosition + MuzzleOffset(self, barrel);
|
||||||
var legacyFacing = MuzzleOrientation(self, barrel).Yaw.Angle / 4;
|
var legacyFacing = MuzzleOrientation(self, barrel).Yaw.Angle / 4;
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
ZSU-23:
|
ZSU-23:
|
||||||
Inherits: ^AACannon
|
Inherits: ^AACannon
|
||||||
Burst: 2
|
Burst: 2
|
||||||
BurstDelay: 5
|
BurstDelay: 0
|
||||||
ReloadDelay: 0
|
ReloadDelay: 5
|
||||||
Range: 10c0
|
Range: 10c0
|
||||||
Projectile: Bullet
|
Projectile: Bullet
|
||||||
Speed: 3c340
|
Speed: 3c340
|
||||||
|
|||||||
Reference in New Issue
Block a user