From 55143ced87a528cdc3530da1c63b88acb3632e28 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 3 Oct 2016 14:56:52 +0200 Subject: [PATCH 1/2] Fix HeliReturnToBase not exposing an host actor parameter --- OpenRA.Mods.Common/Activities/Air/HeliReturnToBase.cs | 8 ++++++-- .../Scripting/Properties/AircraftProperties.cs | 2 +- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Air/HeliReturnToBase.cs b/OpenRA.Mods.Common/Activities/Air/HeliReturnToBase.cs index 98b6adc019..67581d7569 100644 --- a/OpenRA.Mods.Common/Activities/Air/HeliReturnToBase.cs +++ b/OpenRA.Mods.Common/Activities/Air/HeliReturnToBase.cs @@ -21,12 +21,14 @@ namespace OpenRA.Mods.Common.Activities readonly Aircraft heli; readonly bool alwaysLand; readonly bool abortOnResupply; + Actor dest; - public HeliReturnToBase(Actor self, bool abortOnResupply, bool alwaysLand = true) + public HeliReturnToBase(Actor self, bool abortOnResupply, Actor dest = null, bool alwaysLand = true) { heli = self.Trait(); this.alwaysLand = alwaysLand; this.abortOnResupply = abortOnResupply; + this.dest = dest; } public Actor ChooseHelipad(Actor self) @@ -41,7 +43,9 @@ namespace OpenRA.Mods.Common.Activities if (IsCanceled) return NextActivity; - var dest = ChooseHelipad(self); + if (dest == null || Reservable.IsReserved(dest)) + dest = ChooseHelipad(self); + var initialFacing = heli.Info.InitialFacing; if (dest == null) diff --git a/OpenRA.Mods.Common/Scripting/Properties/AircraftProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/AircraftProperties.cs index 13b71c126d..413c6f2454 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/AircraftProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/AircraftProperties.cs @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Scripting if (isPlane) Self.QueueActivity(new ReturnToBase(Self, false, airfield)); else - Self.QueueActivity(new HeliReturnToBase(Self, false)); + Self.QueueActivity(new HeliReturnToBase(Self, false, airfield)); } [ScriptActorPropertyActivity] diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index b3097617b4..34467197eb 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -623,7 +623,7 @@ namespace OpenRA.Mods.Common.Traits if (IsPlane) self.QueueActivity(new ReturnToBase(self, Info.AbortOnResupply, null, false)); else - self.QueueActivity(new HeliReturnToBase(self, Info.AbortOnResupply, false)); + self.QueueActivity(new HeliReturnToBase(self, Info.AbortOnResupply, null, false)); } } From 90e6a69152a7bd04fb34b032d5dbc20f36dfc3a5 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Wed, 5 Oct 2016 16:05:56 +0200 Subject: [PATCH 2/2] Rename the airfield parameter to destination --- .../Scripting/Properties/AircraftProperties.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Properties/AircraftProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/AircraftProperties.cs index 413c6f2454..aed47133d3 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/AircraftProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/AircraftProperties.cs @@ -38,13 +38,13 @@ namespace OpenRA.Mods.Common.Scripting } [ScriptActorPropertyActivity] - [Desc("Return to the base, which is either the airfield given, or an auto-selected one otherwise.")] - public void ReturnToBase(Actor airfield = null) + [Desc("Return to the base, which is either the destination given, or an auto-selected one otherwise.")] + public void ReturnToBase(Actor destination = null) { if (isPlane) - Self.QueueActivity(new ReturnToBase(Self, false, airfield)); + Self.QueueActivity(new ReturnToBase(Self, false, destination)); else - Self.QueueActivity(new HeliReturnToBase(Self, false, airfield)); + Self.QueueActivity(new HeliReturnToBase(Self, false, destination)); } [ScriptActorPropertyActivity]