Remove old update rules
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class AddNukeLaunchAnimation : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Add 'WithNukeLaunchAnimation' and remove 'NukePower.ActivationSequence'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The 'ActivationSequence' property has been removed.\n" +
|
||||
"Use the new 'WithNukeLaunchAnimation' trait instead.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var nukePowers = actorNode.ChildrenMatching("NukePower").ToList();
|
||||
foreach (var nuke in nukePowers)
|
||||
{
|
||||
var activation = nuke.LastChildMatching("ActivationSequence");
|
||||
if (activation == null)
|
||||
continue;
|
||||
|
||||
var sequence = activation.NodeValue<string>();
|
||||
nuke.RemoveNode(activation);
|
||||
actorNode.AddNode("WithNukeLaunchAnimation", "");
|
||||
if (sequence != "active")
|
||||
actorNode.LastChildMatching("WithNukeLaunchAnimation").AddNode("Sequence", sequence);
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class AircraftCanHoverGeneralization : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Split Aircraft.CanHover into multiple parameters"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Aircraft VTOL behaviour has been moved from CanHover to a new VTOL parameter.\n" +
|
||||
"Aircraft taking off automatically after reloading has been moved from CanHover to a new TakeOffOnResupply parameter.\n" +
|
||||
"Actors that set CanHover: true are updated with appropriate defaults for these parameters.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var aircraft in actorNode.ChildrenMatching("Aircraft"))
|
||||
{
|
||||
var canHover = aircraft.LastChildMatching("CanHover");
|
||||
if (canHover != null && canHover.NodeValue<bool>())
|
||||
{
|
||||
if (!aircraft.ChildrenMatching("TakeOffOnResupply").Any())
|
||||
aircraft.AddNode("TakeOffOnResupply", true);
|
||||
|
||||
if (!aircraft.ChildrenMatching("VTOL").Any())
|
||||
aircraft.AddNode("VTOL", true);
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class CapturableChanges : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Changes on 'Captures' and 'ExternalCaptures'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'Type' was renamed to 'Types'. 'AllowAllies',\n" +
|
||||
"'AllowNeutral' and 'AllowEnemies' were replaced by 'ValidStances'.";
|
||||
}
|
||||
}
|
||||
|
||||
void ApplyChanges(MiniYamlNode actorNode, MiniYamlNode node)
|
||||
{
|
||||
// Type renamed to Types
|
||||
var type = node.LastChildMatching("Type");
|
||||
if (type != null)
|
||||
type.RenameKey("Types");
|
||||
|
||||
// Allow(Allies|Neutral|Enemies) replaced with a ValidStances enum
|
||||
var stance = Stance.Neutral | Stance.Enemy;
|
||||
var allowAllies = node.LastChildMatching("AllowAllies");
|
||||
if (allowAllies != null)
|
||||
{
|
||||
if (allowAllies.NodeValue<bool>())
|
||||
stance |= Stance.Ally;
|
||||
else
|
||||
stance &= ~Stance.Ally;
|
||||
|
||||
node.RemoveNode(allowAllies);
|
||||
}
|
||||
|
||||
var allowNeutral = node.LastChildMatching("AllowNeutral");
|
||||
if (allowNeutral != null)
|
||||
{
|
||||
if (allowNeutral.NodeValue<bool>())
|
||||
stance |= Stance.Neutral;
|
||||
else
|
||||
stance &= ~Stance.Neutral;
|
||||
|
||||
node.RemoveNode(allowNeutral);
|
||||
}
|
||||
|
||||
var allowEnemies = node.LastChildMatching("AllowEnemies");
|
||||
if (allowEnemies != null)
|
||||
{
|
||||
if (allowEnemies.NodeValue<bool>())
|
||||
stance |= Stance.Enemy;
|
||||
else
|
||||
stance &= ~Stance.Enemy;
|
||||
|
||||
node.RemoveNode(allowEnemies);
|
||||
}
|
||||
|
||||
if (stance != (Stance.Neutral | Stance.Enemy))
|
||||
node.AddNode("ValidStances", stance);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var ca in actorNode.ChildrenMatching("Capturable"))
|
||||
ApplyChanges(actorNode, ca);
|
||||
|
||||
foreach (var eca in actorNode.ChildrenMatching("ExternalCapturable"))
|
||||
ApplyChanges(actorNode, eca);
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ChangeBuildableArea : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Require 'AreaTypes' on 'GivesBuildableArea'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'AreaTypes' are now mandatory on 'GivesBuildableArea'.\n" +
|
||||
"A 'RequiresBuildableArea' trait was added and 'Building.Adjacent' was moved there.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var givesBuildableArea = actorNode.LastChildMatching("GivesBuildableArea");
|
||||
if (givesBuildableArea != null)
|
||||
givesBuildableArea.AddNode("AreaTypes", "building");
|
||||
|
||||
var building = actorNode.LastChildMatching("Building");
|
||||
if (building != null)
|
||||
{
|
||||
var requiresBuildableArea = new MiniYamlNode("RequiresBuildableArea", "");
|
||||
requiresBuildableArea.AddNode("AreaTypes", "building");
|
||||
|
||||
var adjacent = building.LastChildMatching("Adjacent");
|
||||
if (adjacent != null)
|
||||
requiresBuildableArea.AddNode(adjacent);
|
||||
|
||||
actorNode.AddNode(requiresBuildableArea);
|
||||
building.RemoveNodes("Adjacent");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ChangeCanPowerDown : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Provide a condition in 'CanPowerDown' instead of using 'Actor.Disabled'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'CanPowerDown' now provides a condition instead of using the legacy 'Actor.Disabled' boolean.\n" +
|
||||
"Review your condition setup to make sure all relevant traits are disabled by that condition.";
|
||||
}
|
||||
}
|
||||
|
||||
bool displayed;
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var canPowerDown = actorNode.LastChildMatching("CanPowerDown");
|
||||
if (canPowerDown == null)
|
||||
yield break;
|
||||
|
||||
canPowerDown.AddNode("PowerdownCondition", "powerdown");
|
||||
|
||||
var image = canPowerDown.LastChildMatching("IndicatorImage");
|
||||
var seq = canPowerDown.LastChildMatching("IndicatorSequence");
|
||||
var pal = canPowerDown.LastChildMatching("IndicatorPalette");
|
||||
var imageValue = image != null ? image.NodeValue<string>() : "poweroff";
|
||||
var seqValue = seq != null ? seq.NodeValue<string>() : "offline";
|
||||
var palValue = pal != null ? pal.NodeValue<string>() : "chrome";
|
||||
|
||||
var indicator = new MiniYamlNode("WithDecoration@POWERDOWN", "");
|
||||
indicator.AddNode("Image", imageValue);
|
||||
indicator.AddNode("Sequence", seqValue);
|
||||
indicator.AddNode("Palette", palValue);
|
||||
indicator.AddNode("RequiresCondition", "powerdown");
|
||||
indicator.AddNode("ReferencePoint", "Center");
|
||||
|
||||
actorNode.AddNode(indicator);
|
||||
if (image != null)
|
||||
canPowerDown.RemoveNodes("IndicatorImage");
|
||||
if (seq != null)
|
||||
canPowerDown.RemoveNodes("IndicatorSequence");
|
||||
if (pal != null)
|
||||
canPowerDown.RemoveNodes("IndicatorPalette");
|
||||
|
||||
if (!displayed)
|
||||
{
|
||||
displayed = true;
|
||||
yield return "'CanPowerDown' now provides a condition. You might need to review your condition setup.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class DecoupleSelfReloading : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Replace 'SelfReloads' with 'ReloadAmmoPool'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'SelfReloads', 'SelfReloadDelay', 'ReloadCount', 'ResetOnFire'\n" +
|
||||
"and 'RearmSound' were renamed and moved from 'AmmoPool' to a new 'ReloadAmmoPool' trait.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var poolNumber = 0;
|
||||
var ammoPools = actorNode.ChildrenMatching("AmmoPool").ToList();
|
||||
foreach (var pool in ammoPools)
|
||||
{
|
||||
var selfReloads = pool.LastChildMatching("SelfReloads");
|
||||
if (selfReloads == null || !selfReloads.NodeValue<bool>())
|
||||
continue;
|
||||
|
||||
poolNumber++;
|
||||
var reloadOnCond = new MiniYamlNode("ReloadAmmoPool@" + poolNumber, "");
|
||||
|
||||
var name = pool.LastChildMatching("Name");
|
||||
if (name != null)
|
||||
reloadOnCond.AddNode("AmmoPool", name.NodeValue<string>());
|
||||
|
||||
var selfReloadDelay = pool.LastChildMatching("SelfReloadDelay");
|
||||
if (selfReloadDelay != null)
|
||||
{
|
||||
selfReloadDelay.RenameKey("Delay");
|
||||
reloadOnCond.AddNode(selfReloadDelay);
|
||||
pool.RemoveNodes("SelfReloadDelay");
|
||||
}
|
||||
|
||||
pool.RemoveNodes("SelfReloads");
|
||||
|
||||
var reloadCount = pool.LastChildMatching("ReloadCount");
|
||||
if (reloadCount != null)
|
||||
{
|
||||
reloadCount.RenameKey("Count");
|
||||
reloadOnCond.AddNode(reloadCount);
|
||||
pool.RemoveNodes("ReloadCount");
|
||||
}
|
||||
|
||||
var reset = pool.LastChildMatching("ResetOnFire");
|
||||
if (reset != null)
|
||||
{
|
||||
reloadOnCond.AddNode(reset);
|
||||
pool.RemoveNodes("ResetOnFire");
|
||||
}
|
||||
|
||||
var rearmSound = pool.LastChildMatching("RearmSound");
|
||||
if (rearmSound != null)
|
||||
{
|
||||
rearmSound.RenameKey("Sound");
|
||||
reloadOnCond.AddNode(rearmSound);
|
||||
pool.RemoveNodes("RearmSound");
|
||||
}
|
||||
|
||||
actorNode.AddNode(reloadOnCond);
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class DropPauseAnimationWhenDisabled : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Drop 'PauseAnimationWhenDisabled' from 'WithSpriteBody', replacing it with conditions."; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'WithSpriteBody' is a 'PausableConditionalTrait' now, allowing to drop the 'PauseAnimationWhenDisabled' property\n" +
|
||||
"and to use 'PauseCondition' instead. (With a default value of 'disabled' in this case.)";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var pauseAnimation = actorNode.LastChildMatching("PauseAnimationWhenDisabled");
|
||||
if (pauseAnimation == null)
|
||||
yield break;
|
||||
|
||||
pauseAnimation.RenameKey("PauseCondition");
|
||||
pauseAnimation.ReplaceValue("disabled");
|
||||
|
||||
yield return "'PauseAnimationWhenDisabled' was removed from 'WithSpriteBody' and replaced by conditions.\n" +
|
||||
"You might need to review your condition setup.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class LegacyBetaWarning : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Update path from 20171014 to 20180307 is in beta state"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Due to time constraints and the legacy status of the included rules,\n" +
|
||||
"the update path to 20180307 is considered a beta path.\n" +
|
||||
"If you encounter any issues, please report them on GitHub or our IRC channel.";
|
||||
}
|
||||
}
|
||||
|
||||
bool displayed;
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
var message = "Due to time constraints and the legacy status of the included rules,\n" +
|
||||
"the update path to 20180307 is considered a beta path.\n" +
|
||||
"If you encounter any issues, please report them on GitHub or our IRC channel.";
|
||||
|
||||
if (!displayed)
|
||||
yield return message;
|
||||
|
||||
displayed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class MoveVisualBounds : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Move 'SelectionDecorations.VisualBounds' to 'Selectable.Bounds'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'SelectionDecorations.VisualBounds' was moved to 'Selectable.Bounds'.\n" +
|
||||
"'AutoRenderSize' and 'CustomRenderSize' were renamed to 'Interactable'.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var autoSelectionSize = actorNode.LastChildMatching("AutoSelectionSize");
|
||||
if (autoSelectionSize != null)
|
||||
actorNode.AddNode("Interactable", "");
|
||||
|
||||
var customSelectionSize = actorNode.LastChildMatching("CustomSelectionSize");
|
||||
if (customSelectionSize != null)
|
||||
{
|
||||
var bounds = customSelectionSize.LastChildMatching("CustomBounds");
|
||||
var customRenderSize = new MiniYamlNode("Interactable", "");
|
||||
if (bounds != null)
|
||||
customRenderSize.AddNode("Bounds", bounds.NodeValue<int[]>());
|
||||
|
||||
actorNode.AddNode(customRenderSize);
|
||||
}
|
||||
|
||||
var sd = actorNode.LastChildMatching("SelectionDecorations");
|
||||
if (sd != null)
|
||||
{
|
||||
var boundsNode = sd.LastChildMatching("VisualBounds");
|
||||
if (boundsNode != null)
|
||||
{
|
||||
boundsNode.RenameKey("DecorationBounds");
|
||||
sd.RemoveNode(boundsNode);
|
||||
var selectable = actorNode.LastChildMatching("Selectable");
|
||||
if (selectable == null)
|
||||
{
|
||||
selectable = new MiniYamlNode("Selectable", new MiniYaml(""));
|
||||
actorNode.AddNode(selectable);
|
||||
}
|
||||
|
||||
selectable.AddNode(boundsNode);
|
||||
}
|
||||
}
|
||||
|
||||
if (actorNode.LastChildMatching("-Selectable") != null && actorNode.LastChildMatching("Interactable") == null)
|
||||
actorNode.AddNode("Interactable", "");
|
||||
|
||||
actorNode.RemoveNodes("CustomSelectionSize");
|
||||
actorNode.RemoveNodes("AutoSelectionSize");
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemoveIDisable : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Remove 'IDisabled'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'Actor.IsDisabled' has been removed in favor of pausing/disabling traits via conditions.";
|
||||
}
|
||||
}
|
||||
|
||||
bool displayed;
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var doc = actorNode.LastChildMatching("DisableOnCondition");
|
||||
var grant = actorNode.LastChildMatching("GrantConditionOnDisabled");
|
||||
|
||||
if (!displayed && (doc != null || grant != null))
|
||||
{
|
||||
displayed = true;
|
||||
yield return "Actor.IsDisabled has been removed in favor of pausing/disabling traits via conditions.\n" +
|
||||
"DisableOnCondition and GrantConditionOnDisabled were stop-gap solutions that have been removed along with it.\n" +
|
||||
"You'll have to use RequiresCondition or PauseOnCondition on individual traits to 'disable' actors.";
|
||||
}
|
||||
|
||||
actorNode.RemoveNodes("DisableOnCondition");
|
||||
actorNode.RemoveNodes("GrantConditionOnDisabled");
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemoveMobileOnRails : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Notify Mobile.OnRails removal"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The OnRails parameter on Mobile has been removed.\n" +
|
||||
"Actors that want to duplicate the left-right movement of the original Tiberian Dawn gunboat\n" +
|
||||
"should replace the Mobile and AttackTurreted traits with TDGunboat and AttackTDGunboatTurreted.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var removedOnRails = actorNode.ChildrenMatching("Mobile")
|
||||
.Sum(m => m.Value.Nodes.RemoveAll(n => n.Key == "OnRails"));
|
||||
|
||||
if (removedOnRails == 0)
|
||||
yield break;
|
||||
|
||||
yield return "Mobile.OnRails is no longer supported for actor type {0}.\n".F(actorNode.Key)
|
||||
+ "If you want to duplicate the left-right movement of the original Tiberian Dawn gunboat\n"
|
||||
+ "you must manually replace Mobile with the new TDGunboat trait, and AttackTurreted with AttackTDGunboatTurreted.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemoveOutOfAmmo : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Replace 'Armament.OutOfAmmo' by pausing on condition"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'Armament.OutOfAmmo' has been replaced by pausing on condition\n" +
|
||||
"(which is usually provided by AmmoPool).";
|
||||
}
|
||||
}
|
||||
|
||||
bool messageDisplayed;
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var reloadAmmoPool = actorNode.LastChildMatching("ReloadAmmoPool");
|
||||
var armaments = actorNode.ChildrenMatching("Armament");
|
||||
var ammoPools = actorNode.ChildrenMatching("AmmoPool");
|
||||
|
||||
if (reloadAmmoPool != null || !armaments.Any() || !ammoPools.Any())
|
||||
yield break;
|
||||
|
||||
foreach (var pool in ammoPools)
|
||||
{
|
||||
var nameNode = pool.LastChildMatching("Armaments");
|
||||
var name = nameNode != null ? nameNode.NodeValue<string>() : "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.LastChildMatching("Name");
|
||||
var armaName = armaNameNode != null ? armaNameNode.NodeValue<string>() : "primary";
|
||||
if (name.Contains(armaName))
|
||||
{
|
||||
anyMatchingArmament = true;
|
||||
arma.AddNode(armNoAmmo);
|
||||
}
|
||||
}
|
||||
|
||||
if (anyMatchingArmament)
|
||||
{
|
||||
pool.AddNode(ammoNoAmmo);
|
||||
if (!messageDisplayed)
|
||||
{
|
||||
yield return "Aircraft returning to base is now triggered when all armaments are paused via condition.\n" +
|
||||
"Check if any of your actors with AmmoPools may need further changes.";
|
||||
|
||||
messageDisplayed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemovePlayerPaletteTileset : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Replace 'PlayerPaletteFromCurrentTileset'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The trait 'PlayerPaletteFromCurrentTileset' has been removed.\n" +
|
||||
"Use 'PaletteFromFile' with a Tileset filter.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var ppfct in actorNode.ChildrenMatching("PlayerPaletteFromCurrentTileset"))
|
||||
{
|
||||
ppfct.AddNode("Filename", "");
|
||||
ppfct.AddNode("Tileset", "");
|
||||
ppfct.RenameKey("PaletteFromFile");
|
||||
yield return ppfct.Location + ": The trait 'PlayerPaletteFromCurrentTileset'\n" +
|
||||
"has been replaced by 'PaletteFromFile'. The trait has been renamed for you,\n" +
|
||||
"but you will need to update the definition to specify the correct filename and tileset filters.";
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RenameBurstDelay : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "BurstDelay was renamed to BurstDelays due to support of multiple values."; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "It's now possible to set multiple delay values (one for each consecutive burst),\n" +
|
||||
"so the property was renamed to BurstDelays to account for this.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateWeaponNode(ModData modData, MiniYamlNode weaponNode)
|
||||
{
|
||||
var bd = weaponNode.LastChildMatching("BurstDelay");
|
||||
if (bd != null)
|
||||
bd.RenameKey("BurstDelays");
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RenameWithTurreted : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Rename 'WithTurretedAttackAnimation' and 'WithTurretedSpriteBody'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'WithTurretedAttackAnimation' was renamed to 'WithTurretAttackAnimation'.\n" +
|
||||
"'WithTurretedSpriteBody' was renamed to 'WithEmbeddedTurretSpriteBody'.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var wtaa in actorNode.ChildrenMatching("WithTurretedAttackAnimation"))
|
||||
wtaa.RenameKey("WithTurretAttackAnimation");
|
||||
|
||||
foreach (var wtsb in actorNode.ChildrenMatching("WithTurretedSpriteBody"))
|
||||
wtsb.RenameKey("WithEmbeddedTurretSpriteBody");
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ReplaceCanPowerDown : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Replace 'CanPowerDown' by 'ToggleConditionOnOrder'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'CanPowerDown' was replaced with a more general 'ToggleConditionOnOrder' trait.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var cpd = actorNode.LastChildMatching("CanPowerDown");
|
||||
if (cpd == null)
|
||||
yield break;
|
||||
|
||||
cpd.RenameKey("ToggleConditionOnOrder");
|
||||
var upSound = cpd.LastChildMatching("PowerupSound");
|
||||
if (upSound != null)
|
||||
upSound.RenameKey("DisabledSound");
|
||||
|
||||
var upSpeech = cpd.LastChildMatching("PowerupSpeech");
|
||||
if (upSpeech != null)
|
||||
upSpeech.RenameKey("DisabledSpeech");
|
||||
|
||||
var downSound = cpd.LastChildMatching("PowerdownSound");
|
||||
if (downSound != null)
|
||||
downSound.RenameKey("EnabledSound");
|
||||
|
||||
var downSpeech = cpd.LastChildMatching("PowerdownSpeech");
|
||||
if (downSpeech != null)
|
||||
downSpeech.RenameKey("EnabledSpeech");
|
||||
|
||||
cpd.AddNode("OrderName", "PowerDown");
|
||||
|
||||
var condition = cpd.LastChildMatching("PowerdownCondition");
|
||||
if (condition != null)
|
||||
condition.RenameKey("Condition");
|
||||
else
|
||||
cpd.AddNode("Condition", "powerdown");
|
||||
|
||||
if (cpd.ChildrenMatching("CancelWhenDisabled").Any())
|
||||
{
|
||||
cpd.RemoveNodes("CancelWhenDisabled");
|
||||
yield return "CancelWhenDisabled was removed when CanPowerDown was replaced by ToggleConditionOnOrder.\n" +
|
||||
"Use PauseOnCondition instead of RequiresCondition to replicate the behavior of 'false'.";
|
||||
}
|
||||
|
||||
actorNode.AddNode(new MiniYamlNode("PowerMultiplier@POWERDOWN", new MiniYaml("", new List<MiniYamlNode>()
|
||||
{
|
||||
new MiniYamlNode("RequiresCondition", condition.Value.Value),
|
||||
new MiniYamlNode("Modifier", "0")
|
||||
})));
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ReplaceRequiresPower : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Replace 'RequiresPower' with 'GrantConditionOnPowerState'"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'RequiresPower' has been replaced with 'GrantConditionOnPowerState' which\n" +
|
||||
"toggles a condition depending on the power state.\nPossible PowerStates are: Normal " +
|
||||
"(0 or positive), Low (negative but higher than\n50% of required power) and Critical (below Low).";
|
||||
}
|
||||
}
|
||||
|
||||
bool displayed;
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var requiresPower = actorNode.LastChildMatching("RequiresPower");
|
||||
if (requiresPower == null)
|
||||
yield break;
|
||||
|
||||
requiresPower.RenameKey("GrantConditionOnPowerState@LOWPOWER", false);
|
||||
requiresPower.AddNode("Condition", "lowpower");
|
||||
requiresPower.AddNode("ValidPowerStates", "Low, Critical");
|
||||
|
||||
if (!displayed)
|
||||
{
|
||||
displayed = true;
|
||||
yield return "'RequiresPower' was renamed to 'GrantConditionOnPowerState'.\n" +
|
||||
"You might need to review your condition setup.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ReworkCheckboxes : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Rename 'Locked' and 'Enabled' on checkboxes and dropdowns"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'Locked' and 'Enabled' were renamed to contain the respective checkboxes' name,\n" +
|
||||
"like 'FogCheckboxLocked'. For dropdowns 'Locked' was renamed to 'DropdownLocked'.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var mpUnits = actorNode.LastChildMatching("SpawnMPUnits");
|
||||
if (mpUnits != null)
|
||||
{
|
||||
var locked = mpUnits.LastChildMatching("Locked");
|
||||
if (locked != null)
|
||||
locked.RenameKey("DropdownLocked");
|
||||
}
|
||||
|
||||
var shroud = actorNode.LastChildMatching("Shroud");
|
||||
if (shroud != null)
|
||||
{
|
||||
var fogLocked = shroud.LastChildMatching("FogLocked");
|
||||
if (fogLocked != null)
|
||||
fogLocked.RenameKey("FogCheckboxLocked");
|
||||
|
||||
var fogEnabled = shroud.LastChildMatching("FogEnabled");
|
||||
if (fogEnabled != null)
|
||||
fogEnabled.RenameKey("FogCheckboxEnabled");
|
||||
|
||||
var exploredMapLocked = shroud.LastChildMatching("ExploredMapLocked");
|
||||
if (exploredMapLocked != null)
|
||||
exploredMapLocked.RenameKey("ExploredMapCheckboxLocked");
|
||||
|
||||
var exploredMapEnabled = shroud.LastChildMatching("ExploredMapEnabled");
|
||||
if (exploredMapEnabled != null)
|
||||
exploredMapEnabled.RenameKey("ExploredMapCheckboxEnabled");
|
||||
}
|
||||
|
||||
var options = actorNode.LastChildMatching("MapOptions");
|
||||
if (options != null)
|
||||
{
|
||||
var shortGameLocked = options.LastChildMatching("ShortGameLocked");
|
||||
if (shortGameLocked != null)
|
||||
shortGameLocked.RenameKey("ShortGameCheckboxLocked");
|
||||
|
||||
var shortGameEnabled = options.LastChildMatching("ShortGameEnabled");
|
||||
if (shortGameEnabled != null)
|
||||
shortGameEnabled.RenameKey("ShortGameCheckboxEnabled");
|
||||
|
||||
var techLevelLocked = options.LastChildMatching("TechLevelLocked");
|
||||
if (techLevelLocked != null)
|
||||
techLevelLocked.RenameKey("TechLevelDropdownLocked");
|
||||
|
||||
var gameSpeedLocked = options.LastChildMatching("GameSpeedLocked");
|
||||
if (gameSpeedLocked != null)
|
||||
gameSpeedLocked.RenameKey("GameSpeedDropdownLocked");
|
||||
}
|
||||
|
||||
var creeps = actorNode.LastChildMatching("MapCreeps");
|
||||
if (creeps != null)
|
||||
{
|
||||
var locked = creeps.LastChildMatching("Locked");
|
||||
if (locked != null)
|
||||
locked.RenameKey("CheckboxLocked");
|
||||
|
||||
var enabled = creeps.LastChildMatching("Enabled");
|
||||
if (enabled != null)
|
||||
enabled.RenameKey("CheckboxEnabled");
|
||||
}
|
||||
|
||||
var buildRadius = actorNode.LastChildMatching("MapBuildRadius");
|
||||
if (buildRadius != null)
|
||||
{
|
||||
var alllyLocked = buildRadius.LastChildMatching("AllyBuildRadiusLocked");
|
||||
if (alllyLocked != null)
|
||||
alllyLocked.RenameKey("AllyBuildRadiusCheckboxLocked");
|
||||
|
||||
var allyEnabled = buildRadius.LastChildMatching("AllyBuildRadiusEnabled");
|
||||
if (allyEnabled != null)
|
||||
allyEnabled.RenameKey("AllyBuildRadiusCheckboxEnabled");
|
||||
|
||||
var buildRadiusLocked = buildRadius.LastChildMatching("BuildRadiusLocked");
|
||||
if (buildRadiusLocked != null)
|
||||
buildRadiusLocked.RenameKey("BuildRadiusCheckboxLocked");
|
||||
|
||||
var buildRadiusEnabled = buildRadius.LastChildMatching("BuildRadiusEnabled");
|
||||
if (buildRadiusEnabled != null)
|
||||
buildRadiusEnabled.RenameKey("BuildRadiusCheckboxEnabled");
|
||||
}
|
||||
|
||||
var devMode = actorNode.LastChildMatching("DeveloperMode");
|
||||
if (devMode != null)
|
||||
{
|
||||
var locked = devMode.LastChildMatching("Locked");
|
||||
if (locked != null)
|
||||
locked.RenameKey("CheckboxLocked");
|
||||
|
||||
var enabled = devMode.LastChildMatching("Enabled");
|
||||
if (enabled != null)
|
||||
enabled.RenameKey("CheckboxEnabled");
|
||||
}
|
||||
|
||||
var spawner = actorNode.LastChildMatching("CrateSpawner");
|
||||
if (spawner != null)
|
||||
{
|
||||
var locked = spawner.LastChildMatching("Locked");
|
||||
if (locked != null)
|
||||
locked.RenameKey("CheckboxLocked");
|
||||
|
||||
var enabled = spawner.LastChildMatching("Enabled");
|
||||
if (enabled != null)
|
||||
enabled.RenameKey("CheckboxEnabled");
|
||||
}
|
||||
|
||||
var resources = actorNode.LastChildMatching("PlayerResources");
|
||||
if (resources != null)
|
||||
{
|
||||
var locked = resources.LastChildMatching("Locked");
|
||||
if (locked != null)
|
||||
locked.RenameKey("DefaultCashDropdownLocked");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ScaleDefaultModHealth : ScaleModHealth
|
||||
{
|
||||
static readonly Dictionary<string, int> ModScales = new Dictionary<string, int>()
|
||||
{
|
||||
{ "cnc", 100 },
|
||||
{ "ra", 100 },
|
||||
{ "d2k", 10 },
|
||||
{ "ts", 100 }
|
||||
};
|
||||
|
||||
public override IEnumerable<string> BeforeUpdate(ModData modData)
|
||||
{
|
||||
ModScales.TryGetValue(modData.Manifest.Id, out scale);
|
||||
return base.BeforeUpdate(modData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ScaleModHealth : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Scale health and damage in the default OpenRA mods"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "All health and damage values are increased by a factor of 100 (ra, cnc, ts) or 10 (d2k)\n"
|
||||
+ "in order to reduce numerical inaccuracies in damage calculations.";
|
||||
}
|
||||
}
|
||||
|
||||
static readonly Dictionary<string, Pair<string, string>[]> TraitMapping = new Dictionary<string, Pair<string, string>[]>()
|
||||
{
|
||||
{ "Health", new[] { Pair.New("HP", string.Empty) } },
|
||||
{ "SelfHealing", new[] { Pair.New("Step", "500") } },
|
||||
{ "RepairsUnits", new[] { Pair.New("HpPerStep", "1000") } },
|
||||
{ "RepairableBuilding", new[] { Pair.New("RepairStep", "700") } },
|
||||
{ "Burns", new[] { Pair.New("Damage", "100") } },
|
||||
{ "DamagedByTerrain", new[] { Pair.New("Damage", string.Empty) } },
|
||||
};
|
||||
|
||||
static readonly Dictionary<string, string> WarheadMapping = new Dictionary<string, string>()
|
||||
{
|
||||
{ "SpreadDamage", "Damage" },
|
||||
{ "TargetDamage", "Damage" },
|
||||
};
|
||||
|
||||
public ScaleModHealth(int scale = 100)
|
||||
{
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
protected int scale;
|
||||
|
||||
bool updated;
|
||||
|
||||
public override IEnumerable<string> BeforeUpdate(ModData modData)
|
||||
{
|
||||
updated = false;
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (updated)
|
||||
yield return "Health and damage values have been muliplied by a factor of {0}.\n".F(scale)
|
||||
+ "The increased calculation precision will affect game balance and may need to be manually adjusted.\n";
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var kv in TraitMapping)
|
||||
{
|
||||
foreach (var trait in actorNode.ChildrenMatching(kv.Key))
|
||||
{
|
||||
foreach (var parameter in kv.Value)
|
||||
{
|
||||
var node = trait.LastChildMatching(parameter.First);
|
||||
if (node != null)
|
||||
node.ReplaceValue((scale * node.NodeValue<int>()).ToString());
|
||||
else if (!string.IsNullOrEmpty(parameter.Second))
|
||||
trait.AddNode(parameter.First, parameter.Second);
|
||||
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateWeaponNode(ModData modData, MiniYamlNode weaponNode)
|
||||
{
|
||||
foreach (var warheadNode in weaponNode.ChildrenMatching("Warhead"))
|
||||
{
|
||||
var name = warheadNode.NodeValue<string>();
|
||||
if (name == null)
|
||||
continue;
|
||||
|
||||
string parameterName;
|
||||
if (!WarheadMapping.TryGetValue(name, out parameterName))
|
||||
continue;
|
||||
|
||||
foreach (var node in warheadNode.ChildrenMatching(parameterName))
|
||||
{
|
||||
node.ReplaceValue((scale * node.NodeValue<int>()).ToString());
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ScaleModHealthBy10 : ScaleModHealth
|
||||
{
|
||||
public override IEnumerable<string> BeforeUpdate(ModData modData)
|
||||
{
|
||||
scale = 10;
|
||||
return base.BeforeUpdate(modData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ScaleModHealthBy100 : ScaleModHealth
|
||||
{
|
||||
public override IEnumerable<string> BeforeUpdate(ModData modData)
|
||||
{
|
||||
scale = 100;
|
||||
return base.BeforeUpdate(modData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ScaleSupportPowerSecondsToTicks : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Scale support power time fields from seconds to ticks."; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Scales ChargeTime, GpsPower.RevealDelay, and ChronoshiftPower.Duration\n" +
|
||||
"from seconds to ticks (in other words, by a factor of 25).\n" +
|
||||
"Additionally, renames 'ChargeTime' to 'ChargeInterval'.";
|
||||
}
|
||||
}
|
||||
|
||||
static readonly Dictionary<string, string> ChargeTimeMapping = new Dictionary<string, string>()
|
||||
{
|
||||
{ "AirstrikePower", "ChargeTime" },
|
||||
{ "GrantExternalConditionPower", "ChargeTime" },
|
||||
{ "NukePower", "ChargeTime" },
|
||||
{ "ParatroopersPower", "ChargeTime" },
|
||||
{ "ProduceActorPower", "ChargeTime" },
|
||||
{ "SpawnActorPower", "ChargeTime" },
|
||||
{ "AttackOrderPower", "ChargeTime" },
|
||||
{ "GpsPower", "ChargeTime" },
|
||||
{ "ChronoshiftPower", "ChargeTime" },
|
||||
{ "IonCannonPower", "ChargeTime" },
|
||||
};
|
||||
|
||||
static readonly Dictionary<string, string> SingularCases = new Dictionary<string, string>()
|
||||
{
|
||||
{ "GpsPower", "RevealDelay" },
|
||||
{ "ChronoshiftPower", "Duration" },
|
||||
};
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var kv in ChargeTimeMapping)
|
||||
{
|
||||
foreach (var trait in actorNode.ChildrenMatching(kv.Key))
|
||||
{
|
||||
var node = trait.LastChildMatching(kv.Value);
|
||||
if (node != null)
|
||||
{
|
||||
node.ReplaceValue((25 * node.NodeValue<int>()).ToString());
|
||||
node.RenameKey("ChargeInterval");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var kv in SingularCases)
|
||||
{
|
||||
foreach (var trait in actorNode.ChildrenMatching(kv.Key))
|
||||
{
|
||||
var node = trait.LastChildMatching(kv.Value);
|
||||
if (node != null)
|
||||
node.ReplaceValue((25 * node.NodeValue<int>()).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class SplitGateFromBuilding : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Make gates use the 'Building' trait"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The 'Gate' trait does no longer inherit 'Building'.\n" +
|
||||
"Thus gates must define their own 'Building' trait.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var gate = actorNode.LastChildMatching("Gate");
|
||||
if (gate == null)
|
||||
yield break;
|
||||
|
||||
var openSound = gate.LastChildMatching("OpeningSound");
|
||||
var closeSound = gate.LastChildMatching("ClosingSound");
|
||||
var closeDelay = gate.LastChildMatching("CloseDelay");
|
||||
var transitDelay = gate.LastChildMatching("TransitionDelay");
|
||||
var blockHeight = gate.LastChildMatching("BlocksProjectilesHeight");
|
||||
|
||||
var newGate = new MiniYamlNode("Gate", "");
|
||||
gate.RenameKey("Building");
|
||||
|
||||
if (openSound != null)
|
||||
{
|
||||
newGate.AddNode(openSound);
|
||||
gate.RemoveNode(openSound);
|
||||
}
|
||||
|
||||
if (closeSound != null)
|
||||
{
|
||||
newGate.AddNode(closeSound);
|
||||
gate.RemoveNode(closeSound);
|
||||
}
|
||||
|
||||
if (closeDelay != null)
|
||||
{
|
||||
newGate.AddNode(closeDelay);
|
||||
gate.RemoveNode(closeDelay);
|
||||
}
|
||||
|
||||
if (transitDelay != null)
|
||||
{
|
||||
newGate.AddNode(transitDelay);
|
||||
gate.RemoveNode(transitDelay);
|
||||
}
|
||||
|
||||
if (blockHeight != null)
|
||||
{
|
||||
newGate.AddNode(blockHeight);
|
||||
gate.RemoveNode(blockHeight);
|
||||
}
|
||||
|
||||
actorNode.AddNode(newGate);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class WarnAboutInfiltrateForTypes : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Introduced Types field to InfiltrateFor* traits"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "InfiltrateFor* traits now have a Types field and infiltration will only have the desired\n" +
|
||||
"effect if the Types include the type of the infiltrator.";
|
||||
}
|
||||
}
|
||||
|
||||
readonly string[] infiltrateForTraits =
|
||||
{
|
||||
"InfiltrateForCash", "InfiltrateForDecoration",
|
||||
"InfiltrateForExploration", "InfiltrateForPowerOutage",
|
||||
"InfiltrateForSupportPower",
|
||||
};
|
||||
|
||||
readonly List<Tuple<string, string>> infiltrateForLocations = new List<Tuple<string, string>>();
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
var message1 = "You need to define Types on the InfiltrateFor* trait(s) on the following actors:\n"
|
||||
+ UpdateUtils.FormatMessageList(infiltrateForLocations.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
||||
|
||||
if (infiltrateForLocations.Any())
|
||||
yield return message1;
|
||||
|
||||
infiltrateForLocations.Clear();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var t in infiltrateForTraits)
|
||||
{
|
||||
if (actorNode.LastChildMatching(t) != null)
|
||||
{
|
||||
infiltrateForLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class AddShakeToBridge : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Screen shaking was removed from dying bridges."; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "'Bridges' (and 'GroundLevelBridges') no longer shake the screen on their own.\n" +
|
||||
"The 'ShakeOnDeath' trait is to be used instead.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
if (actorNode.ChildrenMatching("Bridge").Any())
|
||||
AddShakeNode(actorNode);
|
||||
else if (actorNode.ChildrenMatching("GroundLevelBridge").Any())
|
||||
AddShakeNode(actorNode);
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
void AddShakeNode(MiniYamlNode actorNode)
|
||||
{
|
||||
var shake = new MiniYamlNode("ShakeOnDeath", "");
|
||||
shake.AddNode("Duration", "15");
|
||||
shake.AddNode("Intensity", "6");
|
||||
actorNode.AddNode(shake);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ChangeIntensityToDuration : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Add a 'Duration' parameter to 'ShakeOnDeath'."; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The 'Intensity' parameter on 'ShakeOnDeath' has been used as duration\n" +
|
||||
"by accident. A new 'Duration' parameter was added to fix that.\n" +
|
||||
"Definitions of 'Intensity' will be automatically renamed to 'Duration'.\n" +
|
||||
"The old 'Intensity' parameter will now change the intensity as intended.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var sod in actorNode.ChildrenMatching("ShakeOnDeath"))
|
||||
sod.RenameChildrenMatching("Intensity", "Duration");
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class DefineGroundCorpseDefault : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Move Parachutable GroundCorpseSequence default to yaml"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Parachutable's GroundCorpseSequence 'corpse' default has been moved to yaml.";
|
||||
}
|
||||
}
|
||||
|
||||
Tuple<string, string, string, List<string>>[] fields =
|
||||
{
|
||||
Tuple.Create("Parachutable", "GroundCorpseSequence", "corpse", new List<string>()),
|
||||
};
|
||||
|
||||
string BuildMessage(Tuple<string, string, string, List<string>> field)
|
||||
{
|
||||
return "The default value for {0}.{1} has been removed.\n".F(field.Item1, field.Item2) +
|
||||
"You may wish to explicitly define `{0}: {1}` on the `{2}` trait \n".F(field.Item2, field.Item3, field.Item1) +
|
||||
"definitions on the following actors (if they have not already been inherited from a parent).\n" +
|
||||
UpdateUtils.FormatMessageList(field.Item4);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
foreach (var field in fields)
|
||||
{
|
||||
if (field.Item4.Any())
|
||||
yield return BuildMessage(field);
|
||||
|
||||
field.Item4.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var field in fields)
|
||||
{
|
||||
foreach (var traitNode in actorNode.ChildrenMatching(field.Item1))
|
||||
{
|
||||
var node = traitNode.LastChildMatching(field.Item2);
|
||||
if (node == null)
|
||||
field.Item4.Add("{0} ({1})".F(actorNode.Key, traitNode.Location.Filename));
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class DefineLocomotors : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Introduce global Locomotor definitions"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "A large number of properties have been moved from the actor-level Mobile trait\n" +
|
||||
"to either world-level Locomotor traits or new actor-level GrantCondition* traits.\n" +
|
||||
"Conditions for subterranean and jumpjet behaviours are migrated,\n" +
|
||||
"and affected Mobile traits are listed for inspection.";
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<Tuple<string, string>> locations = new List<Tuple<string, string>>();
|
||||
bool subterraneanUsed;
|
||||
bool jumpjetUsed;
|
||||
|
||||
readonly string[] locomotorFields =
|
||||
{
|
||||
"TerrainSpeeds", "Crushes", "CrushDamageTypes", "SharesCell", "MoveIntoShroud"
|
||||
};
|
||||
|
||||
readonly string[] subterraneanFields =
|
||||
{
|
||||
"SubterraneanTransitionCost", "SubterraneanTransitionTerrainTypes",
|
||||
"SubterraneanTransitionOnRamps", "SubterraneanTransitionDepth",
|
||||
"SubterraneanTransitionPalette", "SubterraneanTransitionSound",
|
||||
};
|
||||
|
||||
readonly string[] jumpjetFields =
|
||||
{
|
||||
"JumpjetTransitionCost", "JumpjetTransitionTerrainTypes", "JumpjetTransitionOnRamps"
|
||||
};
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
var message = "You must define a set of Locomotor traits on the World actor for the different\n"
|
||||
+ "movement classes used in your mod (e.g. Infantry, Vehicles, Tanks, Ships, etc)\n"
|
||||
+ "and replace any definitions/overrides of the following properties on each\n"
|
||||
+ "actor with a Locomotor field referencing the appropriate locomotor type.\n\n"
|
||||
+ "The standard Locomotor definition contains the following fields:\n"
|
||||
+ UpdateUtils.FormatMessageList(locomotorFields) + "\n\n";
|
||||
|
||||
if (subterraneanUsed)
|
||||
message += "Actors using the subterranean logic should reference a SubterraneanLocomotor\n"
|
||||
+ "instance that extends Locomotor with additional fields:\n"
|
||||
+ UpdateUtils.FormatMessageList(subterraneanFields) + "\n\n";
|
||||
|
||||
if (jumpjetUsed)
|
||||
message += "Actors using the jump-jet logic should reference a JumpjetLocomotor\n"
|
||||
+ "instance that extends Locomotor with additional fields:\n"
|
||||
+ UpdateUtils.FormatMessageList(jumpjetFields) + "\n\n";
|
||||
|
||||
message += "Condition definitions have been automatically migrated.\n"
|
||||
+ "The following definitions reference fields that must be manually moved to Locomotors:\n"
|
||||
+ UpdateUtils.FormatMessageList(locations.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
||||
|
||||
if (locations.Any())
|
||||
yield return message;
|
||||
|
||||
locations.Clear();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var addNodes = new List<MiniYamlNode>();
|
||||
foreach (var mobileNode in actorNode.ChildrenMatching("Mobile"))
|
||||
{
|
||||
var checkFields = locomotorFields.Append(subterraneanFields).Append(jumpjetFields);
|
||||
if (checkFields.Any(f => mobileNode.ChildrenMatching(f).Any()))
|
||||
locations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
||||
|
||||
var tunnelConditionNode = mobileNode.LastChildMatching("TunnelCondition");
|
||||
if (tunnelConditionNode != null)
|
||||
{
|
||||
var grantNode = new MiniYamlNode("GrantConditionOnTunnelLayer", "");
|
||||
tunnelConditionNode.MoveAndRenameNode(mobileNode, grantNode, "Condition");
|
||||
addNodes.Add(grantNode);
|
||||
}
|
||||
|
||||
var subterraneanNode = mobileNode.LastChildMatching("Subterranean");
|
||||
if (subterraneanNode != null)
|
||||
{
|
||||
subterraneanUsed = true;
|
||||
|
||||
mobileNode.RemoveNodes("Subterranean");
|
||||
var conditionNode = mobileNode.LastChildMatching("SubterraneanCondition");
|
||||
if (conditionNode != null)
|
||||
conditionNode.RenameKey("Condition");
|
||||
|
||||
var transitionImageNode = mobileNode.LastChildMatching("SubterraneanTransitionImage");
|
||||
var transitionSequenceNode = mobileNode.LastChildMatching("SubterraneanTransitionSequence");
|
||||
var transitionPaletteNode = mobileNode.LastChildMatching("SubterraneanTransitionPalette");
|
||||
var transitionSoundNode = mobileNode.LastChildMatching("SubterraneanTransitionSound");
|
||||
|
||||
var nodes = new[]
|
||||
{
|
||||
conditionNode,
|
||||
transitionImageNode,
|
||||
transitionSequenceNode,
|
||||
transitionPaletteNode,
|
||||
transitionSoundNode
|
||||
};
|
||||
|
||||
if (nodes.Any(n => n != null))
|
||||
{
|
||||
var grantNode = new MiniYamlNode("GrantConditionOnSubterraneanLayer", "");
|
||||
foreach (var node in nodes)
|
||||
if (node != null)
|
||||
node.MoveNode(mobileNode, grantNode);
|
||||
|
||||
addNodes.Add(grantNode);
|
||||
}
|
||||
}
|
||||
|
||||
var jumpjetNode = mobileNode.LastChildMatching("Jumpjet");
|
||||
if (jumpjetNode != null)
|
||||
{
|
||||
jumpjetUsed = true;
|
||||
|
||||
mobileNode.RemoveNodes("Jumpjet");
|
||||
var conditionNode = mobileNode.LastChildMatching("JumpjetCondition");
|
||||
if (conditionNode != null)
|
||||
{
|
||||
var grantNode = new MiniYamlNode("GrantConditionOnJumpjetLayer", "");
|
||||
conditionNode.MoveAndRenameNode(mobileNode, grantNode, "Condition");
|
||||
addNodes.Add(grantNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var node in addNodes)
|
||||
actorNode.AddNode(node);
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class DefineOwnerLostAction : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Add OwnerLostAction to player-controlled actors"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "A new OwnerLostAction trait has been introduced to control what happens to a\n" +
|
||||
"player's actors when they are defeated. A warning is displayed notifying that\nthis trait must be added to actors.";
|
||||
}
|
||||
}
|
||||
|
||||
bool reported;
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (!reported)
|
||||
yield return "All player-controlled (or player-capturable) actors should define an OwnerLostAction trait\n" +
|
||||
"specifying an action (Kill, Dispose, ChangeOwner) to apply when the actor's owner is defeated.\n" +
|
||||
"You must manually define this trait on the appropriate default actor templates.\n" +
|
||||
"Actors missing this trait will remain controllable by their owner after they have been defeated.";
|
||||
|
||||
reported = true;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class DefineSoundDefaults : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Move mod-specific sound defaults to yaml"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Mod-specific default sound values have been removed from several traits\n" +
|
||||
"(" + fields.Select(f => f.Item1 + "." + f.Item2).JoinWith(", ") + ")\n" +
|
||||
"Uses of these traits are listed for inspection so the values can be overriden in yaml.";
|
||||
}
|
||||
}
|
||||
|
||||
Tuple<string, string, string, List<string>>[] fields =
|
||||
{
|
||||
Tuple.Create("ParaDrop", "ChuteSound", "chute1.aud", new List<string>()),
|
||||
Tuple.Create("EjectOnDeath", "ChuteSound", "chute1.aud", new List<string>()),
|
||||
Tuple.Create("ProductionParadrop", "ChuteSound", "chute1.aud", new List<string>()),
|
||||
Tuple.Create("Building", "BuildSounds", "placbldg.aud, build5.aud", new List<string>()),
|
||||
Tuple.Create("Building", "UndeploySounds", "cashturn.aud", new List<string>())
|
||||
};
|
||||
|
||||
string BuildMessage(Tuple<string, string, string, List<string>> field)
|
||||
{
|
||||
return "The default value for {0}.{1} has been removed.\n".F(field.Item1, field.Item2) +
|
||||
"You may wish to explicitly define `{0}: {1}` on the `{2}` trait \n".F(field.Item2, field.Item3, field.Item1) +
|
||||
"definitions on the following actors (if they have not already been inherited from a parent).\n" +
|
||||
UpdateUtils.FormatMessageList(field.Item4);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
foreach (var field in fields)
|
||||
{
|
||||
if (field.Item4.Any())
|
||||
yield return BuildMessage(field);
|
||||
|
||||
field.Item4.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var field in fields)
|
||||
{
|
||||
foreach (var traitNode in actorNode.ChildrenMatching(field.Item1))
|
||||
{
|
||||
var node = traitNode.LastChildMatching(field.Item2);
|
||||
if (node == null)
|
||||
field.Item4.Add("{0} ({1})".F(actorNode.Key, traitNode.Location.Filename));
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class DefineSquadExcludeHarvester : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Add harvesters to ExcludeFromSquads"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "HackyAI no longer automatically excludes actors with Harvester trait from attack squads.\n" +
|
||||
"They need to be explicitly added to ExcludeFromSquads. HackyAI instances are listed for inspection.";
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<string> locations = new List<string>();
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
yield return "The automatic exclusion of harvesters from AI squads has been removed.\n" +
|
||||
"You may wish to add your harvester-type actors to `ExcludeFromSquads` under `UnitCommonNames`\n" +
|
||||
"on the following definitions:\n" +
|
||||
UpdateUtils.FormatMessageList(locations);
|
||||
|
||||
locations.Clear();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var hackyAINode in actorNode.ChildrenMatching("HackyAI"))
|
||||
locations.Add("{0} ({1})".F(hackyAINode.Key, hackyAINode.Location.Filename));
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class IgnoreAbstractActors : UpdateRule
|
||||
{
|
||||
readonly Dictionary<string, List<MiniYamlNode>> actors = new Dictionary<string, List<MiniYamlNode>>();
|
||||
|
||||
public override string Name { get { return "Abstract actors are ignored while parsing rules"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Actor ids starting with '^' are now reserved for abstract inheritance templates.\n" +
|
||||
"Definitions that may be affected are listed for inspection so that they can be renamed if necessary.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> BeforeUpdate(ModData modData)
|
||||
{
|
||||
actors.Clear();
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
if (!actorNode.Key.StartsWith("^", StringComparison.Ordinal))
|
||||
yield break;
|
||||
|
||||
var name = actorNode.Key;
|
||||
if (!actors.ContainsKey(name))
|
||||
actors[name] = new List<MiniYamlNode>();
|
||||
|
||||
actors[name].Add(actorNode);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (actors.Any())
|
||||
yield return "Actor ids starting with '^' are now reserved for abstract\n" +
|
||||
"inheritance templates, and will not be parsed by the game.\n" +
|
||||
"Check the following definitions and rename them if they are not used for inheritance:\n" +
|
||||
UpdateUtils.FormatMessageList(actors.Select(n => n.Key + " (" + n.Value.Select(v => v.Location.Filename).JoinWith(", ") + ")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class MoveHackyAISupportPowerDecisions : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Move HackyAI SupportPowerDecisions to a trait property"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The SupportPowerDefinitions on HackyAI are moved from top-level trait properties\n" +
|
||||
"to children of a single SupportPowerDecisions property.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var hackyAINode in actorNode.ChildrenMatching("HackyAI"))
|
||||
{
|
||||
var children = hackyAINode.ChildrenMatching("SupportPowerDecision");
|
||||
if (!children.Any())
|
||||
continue;
|
||||
|
||||
var parent = hackyAINode.LastChildMatching("SupportPowerDecisions");
|
||||
if (parent == null)
|
||||
{
|
||||
parent = new MiniYamlNode("SupportPowerDecisions", "");
|
||||
hackyAINode.AddNode(parent);
|
||||
}
|
||||
|
||||
foreach (var child in children.ToList())
|
||||
{
|
||||
var split = child.Key.Split('@');
|
||||
child.MoveAndRenameNode(hackyAINode, parent, split.Length > 1 ? split[1] : "Default", false);
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemoveCanUndeployFromGrantConditionOnDeploy : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Remove CanUndeploy from GrantConditionOnDeploy."; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The CanUndeploy property was removed from the GrantConditionOnDeploy trait.\n" +
|
||||
"Pausing the trait itself achieves the same effect now.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var gcod in actorNode.ChildrenMatching("GrantConditionOnDeploy"))
|
||||
{
|
||||
var canUndeploy = gcod.LastChildMatching("CanUndeploy");
|
||||
if (canUndeploy == null)
|
||||
continue;
|
||||
|
||||
gcod.RemoveNode(canUndeploy);
|
||||
|
||||
if (canUndeploy.NodeValue<bool>())
|
||||
continue;
|
||||
|
||||
var deployedCondition = gcod.LastChildMatching("DeployedCondition");
|
||||
gcod.AddNode("PauseOnCondition", deployedCondition.Value.Value);
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemovePaletteFromCurrentTileset : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Remove PaletteFromCurrentTileset trait"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The PaletteFromCurrentTileset trait and Palette field on TileSets have been removed.\n" +
|
||||
"Terrain palettes are now explicitly defined on the world actor.\n" +
|
||||
"Palette definitions are generated based on the Tileset metadata.";
|
||||
}
|
||||
}
|
||||
|
||||
readonly Dictionary<string, string> tilesetPalettes = new Dictionary<string, string>();
|
||||
readonly List<Tuple<string, int[]>> paletteTraits = new List<Tuple<string, int[]>>();
|
||||
|
||||
string BuildYaml(string palette, int[] shadow, string tileset, string filename)
|
||||
{
|
||||
return "PaletteFromFile@{0}:\n Name: {1}\n Tileset: {2}\n Filename: {3}\n ShadowIndex: {4}".F(
|
||||
palette + '-' + tileset.ToLower(), palette, tileset, filename, FieldSaver.FormatValue(shadow));
|
||||
}
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (tilesetPalettes.Any() && paletteTraits.Any())
|
||||
yield return "You must add the following to your palette definitions:\n"
|
||||
+ paletteTraits.Select(p => tilesetPalettes.Select(kv =>
|
||||
BuildYaml(p.Item1, p.Item2, kv.Key, kv.Value)).JoinWith("\n")).JoinWith("\n");
|
||||
|
||||
paletteTraits.Clear();
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateTilesetNode(ModData modData, MiniYamlNode tilesetNode)
|
||||
{
|
||||
if (tilesetNode.Key == "General")
|
||||
{
|
||||
var idNode = tilesetNode.LastChildMatching("Id");
|
||||
if (idNode == null)
|
||||
yield break;
|
||||
|
||||
var paletteNode = tilesetNode.LastChildMatching("Palette");
|
||||
if (paletteNode != null)
|
||||
tilesetPalettes[idNode.Value.Value] = paletteNode.Value.Value;
|
||||
|
||||
tilesetNode.RemoveNodes("Palette");
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var paletteNode in actorNode.ChildrenMatching("PaletteFromCurrentTileset"))
|
||||
{
|
||||
var name = "terrain";
|
||||
var shadow = new int[] { };
|
||||
|
||||
var shadowNode = paletteNode.LastChildMatching("ShadowIndex");
|
||||
if (shadowNode != null)
|
||||
shadow = shadowNode.NodeValue<int[]>();
|
||||
|
||||
var nameNode = paletteNode.LastChildMatching("Name");
|
||||
if (nameNode != null)
|
||||
name = nameNode.Value.Value;
|
||||
|
||||
paletteTraits.Add(Tuple.Create(name, shadow));
|
||||
}
|
||||
|
||||
actorNode.RemoveNodes("PaletteFromCurrentTileset");
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemoveTerrainTypeIsWaterFlag : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Remove TerrainType IsWater flag"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The IsWater flag on terrain type definitions has been unused for some time.\n" +
|
||||
"This flag has now been removed from the tileset yaml.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateTilesetNode(ModData modData, MiniYamlNode tilesetNode)
|
||||
{
|
||||
if (tilesetNode.Key == "Terrain")
|
||||
foreach (var type in tilesetNode.Value.Nodes)
|
||||
type.Value.Nodes.RemoveAll(n => n.Key == "IsWater");
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemoveWeaponScanRadius : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Remove Weapon ScanRadius parameters"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The *ScanRadius parameters have been removed from weapon projectiles and warheads.\n" +
|
||||
"These values are now automatically determined by the engine.\n" +
|
||||
"CreateEffect.ImpactActors: False has been added to replace VictimScanRadius: 0";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateWeaponNode(ModData modData, MiniYamlNode weaponNode)
|
||||
{
|
||||
foreach (var node in weaponNode.ChildrenMatching("Warhead"))
|
||||
{
|
||||
if (node.Value.Value == "CreateEffect")
|
||||
{
|
||||
var victimScanRadius = node.LastChildMatching("VictimScanRadius");
|
||||
if (victimScanRadius != null && victimScanRadius.NodeValue<int>() == 0)
|
||||
node.AddNode("ImpactActors", "false");
|
||||
node.RemoveNodes("VictimScanRadius");
|
||||
}
|
||||
}
|
||||
|
||||
var projectile = weaponNode.LastChildMatching("Projectile");
|
||||
if (projectile != null)
|
||||
{
|
||||
projectile.RemoveNodes("BounceBlockerScanRadius");
|
||||
projectile.RemoveNodes("BlockerScanRadius");
|
||||
projectile.RemoveNodes("AreaVictimScanRadius");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemoveWithReloadingSpriteTurret : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Remove WithReloadingSpriteTurret trait"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "WithReloadingSpriteTurret has been superseded by conditions.\n" +
|
||||
"Instances of this trait are replaced by WithSpriteTurret.";
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<string> locations = new List<string>();
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
yield return "WithReloadingSpriteTurret has been replaced by WithSpriteTurret\n" +
|
||||
"You should use AmmoPool.AmmoConditions to switch turret type when reloading\n" +
|
||||
"to restore the previous behaviour on the following actors:\n" +
|
||||
UpdateUtils.FormatMessageList(locations);
|
||||
|
||||
locations.Clear();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var turret in actorNode.ChildrenMatching("WithReloadingSpriteTurret"))
|
||||
{
|
||||
turret.RenameKey("WithSpriteTurret");
|
||||
locations.Add("{0} ({1})".F(actorNode.Key, turret.Location.Filename));
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RenameEmitInfantryOnSell : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "EmitInfantryOnSell renamed to SpawnActorsOnSell"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The EmitInfantryOnSell trait was renamed to SpawnActorsOnSell and the default\n" +
|
||||
"actor type to spawn was removed. Uses of the old traits and defaults are updated\n" +
|
||||
"to account for this.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var eios in actorNode.ChildrenMatching("EmitInfantryOnSell"))
|
||||
{
|
||||
eios.RenameKey("SpawnActorsOnSell");
|
||||
var actortypes = eios.LastChildMatching("ActorTypes");
|
||||
if (actortypes == null)
|
||||
eios.AddNode("ActorTypes", "e1");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RenameWormSpawner : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "WormSpawner renamed and generalized to ActorSpawner"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "The D2k-specific WormSpawner trait was renamed to ActorSpawner, generalized,\n" +
|
||||
"and moved into the common mod code. Uses of the old traits are updated to account for this.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var spawner in actorNode.ChildrenMatching("WormSpawner"))
|
||||
spawner.RenameKey("ActorSpawner");
|
||||
|
||||
foreach (var manager in actorNode.ChildrenMatching("WormManager"))
|
||||
{
|
||||
manager.RenameKey("ActorSpawnManager");
|
||||
var signature = manager.LastChildMatching("WormSignature");
|
||||
if (signature != null)
|
||||
signature.RenameKey("Actors");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class SplitAimAnimations : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Introduce WithAimAnimation and WithTurretAimAnimation traits"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "WithAttackAnimation.AimSequence, WithTurretAttackAnimation.AimSequence\n" +
|
||||
"as well as WithSpriteTurret.AimSequence have been split to new With*AimAnimation traits.\n" +
|
||||
"Furthermore, ReloadPrefixes have been removed in favor of condition-based solutions.";
|
||||
}
|
||||
}
|
||||
|
||||
readonly List<Tuple<string, string>> aimAnimLocations = new List<Tuple<string, string>>();
|
||||
readonly List<Tuple<string, string>> reloadPrefixLocations = new List<Tuple<string, string>>();
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
var message1 = "AimSequences have been split to With*AimAnimation.\n"
|
||||
+ "The following actors have been updated and might need manual adjustments:\n"
|
||||
+ UpdateUtils.FormatMessageList(aimAnimLocations.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
||||
|
||||
if (aimAnimLocations.Any())
|
||||
yield return message1;
|
||||
|
||||
aimAnimLocations.Clear();
|
||||
|
||||
var message2 = "ReloadPrefixes have been removed.\n"
|
||||
+ "Instead, grant a condition on reloading via Armament.ReloadingCondition to enable\n"
|
||||
+ "an alternate sprite body (with reloading sequences) on the following actors:\n"
|
||||
+ UpdateUtils.FormatMessageList(reloadPrefixLocations.Select(n => n.Item1 + " (" + n.Item2 + ")"));
|
||||
|
||||
if (reloadPrefixLocations.Any())
|
||||
yield return message2;
|
||||
|
||||
reloadPrefixLocations.Clear();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var turretAttack = actorNode.LastChildMatching("WithTurretAttackAnimation");
|
||||
if (turretAttack != null)
|
||||
{
|
||||
var attackSequence = turretAttack.LastChildMatching("AttackSequence");
|
||||
var aimSequence = turretAttack.LastChildMatching("AimSequence");
|
||||
var reloadPrefix = turretAttack.LastChildMatching("ReloadPrefix");
|
||||
|
||||
if (aimSequence != null)
|
||||
aimAnimLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
||||
|
||||
if (reloadPrefix != null)
|
||||
reloadPrefixLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
||||
|
||||
// If only AttackSequence is not null, just rename AttackSequence to Sequence.
|
||||
// If only the prefix isn't null (extremely unlikely, but you never know), just rename the trait.
|
||||
// If AttackSequence is null but AimSequence isn't, rename the trait and property.
|
||||
// If both aren't null, split/copy everything relevant to the new WithTurretAimAnimation.
|
||||
// If both are null (extremely unlikely), do nothing.
|
||||
if (attackSequence != null && aimSequence == null)
|
||||
attackSequence.RenameKey("Sequence");
|
||||
else if (attackSequence == null && aimSequence == null && reloadPrefix != null)
|
||||
{
|
||||
turretAttack.RemoveNode(reloadPrefix);
|
||||
turretAttack.RenameKey("WithTurretAimAnimation");
|
||||
}
|
||||
else if (attackSequence == null && aimSequence != null)
|
||||
{
|
||||
turretAttack.RenameKey("WithTurretAimAnimation");
|
||||
aimSequence.RenameKey("Sequence");
|
||||
if (reloadPrefix != null)
|
||||
turretAttack.RemoveNode(reloadPrefix);
|
||||
}
|
||||
else if (attackSequence != null && aimSequence != null)
|
||||
{
|
||||
var turretAim = new MiniYamlNode("WithTurretAimAnimation", "");
|
||||
aimSequence.MoveAndRenameNode(turretAttack, turretAim, "Sequence");
|
||||
|
||||
var turret = turretAttack.LastChildMatching("Turret");
|
||||
var armament = turretAttack.LastChildMatching("Armament");
|
||||
if (reloadPrefix != null)
|
||||
turretAttack.RemoveNode(reloadPrefix);
|
||||
|
||||
if (turret != null)
|
||||
turretAim.AddNode(turret);
|
||||
if (armament != null)
|
||||
turretAim.AddNode(armament);
|
||||
|
||||
attackSequence.RenameKey("Sequence");
|
||||
actorNode.AddNode(turretAim);
|
||||
}
|
||||
}
|
||||
|
||||
var spriteTurret = actorNode.LastChildMatching("WithSpriteTurret");
|
||||
if (spriteTurret != null)
|
||||
{
|
||||
var aimSequence = spriteTurret.LastChildMatching("AimSequence");
|
||||
if (aimSequence != null)
|
||||
{
|
||||
aimAnimLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
||||
|
||||
var aimAnim = new MiniYamlNode("WithTurretAimAnimation", "");
|
||||
aimSequence.MoveAndRenameNode(spriteTurret, aimAnim, "Sequence");
|
||||
actorNode.AddNode(aimAnim);
|
||||
}
|
||||
}
|
||||
|
||||
var attackAnim = actorNode.LastChildMatching("WithAttackAnimation");
|
||||
if (attackAnim != null)
|
||||
{
|
||||
var attackSequence = attackAnim.LastChildMatching("AttackSequence");
|
||||
var aimSequence = attackAnim.LastChildMatching("AimSequence");
|
||||
var reloadPrefix = attackAnim.LastChildMatching("ReloadPrefix");
|
||||
|
||||
if (aimSequence != null)
|
||||
aimAnimLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
||||
|
||||
if (reloadPrefix != null)
|
||||
reloadPrefixLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
|
||||
|
||||
// If only AttackSequence is not null, just rename AttackSequence to Sequence.
|
||||
// If only the prefix isn't null (extremely unlikely, but you never know), just rename the trait.
|
||||
// If AttackSequence is null but AimSequence isn't, rename the trait and property.
|
||||
// If both sequences aren't null, split/copy everything relevant to the new WithAimAnimation.
|
||||
// If both sequences and the prefix are null (extremely unlikely), do nothing.
|
||||
if (attackSequence != null && aimSequence == null && reloadPrefix == null)
|
||||
attackSequence.RenameKey("Sequence");
|
||||
else if (attackSequence == null && aimSequence == null && reloadPrefix != null)
|
||||
{
|
||||
attackAnim.RemoveNode(reloadPrefix);
|
||||
attackAnim.RenameKey("WithAimAnimation");
|
||||
}
|
||||
else if (attackSequence == null && aimSequence != null)
|
||||
{
|
||||
attackAnim.RenameKey("WithAimAnimation");
|
||||
aimSequence.RenameKey("Sequence");
|
||||
if (reloadPrefix != null)
|
||||
attackAnim.RemoveNode(reloadPrefix);
|
||||
}
|
||||
else if (attackSequence != null && aimSequence != null)
|
||||
{
|
||||
var aimAnim = new MiniYamlNode("WithAimAnimation", "");
|
||||
aimSequence.MoveAndRenameNode(attackAnim, aimAnim, "Sequence");
|
||||
|
||||
var body = attackAnim.LastChildMatching("Body");
|
||||
var armament = attackAnim.LastChildMatching("Armament");
|
||||
if (reloadPrefix != null)
|
||||
attackAnim.RemoveNode(reloadPrefix);
|
||||
|
||||
if (body != null)
|
||||
aimAnim.AddNode(body);
|
||||
if (armament != null)
|
||||
aimAnim.AddNode(armament);
|
||||
|
||||
attackSequence.RenameKey("Sequence");
|
||||
actorNode.AddNode(aimAnim);
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class SplitRepairDecoration : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "WithBuildingRepairDecoration trait split from RepairableBuilding"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Rendering for the building repair indicator has been moved to a new\n" +
|
||||
"WithBuildingRepairDecoration trait. The indicator definitions are automatically\n" +
|
||||
"migrated from RepairableBuilding to WithBuildingRepairDecoration.";
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
// RepairableBuilding is hardcoded to only support one instance per actor
|
||||
var rb = actorNode.LastChildMatching("RepairableBuilding");
|
||||
if (rb != null)
|
||||
{
|
||||
var imageNode = rb.LastChildMatching("IndicatorImage");
|
||||
var sequenceNode = rb.LastChildMatching("IndicatorSequence");
|
||||
var paletteNode = rb.LastChildMatching("IndicatorPalette");
|
||||
var palettePrefixNode = rb.LastChildMatching("IndicatorPalettePrefix");
|
||||
|
||||
var decoration = new MiniYamlNode("WithBuildingRepairDecoration", "");
|
||||
decoration.AddNode("Image", imageNode != null ? imageNode.Value.Value : "allyrepair");
|
||||
decoration.AddNode("Sequence", sequenceNode != null ? sequenceNode.Value.Value : "repair");
|
||||
decoration.AddNode("ReferencePoint", "Center");
|
||||
|
||||
if (paletteNode != null)
|
||||
{
|
||||
decoration.AddNode("Palette", paletteNode.Value.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
decoration.AddNode("Palette", palettePrefixNode != null ? palettePrefixNode.Value.Value : "player");
|
||||
decoration.AddNode("IsPlayerPalette", true);
|
||||
}
|
||||
|
||||
actorNode.AddNode(decoration);
|
||||
|
||||
rb.RemoveNode(imageNode);
|
||||
rb.RemoveNode(sequenceNode);
|
||||
rb.RemoveNode(paletteNode);
|
||||
rb.RemoveNode(palettePrefixNode);
|
||||
}
|
||||
|
||||
if (actorNode.LastChildMatching("-RepairableBuilding") != null)
|
||||
actorNode.AddNode("-WithBuildingRepairDecoration", "");
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,58 +34,6 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
Justification = "Extracting update lists to temporary variables obfuscates the definitions.")]
|
||||
static readonly UpdatePath[] Paths =
|
||||
{
|
||||
new UpdatePath("release-20171014", "release-20180218", new UpdateRule[]
|
||||
{
|
||||
new LegacyBetaWarning(),
|
||||
new RemoveMobileOnRails(),
|
||||
new AircraftCanHoverGeneralization(),
|
||||
new AddNukeLaunchAnimation(),
|
||||
new RenameWithTurreted(),
|
||||
new RemovePlayerPaletteTileset(),
|
||||
new CapturableChanges(),
|
||||
new DecoupleSelfReloading(),
|
||||
new RemoveOutOfAmmo(),
|
||||
new ChangeCanPowerDown(),
|
||||
new ReplaceRequiresPower(),
|
||||
new DropPauseAnimationWhenDisabled(),
|
||||
new ChangeBuildableArea(),
|
||||
new MoveVisualBounds(),
|
||||
new ScaleDefaultModHealth(),
|
||||
new ReworkCheckboxes(),
|
||||
new SplitGateFromBuilding(),
|
||||
new RemoveIDisable(),
|
||||
new ReplaceCanPowerDown(),
|
||||
new ScaleSupportPowerSecondsToTicks(),
|
||||
new WarnAboutInfiltrateForTypes(),
|
||||
new RenameBurstDelay(),
|
||||
}),
|
||||
|
||||
new UpdatePath("release-20180218", "release-20180307", new UpdateRule[0]),
|
||||
|
||||
new UpdatePath("release-20180307", "release-20180923", new UpdateRule[]
|
||||
{
|
||||
new RemoveTerrainTypeIsWaterFlag(),
|
||||
new DefineSquadExcludeHarvester(),
|
||||
new RemoveWeaponScanRadius(),
|
||||
new SplitAimAnimations(),
|
||||
new DefineSoundDefaults(),
|
||||
new RenameWormSpawner(),
|
||||
new RemoveWithReloadingSpriteTurret(),
|
||||
new ChangeIntensityToDuration(),
|
||||
new IgnoreAbstractActors(),
|
||||
new AddShakeToBridge(),
|
||||
new RemovePaletteFromCurrentTileset(),
|
||||
new DefineLocomotors(),
|
||||
new DefineOwnerLostAction(),
|
||||
new RenameEmitInfantryOnSell(),
|
||||
new SplitRepairDecoration(),
|
||||
new MoveHackyAISupportPowerDecisions(),
|
||||
new DefineGroundCorpseDefault(),
|
||||
new RemoveCanUndeployFromGrantConditionOnDeploy(),
|
||||
}),
|
||||
|
||||
new UpdatePath("release-20180923", "release-20181215", new UpdateRule[0]),
|
||||
|
||||
new UpdatePath("release-20181215", "release-20190314", new UpdateRule[]
|
||||
{
|
||||
new AddCarryableHarvester(),
|
||||
|
||||
Reference in New Issue
Block a user