Convert Aircraft to conditions.
This commit is contained in:
@@ -53,12 +53,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[VoiceReference] public readonly string Voice = "Action";
|
||||
|
||||
[UpgradeGrantedReference]
|
||||
[Desc("The upgrades to grant to self while airborne.")]
|
||||
public readonly string[] AirborneUpgrades = { };
|
||||
[Desc("The condition to grant to self while airborne.")]
|
||||
public readonly string AirborneCondition = null;
|
||||
|
||||
[UpgradeGrantedReference]
|
||||
[Desc("The upgrades to grant to self while at cruise altitude.")]
|
||||
public readonly string[] CruisingUpgrades = { };
|
||||
[Desc("The condition to grant to self while at cruise altitude.")]
|
||||
public readonly string CruisingCondition = null;
|
||||
|
||||
[Desc("Can the actor hover in place mid-air? If not, then the actor will have to remain in motion (circle around).")]
|
||||
public readonly bool CanHover = false;
|
||||
@@ -119,6 +119,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
bool airborne;
|
||||
bool cruising;
|
||||
bool firstTick = true;
|
||||
int airborneToken = UpgradeManager.InvalidConditionToken;
|
||||
int cruisingToken = UpgradeManager.InvalidConditionToken;
|
||||
|
||||
bool isMoving;
|
||||
bool isMovingVertically;
|
||||
@@ -656,20 +658,20 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
if (airborne)
|
||||
return;
|
||||
|
||||
airborne = true;
|
||||
if (um != null)
|
||||
foreach (var u in Info.AirborneUpgrades)
|
||||
um.GrantUpgrade(self, u, this);
|
||||
if (um != null && !string.IsNullOrEmpty(Info.AirborneCondition) && airborneToken == UpgradeManager.InvalidConditionToken)
|
||||
airborneToken = um.GrantCondition(self, Info.AirborneCondition);
|
||||
}
|
||||
|
||||
void OnAirborneAltitudeLeft()
|
||||
{
|
||||
if (!airborne)
|
||||
return;
|
||||
|
||||
airborne = false;
|
||||
if (um != null)
|
||||
foreach (var u in Info.AirborneUpgrades)
|
||||
um.RevokeUpgrade(self, u, this);
|
||||
if (um != null && airborneToken != UpgradeManager.InvalidConditionToken)
|
||||
airborneToken = um.RevokeCondition(self, airborneToken);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -680,10 +682,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
if (cruising)
|
||||
return;
|
||||
|
||||
cruising = true;
|
||||
if (um != null)
|
||||
foreach (var u in Info.CruisingUpgrades)
|
||||
um.GrantUpgrade(self, u, this);
|
||||
if (um != null && !string.IsNullOrEmpty(Info.CruisingCondition) && cruisingToken == UpgradeManager.InvalidConditionToken)
|
||||
cruisingToken = um.GrantCondition(self, Info.CruisingCondition);
|
||||
}
|
||||
|
||||
void OnCruisingAltitudeLeft()
|
||||
@@ -691,9 +693,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!cruising)
|
||||
return;
|
||||
cruising = false;
|
||||
if (um != null)
|
||||
foreach (var u in Info.CruisingUpgrades)
|
||||
um.RevokeUpgrade(self, u, this);
|
||||
if (um != null && cruisingToken != UpgradeManager.InvalidConditionToken)
|
||||
cruisingToken = um.RevokeCondition(self, cruisingToken);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -586,6 +586,15 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
if (engineVersion < 20161213)
|
||||
{
|
||||
if (node.Key == "Aircraft")
|
||||
{
|
||||
ConvertUpgradesToCondition(parent, node, "AirborneUpgrades", "AirborneCondition");
|
||||
ConvertUpgradesToCondition(parent, node, "CruisingUpgrades", "CruisingCondition");
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ C17:
|
||||
TurnSpeed: 5
|
||||
Speed: 326
|
||||
Repulsable: False
|
||||
AirborneUpgrades: airborne
|
||||
AirborneCondition: airborne
|
||||
MaximumPitch: 36
|
||||
Health:
|
||||
HP: 25
|
||||
@@ -206,7 +206,7 @@ A10:
|
||||
TurnSpeed: 4
|
||||
Speed: 373
|
||||
Repulsable: False
|
||||
AirborneUpgrades: airborne
|
||||
AirborneCondition: airborne
|
||||
Health:
|
||||
HP: 150
|
||||
Armor:
|
||||
|
||||
@@ -202,8 +202,8 @@
|
||||
Aircraft:
|
||||
RepairBuildings: hpad
|
||||
LandWhenIdle: false
|
||||
AirborneUpgrades: airborne
|
||||
CruisingUpgrades: cruising
|
||||
AirborneCondition: airborne
|
||||
CruisingCondition: cruising
|
||||
CanHover: True
|
||||
HiddenUnderFog:
|
||||
Type: CenterPosition
|
||||
@@ -839,7 +839,7 @@
|
||||
Offset: 43, 128, 0
|
||||
ZOffset: -129
|
||||
Aircraft:
|
||||
AirborneUpgrades: airborne
|
||||
AirborneCondition: airborne
|
||||
CanHover: True
|
||||
FallsToEarth:
|
||||
Spins: True
|
||||
|
||||
@@ -16,7 +16,7 @@ carryall.reinforce:
|
||||
LandableTerrainTypes: Sand, Rock, Transition, Spice, SpiceSand, Dune
|
||||
Repulsable: False
|
||||
LandWhenIdle: False
|
||||
AirborneUpgrades: airborne
|
||||
AirborneCondition: airborne
|
||||
CanHover: True
|
||||
Targetable@GROUND:
|
||||
TargetTypes: Ground, Vehicle
|
||||
|
||||
@@ -425,8 +425,8 @@
|
||||
Aircraft:
|
||||
RepairBuildings: fix
|
||||
RearmBuildings: afld
|
||||
AirborneUpgrades: airborne
|
||||
CruisingUpgrades: cruising
|
||||
AirborneCondition: airborne
|
||||
CruisingCondition: cruising
|
||||
Targetable@GROUND:
|
||||
TargetTypes: Ground, Repair, Vehicle
|
||||
RequiresCondition: !airborne
|
||||
@@ -796,8 +796,8 @@
|
||||
Tooltip:
|
||||
GenericName: Destroyed Plane
|
||||
Aircraft:
|
||||
AirborneUpgrades: airborne
|
||||
CruisingUpgrades: cruising
|
||||
AirborneCondition: airborne
|
||||
CruisingCondition: cruising
|
||||
FallsToEarth:
|
||||
Spins: False
|
||||
Moves: True
|
||||
@@ -811,8 +811,8 @@
|
||||
Tooltip:
|
||||
GenericName: Destroyed Helicopter
|
||||
Aircraft:
|
||||
AirborneUpgrades: airborne
|
||||
CruisingUpgrades: cruising
|
||||
AirborneCondition: airborne
|
||||
CruisingCondition: cruising
|
||||
CanHover: True
|
||||
FallsToEarth:
|
||||
BodyOrientation:
|
||||
|
||||
@@ -121,7 +121,7 @@ ORCAB:
|
||||
MaximumPitch: 120
|
||||
TurnSpeed: 3
|
||||
Speed: 96
|
||||
AirborneUpgrades: airborne
|
||||
AirborneCondition: airborne
|
||||
MoveIntoShroud: false
|
||||
TakeoffSound: orcaup1.aud
|
||||
LandingSound: orcadwn1.aud
|
||||
@@ -243,7 +243,7 @@ SCRIN:
|
||||
MaximumPitch: 90
|
||||
TurnSpeed: 3
|
||||
Speed: 168
|
||||
AirborneUpgrades: airborne
|
||||
AirborneCondition: airborne
|
||||
MoveIntoShroud: false
|
||||
TakeoffSound: dropup1.aud
|
||||
LandingSound: dropdwn1.aud
|
||||
|
||||
@@ -569,8 +569,8 @@
|
||||
SelectionDecorations:
|
||||
Palette: pips
|
||||
Aircraft:
|
||||
AirborneUpgrades: airborne
|
||||
CruisingUpgrades: cruising
|
||||
AirborneCondition: airborne
|
||||
CruisingCondition: cruising
|
||||
RepairBuildings: gadept
|
||||
RearmBuildings: gahpad, nahpad
|
||||
LandWhenIdle: false
|
||||
@@ -615,8 +615,8 @@
|
||||
QuantizedFacings: 0
|
||||
CameraPitch: 90
|
||||
Aircraft:
|
||||
AirborneUpgrades: airborne
|
||||
CruisingUpgrades: cruising
|
||||
AirborneCondition: airborne
|
||||
CruisingCondition: cruising
|
||||
Health:
|
||||
HP: 280
|
||||
Armor:
|
||||
|
||||
Reference in New Issue
Block a user