diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs index 64d064a67b..f8a2c3752c 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs @@ -55,6 +55,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Can this actor undeploy?")] public readonly bool CanUndeploy = true; + [Desc("Skip make/deploy animation?")] + public readonly bool SkipMakeAnimation = false; + public object Create(ActorInitializer init) { return new GrantConditionOnDeploy(init, this); } } @@ -223,7 +226,7 @@ namespace OpenRA.Mods.Common.Traits OnDeployCompleted(); else foreach (var n in notify) - n.Deploy(self); + n.Deploy(self, Info.SkipMakeAnimation); } /// Play undeploy sound and animation and after that revoke the condition. @@ -246,7 +249,7 @@ namespace OpenRA.Mods.Common.Traits OnUndeployCompleted(); else foreach (var n in notify) - n.Undeploy(self); + n.Undeploy(self, Info.SkipMakeAnimation); } void OnDeployStarted() diff --git a/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs index 47c355b3a6..21ea11c379 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithMakeAnimation.cs @@ -116,16 +116,24 @@ namespace OpenRA.Mods.Common.Traits.Render } // TODO: Make this use Forward instead - void INotifyDeployTriggered.Deploy(Actor self) + void INotifyDeployTriggered.Deploy(Actor self, bool skipMakeAnim) { var notified = false; + var notify = self.TraitsImplementing(); + + if (skipMakeAnim) + { + foreach (var n in notify) + n.FinishedDeploy(self); + + return; + } foreach (var wsb in wsbs) { if (wsb.IsTraitDisabled) continue; - var notify = self.TraitsImplementing(); wsb.PlayCustomAnimation(self, info.Sequence, () => { if (notified) @@ -141,16 +149,24 @@ namespace OpenRA.Mods.Common.Traits.Render } // TODO: Make this use Reverse instead - void INotifyDeployTriggered.Undeploy(Actor self) + void INotifyDeployTriggered.Undeploy(Actor self, bool skipMakeAnim) { var notified = false; + var notify = self.TraitsImplementing(); + + if (skipMakeAnim) + { + foreach (var n in notify) + n.FinishedUndeploy(self); + + return; + } foreach (var wsb in wsbs) { if (wsb.IsTraitDisabled) continue; - var notify = self.TraitsImplementing(); wsb.PlayCustomAnimationBackwards(self, info.Sequence, () => { if (notified) diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index e8e1a60378..0445f590db 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -175,8 +175,8 @@ namespace OpenRA.Mods.Common.Traits public interface INotifyDeployTriggered { - void Deploy(Actor self); - void Undeploy(Actor self); + void Deploy(Actor self, bool skipMakeAnim); + void Undeploy(Actor self, bool skipMakeAnim); } public interface IAcceptResourcesInfo : ITraitInfo { }