From 31e9d0cce4dfa9c9842fe4dcdc1be9a18bb04628 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 15 Oct 2020 06:48:59 +1000 Subject: [PATCH] Add a function to remove the buff icon model above players, call it when re-spawning, fixes #2503 --- .../common/mutators/mutator/buffs/sv_buffs.qc | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index be310669d..3b272e69c 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -57,6 +57,13 @@ void buffs_BuffModel_Spawn(entity player) setcefc(player.buff_model, buffs_BuffModel_Customize); } +void buffs_BuffModel_Remove(entity player) +{ + if(player.buff_model) + delete(player.buff_model); + player.buff_model = NULL; +} + vector buff_GlowColor(entity buff) { //if(buff.team) { return Team_ColorRGB(buff.team); } @@ -581,6 +588,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerSpawn) { entity player = M_ARGV(0, entity); + buffs_BuffModel_Remove(player); player.oldbuffs = 0; // reset timers here to prevent them continuing after re-spawn player.buff_disability_time = 0; @@ -631,11 +639,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDies) STAT(BUFFS, frag_target) = 0; STAT(BUFF_TIME, frag_target) = 0; - if(frag_target.buff_model) - { - delete(frag_target.buff_model); - frag_target.buff_model = NULL; - } + buffs_BuffModel_Remove(frag_target); } } @@ -741,11 +745,7 @@ MUTATOR_HOOKFUNCTION(buffs, ForbidThrowCurrentWeapon) bool buffs_RemovePlayer(entity player) { - if(player.buff_model) - { - delete(player.buff_model); - player.buff_model = NULL; - } + buffs_BuffModel_Remove(player); // also reset timers here to prevent them continuing after spectating player.buff_disability_time = 0; @@ -998,9 +998,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) } else { - if(player.buff_model) - delete(player.buff_model); - player.buff_model = NULL; + buffs_BuffModel_Remove(player); player.effects &= ~(EF_NOSHADOW); } -- 2.39.2