From e3e012a9ed1a8a9a308f30c768b56c0b18148b89 Mon Sep 17 00:00:00 2001 From: penev92 Date: Thu, 29 Dec 2022 08:34:51 +0200 Subject: [PATCH] Added an update rule for DomainIndex removal Also for adding the new HPF-related PathFinderOverlay and HierarchicalPathFinderOverlay that were added at the same time. --- .../Rules/20210321/RemoveDomainIndex.cs | 33 +++++++++++++++++++ OpenRA.Mods.Common/UpdateRules/UpdatePath.cs | 1 + 2 files changed, 34 insertions(+) create mode 100644 OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemoveDomainIndex.cs diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemoveDomainIndex.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemoveDomainIndex.cs new file mode 100644 index 0000000000..4894275f19 --- /dev/null +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20210321/RemoveDomainIndex.cs @@ -0,0 +1,33 @@ +#region Copyright & License Information +/* + * Copyright 2007-2022 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 RemoveDomainIndex : UpdateRule + { + public override string Name => "Remove DomainIndex from World and add path finder overlays."; + + public override string Description => "The DomainIndex trait was removed from World. Two overlay traits were added at the same time."; + + public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) + { + if (actorNode.RemoveNodes("DomainIndex") > 0) + { + actorNode.AddNode(new MiniYamlNode("PathFinderOverlay", "")); + actorNode.AddNode(new MiniYamlNode("HierarchicalPathFinderOverlay", "")); + } + + yield break; + } + } +} diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs index e5465bd55c..89716b163f 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs @@ -96,6 +96,7 @@ namespace OpenRA.Mods.Common.UpdateRules new UnhardcodeBaseBuilderBotModule(), new UnhardcodeVeteranProductionIconOverlay(), new RenameContrailProperties(), + new RemoveDomainIndex(), }), new UpdatePath("playtest-20221203", new UpdateRule[]