Avoid duplicate field.

This commit is contained in:
Matthias Mailänder
2021-09-12 12:47:50 +02:00
committed by Pavel Penev
parent 718bf88b9a
commit cdac14b92b
6 changed files with 42 additions and 3 deletions

View File

@@ -19,9 +19,6 @@ namespace OpenRA.Mods.Common.Traits
{ {
public class AttackBomberInfo : AttackBaseInfo public class AttackBomberInfo : AttackBaseInfo
{ {
[Desc("Tolerance for attack angle. Range [0, 512], 512 covers 360 degrees.")]
public readonly new WAngle FacingTolerance = new WAngle(8);
public override object Create(ActorInitializer init) { return new AttackBomber(init.Self, this); } public override object Create(ActorInitializer init) { return new AttackBomber(init.Self, this); }
} }

View File

@@ -0,0 +1,37 @@
#region Copyright & License Information
/*
* Copyright 2007-2021 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 AttackBomberFacingTolerance : UpdateRule
{
public override string Name => "Adds the old default value for AttackBomber FacingTolerance.";
public override string Description => "The tolerance for attack angle was defined twice on AttackBomber. This override has to be defined in the rules now.";
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
foreach (var attackBomber in actorNode.ChildrenMatching("AttackBomber"))
{
var facingTolerance = attackBomber.LastChildMatching("FacingTolerance");
if (facingTolerance != null)
continue;
var facingToleranceNode = new MiniYamlNode("FacingTolerance", FieldSaver.FormatValue(new WAngle(8)));
attackBomber.AddNode(facingToleranceNode);
}
yield break;
}
}
}

View File

@@ -96,6 +96,7 @@ namespace OpenRA.Mods.Common.UpdateRules
new RemoveSmokeTrailWhenDamaged(), new RemoveSmokeTrailWhenDamaged(),
new ReplaceCrateSecondsWithTicks(), new ReplaceCrateSecondsWithTicks(),
new UseMillisecondsForSounds(), new UseMillisecondsForSounds(),
new AttackBomberFacingTolerance(),
}) })
}; };

View File

@@ -239,6 +239,7 @@ A10:
Repulsable: False Repulsable: False
AttackBomber: AttackBomber:
Armaments: gun, bombs Armaments: gun, bombs
FacingTolerance: 8
Armament@GUNS: Armament@GUNS:
Name: gun Name: gun
Weapon: Vulcan Weapon: Vulcan

View File

@@ -96,6 +96,7 @@ frigate:
ornithopter: ornithopter:
Inherits: ^Plane Inherits: ^Plane
AttackBomber: AttackBomber:
FacingTolerance: 8
Armament: Armament:
Weapon: OrniBomb Weapon: OrniBomb
Health: Health:

View File

@@ -53,6 +53,7 @@ BADR.Bomber:
RenderSprites: RenderSprites:
Image: badr Image: badr
AttackBomber: AttackBomber:
FacingTolerance: 8
AmmoPool: AmmoPool:
Ammo: 10 Ammo: 10
Armament: Armament:
@@ -439,6 +440,7 @@ U2:
Repulsable: False Repulsable: False
MaximumPitch: 56 MaximumPitch: 56
AttackBomber: AttackBomber:
FacingTolerance: 8
-Selectable: -Selectable:
-Voiced: -Voiced:
-Targetable@AIRBORNE: -Targetable@AIRBORNE: