Add TakeOffOnCreation and TakeOffOnResupply to Aircraft

Before this, it was impossible to replicate the behavior of the original games (staying on pad/airfield after reload) without hacking around in Mods.Common.
This allows modders to disable these without meddling with code.
This commit is contained in:
reaperrr
2017-07-14 05:33:51 +02:00
committed by Matthias Mailänder
parent 5cfb5aaf2d
commit c9ff362ea2
5 changed files with 15 additions and 4 deletions

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Activities
if (host == null)
return;
if (aircraft.IsPlane)
if (!aircraft.Info.TakeOffOnResupply)
{
ChildActivity = ActivityUtils.SequenceActivities(
aircraft.GetResupplyActivities(host)
@@ -38,12 +38,13 @@ namespace OpenRA.Mods.Common.Activities
}
else
{
// Helicopters should take off from their helipad immediately after resupplying.
// HACK: Append NextInQueue to TakeOff to avoid moving to the Rallypoint (if NextInQueue is non-null).
ChildActivity = ActivityUtils.SequenceActivities(
aircraft.GetResupplyActivities(host)
.Append(new AllowYieldingReservation(self))
.Append(new TakeOff(self)).Append(NextInQueue).ToArray());
.Append(new TakeOff(self))
.Append(NextInQueue)
.ToArray());
}
}