diff --git a/battlefield.lua b/battlefield.lua --- a/battlefield.lua +++ b/battlefield.lua @@ -529,11 +529,20 @@ bf_wait = obj { combatant = function(tab) if (tab.canshoot == nil) then tab.canshoot = function(s) + if not here():canShoot(here().plX, here().plY, s.x, s.y) then + return false, 'Вы не попадете в цель отсюда!'; + end; local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY)); - return dist < 6 and not tab.ally; + + if tab.ally then + return false, nil; + elseif dist >= 6 then + return false, 'Цель слишком далеко!'; + end; + return true; end; end; - + if (tab.onthrust == nil) then tab.onthrust = function(s) local dist = math.sqrt((s.x - here().plX) * (s.x - here().plX) + (s.y - here().plY) * (s.y - here().plY));