From 3b01da737c3674416dbae574b699d43f8dba30c6 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 20 Aug 2017 21:18:33 +0200 Subject: [PATCH] Introduce Aircraft VTOL boolean Rather than hard-linking vertical take-off/land to the CanHover = Helicopter assumption. --- .../Scripting/Global/ReinforcementsGlobal.cs | 6 +++--- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Global/ReinforcementsGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/ReinforcementsGlobal.cs index 2a718bdb75..678f6d56ca 100644 --- a/OpenRA.Mods.Common/Scripting/Global/ReinforcementsGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/ReinforcementsGlobal.cs @@ -143,12 +143,12 @@ namespace OpenRA.Mods.Common.Scripting } else { - var aircraftInfo = transport.TraitOrDefault(); + var aircraftInfo = transport.Info.TraitInfoOrDefault(); if (aircraftInfo != null) { - if (!aircraftInfo.IsPlane) + if (aircraftInfo.VTOL) { - transport.QueueActivity(new Turn(transport, aircraftInfo.Info.InitialFacing)); + transport.QueueActivity(new Turn(transport, aircraftInfo.InitialFacing)); transport.QueueActivity(new HeliLand(transport, true)); } else diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 2e4c2b8bbb..c38e54be63 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -69,6 +69,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Can the actor hover in place mid-air? If not, then the actor will have to remain in motion (circle around).")] public readonly bool CanHover = false; + [Desc("Does the actor land and take off vertically?")] + public readonly bool VTOL = false; + [Desc("Will this actor try to land after it has no more commands?")] public readonly bool LandWhenIdle = true; @@ -620,7 +623,8 @@ namespace OpenRA.Mods.Common.Traits new CallFunc(() => SetVisualPosition(self, fromPos)), new Fly(self, Target.FromPos(toPos))); - return ActivityUtils.SequenceActivities(new CallFunc(() => SetVisualPosition(self, fromPos)), + return ActivityUtils.SequenceActivities( + new CallFunc(() => SetVisualPosition(self, fromPos)), new HeliFly(self, Target.FromPos(toPos))); } @@ -757,7 +761,7 @@ namespace OpenRA.Mods.Common.Traits UnReserve(); // TODO: Implement INotifyBecomingIdle instead - if (!IsPlane && Info.LandWhenIdle) + if (Info.VTOL && Info.LandWhenIdle) { if (Info.TurnToLand) self.QueueActivity(new Turn(self, Info.InitialFacing));