]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Simplify buff effect time calculation
authorterencehill <piuntn@gmail.com>
Sun, 1 Sep 2024 12:22:42 +0000 (14:22 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 1 Sep 2024 12:22:42 +0000 (14:22 +0200)
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc

index 4c6db060a5651e704d2a832a080a328ddae07f9d..0822d07cce3451f4d2899a2b563b614f51faefd3 100644 (file)
@@ -242,14 +242,12 @@ void buff_Touch(entity this, entity toucher)
 
        Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
        sound(toucher, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM);
-       float oldtime = StatusEffects_gettime(thebuff, toucher);
        float bufftime = ((this.buffs_finished) ? this.buffs_finished : thebuff.m_time(thebuff));
 
        buff_RemoveAll(toucher, STATUSEFFECT_REMOVE_NORMAL); // remove previous buffs so that a new one may be added
-       if(bufftime)
-               StatusEffects_apply(thebuff, toucher, min(time + bufftime, oldtime + bufftime), 0);
-       else
-               StatusEffects_apply(thebuff, toucher, time + 999, 0); // HACK: zero timer means "infinite"!
+       if(!bufftime)
+               bufftime = 999;
+       StatusEffects_apply(thebuff, toucher, time + bufftime, 0);
 
        STAT(LAST_PICKUP, toucher) = time;
 }