hedgewars/uScript.pas
changeset 12944 0112ef349ddc
parent 12937 e0da398805b6
child 12952 c8b7bc04eb4c
equal deleted inserted replaced
12943:b075ad6112c9 12944:0112ef349ddc
  1760             Gear^.Active:= true;
  1760             Gear^.Active:= true;
  1761             AllInactive:= false
  1761             AllInactive:= false
  1762             end
  1762             end
  1763         end;
  1763         end;
  1764     lc_sethealth:= 0
  1764     lc_sethealth:= 0
       
  1765 end;
       
  1766 
       
  1767 function lc_healhog(L : Plua_State) : LongInt; Cdecl;
       
  1768 var gear : PGear;
       
  1769     healthBoost, n: LongInt;
       
  1770 begin
       
  1771     if CheckAndFetchParamCountRange(L, 2, 4, 'HealHog', 'gearUid, healthBoost [, showMessage [, tint]]', n) then
       
  1772         begin
       
  1773         gear:= GearByUID(Trunc(lua_tonumber(L, 1)));
       
  1774         healthBoost:= Trunc(lua_tonumber(L, 2));
       
  1775         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) and (healthBoost >= 1) then
       
  1776             begin
       
  1777             gear^.Health:= gear^.Health + healthBoost;
       
  1778 
       
  1779             RenderHealth(gear^.Hedgehog^);
       
  1780             RecountTeamHealth(gear^.Hedgehog^.Team);
       
  1781             if n = 4 then
       
  1782                 HHHeal(gear^.Hedgehog, healthBoost, lua_toboolean(L, 3), Trunc(lua_tonumber(L, 4)))
       
  1783             else if n = 3 then
       
  1784                 HHHeal(gear^.Hedgehog, healthBoost, lua_toboolean(L, 3))
       
  1785             else if n = 2 then
       
  1786                 HHHeal(gear^.Hedgehog, healthBoost, true);
       
  1787             Gear^.Active:= true;
       
  1788             AllInactive:= false
       
  1789             end
       
  1790         end;
       
  1791     lc_healhog:= 0
  1765 end;
  1792 end;
  1766 
  1793 
  1767 function lc_settimer(L : Plua_State) : LongInt; Cdecl;
  1794 function lc_settimer(L : Plua_State) : LongInt; Cdecl;
  1768 var gear : PGear;
  1795 var gear : PGear;
  1769 begin
  1796 begin
  3681 lua_register(luaState, _P'GetTeamName', @lc_getteamname);
  3708 lua_register(luaState, _P'GetTeamName', @lc_getteamname);
  3682 lua_register(luaState, _P'AddTeam', @lc_addteam);
  3709 lua_register(luaState, _P'AddTeam', @lc_addteam);
  3683 lua_register(luaState, _P'AddHog', @lc_addhog);
  3710 lua_register(luaState, _P'AddHog', @lc_addhog);
  3684 lua_register(luaState, _P'AddAmmo', @lc_addammo);
  3711 lua_register(luaState, _P'AddAmmo', @lc_addammo);
  3685 lua_register(luaState, _P'GetAmmoCount', @lc_getammocount);
  3712 lua_register(luaState, _P'GetAmmoCount', @lc_getammocount);
       
  3713 lua_register(luaState, _P'HealHog', @lc_healhog);
  3686 lua_register(luaState, _P'SetHealth', @lc_sethealth);
  3714 lua_register(luaState, _P'SetHealth', @lc_sethealth);
  3687 lua_register(luaState, _P'GetHealth', @lc_gethealth);
  3715 lua_register(luaState, _P'GetHealth', @lc_gethealth);
  3688 lua_register(luaState, _P'SetEffect', @lc_seteffect);
  3716 lua_register(luaState, _P'SetEffect', @lc_seteffect);
  3689 lua_register(luaState, _P'GetEffect', @lc_geteffect);
  3717 lua_register(luaState, _P'GetEffect', @lc_geteffect);
  3690 lua_register(luaState, _P'GetHogClan', @lc_gethogclan);
  3718 lua_register(luaState, _P'GetHogClan', @lc_gethogclan);