Make notifyAttacks more consistent

This commit is contained in:
Gustas
2023-11-15 20:48:38 +02:00
committed by abcdefg30
parent 2d332d0a13
commit 1a4f366e4b
6 changed files with 9 additions and 13 deletions

View File

@@ -255,7 +255,7 @@ namespace OpenRA.Mods.Common.Activities
{ {
if (!attack.IsTraitPaused) if (!attack.IsTraitPaused)
foreach (var a in armaments) foreach (var a in armaments)
a.CheckFire(self, facing, target, false); a.CheckFire(self, facing, target);
} }
void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance) void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
continue; continue;
inAttackRange = true; inAttackRange = true;
a.CheckFire(self, facing, target, false); a.CheckFire(self, facing, target);
} }
// Actors without armaments may want to trigger an action when it passes the target // Actors without armaments may want to trigger an action when it passes the target

View File

@@ -268,7 +268,7 @@ namespace OpenRA.Mods.Common.Traits
// Note: facing is only used by the legacy positioning code // Note: facing is only used by the legacy positioning code
// The world coordinate model uses Actor.Orientation // The world coordinate model uses Actor.Orientation
public virtual bool CheckFire(Actor self, IFacing facing, in Target target, bool notifyAttacking) public virtual bool CheckFire(Actor self, IFacing facing, in Target target)
{ {
if (!CanFire(self, target)) if (!CanFire(self, target))
return false; return false;
@@ -286,10 +286,6 @@ namespace OpenRA.Mods.Common.Traits
FireBarrel(self, facing, target, barrel); FireBarrel(self, facing, target, barrel);
UpdateBurst(self, target); UpdateBurst(self, target);
if (notifyAttacking)
foreach (var (notifyActor, notify) in notifyAttacks)
notify.Attacking(notifyActor, target, this, barrel);
} }
while (FireDelay == 0 && CanFire(self, target)); while (FireDelay == 0 && CanFire(self, target));
@@ -357,11 +353,11 @@ namespace OpenRA.Mods.Common.Traits
if (burst == args.Weapon.Burst && args.Weapon.StartBurstReport != null && args.Weapon.StartBurstReport.Length > 0) if (burst == args.Weapon.Burst && args.Weapon.StartBurstReport != null && args.Weapon.StartBurstReport.Length > 0)
Game.Sound.Play(SoundType.World, args.Weapon.StartBurstReport, self.World, self.CenterPosition); Game.Sound.Play(SoundType.World, args.Weapon.StartBurstReport, self.World, self.CenterPosition);
foreach (var (notifyActor, notify) in notifyAttacks)
notify.Attacking(notifyActor, delayedTarget, this, barrel);
Recoil = Info.Recoil; Recoil = Info.Recoil;
} }
foreach (var (notifyActor, notify) in notifyAttacks)
notify.Attacking(notifyActor, delayedTarget, this, barrel);
}); });
} }

View File

@@ -169,7 +169,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
foreach (var a in Armaments) foreach (var a in Armaments)
a.CheckFire(self, facing, target, false); a.CheckFire(self, facing, target);
} }
IEnumerable<IOrderTargeter> IIssueOrder.Orders IEnumerable<IOrderTargeter> IIssueOrder.Orders

View File

@@ -185,7 +185,7 @@ namespace OpenRA.Mods.Common.Traits
paxFacing[a.Actor].Facing = targetYaw; paxFacing[a.Actor].Facing = targetYaw;
paxPos[a.Actor].SetCenterPosition(a.Actor, pos + PortOffset(self, port)); paxPos[a.Actor].SetCenterPosition(a.Actor, pos + PortOffset(self, port));
if (!a.CheckFire(a.Actor, facing, target, true)) if (!a.CheckFire(a.Actor, facing, target))
continue; continue;
if (a.Info.MuzzleSequence != null) if (a.Info.MuzzleSequence != null)

View File

@@ -85,7 +85,7 @@ namespace OpenRA.Mods.D2k.Activities
if (affectedPlayers.Contains(self.World.LocalPlayer)) if (affectedPlayers.Contains(self.World.LocalPlayer))
TextNotificationsManager.AddTransientLine(self.World.LocalPlayer, swallow.Info.WormAttackTextNotification); TextNotificationsManager.AddTransientLine(self.World.LocalPlayer, swallow.Info.WormAttackTextNotification);
return armament.CheckFire(self, facing, target, true); return armament.CheckFire(self, facing, target);
} }
public override bool Tick(Actor self) public override bool Tick(Actor self)