From aeb623498fde10c086a2d43654c064ef30271e06 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Fri, 24 Jan 2020 13:21:15 +0100 Subject: [PATCH] Remove old update rules --- .../Rules/20171014/AddNukeLaunchAnimation.cs | 48 ----- .../AircraftCanHoverGeneralization.cs | 48 ----- .../Rules/20171014/CapturableChanges.cs | 86 --------- .../Rules/20171014/ChangeBuildableArea.cs | 51 ----- .../Rules/20171014/ChangeCanPowerDown.cs | 67 ------- .../Rules/20171014/DecoupleSelfReloading.cs | 85 --------- .../DropPauseAnimationWhenDisabled.cs | 41 ---- .../Rules/20171014/LegacyBetaWarning.cs | 43 ----- .../Rules/20171014/MoveVisualBounds.cs | 72 ------- .../Rules/20171014/RemoveIDisable.cs | 47 ----- .../Rules/20171014/RemoveMobileOnRails.cs | 43 ----- .../Rules/20171014/RemoveOutOfAmmo.cs | 75 -------- .../20171014/RemovePlayerPaletteTileset.cs | 43 ----- .../Rules/20171014/RenameBurstDelay.cs | 37 ---- .../Rules/20171014/RenameWithTurreted.cs | 39 ---- .../Rules/20171014/ReplaceCanPowerDown.cs | 74 -------- .../Rules/20171014/ReplaceRequiresPower.cs | 49 ----- .../Rules/20171014/ReworkCheckboxes.cs | 145 -------------- .../Rules/20171014/ScaleDefaultModHealth.cs | 32 ---- .../Rules/20171014/ScaleModHealth.cs | 111 ----------- .../Rules/20171014/ScaleModHealthBy10.cs | 24 --- .../Rules/20171014/ScaleModHealthBy100.cs | 24 --- .../ScaleSupportPowerSecondsToTicks.cs | 77 -------- .../Rules/20171014/SplitGateFromBuilding.cs | 77 -------- .../20171014/WarnAboutInfiltrateForTypes.cs | 64 ------- .../Rules/20180307/AddShakeToBridge.cs | 47 ----- .../20180307/ChangeIntensityToDuration.cs | 38 ---- .../20180307/DefineGroundCorpseDefault.cs | 68 ------- .../Rules/20180307/DefineLocomotors.cs | 156 --------------- .../Rules/20180307/DefineOwnerLostAction.cs | 45 ----- .../Rules/20180307/DefineSoundDefaults.cs | 74 -------- .../20180307/DefineSquadExcludeHarvester.cs | 50 ----- .../Rules/20180307/IgnoreAbstractActors.cs | 59 ------ .../MoveHackyAISupportPowerDecisions.cs | 54 ------ ...veCanUndeployFromGrantConditionOnDeploy.cs | 48 ----- .../RemovePaletteFromCurrentTileset.cs | 89 --------- .../20180307/RemoveTerrainTypeIsWaterFlag.cs | 37 ---- .../Rules/20180307/RemoveWeaponScanRadius.cs | 53 ------ .../RemoveWithReloadingSpriteTurret.cs | 53 ------ .../20180307/RenameEmitInfantryOnSell.cs | 42 ---- .../Rules/20180307/RenameWormSpawner.cs | 44 ----- .../Rules/20180307/SplitAimAnimations.cs | 179 ------------------ .../Rules/20180307/SplitRepairDecoration.cs | 69 ------- OpenRA.Mods.Common/UpdateRules/UpdatePath.cs | 52 ----- 44 files changed, 2759 deletions(-) delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/AddNukeLaunchAnimation.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/AircraftCanHoverGeneralization.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/CapturableChanges.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ChangeBuildableArea.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ChangeCanPowerDown.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/DecoupleSelfReloading.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/DropPauseAnimationWhenDisabled.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/LegacyBetaWarning.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/MoveVisualBounds.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveIDisable.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveMobileOnRails.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveOutOfAmmo.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemovePlayerPaletteTileset.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/RenameBurstDelay.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/RenameWithTurreted.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReplaceCanPowerDown.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReplaceRequiresPower.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReworkCheckboxes.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleDefaultModHealth.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealth.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealthBy10.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealthBy100.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleSupportPowerSecondsToTicks.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/SplitGateFromBuilding.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20171014/WarnAboutInfiltrateForTypes.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/AddShakeToBridge.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/ChangeIntensityToDuration.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineGroundCorpseDefault.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineLocomotors.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineOwnerLostAction.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineSoundDefaults.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineSquadExcludeHarvester.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/IgnoreAbstractActors.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/MoveHackyAISupportPowerDecisions.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveCanUndeployFromGrantConditionOnDeploy.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemovePaletteFromCurrentTileset.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveTerrainTypeIsWaterFlag.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveWeaponScanRadius.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveWithReloadingSpriteTurret.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/RenameEmitInfantryOnSell.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/RenameWormSpawner.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/SplitAimAnimations.cs delete mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20180307/SplitRepairDecoration.cs diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/AddNukeLaunchAnimation.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/AddNukeLaunchAnimation.cs deleted file mode 100644 index ebd82cb515..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/AddNukeLaunchAnimation.cs +++ /dev/null @@ -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 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(); - nuke.RemoveNode(activation); - actorNode.AddNode("WithNukeLaunchAnimation", ""); - if (sequence != "active") - actorNode.LastChildMatching("WithNukeLaunchAnimation").AddNode("Sequence", sequence); - } - - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/AircraftCanHoverGeneralization.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/AircraftCanHoverGeneralization.cs deleted file mode 100644 index 35b3d830d6..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/AircraftCanHoverGeneralization.cs +++ /dev/null @@ -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 UpdateActorNode(ModData modData, MiniYamlNode actorNode) - { - foreach (var aircraft in actorNode.ChildrenMatching("Aircraft")) - { - var canHover = aircraft.LastChildMatching("CanHover"); - if (canHover != null && canHover.NodeValue()) - { - if (!aircraft.ChildrenMatching("TakeOffOnResupply").Any()) - aircraft.AddNode("TakeOffOnResupply", true); - - if (!aircraft.ChildrenMatching("VTOL").Any()) - aircraft.AddNode("VTOL", true); - } - } - - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/CapturableChanges.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/CapturableChanges.cs deleted file mode 100644 index ae8a3dd8d7..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/CapturableChanges.cs +++ /dev/null @@ -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()) - stance |= Stance.Ally; - else - stance &= ~Stance.Ally; - - node.RemoveNode(allowAllies); - } - - var allowNeutral = node.LastChildMatching("AllowNeutral"); - if (allowNeutral != null) - { - if (allowNeutral.NodeValue()) - stance |= Stance.Neutral; - else - stance &= ~Stance.Neutral; - - node.RemoveNode(allowNeutral); - } - - var allowEnemies = node.LastChildMatching("AllowEnemies"); - if (allowEnemies != null) - { - if (allowEnemies.NodeValue()) - stance |= Stance.Enemy; - else - stance &= ~Stance.Enemy; - - node.RemoveNode(allowEnemies); - } - - if (stance != (Stance.Neutral | Stance.Enemy)) - node.AddNode("ValidStances", stance); - } - - public override IEnumerable 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ChangeBuildableArea.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ChangeBuildableArea.cs deleted file mode 100644 index 1ab75cc8c7..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ChangeBuildableArea.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ChangeCanPowerDown.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ChangeCanPowerDown.cs deleted file mode 100644 index 8104bd78e1..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ChangeCanPowerDown.cs +++ /dev/null @@ -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 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() : "poweroff"; - var seqValue = seq != null ? seq.NodeValue() : "offline"; - var palValue = pal != null ? pal.NodeValue() : "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."; - } - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/DecoupleSelfReloading.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/DecoupleSelfReloading.cs deleted file mode 100644 index 1d000890c7..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/DecoupleSelfReloading.cs +++ /dev/null @@ -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 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()) - continue; - - poolNumber++; - var reloadOnCond = new MiniYamlNode("ReloadAmmoPool@" + poolNumber, ""); - - var name = pool.LastChildMatching("Name"); - if (name != null) - reloadOnCond.AddNode("AmmoPool", name.NodeValue()); - - 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/DropPauseAnimationWhenDisabled.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/DropPauseAnimationWhenDisabled.cs deleted file mode 100644 index 0a92fcf3ab..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/DropPauseAnimationWhenDisabled.cs +++ /dev/null @@ -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 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."; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/LegacyBetaWarning.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/LegacyBetaWarning.cs deleted file mode 100644 index cedc33752a..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/LegacyBetaWarning.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/MoveVisualBounds.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/MoveVisualBounds.cs deleted file mode 100644 index 50faeb493d..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/MoveVisualBounds.cs +++ /dev/null @@ -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 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()); - - 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveIDisable.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveIDisable.cs deleted file mode 100644 index 88f0b1d78e..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveIDisable.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveMobileOnRails.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveMobileOnRails.cs deleted file mode 100644 index e5c9a8c8dd..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveMobileOnRails.cs +++ /dev/null @@ -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 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."; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveOutOfAmmo.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveOutOfAmmo.cs deleted file mode 100644 index e45eb3ae21..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemoveOutOfAmmo.cs +++ /dev/null @@ -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 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() : "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() : "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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemovePlayerPaletteTileset.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemovePlayerPaletteTileset.cs deleted file mode 100644 index 95cf3b6cca..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RemovePlayerPaletteTileset.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RenameBurstDelay.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RenameBurstDelay.cs deleted file mode 100644 index 770b144004..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RenameBurstDelay.cs +++ /dev/null @@ -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 UpdateWeaponNode(ModData modData, MiniYamlNode weaponNode) - { - var bd = weaponNode.LastChildMatching("BurstDelay"); - if (bd != null) - bd.RenameKey("BurstDelays"); - - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RenameWithTurreted.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RenameWithTurreted.cs deleted file mode 100644 index acde459f2f..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/RenameWithTurreted.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReplaceCanPowerDown.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReplaceCanPowerDown.cs deleted file mode 100644 index 7ac6897019..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReplaceCanPowerDown.cs +++ /dev/null @@ -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 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() - { - new MiniYamlNode("RequiresCondition", condition.Value.Value), - new MiniYamlNode("Modifier", "0") - }))); - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReplaceRequiresPower.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReplaceRequiresPower.cs deleted file mode 100644 index b319363dc4..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReplaceRequiresPower.cs +++ /dev/null @@ -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 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."; - } - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReworkCheckboxes.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReworkCheckboxes.cs deleted file mode 100644 index 9e326c7aa9..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ReworkCheckboxes.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleDefaultModHealth.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleDefaultModHealth.cs deleted file mode 100644 index a775d3f23e..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleDefaultModHealth.cs +++ /dev/null @@ -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 ModScales = new Dictionary() - { - { "cnc", 100 }, - { "ra", 100 }, - { "d2k", 10 }, - { "ts", 100 } - }; - - public override IEnumerable BeforeUpdate(ModData modData) - { - ModScales.TryGetValue(modData.Manifest.Id, out scale); - return base.BeforeUpdate(modData); - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealth.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealth.cs deleted file mode 100644 index 31611ef8db..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealth.cs +++ /dev/null @@ -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[]> TraitMapping = new Dictionary[]>() - { - { "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 WarheadMapping = new Dictionary() - { - { "SpreadDamage", "Damage" }, - { "TargetDamage", "Damage" }, - }; - - public ScaleModHealth(int scale = 100) - { - this.scale = scale; - } - - protected int scale; - - bool updated; - - public override IEnumerable BeforeUpdate(ModData modData) - { - updated = false; - yield break; - } - - public override IEnumerable 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 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()).ToString()); - else if (!string.IsNullOrEmpty(parameter.Second)) - trait.AddNode(parameter.First, parameter.Second); - - updated = true; - } - } - } - - yield break; - } - - public override IEnumerable UpdateWeaponNode(ModData modData, MiniYamlNode weaponNode) - { - foreach (var warheadNode in weaponNode.ChildrenMatching("Warhead")) - { - var name = warheadNode.NodeValue(); - 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()).ToString()); - updated = true; - } - } - - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealthBy10.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealthBy10.cs deleted file mode 100644 index 6586984d32..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealthBy10.cs +++ /dev/null @@ -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 BeforeUpdate(ModData modData) - { - scale = 10; - return base.BeforeUpdate(modData); - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealthBy100.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealthBy100.cs deleted file mode 100644 index 3436a67c2a..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleModHealthBy100.cs +++ /dev/null @@ -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 BeforeUpdate(ModData modData) - { - scale = 100; - return base.BeforeUpdate(modData); - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleSupportPowerSecondsToTicks.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleSupportPowerSecondsToTicks.cs deleted file mode 100644 index c143b24aa8..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/ScaleSupportPowerSecondsToTicks.cs +++ /dev/null @@ -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 ChargeTimeMapping = new Dictionary() - { - { "AirstrikePower", "ChargeTime" }, - { "GrantExternalConditionPower", "ChargeTime" }, - { "NukePower", "ChargeTime" }, - { "ParatroopersPower", "ChargeTime" }, - { "ProduceActorPower", "ChargeTime" }, - { "SpawnActorPower", "ChargeTime" }, - { "AttackOrderPower", "ChargeTime" }, - { "GpsPower", "ChargeTime" }, - { "ChronoshiftPower", "ChargeTime" }, - { "IonCannonPower", "ChargeTime" }, - }; - - static readonly Dictionary SingularCases = new Dictionary() - { - { "GpsPower", "RevealDelay" }, - { "ChronoshiftPower", "Duration" }, - }; - - public override IEnumerable 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()).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()).ToString()); - } - } - - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/SplitGateFromBuilding.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/SplitGateFromBuilding.cs deleted file mode 100644 index bc519be846..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/SplitGateFromBuilding.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/WarnAboutInfiltrateForTypes.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20171014/WarnAboutInfiltrateForTypes.cs deleted file mode 100644 index c3f2d7e881..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20171014/WarnAboutInfiltrateForTypes.cs +++ /dev/null @@ -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> infiltrateForLocations = new List>(); - - public override IEnumerable 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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/AddShakeToBridge.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/AddShakeToBridge.cs deleted file mode 100644 index bfff19d76f..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/AddShakeToBridge.cs +++ /dev/null @@ -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 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); - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/ChangeIntensityToDuration.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/ChangeIntensityToDuration.cs deleted file mode 100644 index e89f6966fe..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/ChangeIntensityToDuration.cs +++ /dev/null @@ -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 UpdateActorNode(ModData modData, MiniYamlNode actorNode) - { - foreach (var sod in actorNode.ChildrenMatching("ShakeOnDeath")) - sod.RenameChildrenMatching("Intensity", "Duration"); - - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineGroundCorpseDefault.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineGroundCorpseDefault.cs deleted file mode 100644 index 438eef5177..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineGroundCorpseDefault.cs +++ /dev/null @@ -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>[] fields = - { - Tuple.Create("Parachutable", "GroundCorpseSequence", "corpse", new List()), - }; - - string BuildMessage(Tuple> 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 AfterUpdate(ModData modData) - { - foreach (var field in fields) - { - if (field.Item4.Any()) - yield return BuildMessage(field); - - field.Item4.Clear(); - } - } - - public override IEnumerable 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineLocomotors.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineLocomotors.cs deleted file mode 100644 index b7f46247df..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineLocomotors.cs +++ /dev/null @@ -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> locations = new List>(); - 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 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 UpdateActorNode(ModData modData, MiniYamlNode actorNode) - { - var addNodes = new List(); - 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineOwnerLostAction.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineOwnerLostAction.cs deleted file mode 100644 index d85409d5c0..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineOwnerLostAction.cs +++ /dev/null @@ -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 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 UpdateActorNode(ModData modData, MiniYamlNode actorNode) - { - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineSoundDefaults.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineSoundDefaults.cs deleted file mode 100644 index a9b4970808..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineSoundDefaults.cs +++ /dev/null @@ -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>[] fields = - { - Tuple.Create("ParaDrop", "ChuteSound", "chute1.aud", new List()), - Tuple.Create("EjectOnDeath", "ChuteSound", "chute1.aud", new List()), - Tuple.Create("ProductionParadrop", "ChuteSound", "chute1.aud", new List()), - Tuple.Create("Building", "BuildSounds", "placbldg.aud, build5.aud", new List()), - Tuple.Create("Building", "UndeploySounds", "cashturn.aud", new List()) - }; - - string BuildMessage(Tuple> 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 AfterUpdate(ModData modData) - { - foreach (var field in fields) - { - if (field.Item4.Any()) - yield return BuildMessage(field); - - field.Item4.Clear(); - } - } - - public override IEnumerable 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineSquadExcludeHarvester.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineSquadExcludeHarvester.cs deleted file mode 100644 index c7ee396eed..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/DefineSquadExcludeHarvester.cs +++ /dev/null @@ -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 locations = new List(); - - public override IEnumerable 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 UpdateActorNode(ModData modData, MiniYamlNode actorNode) - { - foreach (var hackyAINode in actorNode.ChildrenMatching("HackyAI")) - locations.Add("{0} ({1})".F(hackyAINode.Key, hackyAINode.Location.Filename)); - - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/IgnoreAbstractActors.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/IgnoreAbstractActors.cs deleted file mode 100644 index 2c4238e6af..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/IgnoreAbstractActors.cs +++ /dev/null @@ -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> actors = new Dictionary>(); - - 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 BeforeUpdate(ModData modData) - { - actors.Clear(); - yield break; - } - - public override IEnumerable 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(); - - actors[name].Add(actorNode); - } - - public override IEnumerable 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(", ") + ")")); - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/MoveHackyAISupportPowerDecisions.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/MoveHackyAISupportPowerDecisions.cs deleted file mode 100644 index 346bf31edf..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/MoveHackyAISupportPowerDecisions.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveCanUndeployFromGrantConditionOnDeploy.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveCanUndeployFromGrantConditionOnDeploy.cs deleted file mode 100644 index 3af9b10b35..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveCanUndeployFromGrantConditionOnDeploy.cs +++ /dev/null @@ -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 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()) - continue; - - var deployedCondition = gcod.LastChildMatching("DeployedCondition"); - gcod.AddNode("PauseOnCondition", deployedCondition.Value.Value); - } - - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemovePaletteFromCurrentTileset.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemovePaletteFromCurrentTileset.cs deleted file mode 100644 index 4d99667e66..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemovePaletteFromCurrentTileset.cs +++ /dev/null @@ -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 tilesetPalettes = new Dictionary(); - readonly List> paletteTraits = new List>(); - - 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 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 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 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(); - - var nameNode = paletteNode.LastChildMatching("Name"); - if (nameNode != null) - name = nameNode.Value.Value; - - paletteTraits.Add(Tuple.Create(name, shadow)); - } - - actorNode.RemoveNodes("PaletteFromCurrentTileset"); - yield break; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveTerrainTypeIsWaterFlag.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveTerrainTypeIsWaterFlag.cs deleted file mode 100644 index 990ebd0045..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveTerrainTypeIsWaterFlag.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveWeaponScanRadius.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveWeaponScanRadius.cs deleted file mode 100644 index 6683510b2d..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveWeaponScanRadius.cs +++ /dev/null @@ -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 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() == 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveWithReloadingSpriteTurret.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveWithReloadingSpriteTurret.cs deleted file mode 100644 index e2132b9dc9..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RemoveWithReloadingSpriteTurret.cs +++ /dev/null @@ -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 locations = new List(); - - public override IEnumerable 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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RenameEmitInfantryOnSell.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RenameEmitInfantryOnSell.cs deleted file mode 100644 index 7d08e4ce54..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RenameEmitInfantryOnSell.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RenameWormSpawner.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RenameWormSpawner.cs deleted file mode 100644 index d42dc34f19..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/RenameWormSpawner.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/SplitAimAnimations.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/SplitAimAnimations.cs deleted file mode 100644 index 8aafe4c7a4..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/SplitAimAnimations.cs +++ /dev/null @@ -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> aimAnimLocations = new List>(); - readonly List> reloadPrefixLocations = new List>(); - - public override IEnumerable 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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/SplitRepairDecoration.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20180307/SplitRepairDecoration.cs deleted file mode 100644 index 9e21921536..0000000000 --- a/OpenRA.Mods.Common/UpdateRules/Rules/20180307/SplitRepairDecoration.cs +++ /dev/null @@ -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 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; - } - } -} diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs index abc807d3ab..f1ca2fe625 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs @@ -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(),