Allow skipping make anim for actors with WithMakeAnimation and GrantConditionOnDeploy
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/// <summary>Play undeploy sound and animation and after that revoke the condition.</summary>
|
||||
@@ -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()
|
||||
|
||||
@@ -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<INotifyDeployComplete>();
|
||||
|
||||
if (skipMakeAnim)
|
||||
{
|
||||
foreach (var n in notify)
|
||||
n.FinishedDeploy(self);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var wsb in wsbs)
|
||||
{
|
||||
if (wsb.IsTraitDisabled)
|
||||
continue;
|
||||
|
||||
var notify = self.TraitsImplementing<INotifyDeployComplete>();
|
||||
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<INotifyDeployComplete>();
|
||||
|
||||
if (skipMakeAnim)
|
||||
{
|
||||
foreach (var n in notify)
|
||||
n.FinishedUndeploy(self);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var wsb in wsbs)
|
||||
{
|
||||
if (wsb.IsTraitDisabled)
|
||||
continue;
|
||||
|
||||
var notify = self.TraitsImplementing<INotifyDeployComplete>();
|
||||
wsb.PlayCustomAnimationBackwards(self, info.Sequence, () =>
|
||||
{
|
||||
if (notified)
|
||||
|
||||
@@ -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 { }
|
||||
|
||||
Reference in New Issue
Block a user