diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 8530dc05a9..f31cbbbf89 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -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[] 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) diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs b/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs index abf21453e4..1d22e0434f 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs @@ -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; diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index 09b9883ee4..0db3440b2f 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -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") diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs index 343780f7fd..e322ac9775 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs @@ -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) diff --git a/OpenRA.Mods.Common/Traits/Transforms.cs b/OpenRA.Mods.Common/Traits/Transforms.cs index dcb184143d..b8388d4bc7 100644 --- a/OpenRA.Mods.Common/Traits/Transforms.cs +++ b/OpenRA.Mods.Common/Traits/Transforms.cs @@ -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()) diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index 77c26d3018..fccf1fb169 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -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); + } }