Add Update rule for LPSlowdown to LPModifier
This commit is contained in:
committed by
Paul Chote
parent
5b00c12ca3
commit
9bcb222a2d
@@ -921,6 +921,7 @@
|
|||||||
<Compile Include="UpdateRules\Rules\20180923\DefineNotificationDefaults.cs" />
|
<Compile Include="UpdateRules\Rules\20180923\DefineNotificationDefaults.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20180923\RenameEditorTilesetFilter.cs" />
|
<Compile Include="UpdateRules\Rules\20180923\RenameEditorTilesetFilter.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20180923\MergeRearmAndRepairAnimation.cs" />
|
<Compile Include="UpdateRules\Rules\20180923\MergeRearmAndRepairAnimation.cs" />
|
||||||
|
<Compile Include="UpdateRules\Rules\20180923\LowPowerSlowdownToModifier.cs" />
|
||||||
<Compile Include="Traits\Player\PlayerResources.cs" />
|
<Compile Include="Traits\Player\PlayerResources.cs" />
|
||||||
<Compile Include="UtilityCommands\DumpSequenceSheetsCommand.cs" />
|
<Compile Include="UtilityCommands\DumpSequenceSheetsCommand.cs" />
|
||||||
<Compile Include="Traits\Render\WithBuildingRepairDecoration.cs" />
|
<Compile Include="Traits\Render\WithBuildingRepairDecoration.cs" />
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version. For more
|
||||||
|
* information, see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
|
{
|
||||||
|
public class LowPowerSlowdownToModifier : UpdateRule
|
||||||
|
{
|
||||||
|
public override string Name { get { return "LowPowerSlowdown is renamed to LowPowerModifier"; } }
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "ProductionQueue.LowPowerSlowdown is renamed to LowPowerModifier, and\n" +
|
||||||
|
"multiplied by 100 to allow multiplying the build time with non-integer values.\n" +
|
||||||
|
"Also default value is changed to 100.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly string[] queueTraits = { "ProductionQueue", "ClassicProductionQueue" };
|
||||||
|
|
||||||
|
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||||
|
{
|
||||||
|
foreach (var queue in queueTraits.SelectMany(t => actorNode.ChildrenMatching(t)))
|
||||||
|
{
|
||||||
|
var lowPower = queue.LastChildMatching("LowPowerSlowdown");
|
||||||
|
if (lowPower != null)
|
||||||
|
{
|
||||||
|
if (lowPower.NodeValue<int>() == 1)
|
||||||
|
queue.RemoveNodes("LowPowerSlowdown");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lowPower.RenameKey("LowPowerModifier");
|
||||||
|
lowPower.ReplaceValue((lowPower.NodeValue<int>() * 100).ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
queue.AddNode("LowPowerModifier", "300");
|
||||||
|
}
|
||||||
|
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -94,6 +94,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
|||||||
new MergeRearmAndRepairAnimation(),
|
new MergeRearmAndRepairAnimation(),
|
||||||
new MergeCaptureTraits(),
|
new MergeCaptureTraits(),
|
||||||
new RemovedNotifyBuildComplete(),
|
new RemovedNotifyBuildComplete(),
|
||||||
|
new LowPowerSlowdownToModifier(),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user