From e5578b18b7c12d46cd72f7febf89a949b76c0636 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 5 Mar 2017 03:30:04 +1000 Subject: [PATCH] Update item's timer if its re-spawn time is quicker than 10 seconds --- qcsrc/common/t_items.qc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index ff7f2feaf..19e404a1a 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -509,7 +509,7 @@ void Item_Respawn (entity this) sound(this, CH_TRIGGER, this.itemdef.m_respawnsound, VOL_BASE, ATTEN_NORM); // play respawn sound setorigin(this, this.origin); - if (Item_ItemsTime_Allow(this.itemdef) || this.weapons & WEPSET_SUPERWEAPONS) + if (Item_ItemsTime_Allow(this.itemdef) || (this.weapons & WEPSET_SUPERWEAPONS)) { float t = Item_ItemsTime_UpdateTime(this, 0); Item_ItemsTime_SetTime(this, t); @@ -594,7 +594,7 @@ void Item_RespawnThink(entity this) void Item_ScheduleRespawnIn(entity e, float t) { // if the respawn time is longer than 10 seconds, show a waypoint, otherwise, just respawn normally - if ((Item_ItemsTime_Allow(e.itemdef) || e.weapons & WEPSET_SUPERWEAPONS) && (t - ITEM_RESPAWN_TICKS) > 0) + if ((Item_ItemsTime_Allow(e.itemdef) || (e.weapons & WEPSET_SUPERWEAPONS)) && (t - ITEM_RESPAWN_TICKS) > 0) { setthink(e, Item_RespawnCountdown); e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS); @@ -610,6 +610,13 @@ void Item_ScheduleRespawnIn(entity e, float t) e.nextthink = time; e.scheduledrespawntime = time + t; e.wait = time + t; + + if(Item_ItemsTime_Allow(e.itemdef) || (e.weapons & WEPSET_SUPERWEAPONS)) + { + t = Item_ItemsTime_UpdateTime(e, e.scheduledrespawntime); + Item_ItemsTime_SetTime(e, t); + Item_ItemsTime_SetTimesForAllPlayers(); + } } } -- 2.39.2