Fix unresponsive aircraft when executing orders queued during resupply
This commit is contained in:
committed by
Paul Chote
parent
297be6d6cc
commit
0ee9219df3
@@ -38,12 +38,10 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// HACK: Append NextInQueue to TakeOff to avoid moving to the Rallypoint (if NextInQueue is non-null).
|
|
||||||
ChildActivity = ActivityUtils.SequenceActivities(
|
ChildActivity = ActivityUtils.SequenceActivities(
|
||||||
aircraft.GetResupplyActivities(host)
|
aircraft.GetResupplyActivities(host)
|
||||||
.Append(new AllowYieldingReservation(self))
|
.Append(new AllowYieldingReservation(self))
|
||||||
.Append(new TakeOff(self))
|
.Append(new TakeOff(self, (a, b, c) => NextInQueue == null && b.NextInQueue == null))
|
||||||
.Append(NextInQueue)
|
|
||||||
.ToArray());
|
.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenRA.Activities;
|
using OpenRA.Activities;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
|
||||||
@@ -18,11 +19,19 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
readonly Aircraft aircraft;
|
readonly Aircraft aircraft;
|
||||||
readonly IMove move;
|
readonly IMove move;
|
||||||
|
Func<Actor, Activity, CPos, bool> moveToRallyPoint;
|
||||||
|
|
||||||
public TakeOff(Actor self)
|
public TakeOff(Actor self)
|
||||||
{
|
{
|
||||||
aircraft = self.Trait<Aircraft>();
|
aircraft = self.Trait<Aircraft>();
|
||||||
move = self.Trait<IMove>();
|
move = self.Trait<IMove>();
|
||||||
|
moveToRallyPoint = (actor, activity, pos) => NextActivity == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TakeOff(Actor self, Func<Actor, Activity, CPos, bool> moveToRallyPoint)
|
||||||
|
: this(self)
|
||||||
|
{
|
||||||
|
this.moveToRallyPoint = moveToRallyPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
@@ -43,10 +52,10 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
var destination = rp != null ? rp.Location :
|
var destination = rp != null ? rp.Location :
|
||||||
(hasHost ? self.World.Map.CellContaining(host.CenterPosition) : self.Location);
|
(hasHost ? self.World.Map.CellContaining(host.CenterPosition) : self.Location);
|
||||||
|
|
||||||
if (NextInQueue == null)
|
if (moveToRallyPoint(self, this, destination))
|
||||||
return new AttackMoveActivity(self, move.MoveTo(destination, 1));
|
return new AttackMoveActivity(self, move.MoveTo(destination, 1));
|
||||||
else
|
else
|
||||||
return NextInQueue;
|
return NextActivity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user