]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up buffs_BuffModel_Customize, fix some duplicate checks
authorMario <mario.mario@y7mail.com>
Fri, 2 Oct 2020 03:09:31 +0000 (13:09 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 2 Oct 2020 03:09:31 +0000 (13:09 +1000)
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc

index 30cef339a69a4249785e6f04344b451f5427691b..be310669d1c5fed1923c0ec9ba86f3c8bca649fd 100644 (file)
@@ -20,20 +20,16 @@ REGISTER_MUTATOR(buffs, autocvar_g_buffs)
 
 bool buffs_BuffModel_Customize(entity this, entity client)
 {
-       entity player, myowner;
-       bool same_team;
-
-       player = WaypointSprite_getviewentity(client);
-       myowner = this.owner;
-       same_team = (SAME_TEAM(player, myowner) || SAME_TEAM(player, myowner));
+       entity player = WaypointSprite_getviewentity(client);
+       entity myowner = this.owner;
 
-       if(myowner.alpha <= 0.5 && !same_team && myowner.alpha != 0)
+       if(myowner.alpha <= 0.5 && DIFF_TEAM(player, myowner) && myowner.alpha != 0)
                return false;
 
        if(MUTATOR_CALLHOOK(BuffModel_Customize, this, player))
                return false;
 
-       if(player == myowner || (IS_SPEC(client) && client.enemy == myowner))
+       if(player == myowner)
        {
                // somewhat hide the model, but keep the glow
                this.effects = 0;
@@ -308,8 +304,7 @@ void buff_Think(entity this)
                if(this.team && !this.buff_waypoint)
                        buff_Waypoint_Spawn(this);
 
-               if(this.lifetime)
-               if(time >= this.lifetime)
+               if(this.lifetime && time >= this.lifetime)
                        buff_Respawn(this);
        }