]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
To prevent spamming pickups, add a delay between dropping a buff and picking up a...
authorMario <mario@smbclan.net>
Sat, 4 Feb 2017 14:01:51 +0000 (00:01 +1000)
committerMario <mario@smbclan.net>
Sat, 4 Feb 2017 14:01:51 +0000 (00:01 +1000)
mutators.cfg
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qh

index d487327bc690c3becc73ee20dbcaab171aa21dad..d6ffe0c6391f14b0111a18324ed44e2cdf93784b 100644 (file)
@@ -291,6 +291,7 @@ set cl_buffs_autoreplace 1 "automatically drop current buff when picking up anot
 set g_buffs -1 "enable buffs (requires buff items or powerups)"
 set g_buffs_effects 1 "show particle effects from carried buffs"
 set g_buffs_waypoint_distance 1024 "maximum distance at which buff waypoint can be seen from item"
+set g_buffs_pickup_delay 0.7 "cooldown before player can pick up another buff after dropping one"
 set g_buffs_randomize 1 "randomize buff type when player drops buff"
 set g_buffs_random_lifetime 30 "re-spawn the buff again if it hasn't been touched after this time in seconds"
 set g_buffs_random_location 0 "randomize buff location on start and when reset"
index edd970126c5a8ec1c467b1f3a2850c70bb042ce8..119829cbad009c6d8f33f024ebca4c77e6c2ea36 100644 (file)
@@ -160,6 +160,7 @@ void buff_Touch(entity this, entity toucher)
        if((this.team && DIFF_TEAM(toucher, this))
        || (STAT(FROZEN, toucher))
        || (toucher.vehicle)
+       || (time < toucher.buff_shield)
        || (!this.buff_active)
        )
        {
@@ -639,7 +640,8 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerUseKey, CBC_ORDER_FIRST)
                Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
 
                player.buffs = 0;
-               player.buff_time = 0; // already notified
+               player.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay);
+               //player.buff_time = 0; // already notified
                sound(player, CH_TRIGGER, SND_BUFF_LOST, VOL_BASE, ATTN_NORM);
                return true;
        }
@@ -840,6 +842,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
                        else
                                Send_Notification(NOTIF_ALL_EXCEPT, player, MSG_INFO, INFO_ITEM_BUFF_LOST, player.netname, buffid);
                        player.buffs = 0;
+                       player.buff_shield = time + max(0, autocvar_g_buffs_pickup_delay); // always put in a delay, even if small
                }
        }
 
index 8383a72ef5789a2cb269e9f61d422bca3c75a04f..f738e9d9d71fcd2a9f16f9232d6b0d3afbe92b3c 100644 (file)
@@ -6,6 +6,7 @@
 
 bool  autocvar_g_buffs_effects;
 float autocvar_g_buffs_waypoint_distance;
+float autocvar_g_buffs_pickup_delay = 0.7;
 bool autocvar_g_buffs_randomize;
 float autocvar_g_buffs_random_lifetime;
 bool autocvar_g_buffs_random_location;
@@ -70,6 +71,7 @@ float autocvar_g_buffs_luck_damagemultiplier = 3;
 .float buff_activetime_updated;
 .entity buff_waypoint;
 .int oldbuffs; // for updating effects
+.float buff_shield; // delay for players to keep them from spamming buff pickups
 .entity buff_model; // controls effects (TODO: make csqc)
 
 const vector BUFF_MIN = ('-16 -16 0');