MovementTypes refactor update rule
This commit is contained in:
@@ -960,6 +960,7 @@
|
||||
<Compile Include="UpdateRules\Rules\20181215\ReplacedWithChargeAnimation.cs" />
|
||||
<Compile Include="UpdateRules\Rules\20181215\RefactorResourceLevelAnimating.cs" />
|
||||
<Compile Include="UpdateRules\Rules\20190314\StreamlineRepairableTraits.cs" />
|
||||
<Compile Include="UpdateRules\Rules\20190314\ReplaceSpecialMoveConsiderations.cs" />
|
||||
<Compile Include="Traits\Player\PlayerResources.cs" />
|
||||
<Compile Include="UtilityCommands\DumpSequenceSheetsCommand.cs" />
|
||||
<Compile Include="Traits\Render\WithBuildingRepairDecoration.cs" />
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#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;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class ReplaceSpecialMoveConsiderations : UpdateRule
|
||||
{
|
||||
public override string Name { get { return "Replaced special-case movement type considerations"; } }
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Removed AlwaysConsiderTurnAsMove from Mobile and ConsiderVerticalMovement\n" +
|
||||
"from GrantConditionOnMovement. Add 'Turn' and/or 'Vertical' on new ValidMovementTypes\n" +
|
||||
"fields on WithMoveAnimation and GrantConditionOnMovement instead.";
|
||||
}
|
||||
}
|
||||
|
||||
readonly Dictionary<string, List<string>> locations = new Dictionary<string, List<string>>();
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (locations.Any())
|
||||
yield return "The following definitions implement WithMoveAnimation\n" +
|
||||
"or GrantConditionOnMovement. Check if they need updated ValidMovementTypes:\n" +
|
||||
UpdateUtils.FormatMessageList(locations.Select(
|
||||
kv => kv.Key + ":\n" + UpdateUtils.FormatMessageList(kv.Value)));
|
||||
|
||||
locations.Clear();
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
var mobileNode = actorNode.ChildrenMatching("Mobile").FirstOrDefault(m => !m.IsRemoval());
|
||||
if (mobileNode != null)
|
||||
{
|
||||
var considerTurnAsMoveNode = mobileNode.LastChildMatching("AlwaysConsiderTurnAsMove");
|
||||
if (considerTurnAsMoveNode != null)
|
||||
mobileNode.RemoveNode(considerTurnAsMoveNode);
|
||||
}
|
||||
|
||||
var used = new List<string>();
|
||||
var grantMoveConditions = actorNode.ChildrenMatching("GrantConditionOnMovement");
|
||||
foreach (var g in grantMoveConditions)
|
||||
{
|
||||
var considerVerticalNode = g.LastChildMatching("ConsiderVerticalMovement");
|
||||
if (considerVerticalNode != null)
|
||||
g.RemoveNode(considerVerticalNode);
|
||||
}
|
||||
|
||||
if (grantMoveConditions.Any())
|
||||
used.Add("GrantConditionOnMovement");
|
||||
|
||||
var moveAnim = actorNode.LastChildMatching("WithMoveAnimation");
|
||||
if (moveAnim != null)
|
||||
used.Add("WithMoveAnimation");
|
||||
|
||||
if (used.Any())
|
||||
{
|
||||
var location = "{0} ({1})".F(actorNode.Key, actorNode.Location.Filename);
|
||||
locations[location] = used;
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
new RemoveSimpleBeacon(),
|
||||
new MakeMobilePausableConditional(),
|
||||
new StreamlineRepairableTraits(),
|
||||
new ReplaceSpecialMoveConsiderations(),
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ SMECH:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 99
|
||||
AlwaysConsiderTurnAsMove: true
|
||||
Health:
|
||||
HP: 17500
|
||||
Armor:
|
||||
@@ -143,6 +142,7 @@ SMECH:
|
||||
Sequence: shoot
|
||||
WithMoveAnimation:
|
||||
MoveSequence: walk
|
||||
ValidMovementTypes: Horizontal, Turn
|
||||
Selectable:
|
||||
Bounds: 20, 32, 0, -8
|
||||
-DamagedByTerrain@VEINS:
|
||||
@@ -166,7 +166,6 @@ MMCH:
|
||||
Mobile:
|
||||
TurnSpeed: 5
|
||||
Speed: 56
|
||||
AlwaysConsiderTurnAsMove: true
|
||||
Health:
|
||||
HP: 40000
|
||||
Armor:
|
||||
@@ -182,6 +181,7 @@ MMCH:
|
||||
Sequence: stand
|
||||
WithMoveAnimation:
|
||||
MoveSequence: walk
|
||||
ValidMovementTypes: Horizontal, Turn
|
||||
Turreted:
|
||||
TurnSpeed: 5
|
||||
AttackTurreted:
|
||||
@@ -229,7 +229,6 @@ HMEC:
|
||||
Mobile:
|
||||
TurnSpeed: 3
|
||||
Speed: 42
|
||||
AlwaysConsiderTurnAsMove: true
|
||||
Health:
|
||||
HP: 80000
|
||||
SelfHealing:
|
||||
@@ -332,7 +331,6 @@ JUGG:
|
||||
TurnSpeed: 5
|
||||
RequiresCondition: undeployed
|
||||
PauseOnCondition: empdisable || being-captured
|
||||
AlwaysConsiderTurnAsMove: true
|
||||
RevealsShroud:
|
||||
RequiresCondition: !inside-tunnel
|
||||
Range: 9c0
|
||||
@@ -348,6 +346,7 @@ JUGG:
|
||||
RequiresCondition: undeployed
|
||||
WithMoveAnimation:
|
||||
MoveSequence: walk
|
||||
ValidMovementTypes: Horizontal, Turn
|
||||
GrantConditionOnDeploy:
|
||||
DeployedCondition: deployed
|
||||
UndeployedCondition: undeployed
|
||||
|
||||
Reference in New Issue
Block a user