Merge pull request #10018 from pchote/fix-spy-cursor
Restore targeting cursor when mousing over a disguised enemy spy.
This commit is contained in:
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
|
||||
public AircraftMoveOrderTargeter(AircraftInfo info) { this.info = info; }
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
if (target.Type != TargetType.Terrain)
|
||||
return false;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
public int OrderPriority { get; private set; }
|
||||
public bool OverrideSelection { get { return true; } }
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
if (target.Type != TargetType.Actor)
|
||||
return false;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
|
||||
public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor);
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
var type = target.Type;
|
||||
if (type != TargetType.Actor && type != TargetType.FrozenActor)
|
||||
|
||||
@@ -282,13 +282,21 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public int OrderPriority { get; private set; }
|
||||
public bool OverrideSelection { get { return true; } }
|
||||
|
||||
bool CanTargetActor(Actor self, Target target, TargetModifiers modifiers, ref string cursor)
|
||||
bool CanTargetActor(Actor self, Target target, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
||||
|
||||
if (modifiers.HasModifier(TargetModifiers.ForceMove))
|
||||
return false;
|
||||
|
||||
// Disguised actors are revealed by the attack cursor
|
||||
// HACK: works around limitations in the targeting code that force the
|
||||
// targeting and attacking logic (which should be logically separate)
|
||||
// to use the same code
|
||||
if (target.Type == TargetType.Actor && target.Actor.EffectiveOwner != null &&
|
||||
target.Actor.EffectiveOwner.Disguised && self.Owner.Stances[target.Actor.Owner] == Stance.Enemy)
|
||||
modifiers |= TargetModifiers.ForceAttack;
|
||||
|
||||
var forceAttack = modifiers.HasModifier(TargetModifiers.ForceAttack);
|
||||
var a = ab.ChooseArmamentsForTarget(target, forceAttack).FirstOrDefault();
|
||||
if (a == null)
|
||||
@@ -329,13 +337,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
switch (target.Type)
|
||||
{
|
||||
case TargetType.Actor:
|
||||
case TargetType.FrozenActor:
|
||||
return CanTargetActor(self, target, modifiers, ref cursor);
|
||||
return CanTargetActor(self, target, ref modifiers, ref cursor);
|
||||
case TargetType.Terrain:
|
||||
return CanTargetLocation(self, self.World.Map.CellContaining(target.CenterPosition), othersAtTarget, modifiers, ref cursor);
|
||||
default:
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public int OrderPriority { get { return 0; } }
|
||||
public bool OverrideSelection { get { return true; } }
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
if (target.Type != TargetType.Terrain)
|
||||
return false;
|
||||
|
||||
@@ -453,7 +453,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public bool IsQueued { get; protected set; }
|
||||
public bool OverrideSelection { get { return true; } }
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
if (target.Type != TargetType.Terrain)
|
||||
return false;
|
||||
|
||||
@@ -707,7 +707,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public int OrderPriority { get { return 4; } }
|
||||
public bool IsQueued { get; protected set; }
|
||||
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
{
|
||||
if (rejectMove || !target.IsValidFor(self))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user