Disable out-of-range non-force targeting for deployed units.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -388,6 +388,7 @@ JUGG:
|
||||
PauseOnCondition: empdisable
|
||||
TargetFrozenActors: True
|
||||
ForceFireIgnoresActors: True
|
||||
OutsideRangeRequiresForceFire: True
|
||||
Armament@deployed:
|
||||
Name: deployed
|
||||
Turret: deployed
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user