Deploy activities for mods and future AI scripting

This commit is contained in:
Forcecore
2017-06-16 20:02:47 -05:00
committed by atlimit8
parent 300a7222f3
commit a7cedc54ff
4 changed files with 116 additions and 12 deletions

View File

@@ -73,6 +73,8 @@ namespace OpenRA.Mods.Common.Traits
int deployedToken = ConditionManager.InvalidConditionToken;
int undeployedToken = ConditionManager.InvalidConditionToken;
public DeployState DeployState { get { return deployState; } }
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info)
{
self = init.Self;
@@ -142,17 +144,9 @@ namespace OpenRA.Mods.Common.Traits
self.CancelActivity();
if (deployState == DeployState.Deployed && info.CanUndeploy)
{
self.QueueActivity(new CallFunc(Undeploy));
}
self.QueueActivity(new UndeployForGrantedCondition(self));
else if (deployState == DeployState.Undeployed)
{
// Turn to the required facing.
if (info.Facing != -1 && canTurn)
self.QueueActivity(new Turn(self, info.Facing));
self.QueueActivity(new CallFunc(Deploy));
}
self.QueueActivity(new DeployForGrantedCondition(self));
}
bool IsCursorBlocked()
@@ -206,7 +200,7 @@ namespace OpenRA.Mods.Common.Traits
}
/// <summary>Play deploy sound and animation.</summary>
void Deploy() { Deploy(false); }
public void Deploy() { Deploy(false); }
void Deploy(bool init)
{
// Something went wrong, most likely due to deploy order spam and the fact that this is a delayed action.
@@ -233,7 +227,7 @@ namespace OpenRA.Mods.Common.Traits
}
/// <summary>Play undeploy sound and animation and after that revoke the condition.</summary>
void Undeploy() { Undeploy(false); }
public void Undeploy() { Undeploy(false); }
void Undeploy(bool init)
{
// Something went wrong, most likely due to deploy order spam and the fact that this is a delayed action.