From: Mario Date: Mon, 13 Jul 2020 19:37:36 +0000 (+1000) Subject: Set the player's colour each frame on the server side so the scoreboard reflects... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9cb0f8411702e9b9debd7beb0b821699ea40139;p=xonotic%2Fxonotic-data.pk3dir.git Set the player's colour each frame on the server side so the scoreboard reflects their status (hunter colour is hidden until the game is stopped at the end of a round) --- diff --git a/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc b/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc index b7516d8d2..47fcca7a1 100644 --- a/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc +++ b/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc @@ -223,6 +223,21 @@ MUTATOR_HOOKFUNCTION(surv, ClientObituary) M_ARGV(5, bool) = true; // anonymous attacker } +MUTATOR_HOOKFUNCTION(surv, PlayerPreThink) +{ + entity player = M_ARGV(0, entity); + + if(IS_PLAYER(player)) + { + // update the scoreboard colour display to out the real killer at the end of the round + // running this every frame to avoid cheats + int plcolor = SURV_COLOR_PREY; + if(player.survival_status == SURV_STATUS_HUNTER && game_stopped) + plcolor = SURV_COLOR_HUNTER; + setcolor(player, plcolor); + } +} + MUTATOR_HOOKFUNCTION(surv, PlayerSpawn) { entity player = M_ARGV(0, entity);