CanSlide update rule

This commit is contained in:
reaperrr
2019-07-13 00:00:12 +02:00
committed by abcdefg30
parent 747e60d8b1
commit 4bf659ca38
4 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
#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;
using System.Collections.Generic;
using System.Linq;
namespace OpenRA.Mods.Common.UpdateRules.Rules
{
public class AddCanSlide : UpdateRule
{
public override string Name { get { return "Split CanSlide from CanHover"; } }
public override string Description
{
get
{
return "Aircraft.CanHover was split into two flags; CanHover now only makes aircraft hover when idle,\n"
+ "while CanSlide toggles the ability to immediately changing direction without flying a curve.";
}
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
var aircraftTraits = actorNode.ChildrenMatching("Aircraft");
foreach (var aircraft in aircraftTraits)
{
var canHover = false;
var canHoverNode = aircraft.LastChildMatching("CanHover");
if (canHoverNode != null)
canHover = canHoverNode.NodeValue<bool>();
else
yield break;
aircraft.AddNode("CanSlide", canHover.ToString());
}
yield break;
}
}
}

View File

@@ -130,6 +130,7 @@ namespace OpenRA.Mods.Common.UpdateRules
new RenameHoversOffsetModifier(), new RenameHoversOffsetModifier(),
new AddAirAttackTypes(), new AddAirAttackTypes(),
new RenameCarryallDelays(), new RenameCarryallDelays(),
new AddCanSlide(),
}) })
}; };

View File

@@ -331,6 +331,7 @@
LandableTerrainTypes: Clear, Rough, Road, Beach, Tiberium, BlueTiberium LandableTerrainTypes: Clear, Rough, Road, Beach, Tiberium, BlueTiberium
Crushes: crate, infantry Crushes: crate, infantry
InitialFacing: 224 InitialFacing: 224
CanSlide: True
HiddenUnderFog: HiddenUnderFog:
Type: GroundPosition Type: GroundPosition
ActorLostNotification: ActorLostNotification:
@@ -1091,6 +1092,7 @@
Aircraft: Aircraft:
CanHover: True CanHover: True
VTOL: true VTOL: true
CanSlide: True
FallsToEarth: FallsToEarth:
Spins: True Spins: True
Moves: False Moves: False

View File

@@ -634,6 +634,7 @@
LandableTerrainTypes: Clear, Rough, Road, Ore, Beach, Gems LandableTerrainTypes: Clear, Rough, Road, Ore, Beach, Gems
Crushes: crate, mine, infantry Crushes: crate, mine, infantry
InitialFacing: 224 InitialFacing: 224
CanSlide: True
GpsDot: GpsDot:
String: Helicopter String: Helicopter
Hovers@CRUISING: Hovers@CRUISING:
@@ -1047,6 +1048,7 @@
Aircraft: Aircraft:
CanHover: True CanHover: True
VTOL: true VTOL: true
CanSlide: True
FallsToEarth: FallsToEarth:
Explosion: UnitExplodeHeli Explosion: UnitExplodeHeli
BodyOrientation: BodyOrientation: