]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Set the player's colour each frame on the server side so the scoreboard reflects...
authorMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 19:37:36 +0000 (05:37 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 13 Jul 2020 19:37:36 +0000 (05:37 +1000)
qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc

index b7516d8d27ec661f5a24783f30ecfbafea2f97ac..47fcca7a17506b4f6a6d2c041ef17e031d148174 100644 (file)
@@ -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);