]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
Allow buff waypoint sprites to be disabled
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / buffs / sv_buffs.qc
index 82c9a595a64455255c783a84a4ca87f27b7cb45e..fcbb399cbedee8e8e91e55a703f40d0ff9a29e1d 100644 (file)
@@ -92,6 +92,8 @@ bool buff_Waypoint_visible_for_player(entity this, entity player, entity view)
 
 void buff_Waypoint_Spawn(entity e)
 {
+       if(autocvar_g_buffs_waypoint_distance <= 0) return;
+
        entity buff = buff_FirstFromFlags(STAT(BUFFS, e));
        entity wp = WaypointSprite_Spawn(WP_Buff, 0, autocvar_g_buffs_waypoint_distance, e, '0 0 1' * e.maxs.z, NULL, e.team, e, buff_waypoint, true, RADARICON_Buff);
        wp.wp_extra = buff.m_id;
@@ -106,7 +108,9 @@ void buff_SetCooldown(entity this, float cd)
        if(!this.buff_waypoint)
                buff_Waypoint_Spawn(this);
 
-       WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + cd);
+       if(this.buff_waypoint)
+               WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + cd);
+
        this.buff_activetime = cd;
        this.buff_active = !cd;
 }
@@ -238,6 +242,9 @@ void buff_NewType(entity ent)
 
 void buff_Think(entity this)
 {
+       if(this.buff_waypoint && autocvar_g_buffs_waypoint_distance <= 0)
+               WaypointSprite_Kill(this.buff_waypoint);
+
        if(STAT(BUFFS, this) != this.oldbuffs)
        {
                entity buff = buff_FirstFromFlags(STAT(BUFFS, this));