From b8ec197b2aae23a3236f5aa867b1335e1da3d656 Mon Sep 17 00:00:00 2001 From: "Spring E. Thing" Date: Thu, 13 Feb 2025 19:04:58 +0000 Subject: [PATCH] player->whip is now readable & writable through Lua --- src/lua_playerlib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index ee0dc0ebe..ee56da06f 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -684,6 +684,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->griefWarned); else if (fastcmp(field,"splitscreenindex")) lua_pushinteger(L, plr->splitscreenindex); + else if (fastcmp(field,"whip")) + LUA_PushUserdata(L, plr->whip, META_MOBJ); #ifdef HWRENDER else if (fastcmp(field,"fovadd")) lua_pushfixed(L, plr->fovadd); @@ -1241,6 +1243,13 @@ static int player_set(lua_State *L) plr->griefWarned = luaL_checkinteger(L, 3); else if (fastcmp(field,"splitscreenindex")) return NOSET; + else if (fastcmp(field,"whip")) + { + mobj_t *mo = NULL; + if (!lua_isnil(L, 3)) + mo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)); + P_SetTarget(&plr->whip, mo); + } #ifdef HWRENDER else if (fastcmp(field,"fovadd")) plr->fovadd = luaL_checkfixed(L, 3);