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> inaccuracyModifiers;
|
||||
|
||||
int ticksSinceLastShot;
|
||||
|
||||
List<Pair<int, Action>> delayedActions = new List<Pair<int, Action>>();
|
||||
|
||||
public WDist Recoil;
|
||||
@@ -169,6 +171,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (IsTraitDisabled)
|
||||
return;
|
||||
|
||||
if (ticksSinceLastShot < Weapon.ReloadDelay)
|
||||
++ticksSinceLastShot;
|
||||
|
||||
if (FireDelay > 0)
|
||||
--FireDelay;
|
||||
|
||||
@@ -221,6 +226,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!Weapon.IsValidAgainst(target, self.World, self))
|
||||
return null;
|
||||
|
||||
if (ticksSinceLastShot >= Weapon.ReloadDelay)
|
||||
Burst = Weapon.Burst;
|
||||
|
||||
ticksSinceLastShot = 0;
|
||||
|
||||
var barrel = Barrels[Burst % Barrels.Length];
|
||||
Func<WPos> muzzlePosition = () => self.CenterPosition + MuzzleOffset(self, barrel);
|
||||
var legacyFacing = MuzzleOrientation(self, barrel).Yaw.Angle / 4;
|
||||
|
||||
Reference in New Issue
Block a user