From 3386ff6b902cab5a8c88fc2c4d7cf8ca1651befc Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 5 Nov 2020 20:02:40 -0800 Subject: [PATCH] Allow accessing a player even if there is no mobj The worst part is you could've just saved the player userdata and accessed it later anyway while player.mo is nil. --- src/lua_playerlib.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index c4c996e5e..24bc6c480 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -52,8 +52,6 @@ static int lib_iteratePlayers(lua_State *L) { if (!playeringame[i]) continue; - if (!players[i].mo) - continue; LUA_PushUserdata(L, &players[i], META_PLAYER); return 1; } @@ -74,8 +72,6 @@ static int lib_getPlayer(lua_State *L) return LUA_PushServerPlayer(L); if (!playeringame[i]) return 0; - if (!players[i].mo) - return 0; LUA_PushUserdata(L, &players[i], META_PLAYER); return 1; } @@ -136,8 +132,6 @@ static int lib_iterateDisplayplayers(lua_State *L) if (i > splitscreen || !playeringame[displayplayers[i]]) return 0; // Stop! There are no more players for us to go through. There will never be a player gap in displayplayers. - if (!players[displayplayers[i]].mo) - continue; LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER); lua_pushinteger(L, i); // push this to recall what number we were on for the next function call. I suppose this also means you can retrieve the splitscreen player number with 'for p, n in displayplayers.iterate'! return 2; @@ -158,8 +152,6 @@ static int lib_getDisplayplayers(lua_State *L) return 0; if (!playeringame[displayplayers[i]]) return 0; - if (!players[displayplayers[i]].mo) - return 0; LUA_PushUserdata(L, &players[displayplayers[i]], META_PLAYER); return 1; }