hedgewars/uScript.pas
changeset 7726 1137406bce12
parent 7721 2b1ad418ba39
child 7754 e81dc9bef8b8
equal deleted inserted replaced
7725:4ad05a478c6c 7726:1137406bce12
   643         gear:= GearByUID(lua_tointeger(L, 1));
   643         gear:= GearByUID(lua_tointeger(L, 1));
   644         if gear <> nil then
   644         if gear <> nil then
   645             gear^.Pos:= lua_tointeger(L, 2);
   645             gear^.Pos:= lua_tointeger(L, 2);
   646         end;
   646         end;
   647     lc_setgearpos:= 0
   647     lc_setgearpos:= 0
       
   648 end;
       
   649 
       
   650 function lc_getgearcollisionmask(L : Plua_State) : LongInt; Cdecl;
       
   651 var gear : PGear;
       
   652 begin
       
   653     if lua_gettop(L) <> 1 then
       
   654         begin
       
   655         LuaError('Lua: Wrong number of parameters passed to GetGearCollisionMask!');
       
   656         lua_pushnil(L); // return value on stack (nil)
       
   657         end
       
   658     else
       
   659         begin
       
   660         gear:= GearByUID(lua_tointeger(L, 1));
       
   661         if gear <> nil then
       
   662             lua_pushinteger(L, gear^.CollisionMask)
       
   663         else
       
   664             lua_pushnil(L);
       
   665         end;
       
   666     lc_getgearcollisionmask:= 1
       
   667 end;
       
   668 
       
   669 function lc_setgearcollisionmask(L : Plua_State) : LongInt; Cdecl;
       
   670 var gear : PGear;
       
   671 begin
       
   672     if lua_gettop(L) <> 2 then
       
   673         LuaError('Lua: Wrong number of parameters passed to SetGearCollisionMask!')
       
   674     else
       
   675         begin
       
   676         gear:= GearByUID(lua_tointeger(L, 1));
       
   677         if gear <> nil then
       
   678             gear^.CollisionMask:= lua_tointeger(L, 2);
       
   679         end;
       
   680     lc_setgearcollisionmask:= 0
   648 end;
   681 end;
   649 
   682 
   650 function lc_gethoglevel(L : Plua_State): LongInt; Cdecl;
   683 function lc_gethoglevel(L : Plua_State): LongInt; Cdecl;
   651 var gear : PGear;
   684 var gear : PGear;
   652 begin
   685 begin
  2325 lua_register(luaState, _P'GetGearRadius', @lc_getgearradius);
  2358 lua_register(luaState, _P'GetGearRadius', @lc_getgearradius);
  2326 lua_register(luaState, _P'GetGearMessage', @lc_getgearmessage);
  2359 lua_register(luaState, _P'GetGearMessage', @lc_getgearmessage);
  2327 lua_register(luaState, _P'SetGearMessage', @lc_setgearmessage);
  2360 lua_register(luaState, _P'SetGearMessage', @lc_setgearmessage);
  2328 lua_register(luaState, _P'GetGearPos', @lc_getgearpos);
  2361 lua_register(luaState, _P'GetGearPos', @lc_getgearpos);
  2329 lua_register(luaState, _P'SetGearPos', @lc_setgearpos);
  2362 lua_register(luaState, _P'SetGearPos', @lc_setgearpos);
       
  2363 lua_register(luaState, _P'GetGearCollisionMask', @lc_getgearcollisionmask);
       
  2364 lua_register(luaState, _P'SetGearCollisionMask', @lc_setgearcollisionmask);
  2330 lua_register(luaState, _P'GetRandom', @lc_getrandom);
  2365 lua_register(luaState, _P'GetRandom', @lc_getrandom);
  2331 lua_register(luaState, _P'SetWind', @lc_setwind);
  2366 lua_register(luaState, _P'SetWind', @lc_setwind);
  2332 lua_register(luaState, _P'GetDataPath', @lc_getdatapath);
  2367 lua_register(luaState, _P'GetDataPath', @lc_getdatapath);
  2333 lua_register(luaState, _P'GetUserDataPath', @lc_getuserdatapath);
  2368 lua_register(luaState, _P'GetUserDataPath', @lc_getuserdatapath);
  2334 lua_register(luaState, _P'MapHasBorder', @lc_maphasborder);
  2369 lua_register(luaState, _P'MapHasBorder', @lc_maphasborder);