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);
|
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,16 +79,19 @@ HELI:
|
|||||||
Weapon: HeliAGGun
|
Weapon: HeliAGGun
|
||||||
LocalOffset: 128,-213,-85, 128,213,-85
|
LocalOffset: 128,-213,-85, 128,213,-85
|
||||||
MuzzleSequence: muzzle
|
MuzzleSequence: muzzle
|
||||||
|
PauseOnCondition: !ammo
|
||||||
Armament@SECONDARY:
|
Armament@SECONDARY:
|
||||||
Name: secondary
|
Name: secondary
|
||||||
Weapon: HeliAAGun
|
Weapon: HeliAAGun
|
||||||
LocalOffset: 128,-213,-85, 128,213,-85
|
LocalOffset: 128,-213,-85, 128,213,-85
|
||||||
MuzzleSequence: muzzle
|
MuzzleSequence: muzzle
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackHeli:
|
AttackHeli:
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
AmmoPool:
|
AmmoPool:
|
||||||
Ammo: 10
|
Ammo: 10
|
||||||
PipCount: 5
|
PipCount: 5
|
||||||
|
AmmoCondition: ammo
|
||||||
WithIdleOverlay@ROTORAIR:
|
WithIdleOverlay@ROTORAIR:
|
||||||
Offset: 0,0,85
|
Offset: 0,0,85
|
||||||
Sequence: rotor
|
Sequence: rotor
|
||||||
@@ -136,14 +139,17 @@ ORCA:
|
|||||||
Armament@PRIMARY:
|
Armament@PRIMARY:
|
||||||
Weapon: OrcaAGMissiles
|
Weapon: OrcaAGMissiles
|
||||||
LocalOffset: 427,-171,-213, 427,171,-213
|
LocalOffset: 427,-171,-213, 427,171,-213
|
||||||
|
PauseOnCondition: !ammo
|
||||||
Armament@SECONDARY:
|
Armament@SECONDARY:
|
||||||
Weapon: OrcaAAMissiles
|
Weapon: OrcaAAMissiles
|
||||||
LocalOffset: 427,-171,-213, 427,171,-213
|
LocalOffset: 427,-171,-213, 427,171,-213
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackHeli:
|
AttackHeli:
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
AmmoPool:
|
AmmoPool:
|
||||||
Ammo: 6
|
Ammo: 6
|
||||||
PipCount: 6
|
PipCount: 6
|
||||||
|
AmmoCondition: ammo
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: ORCA.Husk
|
Actor: ORCA.Husk
|
||||||
Explodes:
|
Explodes:
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ MIG:
|
|||||||
Weapon: Maverick
|
Weapon: Maverick
|
||||||
LocalOffset: 0,-640,0, 0,640,0
|
LocalOffset: 0,-640,0, 0,640,0
|
||||||
LocalYaw: -40, 24
|
LocalYaw: -40, 24
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackPlane:
|
AttackPlane:
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
Aircraft:
|
Aircraft:
|
||||||
@@ -123,6 +124,7 @@ MIG:
|
|||||||
InitialStanceAI: HoldFire
|
InitialStanceAI: HoldFire
|
||||||
AmmoPool:
|
AmmoPool:
|
||||||
Ammo: 8
|
Ammo: 8
|
||||||
|
AmmoCondition: ammo
|
||||||
ReturnOnIdle:
|
ReturnOnIdle:
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 36,28,0,2
|
Bounds: 36,28,0,2
|
||||||
@@ -168,11 +170,13 @@ YAK:
|
|||||||
Weapon: ChainGun.Yak
|
Weapon: ChainGun.Yak
|
||||||
LocalOffset: 256,-213,0
|
LocalOffset: 256,-213,0
|
||||||
MuzzleSequence: muzzle
|
MuzzleSequence: muzzle
|
||||||
|
PauseOnCondition: !ammo
|
||||||
Armament@SECONDARY:
|
Armament@SECONDARY:
|
||||||
Name: secondary
|
Name: secondary
|
||||||
Weapon: ChainGun.Yak
|
Weapon: ChainGun.Yak
|
||||||
LocalOffset: 256,213,0
|
LocalOffset: 256,213,0
|
||||||
MuzzleSequence: muzzle
|
MuzzleSequence: muzzle
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackPlane:
|
AttackPlane:
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
Aircraft:
|
Aircraft:
|
||||||
@@ -190,6 +194,7 @@ YAK:
|
|||||||
Ammo: 18
|
Ammo: 18
|
||||||
PipCount: 6
|
PipCount: 6
|
||||||
ReloadDelay: 11
|
ReloadDelay: 11
|
||||||
|
AmmoCondition: ammo
|
||||||
ReturnOnIdle:
|
ReturnOnIdle:
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 30,28,0,2
|
VisualBounds: 30,28,0,2
|
||||||
@@ -286,9 +291,11 @@ HELI:
|
|||||||
Armament@PRIMARY:
|
Armament@PRIMARY:
|
||||||
Weapon: HellfireAA
|
Weapon: HellfireAA
|
||||||
LocalOffset: 0,-213,-85
|
LocalOffset: 0,-213,-85
|
||||||
|
PauseOnCondition: !ammo
|
||||||
Armament@SECONDARY:
|
Armament@SECONDARY:
|
||||||
Weapon: HellfireAG
|
Weapon: HellfireAG
|
||||||
LocalOffset: 0,213,-85
|
LocalOffset: 0,213,-85
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackHeli:
|
AttackHeli:
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
Aircraft:
|
Aircraft:
|
||||||
@@ -310,6 +317,7 @@ HELI:
|
|||||||
RequiresCondition: !airborne
|
RequiresCondition: !airborne
|
||||||
AmmoPool:
|
AmmoPool:
|
||||||
Ammo: 8
|
Ammo: 8
|
||||||
|
AmmoCondition: ammo
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 36,28
|
VisualBounds: 36,28
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
@@ -347,11 +355,13 @@ HIND:
|
|||||||
Weapon: ChainGun
|
Weapon: ChainGun
|
||||||
LocalOffset: 85,-213,-85
|
LocalOffset: 85,-213,-85
|
||||||
MuzzleSequence: muzzle
|
MuzzleSequence: muzzle
|
||||||
|
PauseOnCondition: !ammo
|
||||||
Armament@SECONDARY:
|
Armament@SECONDARY:
|
||||||
Name: secondary
|
Name: secondary
|
||||||
Weapon: ChainGun
|
Weapon: ChainGun
|
||||||
LocalOffset: 85,213,-85
|
LocalOffset: 85,213,-85
|
||||||
MuzzleSequence: muzzle
|
MuzzleSequence: muzzle
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackHeli:
|
AttackHeli:
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
Aircraft:
|
Aircraft:
|
||||||
@@ -373,6 +383,7 @@ HIND:
|
|||||||
Ammo: 24
|
Ammo: 24
|
||||||
PipCount: 6
|
PipCount: 6
|
||||||
ReloadDelay: 8
|
ReloadDelay: 8
|
||||||
|
AmmoCondition: ammo
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 38,32
|
VisualBounds: 38,32
|
||||||
WithMuzzleOverlay:
|
WithMuzzleOverlay:
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ ORCA:
|
|||||||
Type: CenterPosition
|
Type: CenterPosition
|
||||||
Armament:
|
Armament:
|
||||||
Weapon: Hellfire
|
Weapon: Hellfire
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackHeli:
|
AttackHeli:
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
Voice: Attack
|
Voice: Attack
|
||||||
@@ -101,6 +102,7 @@ ORCA:
|
|||||||
PipCount: 5
|
PipCount: 5
|
||||||
PipType: Ammo
|
PipType: Ammo
|
||||||
PipTypeEmpty: AmmoEmpty
|
PipTypeEmpty: AmmoEmpty
|
||||||
|
AmmoCondition: ammo
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: ORCA.Husk
|
Actor: ORCA.Husk
|
||||||
@@ -140,6 +142,7 @@ ORCAB:
|
|||||||
Type: CenterPosition
|
Type: CenterPosition
|
||||||
Armament:
|
Armament:
|
||||||
Weapon: Bomb
|
Weapon: Bomb
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackPlane:
|
AttackPlane:
|
||||||
Voice: Attack
|
Voice: Attack
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
@@ -150,6 +153,7 @@ ORCAB:
|
|||||||
ReloadDelay: 200
|
ReloadDelay: 200
|
||||||
PipType: Ammo
|
PipType: Ammo
|
||||||
PipTypeEmpty: AmmoEmpty
|
PipTypeEmpty: AmmoEmpty
|
||||||
|
AmmoCondition: ammo
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Hovers@CRUISING:
|
Hovers@CRUISING:
|
||||||
RequiresCondition: cruising
|
RequiresCondition: cruising
|
||||||
@@ -266,6 +270,7 @@ SCRIN:
|
|||||||
Type: CenterPosition
|
Type: CenterPosition
|
||||||
Armament:
|
Armament:
|
||||||
Weapon: Proton
|
Weapon: Proton
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackPlane:
|
AttackPlane:
|
||||||
Voice: Attack
|
Voice: Attack
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
@@ -275,6 +280,7 @@ SCRIN:
|
|||||||
ReloadCount: 5
|
ReloadCount: 5
|
||||||
PipType: Ammo
|
PipType: Ammo
|
||||||
PipTypeEmpty: AmmoEmpty
|
PipTypeEmpty: AmmoEmpty
|
||||||
|
AmmoCondition: ammo
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
DeathSounds:
|
DeathSounds:
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
@@ -309,6 +315,7 @@ APACHE:
|
|||||||
Type: CenterPosition
|
Type: CenterPosition
|
||||||
Armament:
|
Armament:
|
||||||
Weapon: HarpyClaw
|
Weapon: HarpyClaw
|
||||||
|
PauseOnCondition: !ammo
|
||||||
AttackHeli:
|
AttackHeli:
|
||||||
FacingTolerance: 20
|
FacingTolerance: 20
|
||||||
Voice: Attack
|
Voice: Attack
|
||||||
@@ -317,6 +324,7 @@ APACHE:
|
|||||||
PipCount: 4
|
PipCount: 4
|
||||||
PipType: Ammo
|
PipType: Ammo
|
||||||
PipTypeEmpty: AmmoEmpty
|
PipTypeEmpty: AmmoEmpty
|
||||||
|
AmmoCondition: ammo
|
||||||
WithIdleOverlay@ROTORAIR:
|
WithIdleOverlay@ROTORAIR:
|
||||||
Offset: 85,0,384
|
Offset: 85,0,384
|
||||||
Sequence: rotor
|
Sequence: rotor
|
||||||
|
|||||||
Reference in New Issue
Block a user