hedgewars/uScript.pas
branchhedgeroid
changeset 5530 25d4118056e1
parent 5495 272ed78e59a7
parent 5527 418741abd209
child 5548 73f2fec65257
equal deleted inserted replaced
5516:8710987d3484 5530:25d4118056e1
  1212             end
  1212             end
  1213         end;
  1213         end;
  1214     lc_setgearposition:= 0
  1214     lc_setgearposition:= 0
  1215 end;
  1215 end;
  1216 
  1216 
       
  1217 function lc_getgeartarget(L : Plua_State) : LongInt; Cdecl;
       
  1218 var gear: PGear;
       
  1219 begin
       
  1220     if lua_gettop(L) <> 1 then
       
  1221         begin
       
  1222         LuaError('Lua: Wrong number of parameters passed to GetGearTarget!');
       
  1223         lua_pushnil(L);
       
  1224         lua_pushnil(L)
       
  1225         end
       
  1226     else
       
  1227         begin
       
  1228         gear:= GearByUID(lua_tointeger(L, 1));
       
  1229         if gear <> nil then
       
  1230             begin
       
  1231             lua_pushinteger(L, gear^.TargetX);
       
  1232             lua_pushinteger(L, gear^.TargetY)
       
  1233             end
       
  1234         end;
       
  1235     lc_getgeartarget:= 2;
       
  1236 end;
       
  1237 
       
  1238 function lc_setgeartarget(L : Plua_State) : LongInt; Cdecl;
       
  1239 var gear: PGear;
       
  1240 begin
       
  1241     if lua_gettop(L) <> 3 then
       
  1242         LuaError('Lua: Wrong number of parameters passed to SetGearTarget!')
       
  1243     else
       
  1244         begin
       
  1245         gear:= GearByUID(lua_tointeger(L, 1));
       
  1246         if gear <> nil then
       
  1247             begin
       
  1248             gear^.TargetX:= lua_tointeger(L, 2);
       
  1249             gear^.TargetY:= lua_tointeger(L, 3)
       
  1250             end
       
  1251         end;
       
  1252     lc_setgeartarget:= 0
       
  1253 end;
       
  1254 
  1217 function lc_getgearvelocity(L : Plua_State) : LongInt; Cdecl;
  1255 function lc_getgearvelocity(L : Plua_State) : LongInt; Cdecl;
  1218 var gear: PGear;
  1256 var gear: PGear;
  1219 begin
  1257 begin
  1220     if lua_gettop(L) <> 1 then
  1258     if lua_gettop(L) <> 1 then
  1221         begin
  1259         begin
  1817     ScriptSetInteger(EnumToStr(he), ord(he));
  1855     ScriptSetInteger(EnumToStr(he), ord(he));
  1818 
  1856 
  1819 for cg:= Low(TCapGroup) to High(TCapGroup) do
  1857 for cg:= Low(TCapGroup) to High(TCapGroup) do
  1820     ScriptSetInteger(EnumToStr(cg), ord(cg));
  1858     ScriptSetInteger(EnumToStr(cg), ord(cg));
  1821 
  1859 
       
  1860 ScriptSetInteger('gstDrowning'       ,$00000001);
       
  1861 ScriptSetInteger('gstHHDriven'       ,$00000002);
       
  1862 ScriptSetInteger('gstMoving'         ,$00000004);
       
  1863 ScriptSetInteger('gstAttacked'       ,$00000008);
       
  1864 ScriptSetInteger('gstAttacking'      ,$00000010);
       
  1865 ScriptSetInteger('gstCollision'      ,$00000020);
       
  1866 ScriptSetInteger('gstHHChooseTarget' ,$00000040);
       
  1867 ScriptSetInteger('gstHHJumping'      ,$00000100);
       
  1868 ScriptSetInteger('gsttmpFlag'        ,$00000200);
       
  1869 ScriptSetInteger('gstHHThinking'     ,$00000800);
       
  1870 ScriptSetInteger('gstNoDamage'       ,$00001000);
       
  1871 ScriptSetInteger('gstHHHJump'        ,$00002000);
       
  1872 ScriptSetInteger('gstAnimation'      ,$00004000);
       
  1873 ScriptSetInteger('gstHHDeath'        ,$00008000);
       
  1874 ScriptSetInteger('gstWinner'         ,$00010000);
       
  1875 ScriptSetInteger('gstWait'           ,$00020000);
       
  1876 ScriptSetInteger('gstNotKickable'    ,$00040000);
       
  1877 ScriptSetInteger('gstLoser'          ,$00080000);
       
  1878 ScriptSetInteger('gstHHGone'         ,$00100000);
       
  1879 ScriptSetInteger('gstInvisible'      ,$00200000);
       
  1880 
  1822 // register functions
  1881 // register functions
  1823 lua_register(luaState, 'band', @lc_band);
  1882 lua_register(luaState, 'band', @lc_band);
  1824 lua_register(luaState, 'bor', @lc_bor);
  1883 lua_register(luaState, 'bor', @lc_bor);
  1825 lua_register(luaState, 'bnot', @lc_bnot);
  1884 lua_register(luaState, 'bnot', @lc_bnot);
  1826 lua_register(luaState, 'GetInputMask', @lc_getinputmask);
  1885 lua_register(luaState, 'GetInputMask', @lc_getinputmask);
  1841 lua_register(luaState, 'GetGearType', @lc_getgeartype);
  1900 lua_register(luaState, 'GetGearType', @lc_getgeartype);
  1842 lua_register(luaState, 'EndGame', @lc_endgame);
  1901 lua_register(luaState, 'EndGame', @lc_endgame);
  1843 lua_register(luaState, 'FindPlace', @lc_findplace);
  1902 lua_register(luaState, 'FindPlace', @lc_findplace);
  1844 lua_register(luaState, 'SetGearPosition', @lc_setgearposition);
  1903 lua_register(luaState, 'SetGearPosition', @lc_setgearposition);
  1845 lua_register(luaState, 'GetGearPosition', @lc_getgearposition);
  1904 lua_register(luaState, 'GetGearPosition', @lc_getgearposition);
       
  1905 lua_register(luaState, 'SetGearTarget', @lc_setgeartarget);
       
  1906 lua_register(luaState, 'GetGearTarget', @lc_getgeartarget);
  1846 lua_register(luaState, 'SetGearVelocity', @lc_setgearvelocity);
  1907 lua_register(luaState, 'SetGearVelocity', @lc_setgearvelocity);
  1847 lua_register(luaState, 'GetGearVelocity', @lc_getgearvelocity);
  1908 lua_register(luaState, 'GetGearVelocity', @lc_getgearvelocity);
  1848 lua_register(luaState, 'ParseCommand', @lc_parsecommand);
  1909 lua_register(luaState, 'ParseCommand', @lc_parsecommand);
  1849 lua_register(luaState, 'ShowMission', @lc_showmission);
  1910 lua_register(luaState, 'ShowMission', @lc_showmission);
  1850 lua_register(luaState, 'HideMission', @lc_hidemission);
  1911 lua_register(luaState, 'HideMission', @lc_hidemission);