From 14ece703ef6af19f41189d2d019ba12585e59bc0 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sun, 9 Apr 2017 13:50:18 +0200 Subject: [PATCH] Fix allies06a freezing when yaks try to attack camo pillboxes --- mods/ra/maps/allies-06a/allies06a-AI.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mods/ra/maps/allies-06a/allies06a-AI.lua b/mods/ra/maps/allies-06a/allies06a-AI.lua index a0beba1ac6..4656bb0d8c 100644 --- a/mods/ra/maps/allies-06a/allies06a-AI.lua +++ b/mods/ra/maps/allies-06a/allies06a-AI.lua @@ -152,15 +152,13 @@ end TargetAndAttack = function(yak, target) 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 target = Utils.Random(enemies) - else - yak.Wait(DateTime.Seconds(5)) end end - if target and yak.AmmoCount() > 0 then + if target and yak.AmmoCount() > 0 and yak.CanTarget(target) then yak.Attack(target) else yak.ReturnToBase()