Use new update util extensions to simplify some update rules
This commit is contained in:
@@ -30,13 +30,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||||
{
|
{
|
||||||
foreach (var sod in actorNode.ChildrenMatching("ShakeOnDeath"))
|
foreach (var sod in actorNode.ChildrenMatching("ShakeOnDeath"))
|
||||||
{
|
sod.RenameChildrenMatching("Intensity", "Duration");
|
||||||
var intensity = sod.LastChildMatching("Intensity");
|
|
||||||
if (intensity == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
intensity.RenameKey("Duration");
|
|
||||||
}
|
|
||||||
|
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,9 +92,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
if (tunnelConditionNode != null)
|
if (tunnelConditionNode != null)
|
||||||
{
|
{
|
||||||
var grantNode = new MiniYamlNode("GrantConditionOnTunnelLayer", "");
|
var grantNode = new MiniYamlNode("GrantConditionOnTunnelLayer", "");
|
||||||
grantNode.AddNode("Condition", tunnelConditionNode.Value.Value);
|
tunnelConditionNode.MoveAndRenameNode(mobileNode, grantNode, "Condition");
|
||||||
addNodes.Add(grantNode);
|
addNodes.Add(grantNode);
|
||||||
mobileNode.RemoveNodes("TunnelCondition");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var subterraneanNode = mobileNode.LastChildMatching("Subterranean");
|
var subterraneanNode = mobileNode.LastChildMatching("Subterranean");
|
||||||
@@ -125,13 +124,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
{
|
{
|
||||||
var grantNode = new MiniYamlNode("GrantConditionOnSubterraneanLayer", "");
|
var grantNode = new MiniYamlNode("GrantConditionOnSubterraneanLayer", "");
|
||||||
foreach (var node in nodes)
|
foreach (var node in nodes)
|
||||||
{
|
|
||||||
if (node != null)
|
if (node != null)
|
||||||
{
|
node.MoveNode(mobileNode, grantNode);
|
||||||
grantNode.AddNode(node);
|
|
||||||
mobileNode.RemoveNode(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addNodes.Add(grantNode);
|
addNodes.Add(grantNode);
|
||||||
}
|
}
|
||||||
@@ -147,8 +141,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
if (conditionNode != null)
|
if (conditionNode != null)
|
||||||
{
|
{
|
||||||
var grantNode = new MiniYamlNode("GrantConditionOnJumpjetLayer", "");
|
var grantNode = new MiniYamlNode("GrantConditionOnJumpjetLayer", "");
|
||||||
grantNode.AddNode("Condition", conditionNode.Value.Value);
|
conditionNode.MoveAndRenameNode(mobileNode, grantNode, "Condition");
|
||||||
mobileNode.RemoveNodes("JumpjetCondition");
|
|
||||||
addNodes.Add(grantNode);
|
addNodes.Add(grantNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,9 +90,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
else if (attackSequence != null && aimSequence != null)
|
else if (attackSequence != null && aimSequence != null)
|
||||||
{
|
{
|
||||||
var turretAim = new MiniYamlNode("WithTurretAimAnimation", "");
|
var turretAim = new MiniYamlNode("WithTurretAimAnimation", "");
|
||||||
aimSequence.RenameKey("Sequence");
|
aimSequence.MoveAndRenameNode(turretAttack, turretAim, "Sequence");
|
||||||
turretAim.AddNode(aimSequence);
|
|
||||||
turretAttack.RemoveNode(aimSequence);
|
|
||||||
|
|
||||||
var turret = turretAttack.LastChildMatching("Turret");
|
var turret = turretAttack.LastChildMatching("Turret");
|
||||||
var armament = turretAttack.LastChildMatching("Armament");
|
var armament = turretAttack.LastChildMatching("Armament");
|
||||||
@@ -118,9 +116,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
aimAnimLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
aimAnimLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
||||||
|
|
||||||
var aimAnim = new MiniYamlNode("WithTurretAimAnimation", "");
|
var aimAnim = new MiniYamlNode("WithTurretAimAnimation", "");
|
||||||
aimSequence.RenameKey("Sequence");
|
aimSequence.MoveAndRenameNode(spriteTurret, aimAnim, "Sequence");
|
||||||
aimAnim.AddNode(aimSequence);
|
|
||||||
spriteTurret.RemoveNode(aimSequence);
|
|
||||||
actorNode.AddNode(aimAnim);
|
actorNode.AddNode(aimAnim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,9 +156,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
|||||||
else if (attackSequence != null && aimSequence != null)
|
else if (attackSequence != null && aimSequence != null)
|
||||||
{
|
{
|
||||||
var aimAnim = new MiniYamlNode("WithAimAnimation", "");
|
var aimAnim = new MiniYamlNode("WithAimAnimation", "");
|
||||||
aimSequence.RenameKey("Sequence");
|
aimSequence.MoveAndRenameNode(attackAnim, aimAnim, "Sequence");
|
||||||
aimAnim.AddNode(aimSequence);
|
|
||||||
attackAnim.RemoveNode(aimSequence);
|
|
||||||
|
|
||||||
var body = attackAnim.LastChildMatching("Body");
|
var body = attackAnim.LastChildMatching("Body");
|
||||||
var armament = attackAnim.LastChildMatching("Armament");
|
var armament = attackAnim.LastChildMatching("Armament");
|
||||||
|
|||||||
Reference in New Issue
Block a user