hedgewars/uScript.pas
changeset 15079 424e3b132dd3
parent 15032 b181ff6367c9
child 15131 a77b0e339929
equal deleted inserted replaced
15078:fb7a9b0119d3 15079:424e3b132dd3
  1471             lua_pushnil(L);
  1471             lua_pushnil(L);
  1472         end
  1472         end
  1473     else
  1473     else
  1474         lua_pushnil(L); // return value on stack (nil)
  1474         lua_pushnil(L); // return value on stack (nil)
  1475     lc_gethogfort:= 1
  1475     lc_gethogfort:= 1
       
  1476 end;
       
  1477 
       
  1478 function lc_ishogalive(L : Plua_State) : LongInt; Cdecl;
       
  1479 var gear : PGear;
       
  1480 begin
       
  1481     if CheckLuaParamCount(L, 1, 'IsHogAlive', 'gearUid') then
       
  1482         begin
       
  1483         gear:= GearByUID(Trunc(lua_tonumber(L, 1)));
       
  1484         if gear <> nil then
       
  1485             if gear^.Kind = gtHedgehog then
       
  1486                 if (gear^.Health > 0) and (gear^.Health > gear^.Damage) and ((gear^.State and (gstDrowning or gstHHDeath)) = 0) and ((gear^.Message and gmDestroy) = 0) then
       
  1487                     lua_pushboolean(L, true)
       
  1488                 else
       
  1489                     lua_pushboolean(L, false)
       
  1490             else
       
  1491                 lua_pushboolean(L, false)
       
  1492         else
       
  1493             lua_pushboolean(L, false);
       
  1494         end
       
  1495     else
       
  1496         lua_pushnil(L); // return value on stack (nil)
       
  1497     lc_ishogalive:= 1
  1476 end;
  1498 end;
  1477 
  1499 
  1478 function lc_ishoglocal(L : Plua_State) : LongInt; Cdecl;
  1500 function lc_ishoglocal(L : Plua_State) : LongInt; Cdecl;
  1479 var gear : PGear;
  1501 var gear : PGear;
  1480 begin
  1502 begin
  4475 lua_register(luaState, _P'SetClanColor', @lc_setclancolor);
  4497 lua_register(luaState, _P'SetClanColor', @lc_setclancolor);
  4476 lua_register(luaState, _P'GetHogVoicepack', @lc_gethogvoicepack);
  4498 lua_register(luaState, _P'GetHogVoicepack', @lc_gethogvoicepack);
  4477 lua_register(luaState, _P'GetHogFlag', @lc_gethogflag);
  4499 lua_register(luaState, _P'GetHogFlag', @lc_gethogflag);
  4478 lua_register(luaState, _P'GetHogFort', @lc_gethogfort);
  4500 lua_register(luaState, _P'GetHogFort', @lc_gethogfort);
  4479 lua_register(luaState, _P'GetHogGrave', @lc_gethoggrave);
  4501 lua_register(luaState, _P'GetHogGrave', @lc_gethoggrave);
       
  4502 lua_register(luaState, _P'IsHogAlive', @lc_ishogalive);
  4480 lua_register(luaState, _P'IsHogLocal', @lc_ishoglocal);
  4503 lua_register(luaState, _P'IsHogLocal', @lc_ishoglocal);
  4481 lua_register(luaState, _P'GetHogTeamName', @lc_gethogteamname);
  4504 lua_register(luaState, _P'GetHogTeamName', @lc_gethogteamname);
  4482 lua_register(luaState, _P'SetHogTeamName', @lc_sethogteamname);
  4505 lua_register(luaState, _P'SetHogTeamName', @lc_sethogteamname);
  4483 lua_register(luaState, _P'GetHogName', @lc_gethogname);
  4506 lua_register(luaState, _P'GetHogName', @lc_gethogname);
  4484 lua_register(luaState, _P'SetHogName', @lc_sethogname);
  4507 lua_register(luaState, _P'SetHogName', @lc_sethogname);