Replace WithReloadingSpriteTurret with conditions

WithReloadingSpriteTurret was bound to run into conflicts with any WithTurret*Animation traits due to overriding the turret sequence constantly via ITick.
Using (stacked) conditions instead avoids that.
This commit is contained in:
reaperrr
2017-09-16 19:45:41 +02:00
parent 55b11d1745
commit d90ff99e74
5 changed files with 33 additions and 83 deletions

View File

@@ -1650,6 +1650,30 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
// Removed WithReloadingSpriteTurret
if (engineVersion < 20180223)
{
var reloadingTurret = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("WithReloadingSpriteTurret", StringComparison.Ordinal));
if (reloadingTurret != null)
{
var ammoPool = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("AmmoPool", StringComparison.Ordinal));
if (ammoPool != null)
ammoPool.Value.Nodes.Add(new MiniYamlNode("AmmoCondition", "ammo"));
RenameNodeKey(reloadingTurret, "WithSpriteTurret");
var noAmmoTurret = new MiniYamlNode("WithSpriteTurret@NoAmmo", "");
var reqAmmoCondition = new MiniYamlNode("RequiresCondition", "ammo");
var reqNoAmmoCondition = new MiniYamlNode("RequiresCondition", "!ammo");
reloadingTurret.Value.Nodes.Add(reqAmmoCondition);
noAmmoTurret.Value.Nodes.Add(reqNoAmmoCondition);
node.Value.Nodes.Add(noAmmoTurret);
Console.WriteLine("WithReloadingSpriteTurret has been removed in favor of using stacked AmmoPool.AmmoConditions.");
Console.WriteLine("Check if your affected actors need further changes.");
}
}
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
}