Fix HeliReturnToBase not exposing an host actor parameter

This commit is contained in:
abcdefg30
2016-10-03 14:56:52 +02:00
parent 5acbe91221
commit 55143ced87
3 changed files with 8 additions and 4 deletions

View File

@@ -21,12 +21,14 @@ namespace OpenRA.Mods.Common.Activities
readonly Aircraft heli; readonly Aircraft heli;
readonly bool alwaysLand; readonly bool alwaysLand;
readonly bool abortOnResupply; 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<Aircraft>(); heli = self.Trait<Aircraft>();
this.alwaysLand = alwaysLand; this.alwaysLand = alwaysLand;
this.abortOnResupply = abortOnResupply; this.abortOnResupply = abortOnResupply;
this.dest = dest;
} }
public Actor ChooseHelipad(Actor self) public Actor ChooseHelipad(Actor self)
@@ -41,7 +43,9 @@ namespace OpenRA.Mods.Common.Activities
if (IsCanceled) if (IsCanceled)
return NextActivity; return NextActivity;
var dest = ChooseHelipad(self); if (dest == null || Reservable.IsReserved(dest))
dest = ChooseHelipad(self);
var initialFacing = heli.Info.InitialFacing; var initialFacing = heli.Info.InitialFacing;
if (dest == null) if (dest == null)

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Scripting
if (isPlane) if (isPlane)
Self.QueueActivity(new ReturnToBase(Self, false, airfield)); Self.QueueActivity(new ReturnToBase(Self, false, airfield));
else else
Self.QueueActivity(new HeliReturnToBase(Self, false)); Self.QueueActivity(new HeliReturnToBase(Self, false, airfield));
} }
[ScriptActorPropertyActivity] [ScriptActorPropertyActivity]

View File

@@ -623,7 +623,7 @@ namespace OpenRA.Mods.Common.Traits
if (IsPlane) if (IsPlane)
self.QueueActivity(new ReturnToBase(self, Info.AbortOnResupply, null, false)); self.QueueActivity(new ReturnToBase(self, Info.AbortOnResupply, null, false));
else else
self.QueueActivity(new HeliReturnToBase(self, Info.AbortOnResupply, false)); self.QueueActivity(new HeliReturnToBase(self, Info.AbortOnResupply, null, false));
} }
} }