From 52d0490f95c9e7b403f5e98dd403040b8ef41f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 26 Apr 2020 11:36:58 +0200 Subject: [PATCH] Supersede INotifyNuke --- OpenRA.Mods.Common/Traits/Render/WithNukeLaunchAnimation.cs | 6 ++++-- OpenRA.Mods.Common/Traits/Render/WithNukeLaunchOverlay.cs | 6 ++++-- OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs | 3 --- OpenRA.Mods.Common/TraitsInterfaces.cs | 1 - 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithNukeLaunchAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithNukeLaunchAnimation.cs index 7037966b1e..bbd9975592 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithNukeLaunchAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithNukeLaunchAnimation.cs @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits.Render public override object Create(ActorInitializer init) { return new WithNukeLaunchAnimation(init.Self, this); } } - public class WithNukeLaunchAnimation : ConditionalTrait, INotifyNuke + public class WithNukeLaunchAnimation : ConditionalTrait, INotifySupportPower { readonly WithSpriteBody wsb; @@ -37,7 +37,9 @@ namespace OpenRA.Mods.Common.Traits.Render wsb = self.TraitsImplementing().Single(w => w.Info.Name == Info.Body); } - void INotifyNuke.Launching(Actor self) + void INotifySupportPower.Charged(Actor self) { } + + void INotifySupportPower.Activated(Actor self) { if (!IsTraitDisabled) wsb.PlayCustomAnimation(self, Info.Sequence, () => wsb.CancelCustomAnimation(self)); diff --git a/OpenRA.Mods.Common/Traits/Render/WithNukeLaunchOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithNukeLaunchOverlay.cs index 970cc43d1d..4af98bb6b6 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithNukeLaunchOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithNukeLaunchOverlay.cs @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits.Render public override object Create(ActorInitializer init) { return new WithNukeLaunchOverlay(init.Self, this); } } - public class WithNukeLaunchOverlay : ConditionalTrait, INotifyNuke + public class WithNukeLaunchOverlay : ConditionalTrait, INotifySupportPower { readonly Animation overlay; bool visible; @@ -56,7 +56,9 @@ namespace OpenRA.Mods.Common.Traits.Render rs.Add(anim, info.Palette, info.IsPlayerPalette); } - void INotifyNuke.Launching(Actor self) + void INotifySupportPower.Charged(Actor self) { } + + void INotifySupportPower.Activated(Actor self) { visible = true; overlay.PlayThen(overlay.CurrentSequence.Name, () => visible = false); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index 696cd15650..02a1a151be 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -148,9 +148,6 @@ namespace OpenRA.Mods.Common.Traits public void Activate(Actor self, WPos targetPosition) { - foreach (var launchpad in self.TraitsImplementing()) - launchpad.Launching(self); - var palette = info.IsPlayerPalette ? info.MissilePalette + self.Owner.InternalName : info.MissilePalette; var skipAscent = info.SkipAscent || body == null; var launchPos = skipAscent ? WPos.Zero : self.CenterPosition + body.LocalToWorld(info.SpawnOffset); diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index 1aebc3cbd1..464ac49659 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -136,7 +136,6 @@ namespace OpenRA.Mods.Common.Traits public interface INotifySupportPower { void Charged(Actor self); void Activated(Actor self); } public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); } - public interface INotifyNuke { void Launching(Actor self); } public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); } public interface INotifyChat { bool OnChat(string from, string message); } public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); }