diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs index 0c2ac8bb10..cee6e7790a 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackGarrisoned.cs @@ -156,7 +156,10 @@ namespace OpenRA.Mods.Common.Traits paxPos[a.Actor].SetVisualPosition(a.Actor, pos + PortOffset(self, port)); var barrel = a.CheckFire(a.Actor, facing.Value, target); - if (barrel != null && a.Info.MuzzleSequence != null) + if (barrel == null) + return; + + if (a.Info.MuzzleSequence != null) { // Muzzle facing is fixed once the firing starts var muzzleAnim = new Animation(self.World, paxRender[a.Actor].GetImage(a.Actor), () => muzzleFacing); diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index e3afa8aa45..0a00a04de0 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -31,18 +31,22 @@ namespace OpenRA.Mods.D2k.Activities readonly Sandworm sandworm; readonly ConditionManager conditionManager; readonly WeaponInfo weapon; + readonly Armament armament; readonly AttackSwallow swallow; readonly IPositionable positionable; + readonly IFacing facing; int countdown; CPos burrowLocation; AttackState stance; int attackingToken = ConditionManager.InvalidConditionToken; - public SwallowActor(Actor self, Target target, WeaponInfo weapon) + public SwallowActor(Actor self, Target target, Armament a, IFacing facing) { this.target = target; - this.weapon = weapon; + this.facing = facing; + armament = a; + weapon = a.Weapon; sandworm = self.Trait(); positionable = self.Trait(); swallow = self.Trait(); @@ -80,11 +84,13 @@ namespace OpenRA.Mods.D2k.Activities foreach (var player in affectedPlayers) self.World.AddFrameEndTask(w => w.Add(new MapNotificationEffect(player, "Speech", swallow.Info.WormAttackNotification, 25, true, attackPosition, Color.Red))); + var barrel = armament.CheckFire(self, facing, target); + if (barrel == null) + return false; + + // armament.CheckFire already calls INotifyAttack.PreparingAttack foreach (var notify in self.TraitsImplementing()) - { - notify.PreparingAttack(self, target, null, null); - notify.Attacking(self, target, null, null); - } + notify.Attacking(self, target, armament, barrel); return true; } diff --git a/OpenRA.Mods.D2k/Traits/AttackSwallow.cs b/OpenRA.Mods.D2k/Traits/AttackSwallow.cs index 536f5abfb7..5bcabb4768 100644 --- a/OpenRA.Mods.D2k/Traits/AttackSwallow.cs +++ b/OpenRA.Mods.D2k/Traits/AttackSwallow.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.D2k.Traits return; self.CancelActivity(); - self.QueueActivity(new SwallowActor(self, target, a.Weapon)); + self.QueueActivity(new SwallowActor(self, target, a, facing.Value)); } } }