Check ITargetable when deciding target validity. Fixes #3659.
This commit is contained in:
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA
|
||||
if (!self.IsInWorld)
|
||||
return false;
|
||||
|
||||
if (!target.IsValid)
|
||||
if (!target.IsValidFor(self))
|
||||
return false;
|
||||
|
||||
if (Armaments.All(a => a.IsReloading))
|
||||
@@ -54,10 +54,6 @@ namespace OpenRA.Mods.RA
|
||||
if (self.IsDisabled())
|
||||
return false;
|
||||
|
||||
if (target.Type == TargetType.Actor && target.Actor.HasTrait<ITargetable>() &&
|
||||
!target.Actor.Trait<ITargetable>().TargetableBy(target.Actor, self))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -133,7 +129,7 @@ namespace OpenRA.Mods.RA
|
||||
if (order.OrderString == "Attack")
|
||||
{
|
||||
var target = self.ResolveFrozenActorOrder(order, Color.Red);
|
||||
if (!target.IsValid)
|
||||
if (!target.IsValidFor(self))
|
||||
return;
|
||||
|
||||
self.SetTargetLine(target, Color.Red);
|
||||
@@ -155,7 +151,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public void AttackTarget(Target target, bool queued, bool allowMove)
|
||||
{
|
||||
if (!target.IsValid)
|
||||
if (!target.IsValidFor(self))
|
||||
return;
|
||||
|
||||
if (!queued)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
if( IsCanceled || !target.IsValid )
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
self.Trait<AttackOmni>().DoAttack(self, target);
|
||||
|
||||
@@ -67,7 +67,8 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
if( IsCanceled || !target.IsValid ) return NextActivity;
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
var attack = self.Trait<AttackTesla>();
|
||||
if( attack.charges == 0 || !attack.CanAttack( self, target ) )
|
||||
@@ -85,7 +86,8 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
if( IsCanceled || !target.IsValid ) return NextActivity;
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
var attack = self.Trait<AttackTesla>();
|
||||
if( attack.charges == 0 ) return NextActivity;
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace OpenRA.Mods.RA
|
||||
if (self.HasTrait<Building>() && !buildComplete)
|
||||
return false;
|
||||
|
||||
if (!target.IsValid) return false;
|
||||
if (!target.IsValidFor(self))
|
||||
return false;
|
||||
|
||||
bool canAttack = false;
|
||||
foreach (var t in turrets)
|
||||
@@ -53,7 +54,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
base.Tick(self);
|
||||
DoAttack(self, Target);
|
||||
IsAttacking = Target.IsValid;
|
||||
IsAttacking = Target.IsValidFor(self);
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove)
|
||||
@@ -84,7 +85,8 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled || !target.IsValid) return NextActivity;
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
if (self.IsDisabled()) return this;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user