diff --git a/src/deh_lua.c b/src/deh_lua.c index 16b3dcfb1..082a8e459 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -513,8 +513,8 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) if (mathlib) return luaL_error(L, "sfx '%s' could not be found.\n", word); return 0; } - else if (!mathlib && fastncmp("k_",word,5)) { - p = word+5; + else if (!mathlib && fastncmp("k_",word,2)) { + p = word+2; for (i = 0; i < NUMKARTSTUFF; i++) if (fasticmp(p, KARTSTUFF_LIST[i])) { lua_pushinteger(L, i); @@ -522,8 +522,8 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) } return 0; } - else if (mathlib && fastncmp("K_",word,5)) { // SOCs are ALL CAPS! - p = word+5; + else if (mathlib && fastncmp("K_",word,2)) { // SOCs are ALL CAPS! + p = word+2; for (i = 0; i < NUMKARTSTUFF; i++) if (fastcmp(p, KARTSTUFF_LIST[i])) { lua_pushinteger(L, i); diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 0191e8e12..7a4720f55 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -910,6 +910,7 @@ static int kartstuff_get(lua_State *L) static int kartstuff_set(lua_State *L) { INT32 *kartstuff = *((INT32 **)luaL_checkudata(L, 1, META_KARTSTUFF)); + player_t *plr = (player_t*)(kartstuff - offsetof(player_t, kartstuff)); kartstufftype_t ks = luaL_checkinteger(L, 2); INT32 i = (INT32)luaL_checkinteger(L, 3); @@ -919,7 +920,17 @@ static int kartstuff_set(lua_State *L) return luaL_error(L, "Do not alter player_t in HUD rendering code!"); if (hook_cmd_running) return luaL_error(L, "Do not alter player_t in CMD building code!"); - kartstuff[ks] = i; + + switch (ks) + { + case k_sneakertimer: + plr->sneakertimer = i; + break; + + default: + return luaL_error(L, LUA_QL("kartstufftype_t") " cannot be %u", ks); + } + return 0; }