diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index f6f6628c4e..f1182afad6 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -15,6 +15,7 @@ using System.Linq; using OpenRA.Activities; using OpenRA.Mods.Common.Warheads; using OpenRA.Primitives; +using OpenRA.Support; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -37,6 +38,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Force-fire mode ignores actors and targets the ground instead.")] public readonly bool ForceFireIgnoresActors = false; + [Desc("Force-fire mode is required to enable targeting against targets outside of range.")] + public readonly bool OutsideRangeRequiresForceFire = false; + [VoiceReference] public readonly string Voice = "Action"; @@ -456,10 +460,13 @@ namespace OpenRA.Mods.Common.Traits if (a == null) a = armaments.First(); - cursor = !target.IsInRange(self.CenterPosition, a.MaxRange()) || - (!forceAttack && target.Type == TargetType.FrozenActor && !ab.Info.TargetFrozenActors) - ? ab.Info.OutsideRangeCursor ?? a.Info.OutsideRangeCursor - : ab.Info.Cursor ?? a.Info.Cursor; + var outOfRange = !target.IsInRange(self.CenterPosition, a.MaxRange()) || + (!forceAttack && target.Type == TargetType.FrozenActor && !ab.Info.TargetFrozenActors); + + if (outOfRange && ab.Info.OutsideRangeRequiresForceFire && !modifiers.HasModifier(TargetModifiers.ForceAttack)) + return false; + + cursor = outOfRange ? ab.Info.OutsideRangeCursor ?? a.Info.OutsideRangeCursor : ab.Info.Cursor ?? a.Info.Cursor; if (!forceAttack) return true; diff --git a/mods/ts/rules/gdi-vehicles.yaml b/mods/ts/rules/gdi-vehicles.yaml index c9c914b4cf..052a9b29b4 100644 --- a/mods/ts/rules/gdi-vehicles.yaml +++ b/mods/ts/rules/gdi-vehicles.yaml @@ -388,6 +388,7 @@ JUGG: PauseOnCondition: empdisable TargetFrozenActors: True ForceFireIgnoresActors: True + OutsideRangeRequiresForceFire: True Armament@deployed: Name: deployed Turret: deployed diff --git a/mods/ts/rules/nod-vehicles.yaml b/mods/ts/rules/nod-vehicles.yaml index 165cbf2aad..ebbbb4f291 100644 --- a/mods/ts/rules/nod-vehicles.yaml +++ b/mods/ts/rules/nod-vehicles.yaml @@ -170,6 +170,7 @@ TTNK: Turrets: deployed RequiresCondition: deployed PauseOnCondition: empdisable + OutsideRangeRequiresForceFire: True Armament@deployed: Name: deployed Turret: deployed @@ -276,6 +277,7 @@ ART2: PauseOnCondition: empdisable TargetFrozenActors: True ForceFireIgnoresActors: True + OutsideRangeRequiresForceFire: True Armament@deployed: Name: deployed Turret: deployed