Move 20171014-20180218 update rules to subfolder
Also synced order of appearance with order they're applied in when running the full update path.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
using OpenRA.Mods.Common.UpdateRules;
|
||||
|
||||
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.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
111
OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealth.cs
Normal file
111
OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealth.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2018 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user