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