item_pipe = obj { nam = "pipe"; disp = "Кусок трубы"; inv = "Прочный, толстый кусок металлической трубы. Вполне может пригодиться"; use = function(s, o) local canhit = false; if (type(o.canhit) == "function") then canhit = o.canhit(o); else canhit = o.canhit; end; if (canhit) then if (o.onhit) then return(o.onhit(o)); else return ""; end; elseif (o.nohitmsg) then return o.nohitmsg; else return "Я не буду этого делать!"; end; end; }; item_colt = obj { nam = "colt"; bullets = 6; disp = function(s) return "Кольт (" .. tostring(s.bullets) .. " зарядов)"; end; dsc = [[ Ваш револьвер. Надежное оружие в хорошем состоянии. Оно еще не раз спасет вашу жизнь. У вас также есть небольшой запас патронов к нему. ]]; use = function(s, o) if (s.bullets == 0) then return "Нужно перезарядиться, патроны кончились"; end; local canshoot = false; if (type(o.canshoot) == "function") then canshoot = o.canshoot(o); else canshoot = o.canshoot; end; if (canshoot) then s.bullets = s.bullets - 1; p("Вы стреляете в "..o.disp2 .. ". "); if (o.onshoot) then return(o.onshoot(o)); else return ""; end elseif (o.noshootmsg) then return o.noshootmsg; else return "Я не буду этого делать!"; end; end; inv = function(s) if (s.bullets > 0) then return [[ Ваш револьвер. Надежное оружие в хорошем состоянии. Оно еще не раз спасет вашу жизнь. У вас также есть небольшой запас патронов к нему. ]]; else s.bullets = 6; return [[ Вы перезаряжаете ваш револьвер и оружие снова готово к бою ]]; end; end; };