File diff 1cc57d5d7ee6 → 12dc77d6f1ec
battlefield.lua
Show inline comments
 
@@ -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));