984 begin |
984 begin |
985 if lua_gettop(L) <> 3 then |
985 if lua_gettop(L) <> 3 then |
986 LuaError('Lua: Wrong number of parameters passed to SetEffect!') |
986 LuaError('Lua: Wrong number of parameters passed to SetEffect!') |
987 else begin |
987 else begin |
988 gear := GearByUID(lua_tointeger(L, 1)); |
988 gear := GearByUID(lua_tointeger(L, 1)); |
989 if gear <> nil then |
989 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
990 gear^.Hedgehog^.Effects[THogEffect(lua_tointeger(L, 2))]:= lua_toboolean(L, 3); |
990 gear^.Hedgehog^.Effects[THogEffect(lua_tointeger(L, 2))]:= lua_toboolean(L, 3); |
991 end; |
991 end; |
992 lc_seteffect := 0; |
992 lc_seteffect := 0; |
|
993 end; |
|
994 function lc_geteffect(L : Plua_State) : LongInt; Cdecl; |
|
995 var gear : PGear; |
|
996 begin |
|
997 if lua_gettop(L) <> 2 then |
|
998 begin |
|
999 LuaError('Lua: Wrong number of parameters passed to GetEffect!'); |
|
1000 end |
|
1001 else |
|
1002 begin |
|
1003 gear:= GearByUID(lua_tointeger(L, 1)); |
|
1004 if (gear <> nil) and (gear^.Hedgehog <> nil) then |
|
1005 lua_pushboolean(L, gear^.Hedgehog^.Effects[THogEffect(lua_tointeger(L, 2))]) |
|
1006 else |
|
1007 lua_pushboolean(L, false) |
|
1008 end; |
|
1009 lc_geteffect:= 1 |
993 end; |
1010 end; |
994 |
1011 |
995 function lc_setstate(L : Plua_State) : LongInt; Cdecl; |
1012 function lc_setstate(L : Plua_State) : LongInt; Cdecl; |
996 var gear : PGear; |
1013 var gear : PGear; |
997 begin |
1014 begin |
1838 lua_register(luaState, 'AddHog', @lc_addhog); |
1855 lua_register(luaState, 'AddHog', @lc_addhog); |
1839 lua_register(luaState, 'AddAmmo', @lc_addammo); |
1856 lua_register(luaState, 'AddAmmo', @lc_addammo); |
1840 lua_register(luaState, 'SetHealth', @lc_sethealth); |
1857 lua_register(luaState, 'SetHealth', @lc_sethealth); |
1841 lua_register(luaState, 'GetHealth', @lc_gethealth); |
1858 lua_register(luaState, 'GetHealth', @lc_gethealth); |
1842 lua_register(luaState, 'SetEffect', @lc_seteffect); |
1859 lua_register(luaState, 'SetEffect', @lc_seteffect); |
|
1860 lua_register(luaState, 'GetEffect', @lc_geteffect); |
1843 lua_register(luaState, 'GetHogClan', @lc_gethogclan); |
1861 lua_register(luaState, 'GetHogClan', @lc_gethogclan); |
1844 lua_register(luaState, 'GetClanColor', @lc_getclancolor); |
1862 lua_register(luaState, 'GetClanColor', @lc_getclancolor); |
1845 lua_register(luaState, 'SetClanColor', @lc_setclancolor); |
1863 lua_register(luaState, 'SetClanColor', @lc_setclancolor); |
1846 lua_register(luaState, 'GetHogTeamName', @lc_gethogteamname); |
1864 lua_register(luaState, 'GetHogTeamName', @lc_gethogteamname); |
1847 lua_register(luaState, 'GetHogName', @lc_gethogname); |
1865 lua_register(luaState, 'GetHogName', @lc_gethogname); |