mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-24 11:21:29 +00:00
Prevent spectate griefing
If the player count dips below what was stored on the start of the last lap, then don't do time over so that someone can't just spectate at the end of a race out of rage. Y'all are assholes :V
This commit is contained in:
parent
6a0b1526b9
commit
01c48c88d0
7 changed files with 19 additions and 2 deletions
|
@ -461,6 +461,7 @@ extern tic_t indirectitemcooldown;
|
|||
extern tic_t spbincoming;
|
||||
extern UINT8 spbplayer;
|
||||
extern tic_t mapreset;
|
||||
extern UINT8 nospectategrief;
|
||||
|
||||
extern boolean legitimateexit;
|
||||
extern boolean comebackshowninfo;
|
||||
|
|
|
@ -267,6 +267,7 @@ tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any othe
|
|||
tic_t spbincoming; // Timer before SPB hits, can switch targets at this point
|
||||
UINT8 spbplayer; // Player num that used the last SPB
|
||||
tic_t mapreset; // Map reset delay when enough players have joined an empty game
|
||||
UINT8 nospectategrief; // How many players need to be in-game to eliminate last; for preventing spectate griefing
|
||||
|
||||
// Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players)
|
||||
boolean legitimateexit; // Did this client actually finish the match?
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
// spbincoming is the timer before k_deathsentence is cast on the player in 1st
|
||||
// spbplayer is the last player who fired a SPB
|
||||
// mapreset is set when enough players fill an empty server
|
||||
// nospectategrief is the players in-game needed to eliminate the person in last
|
||||
|
||||
|
||||
//{ SRB2kart Color Code
|
||||
|
|
|
@ -2150,7 +2150,7 @@ boolean P_CheckRacers(void)
|
|||
numplayersingame++;
|
||||
}
|
||||
|
||||
if (numplayersingame > 1) // if there's more than one player in-game, this is safe to do
|
||||
if (numplayersingame >= nospectategrief) // prevent spectate griefing
|
||||
{
|
||||
// check if we just got unlucky and there was only one guy who was a problem
|
||||
for (j = i+1; j < MAXPLAYERS; j++)
|
||||
|
|
|
@ -3273,6 +3273,7 @@ static void P_NetArchiveMisc(void)
|
|||
WRITEUINT32(save_p, spbincoming);
|
||||
WRITEUINT8(save_p, spbplayer);
|
||||
WRITEUINT32(save_p, mapreset);
|
||||
WRITEUINT8(save_p, nospectategrief);
|
||||
|
||||
// Is it paused?
|
||||
if (paused)
|
||||
|
@ -3379,6 +3380,7 @@ static inline boolean P_NetUnArchiveMisc(void)
|
|||
spbincoming = READUINT32(save_p);
|
||||
spbplayer = READUINT8(save_p);
|
||||
mapreset = READUINT32(save_p);
|
||||
nospectategrief = READUINT8(save_p);
|
||||
|
||||
// Is it paused?
|
||||
if (READUINT8(save_p) == 0x2f)
|
||||
|
|
|
@ -3027,6 +3027,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
spbincoming = 0;
|
||||
spbplayer = 0;
|
||||
mapreset = 0;
|
||||
nospectategrief = 0;
|
||||
|
||||
// clear special respawning que
|
||||
iquehead = iquetail = 0;
|
||||
|
|
13
src/p_spec.c
13
src/p_spec.c
|
@ -4249,12 +4249,23 @@ DoneSection2:
|
|||
S_StartSound(NULL, sfx_s221);
|
||||
}
|
||||
|
||||
//
|
||||
//player->starpostangle = player->starposttime = player->starpostnum = 0;
|
||||
//player->starpostx = player->starposty = player->starpostz = 0;
|
||||
|
||||
// Play the starpost sound for 'consistency'
|
||||
// S_StartSound(player->mo, sfx_strpst);
|
||||
|
||||
// Figure out how many are playing on the last lap, to prevent spectate griefing
|
||||
if (!nospectategrief && player->laps == (UINT8)(cv_numlaps.value - 1))
|
||||
{
|
||||
UINT8 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
nospectategrief++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (player->starpostnum)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue