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.Activities;
|
||||||
using OpenRA.Mods.Common.Warheads;
|
using OpenRA.Mods.Common.Warheads;
|
||||||
using OpenRA.Primitives;
|
using OpenRA.Primitives;
|
||||||
|
using OpenRA.Support;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.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.")]
|
[Desc("Force-fire mode ignores actors and targets the ground instead.")]
|
||||||
public readonly bool ForceFireIgnoresActors = false;
|
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]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
public readonly string Voice = "Action";
|
||||||
|
|
||||||
@@ -456,10 +460,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (a == null)
|
if (a == null)
|
||||||
a = armaments.First();
|
a = armaments.First();
|
||||||
|
|
||||||
cursor = !target.IsInRange(self.CenterPosition, a.MaxRange()) ||
|
var outOfRange = !target.IsInRange(self.CenterPosition, a.MaxRange()) ||
|
||||||
(!forceAttack && target.Type == TargetType.FrozenActor && !ab.Info.TargetFrozenActors)
|
(!forceAttack && target.Type == TargetType.FrozenActor && !ab.Info.TargetFrozenActors);
|
||||||
? ab.Info.OutsideRangeCursor ?? a.Info.OutsideRangeCursor
|
|
||||||
: ab.Info.Cursor ?? a.Info.Cursor;
|
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)
|
if (!forceAttack)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -388,6 +388,7 @@ JUGG:
|
|||||||
PauseOnCondition: empdisable
|
PauseOnCondition: empdisable
|
||||||
TargetFrozenActors: True
|
TargetFrozenActors: True
|
||||||
ForceFireIgnoresActors: True
|
ForceFireIgnoresActors: True
|
||||||
|
OutsideRangeRequiresForceFire: True
|
||||||
Armament@deployed:
|
Armament@deployed:
|
||||||
Name: deployed
|
Name: deployed
|
||||||
Turret: deployed
|
Turret: deployed
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ TTNK:
|
|||||||
Turrets: deployed
|
Turrets: deployed
|
||||||
RequiresCondition: deployed
|
RequiresCondition: deployed
|
||||||
PauseOnCondition: empdisable
|
PauseOnCondition: empdisable
|
||||||
|
OutsideRangeRequiresForceFire: True
|
||||||
Armament@deployed:
|
Armament@deployed:
|
||||||
Name: deployed
|
Name: deployed
|
||||||
Turret: deployed
|
Turret: deployed
|
||||||
@@ -276,6 +277,7 @@ ART2:
|
|||||||
PauseOnCondition: empdisable
|
PauseOnCondition: empdisable
|
||||||
TargetFrozenActors: True
|
TargetFrozenActors: True
|
||||||
ForceFireIgnoresActors: True
|
ForceFireIgnoresActors: True
|
||||||
|
OutsideRangeRequiresForceFire: True
|
||||||
Armament@deployed:
|
Armament@deployed:
|
||||||
Name: deployed
|
Name: deployed
|
||||||
Turret: deployed
|
Turret: deployed
|
||||||
|
|||||||
Reference in New Issue
Block a user