* Set player->outofcoop to false if it's not a coop gametype.

* Expose player->outofcoop to Lua.
This commit is contained in:
toasterbabe 2017-07-04 14:58:58 +01:00
parent f809923f69
commit 1a7a0662ba
2 changed files with 30 additions and 22 deletions

View file

@ -320,6 +320,8 @@ static int player_get(lua_State *L)
lua_pushangle(L, plr->awayviewaiming); lua_pushangle(L, plr->awayviewaiming);
else if (fastcmp(field,"spectator")) else if (fastcmp(field,"spectator"))
lua_pushboolean(L, plr->spectator); lua_pushboolean(L, plr->spectator);
else if (fastcmp(field,"outofcoop"))
lua_pushboolean(L, plr->outofcoop);
else if (fastcmp(field,"bot")) else if (fastcmp(field,"bot"))
lua_pushinteger(L, plr->bot); lua_pushinteger(L, plr->bot);
else if (fastcmp(field,"jointime")) else if (fastcmp(field,"jointime"))
@ -597,6 +599,8 @@ static int player_set(lua_State *L)
plr->awayviewaiming = luaL_checkangle(L, 3); plr->awayviewaiming = luaL_checkangle(L, 3);
else if (fastcmp(field,"spectator")) else if (fastcmp(field,"spectator"))
plr->spectator = lua_toboolean(L, 3); plr->spectator = lua_toboolean(L, 3);
else if (fastcmp(field,"outofcoop"))
plr->outofcoop = lua_toboolean(L, 3);
else if (fastcmp(field,"bot")) else if (fastcmp(field,"bot"))
return NOSET; return NOSET;
else if (fastcmp(field,"jointime")) else if (fastcmp(field,"jointime"))

View file

@ -9106,7 +9106,10 @@ void P_SpawnPlayer(INT32 playernum)
|| (cv_coopstarposts.value == 2 && (p->jointime < 1 || p->outofcoop)))) // late join or die in new coop || (cv_coopstarposts.value == 2 && (p->jointime < 1 || p->outofcoop)))) // late join or die in new coop
|| (((cv_cooplives.value == 1) || !P_GetLives(p)) && p->lives <= 0))); // game over and can't redistribute lives || (((cv_cooplives.value == 1) || !P_GetLives(p)) && p->lives <= 0))); // game over and can't redistribute lives
} }
else if (netgame && p->jointime < 1) else
{
p->outofcoop = false;
if (netgame && p->jointime < 1)
p->spectator = true; p->spectator = true;
else if (multiplayer && !netgame) else if (multiplayer && !netgame)
{ {
@ -9134,6 +9137,7 @@ void P_SpawnPlayer(INT32 playernum)
else // Otherwise, never spectator. else // Otherwise, never spectator.
p->spectator = false; p->spectator = false;
} }
}
if (G_GametypeHasTeams()) if (G_GametypeHasTeams())
{ {