Projectile refactoring upgrade rules

This commit is contained in:
reaperrr
2015-03-05 23:57:12 +01:00
parent c92b2298c3
commit 33cb4fe3e1

View File

@@ -829,6 +829,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
node.Key = "AmmoPool";
}
if (engineVersion < 20150326)
{
// Rename BlocksBullets to BlocksProjectiles
if (node.Key == "BlocksBullets")
node.Key = "BlocksProjectiles";
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}
@@ -1169,6 +1176,51 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
if (engineVersion < 20150326)
{
// Remove TurboBoost from missiles
if (depth == 1 && node.Key == "Projectile" && node.Value.Nodes.Exists(n => n.Key == "TurboBoost"))
{
node.Value.Nodes.RemoveAll(n => n.Key == "TurboBoost");
Console.WriteLine("'TurboBoost' has been removed.");
Console.WriteLine("If you want to reproduce its behavior, create a duplicate");
Console.WriteLine("of the weapon in question, change it to be anti-air only,");
Console.WriteLine("increase its speed, make the original weapon anti-ground only,");
Console.WriteLine("and add the new weapon as additional armament to the actor.");
}
// Rename ROT to RateOfTurn
if (depth == 2 && node.Key == "ROT")
node.Key = "RateOfTurn";
// Rename High to Blockable
if (depth == 2 && parentKey == "Projectile" && node.Key == "High")
{
var highField = node.Value.Value != null ? FieldLoader.GetValue<bool>("High", node.Value.Value) : false;
var blockable = !highField;
node.Value.Value = blockable.ToString().ToLowerInvariant();
node.Key = "Blockable";
}
// Move Palette from weapon to projectiles
if (depth == 0)
{
var weapons = node.Value.Nodes;
var palette = weapons.FirstOrDefault(p => p.Key == "Palette");
var projectile = weapons.FirstOrDefault(r => r.Key == "Projectile");
if (palette != null)
{
var projectileFields = projectile.Value.Nodes;
var paletteName = palette.Value.Value != null ? FieldLoader.GetValue<string>("Palette", palette.Value.Value) : "effect";
projectileFields.Add(new MiniYamlNode("Palette", paletteName.ToString()));
weapons.Remove(palette);
}
}
}
UpgradeWeaponRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}