Merge branch 'fix-joiner-consoleplayer' into 'next'

Fix consoleplayer returning the server player during joining phase

See merge request STJr/SRB2!1396
This commit is contained in:
LJ Sonic 2021-02-12 17:42:15 -05:00
commit 481ddb6532
2 changed files with 2 additions and 2 deletions

View File

@ -1678,7 +1678,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// At this point, cmd doesn't contain the final angle yet,
// So we need to temporarily transform it so Lua scripters
// don't need to handle it differently than in other hooks.
if (gamestate == GS_LEVEL)
if (addedtogame && gamestate == GS_LEVEL)
{
INT16 extra = ticcmd_oldangleturn[forplayer] - player->oldrelangleturn;
INT16 origangle = cmd->angleturn;

View File

@ -333,7 +333,7 @@ int LUA_PushGlobals(lua_State *L, const char *word)
return 1;
// local player variables, by popular request
} else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1)
if (consoleplayer < 0 || !playeringame[consoleplayer])
if (!addedtogame || consoleplayer < 0 || !playeringame[consoleplayer])
return 0;
LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER);
return 1;