Add an update rule for the PlaceSimpleBeacon removal

This commit is contained in:
abcdefg30
2018-12-26 10:56:30 +01:00
committed by reaperrr
parent 2ab127537c
commit e2a51676f7
3 changed files with 57 additions and 0 deletions

View File

@@ -610,6 +610,7 @@
<Compile Include="UpdateRules\Rules\20181215\RequireProductionType.cs" />
<Compile Include="UpdateRules\Rules\20190106\MakeMobilePausableConditional.cs" />
<Compile Include="UpdateRules\Rules\20190106\MultipleDeploySounds.cs" />
<Compile Include="UpdateRules\Rules\20190106\RemoveSimpleBeacon.cs" />
<Compile Include="UtilityCommands\CheckYaml.cs" />
<Compile Include="UtilityCommands\ConvertPngToShpCommand.cs" />
<Compile Include="UtilityCommands\ConvertSpriteToPngCommand.cs" />

View File

@@ -0,0 +1,55 @@
#region Copyright & License Information
/*
* Copyright 2007-2019 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 RemoveSimpleBeacon : UpdateRule
{
public override string Name { get { return "Remove 'PlaceSimpleBeacon'."; } }
public override string Description
{
get
{
return "The 'PlaceSimpleBeacon' trait was removed.\n" +
"Use the new functionality of the 'PlaceBeacon' trait instead.";
}
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
var psb = actorNode.LastChildMatching("PlaceSimpleBeacon");
if (psb == null)
yield break;
psb.RenameKey("PlaceBeacon");
var palette = psb.LastChildMatching("Palette");
var isPlayer = psb.LastChildMatching("IsPlayerPalette");
var sequence = psb.LastChildMatching("BeaconSequence");
if (palette == null)
psb.AddNode("Palette", "effect");
if (isPlayer == null)
psb.AddNode("IsPlayerPalette", "false");
if (sequence == null)
psb.AddNode("BeaconSequence", "idle");
psb.AddNode("ArrowSequence", "");
psb.AddNode("CircleSequence", "");
yield break;
}
}
}

View File

@@ -119,6 +119,7 @@ namespace OpenRA.Mods.Common.UpdateRules
// Bleed only changes here
new RemoveAttackSuicides(),
new MultipleDeploySounds(),
new RemoveSimpleBeacon(),
new MakeMobilePausableConditional(),
new StreamlineRepairableTraits(),
})