Force respawn automatically in DM/TDM, PF and HTF in mastermode MATCH
This commit is contained in:
@@ -126,6 +126,7 @@ enum
|
||||
#define m_noprimary (m_pistol || m_lss)
|
||||
#define m_noguns (m_nopistol && m_noprimary)
|
||||
#define m_arena (m_lms || m_lss || m_osok)
|
||||
#define m_autospawn (gamemode == 0 || gamemode == 2 || gamemode == 6 || gamemode == 13 || gamemode == 16)
|
||||
#define m_teammode (gamemode==0 || gamemode==4 || gamemode==5 || gamemode==7 || gamemode==11 || gamemode==13 || gamemode==14 || gamemode==16 || gamemode==17 || gamemode==20 || gamemode==21)
|
||||
#define m_tarena (m_arena && m_teammode)
|
||||
#define m_botmode (gamemode==7 || gamemode == 8 || gamemode==12 || (gamemode>=18 && gamemode<=21))
|
||||
|
||||
@@ -1590,6 +1590,22 @@ int canspawn(client *c) // beware: canspawn() doesn't check m_arena!
|
||||
return SP_OK;
|
||||
}
|
||||
|
||||
void autospawncheck()
|
||||
{
|
||||
if(mastermode != MM_MATCH || !m_autospawn || interm) return;
|
||||
|
||||
loopv(clients) if(clients[i]->type!=ST_EMPTY && clients[i]->isauthed && team_isactive(clients[i]->team))
|
||||
{
|
||||
client *cl = clients[i];
|
||||
if((cl->state.state == CS_DEAD || cl->state.state == CS_SPECTATE)
|
||||
&& canspawn(cl) == SP_OK && !cl->autospawn)
|
||||
{
|
||||
sendspawn(cl);
|
||||
cl->autospawn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** FIXME: this function is unnecessarily complicated */
|
||||
bool updateclientteam(int cln, int newteam, int ftr)
|
||||
{
|
||||
@@ -3099,6 +3115,7 @@ void process(ENetPacket *packet, int sender, int chan)
|
||||
ls!=cl->state.lifesequence || cl->state.lastspawn<0 || gunselect<0 || gunselect>=NUMGUNS || gunselect == GUN_CPISTOL) break;
|
||||
cl->state.lastspawn = -1;
|
||||
cl->state.spawn = gamemillis;
|
||||
cl->autospawn = false;
|
||||
cl->upspawnp = false;
|
||||
cl->state.state = CS_ALIVE;
|
||||
cl->state.gunselect = gunselect;
|
||||
@@ -3873,6 +3890,7 @@ void serverslice(uint timeout) // main server update, called from cube main lo
|
||||
}
|
||||
if(m_ktf && !ktfflagingame) flagaction(rnd(2), FA_RESET, -1); // ktf flag watchdog
|
||||
if(m_arena) arenacheck();
|
||||
else if(m_autospawn) autospawncheck();
|
||||
// if(m_lms) lmscheck();
|
||||
sendextras();
|
||||
if ( scl.afk_limit && mastermode == MM_OPEN && next_afk_check < servmillis && gamemillis > 20 * 1000 ) check_afk();
|
||||
|
||||
@@ -256,6 +256,7 @@ struct client // server side version of "dynent" type
|
||||
bool at3_dontmove;
|
||||
int spawnindex;
|
||||
int spawnperm, spawnpermsent;
|
||||
bool autospawn;
|
||||
int salt;
|
||||
string pwd;
|
||||
uint authreq; // for AUTH
|
||||
@@ -294,6 +295,7 @@ struct client // server side version of "dynent" type
|
||||
isonrightmap = m_coop;
|
||||
spawnperm = SP_WRONGMAP;
|
||||
spawnpermsent = servmillis;
|
||||
autospawn = false;
|
||||
if(!getmap)
|
||||
{
|
||||
loggedwrongmap = false;
|
||||
|
||||
Reference in New Issue
Block a user