Merge pull request #13102 from abcdefg30/06yak

Fix allies06a freezing when yaks try to attack camo pillboxes
This commit is contained in:
reaperrr
2017-04-15 12:36:18 +02:00
committed by GitHub

View File

@@ -160,15 +160,13 @@ end
TargetAndAttack = function(yak, target) TargetAndAttack = function(yak, target)
if not target or target.IsDead or (not target.IsInWorld) then if not target or target.IsDead or (not target.IsInWorld) then
local enemies = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == player and self.HasProperty("Health") end) local enemies = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == player and self.HasProperty("Health") and yak.CanTarget(self) end)
if #enemies > 0 then if #enemies > 0 then
target = Utils.Random(enemies) target = Utils.Random(enemies)
else
yak.Wait(DateTime.Seconds(5))
end end
end end
if target and yak.AmmoCount() > 0 then if target and yak.AmmoCount() > 0 and yak.CanTarget(target) then
yak.Attack(target) yak.Attack(target)
else else
yak.ReturnToBase() yak.ReturnToBase()