From: Mario Date: Wed, 14 Oct 2020 20:48:59 +0000 (+1000) Subject: Add a function to remove the buff icon model above players, call it when re-spawning... X-Git-Tag: xonotic-v0.8.5~736 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=31e9d0cce4dfa9c9842fe4dcdc1be9a18bb04628;p=xonotic%2Fxonotic-data.pk3dir.git Add a function to remove the buff icon model above players, call it when re-spawning, fixes #2503 --- 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); }