Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/action/a_esp.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// This is set to 1 if either atl or etv are 1
extern cvar_t *esp;

// Discrete game modes
extern cvar_t *atl;
extern cvar_t *etv;

#define IS_LEADER(ent) (teams[(ent)->client->resp.team].leader == (ent))
#define HAVE_LEADER(teamNum) (teams[(teamNum)].leader)
#define MAX_ESP_STRLEN 32
Expand Down
3 changes: 1 addition & 2 deletions src/action/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ typedef struct
int timeoutFrames;
float matchTime;
float emptyTime;
float quit_empty_time; // LRCON quit_on_empty: level.time when server first emptied, or -1 if not empty. Separate from emptyTime which empty_rotate uses as an accumulator.
int abandonFrames; // Countdown for abandon forfeit
int weapon_sound_framenum;
int pic_teamplay_timer_icon;
Expand Down Expand Up @@ -1396,8 +1397,6 @@ extern cvar_t *medkit_value;

// BEGIN AQ2 ETE
extern cvar_t *esp; // Enable or disable Espionage mode
extern cvar_t *atl; // Enable or disable Assassinate the Leader mode (do not set this manually)
extern cvar_t *etv; // Enable or disable Escort the VIP mode (do not set this manually)
extern cvar_t *esp_atl; // Prefer ATL mode even if ETV mode is available
extern cvar_t *esp_punish; // Enable or disable punishment for losing the around
extern cvar_t *esp_etv_halftime; // Enable or disable halftime in ETV mode
Expand Down
18 changes: 11 additions & 7 deletions src/action/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,6 @@ cvar_t *jump; // jumping mod

// BEGIN AQ2 ETE
cvar_t *esp;
cvar_t *atl;
cvar_t *etv;
cvar_t *esp_atl;
cvar_t *esp_punish;
cvar_t *esp_etv_halftime;
Expand Down Expand Up @@ -1344,18 +1342,24 @@ void G_RunFrame (void)
return;
}

// LRCON quit_on_empty logic
// LRCON quit_on_empty logic.
// Uses its own quit_empty_time field — sharing level.emptyTime with the
// empty_rotate accumulator above caused the old comparison
// `level.time - level.emptyTime > 5.0` to fire after one frame when a
// player left a long-running server (level.time was already large but
// emptyTime had just incremented from 0). Sentinel -1.0f means "not
// currently empty" so we can distinguish from level.time == 0 at start.
if (game.lrcon_config.quit_on_empty) {
if (empty) {
if (level.emptyTime == 0) {
level.emptyTime = level.time;
if (level.quit_empty_time < 0) {
level.quit_empty_time = level.time;
gi.dprintf("LRCON: Server empty, will quit in 5 seconds\n");
} else if (level.time - level.emptyTime > 5.0) {
} else if (level.time - level.quit_empty_time > 5.0f) {
gi.dprintf("LRCON: Quitting server (empty for 5+ seconds)\n");
gi.AddCommandString("quit\n");
}
} else {
level.emptyTime = 0;
level.quit_empty_time = -1.0f;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/action/g_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ void InitGame( void )
esp_matchmode = gi.cvar("esp_matchmode", "0", 0);
esp_respawn_uvtime = gi.cvar("esp_respawn_uvtime", "10", 0);
if (esp_respawn_uvtime->value > 20) {
gi.dprintf("esp_respawn_uvtime was set too high, setting to 2 seconds\n");
gi.dprintf("esp_respawn_uvtime was set too high, setting to 20 seconds\n");
gi.cvar_forceset("esp_respawn_uvtime", "20");
}
esp_debug = gi.cvar("esp_debug", "0", 0); // Set to 1 to enable debug messages for Espionage
Expand Down
4 changes: 4 additions & 0 deletions src/action/g_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,10 @@ void SpawnEntities (const char *mapname, const char *entities, const char *spawn
memset(&level, 0, sizeof (level));
memset(g_edicts, 0, game.maxentities * sizeof (g_edicts[0]));

// quit_empty_time uses -1 as the "not currently empty" sentinel (0 is a
// valid level.time at start of map).
level.quit_empty_time = -1.0f;

Q_strncpyz(level.mapname, mapname, sizeof(level.mapname));
Q_strncpyz(game.spawnpoint, spawnpoint, sizeof(game.spawnpoint));

Expand Down
5 changes: 5 additions & 0 deletions src/server/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ void SV_InitGame(unsigned mvd_spawn)
SV_MvdPostInit();
}

// Reset bot client slots on game (re)initialization. Cold-start gets
// zeroed bot_clients[] via BSS, but SV_InitGame can be called on
// restart/map-change where in-progress state could otherwise persist.
SV_BotInit();

if (svs.csr.extended && IS_NEW_GAME_API)
PmoveEnableExt(&svs.pmp);

Expand Down