From: Mario Date: Mon, 13 Apr 2020 13:44:46 +0000 (+1000) Subject: Remove unlisted buffs before applying enabled buffs in GiveItems, fixes buffs being... X-Git-Tag: xonotic-v0.8.5~1113 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=db25c93863fe768dea2d0c0644595ab68a3e139c;p=xonotic%2Fxonotic-data.pk3dir.git Remove unlisted buffs before applying enabled buffs in GiveItems, fixes buffs being retained through item triggers --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index a05f90f9e..877537a2a 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -1565,6 +1565,8 @@ spawnfunc(target_items) if(GetResource(this, RES_FUEL) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_FUEL)), "fuel"); if(GetResource(this, RES_HEALTH) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_HEALTH)), "health"); if(GetResource(this, RES_ARMOR) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_ARMOR)), "armor"); + // HACK: buffs share a single timer, so we need to include enabled buffs AFTER disabled ones to avoid loss + FOREACH(Buffs, it != BUFF_Null && !(STAT(BUFFS, this) & it.m_itemid), this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, STAT(BUFF_TIME, this)), it.netname)); FOREACH(Buffs, it != BUFF_Null && (STAT(BUFFS, this) & it.m_itemid), this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, STAT(BUFF_TIME, this)), it.netname)); FOREACH(Weapons, it != WEP_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(STAT(WEAPONS, this) & (it.m_wepset)), it.netname)); }