From 75dc0326b6d069125e8f1f955f3003b39aa08f4c Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sat, 16 Apr 2022 18:38:07 +1000 Subject: [PATCH] Implement sv_showspectators 2: Only spectators can see the spectators list --- qcsrc/server/client.qc | 3 ++- qcsrc/server/world.qc | 1 + xonotic-server.cfg | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 44226c6f5..cab642e67 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -137,7 +137,8 @@ bool ClientData_Send(entity this, entity to, int sf) if (CS(e).race_completed) sf |= BIT(0); // forced scoreboard if (CS(to).spectatee_status) sf |= BIT(1); // spectator ent number follows if (CS(e).zoomstate) sf |= BIT(2); // zoomed - if (autocvar_sv_showspectators) sf |= BIT(4); // show spectators + if (autocvar_sv_showspectators == 1 || (autocvar_sv_showspectators && IS_SPEC(to))) + sf |= BIT(4); // show spectators WriteHeader(MSG_ENTITY, ENT_CLIENT_CLIENTDATA); WriteByte(MSG_ENTITY, sf); diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 9d4678ffd..69eefdc5c 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -495,6 +495,7 @@ void cvar_changes_init() BADCVAR("sv_motd"); BADCVAR("sv_public"); BADCVAR("sv_showfps"); + BADCVAR("sv_showspectators"); BADCVAR("sv_status_privacy"); BADCVAR("sv_taunt"); BADCVAR("sv_vote_call"); diff --git a/xonotic-server.cfg b/xonotic-server.cfg index c9a22805c..859314980 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -584,7 +584,7 @@ set sv_join_notices_time 15 "how long the alert is shown on the player's screen" set sv_simple_items 1 "allow or forbid client use of simple items" -set sv_showspectators 1 "Show who's spectating who in the player info panel when client has cl_showspectators on. Shouldn't be used on competitive servers, also disable when watching a suspected cheater" +set sv_showspectators 1 "Show who's spectating who in the player info panel when client has cl_showspectators on. 1: shouldn't be used on competitive servers, or when watching a suspected cheater. 2: only spectators can see the spectators list" set sv_damagetext 2 "<= 0: disabled, >= 1: visible to spectators, >= 2: visible to attacker, >= 3: all players see everyone's damage" -- 2.39.2