Merge pull request #12160 from abcdefg30/hboxYak

Fix yaks trying to attack invalid targets
This commit is contained in:
reaperrr
2016-10-14 18:55:37 +02:00
committed by GitHub
5 changed files with 21 additions and 19 deletions

View File

@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Scripting
public void Attack(Actor targetActor, bool allowMove = true, bool forceAttack = false)
{
var target = Target.FromActor(targetActor);
if (!target.IsValidFor(Self) || target.Type == TargetType.FrozenActor)
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))
@@ -98,5 +98,11 @@ namespace OpenRA.Mods.Common.Scripting
attackBase.AttackTarget(target, true, allowMove, forceAttack);
}
[Desc("Checks if the targeted actor is a valid target for this actor.")]
public bool CanTarget(Actor targetActor)
{
return Target.FromActor(targetActor).IsValidFor(Self);
}
}
}