mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 12:31:32 +00:00
Add variable to move idle players to spectators
This commit is contained in:
parent
33a1776f97
commit
7e3f6a2803
3 changed files with 18 additions and 2 deletions
|
@ -114,6 +114,7 @@ static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0,
|
||||||
consvar_t cv_playbackspeed = CVAR_INIT ("playbackspeed", "1", 0, playbackspeed_cons_t, NULL);
|
consvar_t cv_playbackspeed = CVAR_INIT ("playbackspeed", "1", 0, playbackspeed_cons_t, NULL);
|
||||||
|
|
||||||
consvar_t cv_idletime = CVAR_INIT ("idletime", "0", CV_SAVE, CV_Unsigned, NULL);
|
consvar_t cv_idletime = CVAR_INIT ("idletime", "0", CV_SAVE, CV_Unsigned, NULL);
|
||||||
|
consvar_t cv_idlespectate = CVAR_INIT ("idlespectate", "On", CV_SAVE, CV_OnOff, NULL);
|
||||||
consvar_t cv_dedicatedidletime = CVAR_INIT ("dedicatedidletime", "10", CV_SAVE, CV_Unsigned, NULL);
|
consvar_t cv_dedicatedidletime = CVAR_INIT ("dedicatedidletime", "10", CV_SAVE, CV_Unsigned, NULL);
|
||||||
|
|
||||||
consvar_t cv_httpsource = CVAR_INIT ("http_source", "", CV_SAVE, NULL, NULL);
|
consvar_t cv_httpsource = CVAR_INIT ("http_source", "", CV_SAVE, NULL, NULL);
|
||||||
|
@ -1372,9 +1373,23 @@ static void IdleUpdate(void)
|
||||||
if (players[i].lastinputtime > (tic_t)cv_idletime.value * TICRATE * 60)
|
if (players[i].lastinputtime > (tic_t)cv_idletime.value * TICRATE * 60)
|
||||||
{
|
{
|
||||||
players[i].lastinputtime = 0;
|
players[i].lastinputtime = 0;
|
||||||
|
if (cv_idlespectate.value && G_GametypeHasSpectators())
|
||||||
|
{
|
||||||
|
changeteam_union NetPacket;
|
||||||
|
UINT16 usvalue;
|
||||||
|
NetPacket.value.l = NetPacket.value.b = 0;
|
||||||
|
NetPacket.packet.newteam = 0;
|
||||||
|
NetPacket.packet.playernum = i;
|
||||||
|
NetPacket.packet.verification = true; // This signals that it's a server change
|
||||||
|
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||||
|
SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SendKick(i, KICK_MSG_IDLE | KICK_MSG_KEEP_BODY);
|
SendKick(i, KICK_MSG_IDLE | KICK_MSG_KEEP_BODY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
players[i].lastinputtime = 0;
|
players[i].lastinputtime = 0;
|
||||||
|
|
|
@ -73,7 +73,7 @@ extern UINT32 realpingtable[MAXPLAYERS];
|
||||||
extern UINT32 playerpingtable[MAXPLAYERS];
|
extern UINT32 playerpingtable[MAXPLAYERS];
|
||||||
extern tic_t servermaxping;
|
extern tic_t servermaxping;
|
||||||
|
|
||||||
extern consvar_t cv_netticbuffer, cv_resynchattempts, cv_blamecfail, cv_playbackspeed, cv_idletime, cv_dedicatedidletime;
|
extern consvar_t cv_netticbuffer, cv_resynchattempts, cv_blamecfail, cv_playbackspeed, cv_idletime, cv_idlespectate, cv_dedicatedidletime;
|
||||||
extern consvar_t cv_httpsource;
|
extern consvar_t cv_httpsource;
|
||||||
|
|
||||||
// Used in d_net, the only dependence
|
// Used in d_net, the only dependence
|
||||||
|
|
|
@ -620,6 +620,7 @@ void D_RegisterServerCommands(void)
|
||||||
CV_RegisterVar(&cv_blamecfail);
|
CV_RegisterVar(&cv_blamecfail);
|
||||||
CV_RegisterVar(&cv_dedicatedidletime);
|
CV_RegisterVar(&cv_dedicatedidletime);
|
||||||
CV_RegisterVar(&cv_idletime);
|
CV_RegisterVar(&cv_idletime);
|
||||||
|
CV_RegisterVar(&cv_idlespectate);
|
||||||
CV_RegisterVar(&cv_httpsource);
|
CV_RegisterVar(&cv_httpsource);
|
||||||
|
|
||||||
COM_AddCommand("ping", Command_Ping_f, COM_LUA);
|
COM_AddCommand("ping", Command_Ping_f, COM_LUA);
|
||||||
|
|
Loading…
Reference in a new issue