Upgrade rule for adapting to removal of Armament.OutOfAmmo
This commit is contained in:
@@ -1113,6 +1113,44 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
// Armament.OutOfAmmo has been replaced by pausing on condition (usually provided by AmmoPool)
|
||||
if (engineVersion < 20171104)
|
||||
{
|
||||
var reloadAmmoPool = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("ReloadAmmoPool", StringComparison.Ordinal));
|
||||
var armaments = node.Value.Nodes.Where(n => n.Key.StartsWith("Armament", StringComparison.Ordinal));
|
||||
var ammoPools = node.Value.Nodes.Where(n => n.Key.StartsWith("AmmoPool", StringComparison.Ordinal));
|
||||
|
||||
if (reloadAmmoPool == null && armaments.Any() && ammoPools.Any())
|
||||
{
|
||||
foreach (var pool in ammoPools)
|
||||
{
|
||||
var nameNode = pool.Value.Nodes.FirstOrDefault(n => n.Key == "Armaments");
|
||||
var name = nameNode != null ? FieldLoader.GetValue<string>("Armaments", nameNode.Value.Value) : "primary, secondary";
|
||||
var anyMatchingArmament = false;
|
||||
var ammoNoAmmo = new MiniYamlNode("AmmoCondition", "ammo");
|
||||
var armNoAmmo = new MiniYamlNode("PauseOnCondition", "!ammo");
|
||||
|
||||
foreach (var arma in armaments)
|
||||
{
|
||||
var armaNameNode = arma.Value.Nodes.FirstOrDefault(n => n.Key == "Name");
|
||||
var armaName = armaNameNode != null ? FieldLoader.GetValue<string>("Name", armaNameNode.Value.Value) : "primary";
|
||||
if (name.Contains(armaName))
|
||||
{
|
||||
anyMatchingArmament = true;
|
||||
arma.Value.Nodes.Add(armNoAmmo);
|
||||
}
|
||||
}
|
||||
|
||||
if (anyMatchingArmament)
|
||||
{
|
||||
pool.Value.Nodes.Add(ammoNoAmmo);
|
||||
Console.WriteLine("Aircraft returning to base is now triggered when all armaments are paused via condition.");
|
||||
Console.WriteLine("Check if any of your actors with AmmoPools may need further changes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,16 +79,19 @@ HELI:
|
||||
Weapon: HeliAGGun
|
||||
LocalOffset: 128,-213,-85, 128,213,-85
|
||||
MuzzleSequence: muzzle
|
||||
PauseOnCondition: !ammo
|
||||
Armament@SECONDARY:
|
||||
Name: secondary
|
||||
Weapon: HeliAAGun
|
||||
LocalOffset: 128,-213,-85, 128,213,-85
|
||||
MuzzleSequence: muzzle
|
||||
PauseOnCondition: !ammo
|
||||
AttackHeli:
|
||||
FacingTolerance: 20
|
||||
AmmoPool:
|
||||
Ammo: 10
|
||||
PipCount: 5
|
||||
AmmoCondition: ammo
|
||||
WithIdleOverlay@ROTORAIR:
|
||||
Offset: 0,0,85
|
||||
Sequence: rotor
|
||||
@@ -136,14 +139,17 @@ ORCA:
|
||||
Armament@PRIMARY:
|
||||
Weapon: OrcaAGMissiles
|
||||
LocalOffset: 427,-171,-213, 427,171,-213
|
||||
PauseOnCondition: !ammo
|
||||
Armament@SECONDARY:
|
||||
Weapon: OrcaAAMissiles
|
||||
LocalOffset: 427,-171,-213, 427,171,-213
|
||||
PauseOnCondition: !ammo
|
||||
AttackHeli:
|
||||
FacingTolerance: 20
|
||||
AmmoPool:
|
||||
Ammo: 6
|
||||
PipCount: 6
|
||||
AmmoCondition: ammo
|
||||
SpawnActorOnDeath:
|
||||
Actor: ORCA.Husk
|
||||
Explodes:
|
||||
|
||||
@@ -108,6 +108,7 @@ MIG:
|
||||
Weapon: Maverick
|
||||
LocalOffset: 0,-640,0, 0,640,0
|
||||
LocalYaw: -40, 24
|
||||
PauseOnCondition: !ammo
|
||||
AttackPlane:
|
||||
FacingTolerance: 20
|
||||
Aircraft:
|
||||
@@ -123,6 +124,7 @@ MIG:
|
||||
InitialStanceAI: HoldFire
|
||||
AmmoPool:
|
||||
Ammo: 8
|
||||
AmmoCondition: ammo
|
||||
ReturnOnIdle:
|
||||
Selectable:
|
||||
Bounds: 36,28,0,2
|
||||
@@ -168,11 +170,13 @@ YAK:
|
||||
Weapon: ChainGun.Yak
|
||||
LocalOffset: 256,-213,0
|
||||
MuzzleSequence: muzzle
|
||||
PauseOnCondition: !ammo
|
||||
Armament@SECONDARY:
|
||||
Name: secondary
|
||||
Weapon: ChainGun.Yak
|
||||
LocalOffset: 256,213,0
|
||||
MuzzleSequence: muzzle
|
||||
PauseOnCondition: !ammo
|
||||
AttackPlane:
|
||||
FacingTolerance: 20
|
||||
Aircraft:
|
||||
@@ -190,6 +194,7 @@ YAK:
|
||||
Ammo: 18
|
||||
PipCount: 6
|
||||
ReloadDelay: 11
|
||||
AmmoCondition: ammo
|
||||
ReturnOnIdle:
|
||||
SelectionDecorations:
|
||||
VisualBounds: 30,28,0,2
|
||||
@@ -286,9 +291,11 @@ HELI:
|
||||
Armament@PRIMARY:
|
||||
Weapon: HellfireAA
|
||||
LocalOffset: 0,-213,-85
|
||||
PauseOnCondition: !ammo
|
||||
Armament@SECONDARY:
|
||||
Weapon: HellfireAG
|
||||
LocalOffset: 0,213,-85
|
||||
PauseOnCondition: !ammo
|
||||
AttackHeli:
|
||||
FacingTolerance: 20
|
||||
Aircraft:
|
||||
@@ -310,6 +317,7 @@ HELI:
|
||||
RequiresCondition: !airborne
|
||||
AmmoPool:
|
||||
Ammo: 8
|
||||
AmmoCondition: ammo
|
||||
SelectionDecorations:
|
||||
VisualBounds: 36,28
|
||||
SpawnActorOnDeath:
|
||||
@@ -347,11 +355,13 @@ HIND:
|
||||
Weapon: ChainGun
|
||||
LocalOffset: 85,-213,-85
|
||||
MuzzleSequence: muzzle
|
||||
PauseOnCondition: !ammo
|
||||
Armament@SECONDARY:
|
||||
Name: secondary
|
||||
Weapon: ChainGun
|
||||
LocalOffset: 85,213,-85
|
||||
MuzzleSequence: muzzle
|
||||
PauseOnCondition: !ammo
|
||||
AttackHeli:
|
||||
FacingTolerance: 20
|
||||
Aircraft:
|
||||
@@ -373,6 +383,7 @@ HIND:
|
||||
Ammo: 24
|
||||
PipCount: 6
|
||||
ReloadDelay: 8
|
||||
AmmoCondition: ammo
|
||||
SelectionDecorations:
|
||||
VisualBounds: 38,32
|
||||
WithMuzzleOverlay:
|
||||
|
||||
@@ -93,6 +93,7 @@ ORCA:
|
||||
Type: CenterPosition
|
||||
Armament:
|
||||
Weapon: Hellfire
|
||||
PauseOnCondition: !ammo
|
||||
AttackHeli:
|
||||
FacingTolerance: 20
|
||||
Voice: Attack
|
||||
@@ -101,6 +102,7 @@ ORCA:
|
||||
PipCount: 5
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AmmoCondition: ammo
|
||||
RenderSprites:
|
||||
SpawnActorOnDeath:
|
||||
Actor: ORCA.Husk
|
||||
@@ -140,6 +142,7 @@ ORCAB:
|
||||
Type: CenterPosition
|
||||
Armament:
|
||||
Weapon: Bomb
|
||||
PauseOnCondition: !ammo
|
||||
AttackPlane:
|
||||
Voice: Attack
|
||||
FacingTolerance: 20
|
||||
@@ -150,6 +153,7 @@ ORCAB:
|
||||
ReloadDelay: 200
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AmmoCondition: ammo
|
||||
RenderSprites:
|
||||
Hovers@CRUISING:
|
||||
RequiresCondition: cruising
|
||||
@@ -266,6 +270,7 @@ SCRIN:
|
||||
Type: CenterPosition
|
||||
Armament:
|
||||
Weapon: Proton
|
||||
PauseOnCondition: !ammo
|
||||
AttackPlane:
|
||||
Voice: Attack
|
||||
FacingTolerance: 20
|
||||
@@ -275,6 +280,7 @@ SCRIN:
|
||||
ReloadCount: 5
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AmmoCondition: ammo
|
||||
RenderSprites:
|
||||
DeathSounds:
|
||||
SpawnActorOnDeath:
|
||||
@@ -309,6 +315,7 @@ APACHE:
|
||||
Type: CenterPosition
|
||||
Armament:
|
||||
Weapon: HarpyClaw
|
||||
PauseOnCondition: !ammo
|
||||
AttackHeli:
|
||||
FacingTolerance: 20
|
||||
Voice: Attack
|
||||
@@ -317,6 +324,7 @@ APACHE:
|
||||
PipCount: 4
|
||||
PipType: Ammo
|
||||
PipTypeEmpty: AmmoEmpty
|
||||
AmmoCondition: ammo
|
||||
WithIdleOverlay@ROTORAIR:
|
||||
Offset: 85,0,384
|
||||
Sequence: rotor
|
||||
|
||||
Reference in New Issue
Block a user