Merge pull request #12160 from abcdefg30/hboxYak
Fix yaks trying to attack invalid targets
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user