Expose P_IsLocalPlayer to Lua

This commit is contained in:
SMS Alfredo 2023-05-31 22:45:00 -05:00
parent d6d424f102
commit e65bdf8d2f

View file

@ -1327,6 +1327,17 @@ static int lib_pSetObjectMomZ(lua_State *L)
return 0; return 0;
} }
static int lib_pIsLocalPlayer(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
//NOHUD
//INLEVEL
if (!player)
return LUA_ErrInvalid(L, "player_t");
lua_pushboolean(L, P_IsLocalPlayer(player));
return 1;
}
static int lib_pPlayJingle(lua_State *L) static int lib_pPlayJingle(lua_State *L)
{ {
player_t *player = NULL; player_t *player = NULL;
@ -4085,6 +4096,7 @@ static luaL_Reg lib[] = {
{"P_InQuicksand",lib_pInQuicksand}, {"P_InQuicksand",lib_pInQuicksand},
{"P_InJumpFlipSector",lib_pInJumpFlipSector}, {"P_InJumpFlipSector",lib_pInJumpFlipSector},
{"P_SetObjectMomZ",lib_pSetObjectMomZ}, {"P_SetObjectMomZ",lib_pSetObjectMomZ},
{"P_IsLocalPlayer",lib_pIsLocalPlayer},
{"P_PlayJingle",lib_pPlayJingle}, {"P_PlayJingle",lib_pPlayJingle},
{"P_PlayJingleMusic",lib_pPlayJingleMusic}, {"P_PlayJingleMusic",lib_pPlayJingleMusic},
{"P_RestoreMusic",lib_pRestoreMusic}, {"P_RestoreMusic",lib_pRestoreMusic},