Retire the release-20200202 update path

This commit is contained in:
abcdefg30
2023-02-28 23:09:06 +01:00
committed by Matthias Mailänder
parent 422a228cea
commit 65e28d5562
11 changed files with 3 additions and 677 deletions

View File

@@ -1,59 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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 AddResourceRenderer : UpdateRule
{
public override string Name => "Add ResourceRenderer trait";
public override string Description => "The rendering parts of ResourceLayer have been moved to a new trait";
readonly List<string> locations = new List<string>();
public override IEnumerable<string> AfterUpdate(ModData modData)
{
if (locations.Count > 0)
yield return "[D2k]ResourceRenderer has been added.\n" +
"You need to adjust the field RenderTypes on trait [D2k]ResourceRenderer\n" +
"on the following actors:\n" +
UpdateUtils.FormatMessageList(locations);
locations.Clear();
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
if (actorNode.ChildrenMatching("ResourceLayer").Any() && !actorNode.ChildrenMatching("ResourceRenderer").Any())
{
locations.Add($"{actorNode.Key} ({actorNode.Location.Filename})");
var resourceRenderer = new MiniYamlNode("ResourceRenderer", "");
resourceRenderer.AddNode("RenderTypes", "");
actorNode.AddNode(resourceRenderer);
}
if (actorNode.ChildrenMatching("D2kResourceLayer").Any() && !actorNode.ChildrenMatching("D2kResourceRenderer").Any())
{
actorNode.RenameChildrenMatching("D2kResourceLayer", "ResourceLayer");
locations.Add($"{actorNode.Key} ({actorNode.Location.Filename})");
var resourceRenderer = new MiniYamlNode("D2kResourceRenderer", "");
resourceRenderer.AddNode("RenderTypes", "");
actorNode.AddNode(resourceRenderer);
}
yield break;
}
}
}

View File

@@ -1,68 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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 CreateScreenShakeWarhead : UpdateRule
{
public override string Name => "Create ScreenShakeWarhead to replace hardcoded shaking.";
public override string Description => "The traits MadTank and NukePower (via the NukeLaunch projectile that it uses) no longer have built-in screen shaking.";
readonly List<Tuple<string, string, string>> weaponsToUpdate = new List<Tuple<string, string, string>>();
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
var madTankTraits = actorNode.ChildrenMatching("MadTank");
var nukePowerTraits = actorNode.ChildrenMatching("NukePower");
foreach (var madTankTrait in madTankTraits)
{
var traitName = madTankTrait.Key;
var weaponNode = madTankTrait.ChildrenMatching("MADTankThump").FirstOrDefault();
var weaponName = weaponNode != null ? weaponNode.Value.Value : "MADTankThump";
weaponsToUpdate.Add(new Tuple<string, string, string>(weaponName, traitName, $"{actorNode.Key} ({actorNode.Location.Filename})"));
madTankTrait.RemoveNodes("ThumpShakeTime");
madTankTrait.RemoveNodes("ThumpShakeIntensity");
madTankTrait.RemoveNodes("ThumpShakeMultiplier");
}
foreach (var nukePowerTrait in nukePowerTraits)
{
var traitName = nukePowerTrait.Key;
var weaponNode = nukePowerTrait.ChildrenMatching("MissileWeapon").FirstOrDefault();
if (weaponNode == null)
continue;
var weaponName = weaponNode.Value.Value;
weaponsToUpdate.Add(new Tuple<string, string, string>(weaponName, traitName, $"{actorNode.Key} ({actorNode.Location.Filename})"));
}
yield break;
}
public override IEnumerable<string> AfterUpdate(ModData modData)
{
if (weaponsToUpdate.Count > 0)
yield return "Add a ScreenShakeWarhead to the following weapons:\n" +
UpdateUtils.FormatMessageList(weaponsToUpdate.Select(x => $"Weapon `{x.Item1}`, used by trait `{x.Item2}` on actor {x.Item3}"));
weaponsToUpdate.Clear();
}
}
}

View File

@@ -1,208 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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.Drawing;
using System.Linq;
using OpenRA.Graphics;
namespace OpenRA.Mods.Common.UpdateRules.Rules
{
public class ReformatChromeProvider : UpdateRule
{
public override string Name => "Reformat UI image definitions.";
public override string Description =>
"The format of the chrome.yaml file defining image regions for the UI has\n" +
"changed to support additional metadata fields. ";
readonly List<string> overrideLocations = new List<string>();
readonly List<string> panelLocations = new List<string>();
public override IEnumerable<string> AfterUpdate(ModData modData)
{
if (overrideLocations.Count > 0)
yield return "Region-specific image overrides are no longer supported. The following definitions must be replaced:\n" +
UpdateUtils.FormatMessageList(overrideLocations);
if (panelLocations.Count > 0)
yield return "The following definitions appear to be panels, but could not be converted to the new PanelRegion format.\n" +
"You may wish to define PanelRegion/PanelSides manually to reduce duplication:\n" +
UpdateUtils.FormatMessageList(panelLocations);
overrideLocations.Clear();
panelLocations.Clear();
}
readonly string[] edgeKeys =
{
"corner-tl", "corner-tr", "corner-bl", "corner-br",
"border-t", "border-b", "border-l", "border-r"
};
bool ExtractPanelDefinition(MiniYamlNode chromeProviderNode, MiniYamlNode regionsNode)
{
var cNode = regionsNode.LastChildMatching("background");
var hasCenter = cNode != null;
var hasEdges = edgeKeys.Any(k => regionsNode.LastChildMatching(k) != null);
// Not a panel
if (!hasCenter && !hasEdges)
return true;
// Panels may define just the background
if (hasCenter && !hasEdges)
{
var bgRect = cNode.NodeValue<Rectangle>();
chromeProviderNode.AddNode("PanelRegion", new[]
{
bgRect.X, bgRect.Y,
0, 0,
bgRect.Width, bgRect.Height,
0, 0
});
chromeProviderNode.AddNode("PanelSides", PanelSides.Center);
regionsNode.RemoveNode(cNode);
return true;
}
// Panels may define just the edges, or edges plus background
var tlNode = regionsNode.LastChildMatching("corner-tl");
if (tlNode == null)
return false;
var tlRect = tlNode.NodeValue<Rectangle>();
var tNode = regionsNode.LastChildMatching("border-t");
if (tNode == null)
return false;
var tRect = tNode.NodeValue<Rectangle>();
if (tRect.Left != tlRect.Right || tRect.Top != tlRect.Top || tRect.Bottom != tlRect.Bottom)
return false;
var trNode = regionsNode.LastChildMatching("corner-tr");
if (trNode == null)
return false;
var trRect = trNode.NodeValue<Rectangle>();
if (trRect.Left != tRect.Right || trRect.Top != tRect.Top || trRect.Bottom != tRect.Bottom)
return false;
var lNode = regionsNode.LastChildMatching("border-l");
if (lNode == null)
return false;
var lRect = lNode.NodeValue<Rectangle>();
if (lRect.Left != tlRect.Left || lRect.Top != tlRect.Bottom || lRect.Right != tlRect.Right)
return false;
var rNode = regionsNode.LastChildMatching("border-r");
if (rNode == null)
return false;
var rRect = rNode.NodeValue<Rectangle>();
if (rRect.Left != trRect.Left || rRect.Top != trRect.Bottom || rRect.Bottom != lRect.Bottom || rRect.Right != trRect.Right)
return false;
var blNode = regionsNode.LastChildMatching("corner-bl");
if (blNode == null)
return false;
var blRect = blNode.NodeValue<Rectangle>();
if (blRect.Left != lRect.Left || blRect.Top != lRect.Bottom || blRect.Right != lRect.Right)
return false;
var bNode = regionsNode.LastChildMatching("border-b");
if (bNode == null)
return false;
var bRect = bNode.NodeValue<Rectangle>();
if (bRect.Left != blRect.Right || bRect.Top != blRect.Top || bRect.Bottom != blRect.Bottom || bRect.Right != tRect.Right)
return false;
var brNode = regionsNode.LastChildMatching("corner-br");
if (brNode == null)
return false;
var brRect = brNode.NodeValue<Rectangle>();
if (brRect.Left != bRect.Right || brRect.Top != bRect.Top || brRect.Bottom != bRect.Bottom || brRect.Right != rRect.Right)
return false;
// Background definition may be omitted
if (hasCenter)
{
var bgRect = cNode.NodeValue<Rectangle>();
if (bgRect.Left != lRect.Right || bgRect.Top != lRect.Top || bgRect.Bottom != lRect.Bottom || bgRect.Right != tRect.Right)
return false;
}
// Define the short-form panel region
chromeProviderNode.AddNode("PanelRegion", new[]
{
tlRect.X, tlRect.Y,
tlRect.Width, tlRect.Height,
trRect.Left - tlRect.Right, blRect.Top - tlRect.Bottom,
brRect.Width, brRect.Height
});
if (!hasCenter)
chromeProviderNode.AddNode("PanelSides", PanelSides.Edges);
// Remove the now redundant regions
regionsNode.RemoveNode(tlNode);
regionsNode.RemoveNode(tNode);
regionsNode.RemoveNode(trNode);
regionsNode.RemoveNode(lNode);
regionsNode.RemoveNode(rNode);
regionsNode.RemoveNode(blNode);
regionsNode.RemoveNode(bNode);
regionsNode.RemoveNode(brNode);
if (cNode != null)
regionsNode.RemoveNode(cNode);
return true;
}
public override IEnumerable<string> UpdateChromeProviderNode(ModData modData, MiniYamlNode chromeProviderNode)
{
// Migrate image rectangles
var regionsNode = new MiniYamlNode("Regions", "");
foreach (var n in chromeProviderNode.Value.Nodes)
{
if (n.Key == "Inherits")
continue;
// Reformat region as a list
regionsNode.AddNode(n.Key, n.NodeValue<int[]>());
if (n.Value.Nodes.Count > 0)
overrideLocations.Add($"{chromeProviderNode.Key}.{n.Key} ({chromeProviderNode.Location.Filename})");
}
chromeProviderNode.Value.Nodes.RemoveAll(n => n.Key != "Inherits");
// Migrate image definition
chromeProviderNode.AddNode(new MiniYamlNode("Image", chromeProviderNode.Value.Value));
chromeProviderNode.Value.Value = "";
if (!ExtractPanelDefinition(chromeProviderNode, regionsNode))
panelLocations.Add($"{chromeProviderNode.Key} ({chromeProviderNode.Location.Filename})");
if (regionsNode.Value.Nodes.Count > 0)
chromeProviderNode.AddNode(regionsNode);
yield break;
}
}
}

View File

@@ -1,51 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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 RemoveAirdropActorTypeDefault : UpdateRule
{
public override string Name => "Removed internal default of ProductionAirdrop.ActorType";
public override string Description => "Removed internal default of 'c17' from ProductionAirdrop.ActorType.";
readonly List<Tuple<string, string>> missingActorTypes = new List<Tuple<string, string>>();
public override IEnumerable<string> AfterUpdate(ModData modData)
{
var message = "ProductionAirdrop.ActorType no longer defaults to 'c17' and must be defined explicitly.\n"
+ "You may have to define it manually now in the following places:\n"
+ UpdateUtils.FormatMessageList(missingActorTypes.Select(n => n.Item1 + " (" + n.Item2 + ")"));
if (missingActorTypes.Count > 0)
yield return message;
missingActorTypes.Clear();
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
var airProd = actorNode.LastChildMatching("ProductionAirdrop");
if (airProd != null)
{
var actorTypeNode = airProd.LastChildMatching("ActorType");
if (actorTypeNode == null)
missingActorTypes.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
}
yield break;
}
}
}

View File

@@ -1,58 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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 RemoveInitialFacingHardcoding : UpdateRule
{
public override string Name => "Removed InitialFacing hardcoding for non-VTOLs";
public override string Description => "Removed hardcoding of InitialFacing to 192 for aircraft with VTOL: false.";
readonly List<Tuple<string, string>> nonVTOLs = new List<Tuple<string, string>>();
public override IEnumerable<string> AfterUpdate(ModData modData)
{
var message = "InitialFacing is no longer hardcoded to 192 for aircraft with VTOL: false.\n"
+ "You may have to set it manually now in the following places:\n"
+ UpdateUtils.FormatMessageList(nonVTOLs.Select(n => n.Item1 + " (" + n.Item2 + ")"));
if (nonVTOLs.Count > 0)
yield return message;
nonVTOLs.Clear();
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
var aircraft = actorNode.LastChildMatching("Aircraft");
if (aircraft != null)
{
var initialFacing = aircraft.LastChildMatching("InitialFacing");
var isVTOL = false;
var vtolNode = aircraft.LastChildMatching("VTOL");
if (vtolNode != null)
isVTOL = vtolNode.NodeValue<bool>();
// If InitialFacing is defined or it's a VTOL, no changes are needed.
if (initialFacing != null || isVTOL)
yield break;
nonVTOLs.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename));
}
}
}
}

View File

@@ -1,47 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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 RemoveWithPermanentInjury : UpdateRule
{
public override string Name => "WithPermanentInjury trait has been removed.";
public override string Description =>
"The WithPermanentInjury trait has been removed, and should be replaced by\n" +
"TakeCover with negative ProneTime value + GrantConditionOnDamageState/-Health.\n" +
"Affected actors are listed so that these traits can be defined.";
readonly List<string> locations = new List<string>();
public override IEnumerable<string> AfterUpdate(ModData modData)
{
if (locations.Count > 0)
yield return "The WithPermanentInjury trait has been removed from the following actors.\n" +
"You must manually define TakeCover with a negative ProneTime and use\n" +
"GrantConditionOnDamageState/-Health with 'GrantPermanently: true'\n" +
"to enable TakeCover at the desired damage state:\n" +
UpdateUtils.FormatMessageList(locations);
locations.Clear();
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
if (actorNode.RemoveNodes("WithPermanentInjury") > 0)
locations.Add($"{actorNode.Key} ({actorNode.Location.Filename})");
yield break;
}
}
}

View File

@@ -1,56 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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 RemoveYesNo : UpdateRule
{
public override string Name => "Remove 'yes' and 'no' in favor of 'true' and 'false'.";
public override string Description =>
"'Yes' and 'no' are no longer valid values for booleans. " +
"Use 'true' and 'false' instead.";
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
foreach (var traitNode in actorNode.Value.Nodes)
{
foreach (var n in traitNode.Value.Nodes)
{
var value = n.NodeValue<string>();
if (value == null)
continue;
if (string.Equals(value, "yes", System.StringComparison.InvariantCultureIgnoreCase))
n.ReplaceValue("true");
else if (string.Equals(value, "no", System.StringComparison.InvariantCultureIgnoreCase))
n.ReplaceValue("false");
}
}
yield break;
}
bool displayed;
public override IEnumerable<string> AfterUpdate(ModData modData)
{
if (displayed)
yield break;
displayed = true;
yield return "'Yes' and 'no' have been removed from the mod rules. "
+ "Chrome yaml files may need a manual update.";
}
}
}

View File

@@ -1,30 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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
{
class RenameProneTime : UpdateRule
{
public override string Name => "Renamed ProneTime to Duration";
public override string Description => "Renamed TakeCover property ProneTime to Duration.";
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
foreach (var takeCover in actorNode.ChildrenMatching("TakeCover"))
takeCover.RenameChildrenMatching("ProneTime", "Duration");
yield break;
}
}
}

View File

@@ -1,30 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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
{
class RenameRallyPointPath : UpdateRule
{
public override string Name => "Renamed RallyPoint Offset to Path";
public override string Description => "The RallyPoint Offset property has been renamed to Path and now accepts multiple (or no) values.";
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
foreach (var rp in actorNode.ChildrenMatching("RallyPoint"))
rp.RenameChildrenMatching("Offset", "Path");
yield break;
}
}
}

View File

@@ -1,54 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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 RenameSpins : UpdateRule
{
public override string Name => "FallsToEarth.Spins has been refactored to MaximumSpinSpeed.";
public override string Description => "The FallsToEarth.Spins property has been refactored to MaximumSpinSpeed.";
readonly List<string> locations = new List<string>();
public override IEnumerable<string> AfterUpdate(ModData modData)
{
if (locations.Count > 0)
yield return "The Spins property has been refactored to MaximumSpinSpeed.\n" +
"MaximumSpinSpeed defaults to 'unlimited', while disabling is done by setting it to 0.\n" +
"You may want to set a custom MaximumSpinSpeed limiting value in the following places:\n" +
UpdateUtils.FormatMessageList(locations);
locations.Clear();
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
foreach (var fallsToEarth in actorNode.ChildrenMatching("FallsToEarth"))
{
var spinsNode = fallsToEarth.LastChildMatching("Spins");
if (spinsNode != null)
{
var spins = spinsNode.NodeValue<bool>();
if (!spins)
fallsToEarth.AddNode("MaximumSpinSpeed", "0");
fallsToEarth.RemoveNode(spinsNode);
locations.Add($"{actorNode.Key} ({actorNode.Location.Filename})");
}
}
yield break;
}
}
}

View File

@@ -31,20 +31,6 @@ namespace OpenRA.Mods.Common.UpdateRules
// release-to-bleed path.
static readonly UpdatePath[] Paths =
{
new UpdatePath("release-20200202", "release-20200503", new UpdateRule[]
{
new RemoveYesNo(),
new RemoveInitialFacingHardcoding(),
new RemoveAirdropActorTypeDefault(),
new RenameProneTime(),
new RemoveWithPermanentInjury(),
new AddResourceRenderer(),
new ReformatChromeProvider(),
new RenameSpins(),
new CreateScreenShakeWarhead(),
new RenameRallyPointPath(),
}),
new UpdatePath("release-20200503", "release-20210321", new UpdateRule[]
{
new AddPipDecorationTraits(),
@@ -72,7 +58,7 @@ namespace OpenRA.Mods.Common.UpdateRules
new RemoveLaysTerrain(),
}),
new UpdatePath("release-20210321", "playtest-20221203", new UpdateRule[]
new UpdatePath("release-20210321", "release-20230225", new UpdateRule[]
{
new RenameMPTraits(),
new RemovePlayerHighlightPalette(),
@@ -100,8 +86,9 @@ namespace OpenRA.Mods.Common.UpdateRules
new AddControlGroups(),
}),
new UpdatePath("playtest-20221203", new UpdateRule[]
new UpdatePath("release-20230225", new UpdateRule[]
{
// bleed only changes here
new TextNotificationsDisplayWidgetRemoveTime(),
new ExplicitSequenceFilenames(),
new RenameEngineerRepair(),