]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
ItemsTime: only loop through items, not every single entity
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 09:36:19 +0000 (19:36 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 09:36:19 +0000 (19:36 +1000)
qcsrc/common/mutators/mutator/itemstime/itemstime.qc

index 3fe9de6d7d5f849ea9356d04b6930a59caf76769..70587f430731eaf9a556896ff72f5559c6812549 100644 (file)
@@ -137,11 +137,10 @@ void Item_ItemsTime_SetTimesForAllPlayers()
 float Item_ItemsTime_UpdateTime(entity e, float t)
 {
     bool isavailable = (t == 0);
-    FOREACH_ENTITY_FLOAT(pure_data, false,
+    IL_EACH(g_items, it != e,
     {
-        if(!(it.itemdef == e.itemdef || ((e.weapons & WEPSET_SUPERWEAPONS) && (it.weapons & WEPSET_SUPERWEAPONS) && clienttype(it) == CLIENTTYPE_NOTACLIENT)))
+        if(!(it.itemdef == e.itemdef || ((e.weapons & WEPSET_SUPERWEAPONS) && (it.weapons & WEPSET_SUPERWEAPONS))))
             continue;
-        if (e == it) continue;
         if (it.scheduledrespawntime <= time)
             isavailable = true;
         else if (t == 0 || it.scheduledrespawntime < t)
@@ -157,11 +156,9 @@ MUTATOR_HOOKFUNCTION(itemstime, reset_map_global)
     Item_ItemsTime_ResetTimes();
     // ALL the times need to be reset before .reset()ing each item
     // since Item_Reset schedules respawn of superweapons and powerups
-    FOREACH_ENTITY_FLOAT(pure_data, false,
+    IL_EACH(g_items, it.reset,
     {
-        if(IS_CLIENT(it))
-            continue;
-        if (it.reset) Item_ItemsTime_SetTime(it, 0);
+        Item_ItemsTime_SetTime(it, 0);
     });
     Item_ItemsTime_SetTimesForAllPlayers();
 }