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:
committed by
Matthias Mailänder
parent
5cfb5aaf2d
commit
c9ff362ea2
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Does this actor cancel its previous activity after resupplying?")]
|
||||
public readonly bool AbortOnResupply = true;
|
||||
|
||||
[Desc("Does this actor automatically take off after resupplying?")]
|
||||
public readonly bool TakeOffOnResupply = false;
|
||||
|
||||
[Desc("Does this actor automatically take off after creation?")]
|
||||
public readonly bool TakeOffOnCreation = true;
|
||||
|
||||
[Desc("Altitude at which the aircraft considers itself landed.")]
|
||||
public readonly WDist LandAltitude = WDist.Zero;
|
||||
|
||||
@@ -264,7 +270,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (host == null)
|
||||
return;
|
||||
|
||||
self.QueueActivity(new TakeOff(self));
|
||||
if (Info.TakeOffOnCreation)
|
||||
self.QueueActivity(new TakeOff(self));
|
||||
}
|
||||
|
||||
// Add land activity if LandOnCondidion resolves to true and the actor can land at the current location.
|
||||
|
||||
@@ -272,6 +272,7 @@
|
||||
AirborneCondition: airborne
|
||||
CruisingCondition: cruising
|
||||
CanHover: True
|
||||
TakeOffOnResupply: true
|
||||
HiddenUnderFog:
|
||||
Type: GroundPosition
|
||||
ActorLostNotification:
|
||||
|
||||
@@ -548,6 +548,7 @@
|
||||
CanHover: True
|
||||
CruisingCondition: cruising
|
||||
WaitDistanceFromResupplyBase: 4c0
|
||||
TakeOffOnResupply: true
|
||||
GpsDot:
|
||||
String: Helicopter
|
||||
Hovers@CRUISING:
|
||||
|
||||
@@ -820,6 +820,7 @@
|
||||
CruiseAltitude: 2048
|
||||
CanHover: True
|
||||
CruisingCondition: cruising
|
||||
TakeOffOnResupply: true
|
||||
Hovers@CRUISING:
|
||||
RequiresCondition: cruising
|
||||
|
||||
|
||||
Reference in New Issue
Block a user