From 84438ff8376391fee0cfb160fb637a23102963e2 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 31 May 2023 22:39:08 -0500 Subject: [PATCH] Expose P_GivePlayerSpheres to Lua --- src/lua_baselib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 25fa38769..0ebb143ca 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1422,6 +1422,18 @@ static int lib_pGivePlayerRings(lua_State *L) return 0; } +static int lib_pGivePlayerSpheres(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + INT32 num_spheres = (INT32)luaL_checkinteger(L, 2); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_GivePlayerSpheres(player, num_spheres); + return 0; +} + static int lib_pGivePlayerLives(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); @@ -4091,6 +4103,7 @@ static luaL_Reg lib[] = { {"P_SpawnShieldOrb",lib_pSpawnShieldOrb}, {"P_SpawnGhostMobj",lib_pSpawnGhostMobj}, {"P_GivePlayerRings",lib_pGivePlayerRings}, + {"P_GivePlayerSpheres",lib_pGivePlayerSpheres}, {"P_GivePlayerLives",lib_pGivePlayerLives}, {"P_GiveCoopLives",lib_pGiveCoopLives}, {"P_ResetScore",lib_pResetScore},