Deduplicate directional support powers.

This commit is contained in:
Matthias Mailänder
2024-04-14 12:58:11 +02:00
committed by Gustas
parent 1a3d3cd31e
commit fc4ebf332d
4 changed files with 60 additions and 49 deletions

View File

@@ -19,7 +19,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class ParatroopersPowerInfo : SupportPowerInfo
public class ParatroopersPowerInfo : DirectionalSupportPowerInfo
{
[ActorReference(typeof(AircraftInfo))]
public readonly string UnitType = "badr";
@@ -54,22 +54,13 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Amount of time (in ticks) to keep the camera alive while the passengers drop.")]
public readonly int CameraRemoveDelay = 85;
[Desc("Enables the player directional targeting")]
public readonly bool UseDirectionalTarget = false;
[Desc("Animation used to render the direction arrows.")]
public readonly string DirectionArrowAnimation = null;
[Desc("Palette for direction cursor animation.")]
public readonly string DirectionArrowPalette = "chrome";
[Desc("Weapon range offset to apply during the beacon clock calculation.")]
public readonly WDist BeaconDistanceOffset = WDist.FromCells(4);
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.Self, this); }
}
public class ParatroopersPower : SupportPower
public class ParatroopersPower : DirectionalSupportPower
{
readonly ParatroopersPowerInfo info;
@@ -79,14 +70,6 @@ namespace OpenRA.Mods.Common.Traits
this.info = info;
}
public override void SelectTarget(Actor self, string order, SupportPowerManager manager)
{
if (info.UseDirectionalTarget)
self.World.OrderGenerator = new SelectDirectionalTarget(self.World, order, manager, Info.Cursor, info.DirectionArrowAnimation, info.DirectionArrowPalette);
else
base.SelectTarget(self, order, manager);
}
public override void Activate(Actor self, Order order, SupportPowerManager manager)
{
base.Activate(self, order, manager);