]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/itemstime.qc
Use a more appropriated check
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / itemstime.qc
index 1d615b7c0607623312b7f4ad95978cb27f53f6cb..d6b256af3ccd349a9c42f67c286d791ccb78b911 100644 (file)
@@ -1,11 +1,13 @@
+#ifdef IMPLEMENTATION
 REGISTER_MUTATOR(itemstime, true);
 
+REGISTER_NET_TEMP(itemstime)
+
 #ifdef SVQC
 void IT_Write(entity e, int i, float f) {
     if (!IS_REAL_CLIENT(e)) return;
     msg_entity = e;
-    WriteByte(MSG_ONE, SVC_TEMPENTITY);
-    WriteMutator(MSG_ONE, itemstime);
+    WriteHeader(MSG_ONE, itemstime);
     WriteByte(MSG_ONE, i);
     WriteFloat(MSG_ONE, f);
 }
@@ -14,13 +16,12 @@ void IT_Write(entity e, int i, float f) {
 #ifdef CSQC
 float ItemsTime_time[Items_MAX];
 float ItemsTime_availableTime[Items_MAX];
-MUTATOR_HOOKFUNCTION(itemstime, CSQC_Parse_TempEntity) {
-    if (MUTATOR_RETURNVALUE) return false;
-    if (!ReadMutatorEquals(mutator_argv_int_0, itemstime)) return false;
+NET_HANDLE(itemstime, bool isNew)
+{
     int i = ReadByte();
     float f = ReadFloat();
+    return = true;
     ItemsTime_time[i] = f;
-    return true;
 }
 #endif
 
@@ -101,7 +102,10 @@ void Item_ItemsTime_SetTime(entity e, float t)
         return;
 
     GameItem item = e.itemdef;
-    it_times[item.m_id] = t;
+    if (item.instanceOfGameItem && !item.instanceOfWeaponPickup)
+    {
+        it_times[item.m_id] = t;
+    }
 }
 
 void Item_ItemsTime_SetTimesForAllPlayers()
@@ -388,3 +392,4 @@ void HUD_ItemsTime()
 }
 
 #endif
+#endif