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)); diff --git a/items.lua b/items.lua --- a/items.lua +++ b/items.lua @@ -410,7 +410,7 @@ item_spear = obj { elseif (o.nohitmsg) then return o.nohitmsg; else - return "Я не буду этого делать!"; + return "Фаэтларр не станет этого делать!"; end; end; }; @@ -436,7 +436,7 @@ item_colt = obj { local canshoot = false; if (type(o.canshoot) == "function") then - canshoot = o.canshoot(o); + canshoot, noshootmsg = o.canshoot(o); else canshoot = o.canshoot; end; @@ -449,12 +449,14 @@ item_colt = obj { else return ""; end; + elseif noshootmsg then + return noshootmsg; elseif o.noshootsilent then return elseif o.noshootmsg then return o.noshootmsg; else - return "Я не буду этого делать!"; + return "Не стоит этого делать!"; end; end; inv = function(s) @@ -487,7 +489,8 @@ item_harpoon = obj { use = function(s, o) local canshoot = false; if (type(o.canshoot) == "function") then - canshoot = o:canshoot(); + canshoot, noshootmsg = o:canshoot(); + print(canshoot, noshootmsg); else canshoot = o.canshoot; end; @@ -518,12 +521,14 @@ item_harpoon = obj { else return ""; end; + elseif noshootmsg then + return noshootmsg; elseif o.noshootsilent then return elseif (o.noshootmsg) then return o.noshootmsg; else - return "Я не буду этого делать!"; + return "Не стоит этого делать!"; end; end; inv = function(s)