From db25c93863fe768dea2d0c0644595ab68a3e139c Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 13 Apr 2020 23:44:46 +1000 Subject: [PATCH] Remove unlisted buffs before applying enabled buffs in GiveItems, fixes buffs being retained through item triggers --- qcsrc/common/t_items.qc | 2 ++ 1 file changed, 2 insertions(+) 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)); } -- 2.39.2