X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fbuffs%2Fsv_buffs.qc;h=83b471cd810e0c6ae992c9f115d70abc0cabff2a;hp=256af90affb3650cfc444b0e9d33827af1504ab1;hb=3cd90b2dd499cbe6419a8fe5e8a0ee339aaa191b;hpb=aa95e823f3a1cd929102eeaeedfe52978d4e118e diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 256af90aff..83b471cd81 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -203,6 +203,7 @@ 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); STAT(BUFFS, toucher) |= (STAT(BUFFS, this)); + STAT(LAST_PICKUP, toucher) = time; float bufftime = ((this.count) ? this.count : thebuff.m_time(thebuff)); if(bufftime) STAT(BUFF_TIME, toucher) = min(time + bufftime, max(STAT(BUFF_TIME, toucher), time) + bufftime); @@ -227,7 +228,8 @@ void buff_NewType(entity ent) FOREACH(Buffs, buff_Available(it), { // if it's already been chosen, give it a lower priority - RandomSelection_AddEnt(it, max(0.2, 1 / it.buff_seencount), 1); + float myseencount = (it.buff_seencount > 0) ? it.buff_seencount : 1; // no division by zero please! + RandomSelection_AddEnt(it, max(0.2, 1 / myseencount), 1); }); entity newbuff = RandomSelection_chosen_ent; newbuff.buff_seencount += 1; // lower chances of seeing this buff again soon @@ -271,7 +273,7 @@ void buff_Think(entity this) { buff_SetCooldown(this, autocvar_g_buffs_cooldown_respawn + frametime); this.owner = NULL; - if(autocvar_g_buffs_randomize) + if(autocvar_g_buffs_randomize && (!teamplay || autocvar_g_buffs_randomize_teamplay)) buff_NewType(this); if(autocvar_g_buffs_random_location || (this.spawnflags & 64)) @@ -315,7 +317,7 @@ void buff_Waypoint_Reset(entity this) void buff_Reset(entity this) { - if(autocvar_g_buffs_randomize) + if(autocvar_g_buffs_randomize && (!teamplay || autocvar_g_buffs_randomize_teamplay)) buff_NewType(this); this.owner = NULL; buff_SetCooldown(this, autocvar_g_buffs_cooldown_activate);