Add IIssueDeployOrder.
This commit is contained in:
@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
public class Aircraft : ITick, ISync, IFacing, IPositionable, IMove, IIssueOrder, IResolveOrder, IOrderVoice, IDeathActorInitModifier,
|
||||
INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyActorDisposing, IActorPreviewInitModifier
|
||||
INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyActorDisposing, IActorPreviewInitModifier, IIssueDeployOrder
|
||||
{
|
||||
static readonly Pair<CPos, SubCell>[] NoCells = { };
|
||||
|
||||
@@ -564,6 +564,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null;
|
||||
}
|
||||
|
||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
||||
{
|
||||
return new Order("ReturnToBase", self, false);
|
||||
}
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
switch (order.OrderString)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public object Create(ActorInitializer init) { return new AttackSuicides(init.Self, this); }
|
||||
}
|
||||
|
||||
class AttackSuicides : IIssueOrder, IResolveOrder, IOrderVoice
|
||||
class AttackSuicides : IIssueOrder, IResolveOrder, IOrderVoice, IIssueDeployOrder
|
||||
{
|
||||
readonly AttackSuicidesInfo info;
|
||||
readonly IMove move;
|
||||
@@ -56,6 +56,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new Order(order.OrderID, self, queued) { TargetActor = target.Actor };
|
||||
}
|
||||
|
||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
||||
{
|
||||
return new Order("Detonate", self, false);
|
||||
}
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
return info.Voice;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
public class Cargo : IPips, IIssueOrder, IResolveOrder, IOrderVoice, INotifyCreated, INotifyKilled,
|
||||
INotifyOwnerChanged, INotifyAddedToWorld, ITick, INotifySold, INotifyActorDisposing
|
||||
INotifyOwnerChanged, INotifyAddedToWorld, ITick, INotifySold, INotifyActorDisposing, IIssueDeployOrder
|
||||
{
|
||||
public readonly CargoInfo Info;
|
||||
readonly Actor self;
|
||||
@@ -160,6 +160,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null;
|
||||
}
|
||||
|
||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
||||
{
|
||||
return new Order("Unload", self, false);
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "Unload")
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public enum DeployState { Undeployed, Deploying, Deployed, Undeploying }
|
||||
|
||||
public class GrantConditionOnDeploy : IResolveOrder, IIssueOrder, INotifyCreated, INotifyDeployComplete
|
||||
public class GrantConditionOnDeploy : IResolveOrder, IIssueOrder, INotifyCreated, INotifyDeployComplete, IIssueDeployOrder
|
||||
{
|
||||
readonly Actor self;
|
||||
readonly GrantConditionOnDeployInfo info;
|
||||
@@ -128,6 +128,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null;
|
||||
}
|
||||
|
||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
||||
{
|
||||
return new Order("GrantConditionOnDeploy", self, false);
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString != "GrantConditionOnDeploy" || deployState == DeployState.Deploying || deployState == DeployState.Undeploying)
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public virtual object Create(ActorInitializer init) { return new Transforms(init, this); }
|
||||
}
|
||||
|
||||
public class Transforms : IIssueOrder, IResolveOrder, IOrderVoice
|
||||
public class Transforms : IIssueOrder, IResolveOrder, IOrderVoice, IIssueDeployOrder
|
||||
{
|
||||
readonly Actor self;
|
||||
readonly TransformsInfo info;
|
||||
@@ -94,6 +94,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null;
|
||||
}
|
||||
|
||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
||||
{
|
||||
return new Order("DeployTransform", self, false);
|
||||
}
|
||||
|
||||
public void DeployTransform(bool queued)
|
||||
{
|
||||
if (!queued && !CanDeploy())
|
||||
|
||||
@@ -283,4 +283,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
byte GetTerrainIndex(CPos cell);
|
||||
WPos CenterOfCell(CPos cell);
|
||||
}
|
||||
|
||||
// For traits that want to be exposed to the "Deploy" UI button / hotkey
|
||||
[RequireExplicitImplementation]
|
||||
public interface IIssueDeployOrder
|
||||
{
|
||||
Order IssueDeployOrder(Actor self);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user