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\ReplacedWithChargeAnimation.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20181215\RefactorResourceLevelAnimating.cs" />
|
<Compile Include="UpdateRules\Rules\20181215\RefactorResourceLevelAnimating.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20190314\StreamlineRepairableTraits.cs" />
|
<Compile Include="UpdateRules\Rules\20190314\StreamlineRepairableTraits.cs" />
|
||||||
|
<Compile Include="UpdateRules\Rules\20190314\ReplaceSpecialMoveConsiderations.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,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 RemoveSimpleBeacon(),
|
||||||
new MakeMobilePausableConditional(),
|
new MakeMobilePausableConditional(),
|
||||||
new StreamlineRepairableTraits(),
|
new StreamlineRepairableTraits(),
|
||||||
|
new ReplaceSpecialMoveConsiderations(),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ SMECH:
|
|||||||
Mobile:
|
Mobile:
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 99
|
Speed: 99
|
||||||
AlwaysConsiderTurnAsMove: true
|
|
||||||
Health:
|
Health:
|
||||||
HP: 17500
|
HP: 17500
|
||||||
Armor:
|
Armor:
|
||||||
@@ -143,6 +142,7 @@ SMECH:
|
|||||||
Sequence: shoot
|
Sequence: shoot
|
||||||
WithMoveAnimation:
|
WithMoveAnimation:
|
||||||
MoveSequence: walk
|
MoveSequence: walk
|
||||||
|
ValidMovementTypes: Horizontal, Turn
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 20, 32, 0, -8
|
Bounds: 20, 32, 0, -8
|
||||||
-DamagedByTerrain@VEINS:
|
-DamagedByTerrain@VEINS:
|
||||||
@@ -166,7 +166,6 @@ MMCH:
|
|||||||
Mobile:
|
Mobile:
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
Speed: 56
|
Speed: 56
|
||||||
AlwaysConsiderTurnAsMove: true
|
|
||||||
Health:
|
Health:
|
||||||
HP: 40000
|
HP: 40000
|
||||||
Armor:
|
Armor:
|
||||||
@@ -182,6 +181,7 @@ MMCH:
|
|||||||
Sequence: stand
|
Sequence: stand
|
||||||
WithMoveAnimation:
|
WithMoveAnimation:
|
||||||
MoveSequence: walk
|
MoveSequence: walk
|
||||||
|
ValidMovementTypes: Horizontal, Turn
|
||||||
Turreted:
|
Turreted:
|
||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
AttackTurreted:
|
AttackTurreted:
|
||||||
@@ -229,7 +229,6 @@ HMEC:
|
|||||||
Mobile:
|
Mobile:
|
||||||
TurnSpeed: 3
|
TurnSpeed: 3
|
||||||
Speed: 42
|
Speed: 42
|
||||||
AlwaysConsiderTurnAsMove: true
|
|
||||||
Health:
|
Health:
|
||||||
HP: 80000
|
HP: 80000
|
||||||
SelfHealing:
|
SelfHealing:
|
||||||
@@ -332,7 +331,6 @@ JUGG:
|
|||||||
TurnSpeed: 5
|
TurnSpeed: 5
|
||||||
RequiresCondition: undeployed
|
RequiresCondition: undeployed
|
||||||
PauseOnCondition: empdisable || being-captured
|
PauseOnCondition: empdisable || being-captured
|
||||||
AlwaysConsiderTurnAsMove: true
|
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
RequiresCondition: !inside-tunnel
|
RequiresCondition: !inside-tunnel
|
||||||
Range: 9c0
|
Range: 9c0
|
||||||
@@ -348,6 +346,7 @@ JUGG:
|
|||||||
RequiresCondition: undeployed
|
RequiresCondition: undeployed
|
||||||
WithMoveAnimation:
|
WithMoveAnimation:
|
||||||
MoveSequence: walk
|
MoveSequence: walk
|
||||||
|
ValidMovementTypes: Horizontal, Turn
|
||||||
GrantConditionOnDeploy:
|
GrantConditionOnDeploy:
|
||||||
DeployedCondition: deployed
|
DeployedCondition: deployed
|
||||||
UndeployedCondition: undeployed
|
UndeployedCondition: undeployed
|
||||||
|
|||||||
Reference in New Issue
Block a user