hedgewars/uScript.pas
changeset 4985 304d149bb3dd
parent 4976 088d40d8aba2
child 5013 04789ba3f200
equal deleted inserted replaced
4984:20da3c5c7dee 4985:304d149bb3dd
    59     uCaptions,
    59     uCaptions,
    60     uDebug,
    60     uDebug,
    61     uCollisions,
    61     uCollisions,
    62     uRenderUtils,
    62     uRenderUtils,
    63     uTextures,
    63     uTextures,
       
    64     uLandGraphics,
    64     SDLh; 
    65     SDLh; 
    65 
    66 
    66 var luaState : Plua_State;
    67 var luaState : Plua_State;
    67     ScriptAmmoLoadout : shortstring;
    68     ScriptAmmoLoadout : shortstring;
    68     ScriptAmmoProbability : shortstring;
    69     ScriptAmmoProbability : shortstring;
  1269             hat:= lua_tostring(L, 2);
  1270             hat:= lua_tostring(L, 2);
  1270             gear^.Hedgehog^.Hat:= hat;
  1271             gear^.Hedgehog^.Hat:= hat;
  1271             LoadHedgehogHat(gear, hat);
  1272             LoadHedgehogHat(gear, hat);
  1272         end;
  1273         end;
  1273     lc_sethoghat:= 0;
  1274     lc_sethoghat:= 0;
       
  1275 end;
       
  1276 
       
  1277 function lc_placegirder(L : Plua_State) : LongInt; Cdecl;
       
  1278 begin
       
  1279     if lua_gettop(L) <> 3 then
       
  1280         LuaError('Lua: Wrong number of parameters passed to PlaceGirder!')
       
  1281     else
       
  1282         TryPlaceOnLand(
       
  1283             lua_tointeger(L, 1) - SpritesData[sprAmGirder].Width div 2,
       
  1284             lua_tointeger(L, 2) - SpritesData[sprAmGirder].Height div 2,
       
  1285             sprAmGirder, lua_tointeger(L, 3), true, false);
       
  1286     lc_placegirder:= 0
  1274 end;
  1287 end;
  1275 ///////////////////
  1288 ///////////////////
  1276 
  1289 
  1277 procedure ScriptPrintStack;
  1290 procedure ScriptPrintStack;
  1278 var n, i : LongInt;
  1291 var n, i : LongInt;
  1689 lua_register(luaState, 'SetWind', @lc_setwind);
  1702 lua_register(luaState, 'SetWind', @lc_setwind);
  1690 lua_register(luaState, 'GetDataPath', @lc_getdatapath);
  1703 lua_register(luaState, 'GetDataPath', @lc_getdatapath);
  1691 lua_register(luaState, 'MapHasBorder', @lc_maphasborder);
  1704 lua_register(luaState, 'MapHasBorder', @lc_maphasborder);
  1692 lua_register(luaState, 'GetHogHat', @lc_gethoghat);
  1705 lua_register(luaState, 'GetHogHat', @lc_gethoghat);
  1693 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
  1706 lua_register(luaState, 'SetHogHat', @lc_sethoghat);
       
  1707 lua_register(luaState, 'PlaceGirder', @lc_placegirder);
  1694 
  1708 
  1695 
  1709 
  1696 ScriptClearStack; // just to be sure stack is empty
  1710 ScriptClearStack; // just to be sure stack is empty
  1697 ScriptLoaded:= false;
  1711 ScriptLoaded:= false;
  1698 end;
  1712 end;