]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show 50 armor and health in itemstime. Fixes #1521
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 24 Aug 2015 03:56:05 +0000 (13:56 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 24 Aug 2015 03:56:05 +0000 (13:56 +1000)
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/server/t_items.qc

index fe29496ba29c16011d436d0f9fa9e1cbb67129c7..f0db281af8c522f3d23e06898f6f745fca7fa69d 100644 (file)
@@ -25,6 +25,18 @@ MUTATOR_HOOKFUNCTION(itemstime, CSQC_Parse_TempEntity) {
 #endif
 
 #ifdef SVQC
+
+bool Item_ItemsTime_Allow(entity e)
+{
+    GameItem it = e.itemdef;
+       return (false
+       || it.instanceOfPowerup
+       || it == ITEM_ArmorMega     || it == ITEM_ArmorLarge
+       || it == ITEM_HealthMega    || it == ITEM_HealthLarge
+       || (e.weapons & WEPSET_SUPERWEAPONS)
+       );
+}
+
 float it_times[MAX_ITEMS];
 
 void Item_ItemsTime_Init()
index 747075812b9a58933bfd0970328888b11bbd119b..406f8ec33741db433d10f6bfd42d0fa58639235e 100644 (file)
@@ -412,6 +412,7 @@ void Item_Think()
        }
 }
 
+bool Item_ItemsTime_Allow(entity e);
 float Item_ItemsTime_UpdateTime(entity e, float t);
 void Item_ItemsTime_SetTime(entity e, float t);
 void Item_ItemsTime_SetTimesForAllPlayers();
@@ -428,7 +429,7 @@ void Item_Respawn (void)
                sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound
        setorigin (self, self.origin);
 
-       if(self.flags & FL_POWERUP || self.itemdef == ITEM_ArmorMega || self.items == IT_HEALTH || (self.weapons & WEPSET_SUPERWEAPONS))
+    if (Item_ItemsTime_Allow(self))
        {
                float t = Item_ItemsTime_UpdateTime(self, 0);
                Item_ItemsTime_SetTime(self, t);
@@ -539,7 +540,7 @@ void Item_RespawnThink()
 
 void Item_ScheduleRespawnIn(entity e, float t)
 {
-       if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS) || e.itemdef == ITEM_ArmorMega || e.items == IT_HEALTH)
+       if (Item_ItemsTime_Allow(e))
        {
                e.think = Item_RespawnCountdown;
                e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);