diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs index 5da7332710..c05c0e3541 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs @@ -36,12 +36,21 @@ namespace OpenRA.Mods.Common.Traits [Desc("Amount of time to keep the camera alive after the aircraft have finished attacking")] public readonly int CameraRemoveDelay = 25; + [Desc("Enables the player directional targeting")] + public readonly bool UseDirectionalTarget = false; + [Desc("Placeholder cursor animation for the target cursor when the real cursor is invisible.")] public readonly string TargetPlaceholderCursorAnimation = null; + [Desc("Palette for placeholder cursor animation.")] + public readonly string TargetPlaceholderCursorPalette = "chrome"; + [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(6); @@ -60,17 +69,23 @@ namespace OpenRA.Mods.Common.Traits public override void SelectTarget(Actor self, string order, SupportPowerManager manager) { - Game.Sound.PlayToPlayer(SoundType.UI, manager.Self.Owner, Info.SelectTargetSound); - Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", - Info.SelectTargetSpeechNotification, self.Owner.Faction.InternalName); + if (info.UseDirectionalTarget) + { + Game.Sound.PlayToPlayer(SoundType.UI, manager.Self.Owner, Info.SelectTargetSound); + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", + Info.SelectTargetSpeechNotification, self.Owner.Faction.InternalName); - self.World.OrderGenerator = new SelectDirectionalTarget(self.World, order, manager, Info.Cursor, info.TargetPlaceholderCursorAnimation, info.DirectionArrowAnimation); + self.World.OrderGenerator = new SelectDirectionalTarget(self.World, order, manager, Info.Cursor, + info.TargetPlaceholderCursorAnimation, info.DirectionArrowAnimation, info.TargetPlaceholderCursorPalette, info.DirectionArrowPalette); + } + else + base.SelectTarget(self, order, manager); } public override void Activate(Actor self, Order order, SupportPowerManager manager) { base.Activate(self, order, manager); - SendAirstrike(self, order.Target.CenterPosition, order.ExtraData == uint.MaxValue, (int)order.ExtraData); + SendAirstrike(self, order.Target.CenterPosition, !info.UseDirectionalTarget || order.ExtraData == uint.MaxValue, (int)order.ExtraData); } public void SendAirstrike(Actor self, WPos target, bool randomize = true, int attackFacing = 0) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs index b462ab15de..29e377d3a0 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/ParatroopersPower.cs @@ -50,12 +50,21 @@ 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("Placeholder cursor animation for the target cursor when the real cursor is invisible.")] public readonly string TargetPlaceholderCursorAnimation = null; + [Desc("Palette for placeholder cursor animation.")] + public readonly string TargetPlaceholderCursorPalette = "chrome"; + [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); @@ -74,18 +83,24 @@ namespace OpenRA.Mods.Common.Traits public override void SelectTarget(Actor self, string order, SupportPowerManager manager) { - Game.Sound.PlayToPlayer(SoundType.UI, manager.Self.Owner, Info.SelectTargetSound); - Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", - Info.SelectTargetSpeechNotification, self.Owner.Faction.InternalName); + if (info.UseDirectionalTarget) + { + Game.Sound.PlayToPlayer(SoundType.UI, manager.Self.Owner, Info.SelectTargetSound); + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", + Info.SelectTargetSpeechNotification, self.Owner.Faction.InternalName); - self.World.OrderGenerator = new SelectDirectionalTarget(self.World, order, manager, Info.Cursor, info.TargetPlaceholderCursorAnimation, info.DirectionArrowAnimation); + self.World.OrderGenerator = new SelectDirectionalTarget(self.World, order, manager, Info.Cursor, + info.TargetPlaceholderCursorAnimation, info.DirectionArrowAnimation, info.TargetPlaceholderCursorPalette, info.DirectionArrowPalette); + } + else + base.SelectTarget(self, order, manager); } public override void Activate(Actor self, Order order, SupportPowerManager manager) { base.Activate(self, order, manager); - SendParatroopers(self, order.Target.CenterPosition, order.ExtraData == uint.MaxValue, (int)order.ExtraData); + SendParatroopers(self, order.Target.CenterPosition, !info.UseDirectionalTarget || order.ExtraData == uint.MaxValue, (int)order.ExtraData); } public Actor[] SendParatroopers(Actor self, WPos target, bool randomize = true, int dropFacing = 0) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs index 4895fd2bfb..5d6db44ff3 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs @@ -22,6 +22,8 @@ namespace OpenRA.Mods.Common.Traits readonly string order; readonly SupportPowerManager manager; readonly string cursor; + readonly string targetPlaceholderCursorPalette; + readonly string directionArrowPalette; readonly Animation targetCursor; readonly string[] arrows = { "arrow-t", "arrow-tl", "arrow-l", "arrow-bl", "arrow-b", "arrow-br", "arrow-r", "arrow-tr" }; @@ -35,11 +37,13 @@ namespace OpenRA.Mods.Common.Traits Arrow currentArrow; public SelectDirectionalTarget(World world, string order, SupportPowerManager manager, string cursor, string targetPlaceholderCursorAnimation, - string directionArrowAnimation) + string directionArrowAnimation, string targetPlaceholderCursorPalette, string directionArrowPalette) { this.order = order; this.manager = manager; this.cursor = cursor; + this.targetPlaceholderCursorPalette = targetPlaceholderCursorPalette; + this.directionArrowPalette = directionArrowPalette; targetCursor = new Animation(world, targetPlaceholderCursorAnimation); targetCursor.PlayRepeating("cursor"); @@ -116,13 +120,16 @@ namespace OpenRA.Mods.Common.Traits if (!beginDrag) return Enumerable.Empty(); - var palette = wr.Palette("chrome"); + var targetPalette = wr.Palette(targetPlaceholderCursorPalette); var worldPx = wr.Viewport.ViewToWorldPx(location); var worldPos = wr.ProjectedPosition(worldPx); - var renderables = new List(targetCursor.Render(worldPos, WVec.Zero, -511, palette, 1 / wr.Viewport.Zoom)); + var renderables = new List(targetCursor.Render(worldPos, WVec.Zero, -511, targetPalette, 1 / wr.Viewport.Zoom)); if (IsOutsideDragZone) - renderables.Add(new SpriteRenderable(currentArrow.Sprite, worldPos, WVec.Zero, -511, palette, 1 / wr.Viewport.Zoom, true)); + { + var directionPalette = wr.Palette(directionArrowPalette); + renderables.Add(new SpriteRenderable(currentArrow.Sprite, worldPos, WVec.Zero, -511, directionPalette, 1 / wr.Viewport.Zoom, true)); + } return renderables; } diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 1469a853a1..7f4f2f5c11 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -628,6 +628,7 @@ HQ: ArrowSequence: arrow ClockSequence: clock CircleSequence: circles + UseDirectionalTarget: True TargetPlaceholderCursorAnimation: airstriketarget DirectionArrowAnimation: airstrikedirection SupportPowerChargeBar: diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index bfa176abae..3eb35d7d31 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -1461,6 +1461,7 @@ AFLD: ArrowSequence: arrow ClockSequence: clock CircleSequence: circles + UseDirectionalTarget: True TargetPlaceholderCursorAnimation: paratarget DirectionArrowAnimation: paradirection ParatroopersPower@paratroopers: @@ -1481,6 +1482,7 @@ AFLD: ArrowSequence: arrow ClockSequence: clock CircleSequence: circles + UseDirectionalTarget: True TargetPlaceholderCursorAnimation: paratarget DirectionArrowAnimation: paradirection AirstrikePower@parabombs: @@ -1502,6 +1504,7 @@ AFLD: ArrowSequence: arrow ClockSequence: clock CircleSequence: circles + UseDirectionalTarget: True TargetPlaceholderCursorAnimation: paratarget DirectionArrowAnimation: paradirection ProductionBar: