Remove Player.CanViewActor and .CanTargetActor.
This commit is contained in:
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
|
||||
public bool IsTargetVisible
|
||||
{
|
||||
get { return Bot.Player.PlayerActor.Owner.CanTargetActor(TargetActor); }
|
||||
get { return TargetActor.CanBeViewedByPlayer(Bot.Player); }
|
||||
}
|
||||
|
||||
public WPos CenterPosition { get { return Units.Select(u => u.CenterPosition).Average(); } }
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
var pos = self.CenterPosition;
|
||||
var targetPos = attackHeli.GetTargetPosition(pos, target);
|
||||
if (attackOnlyVisibleTargets && target.Type == TargetType.Actor && canHideUnderFog
|
||||
&& !self.Owner.CanTargetActor(target.Actor))
|
||||
&& !target.Actor.CanBeViewedByPlayer(self.Owner))
|
||||
{
|
||||
var newTarget = Target.FromCell(self.World, self.World.Map.CellContaining(targetPos));
|
||||
|
||||
|
||||
@@ -90,7 +90,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
// HACK: This would otherwise break targeting frozen actors
|
||||
// The problem is that Shroud.IsTargetable returns false (as it should) for
|
||||
// frozen actors, but we do want to explicitly target the underlying actor here.
|
||||
if (!attack.Info.IgnoresVisibility && type == TargetType.Actor && !Target.Actor.Info.HasTraitInfo<FrozenUnderFogInfo>() && !self.Owner.CanTargetActor(Target.Actor))
|
||||
if (!attack.Info.IgnoresVisibility && type == TargetType.Actor
|
||||
&& !Target.Actor.Info.HasTraitInfo<FrozenUnderFogInfo>()
|
||||
&& !Target.Actor.CanBeViewedByPlayer(self.Owner))
|
||||
return NextActivity;
|
||||
|
||||
// Drop the target once none of the weapons are effective against it
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
// Target moved under the fog. Move to its last known position.
|
||||
if (Target.Type == TargetType.Actor && canHideUnderFog
|
||||
&& !self.Owner.CanTargetActor(Target.Actor))
|
||||
&& !Target.Actor.CanBeViewedByPlayer(self.Owner))
|
||||
{
|
||||
if (inner != null)
|
||||
inner.Cancel(self);
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
if (!target.IsValidFor(Self))
|
||||
Log.Write("lua", "{1} is an invalid target for {0}!", Self, targetActor);
|
||||
|
||||
if (!targetActor.Info.HasTraitInfo<FrozenUnderFogInfo>() && !Self.Owner.CanTargetActor(targetActor))
|
||||
if (!targetActor.Info.HasTraitInfo<FrozenUnderFogInfo>() && !targetActor.CanBeViewedByPlayer(Self.Owner))
|
||||
Log.Write("lua", "{1} is not revealed for player {0}!", Self.Owner, targetActor);
|
||||
|
||||
attackBase.AttackTarget(target, true, allowMove, forceAttack);
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}).ToList();
|
||||
|
||||
if (!validPriorities.Any() || PreventsAutoTarget(self, actor) || !self.Owner.CanTargetActor(actor))
|
||||
if (!validPriorities.Any() || PreventsAutoTarget(self, actor) || !actor.CanBeViewedByPlayer(self.Owner))
|
||||
continue;
|
||||
|
||||
// Make sure that we can actually fire on the actor
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
continue;
|
||||
|
||||
// The actor is not currently visible
|
||||
if (!self.Owner.CanViewActor(actor.Actor))
|
||||
if (!actor.Actor.CanBeViewedByPlayer(self.Owner))
|
||||
continue;
|
||||
|
||||
visibleActorIds.Add(actor.Actor.ActorID);
|
||||
|
||||
Reference in New Issue
Block a user