]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/item/ammo.qc
Remove SPAWNTIMES enum
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / ammo.qc
index 9bce0839a28a1cb7fa00952100188f0659bf5f57..7267f8d07288729a89d3c60429334372e62094f5 100644 (file)
@@ -1,57 +1,73 @@
 #include "ammo.qh"
 #include "../../../server/t_items.qh"
 
-#define REGISTER_AMMO(id, model, sound, name, itemid, basevalue) \
-REGISTER_ITEM(id, Ammo, LAMBDA({    \
-    this.ammoModel = model;         \
-    this.ammoSound = sound;         \
-    this.ammoName = name;           \
-    this.ammoId = itemid;           \
-    this.ammoQuantity = basevalue;  \
-}))
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+#define DEFINE(id, ...)                                             \
+    REGISTER_ITEM(id, Ammo, LAMBDA(                                 \
+        IF(SV, CONFIGURE                                            \
+        ,   respawntime         =       g_pickup_respawntime_ammo   \
+        ,   respawntimejitter   = g_pickup_respawntimejitter_ammo   \
+        )                                                           \
+        MAP(IDENTITY, __VA_ARGS__)                                  \
+    ))
 
-REGISTER_AMMO(Bullets,
-    "models/items/a_bullets.mdl",
-    "misc/itempickup.wav",
-    "bullets",
-    IT_NAILS,
-    2000
+DEFINE(Bullets
+    ,IF(ALL, CONFIGURE
+    ,   model               =   "models/items/a_bullets.mdl"
+    ,   sound               =   "misc/itempickup.wav"
+    ,   name                =   "bullets"
+    ,   itemid              =   IT_NAILS
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   2000
+    )
 )
-REGISTER_AMMO(Cells,
-    "models/items/a_cells.md3",
-    "misc/itempickup.wav",
-    "cells",
-    IT_ROCKETS,
-    2000
+DEFINE(Cells
+    ,IF(ALL, CONFIGURE
+    ,   model               =   "models/items/a_cells.md3"
+    ,   sound               =   "misc/itempickup.wav"
+    ,   name                =   "cells"
+    ,   itemid              =   IT_ROCKETS
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   2000
+    )
 )
-REGISTER_AMMO(Plasma,
-    "models/items/a_cells.md3",
-    "misc/itempickup.wav",
-    "plasma",
-    IT_ROCKETS,
-    2000
+DEFINE(Plasma
+    ,IF(ALL, CONFIGURE
+    ,   model               =   "models/items/a_cells.md3"
+    ,   sound               =   "misc/itempickup.wav"
+    ,   name                =   "plasma"
+    ,   itemid              =   IT_ROCKETS
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   2000
+    )
 )
-REGISTER_AMMO(Rockets,
-    "models/items/a_rockets.md3",
-    "misc/itempickup.wav",
-    "rockets",
-    IT_ROCKETS,
-    3000
+DEFINE(Rockets
+    ,IF(ALL, CONFIGURE
+    ,   model               =   "models/items/a_rockets.md3"
+    ,   sound               =   "misc/itempickup.wav"
+    ,   name                =   "rockets"
+    ,   itemid              =   IT_ROCKETS
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   3000
+    )
 )
-REGISTER_AMMO(Shells,
-    "models/items/a_shells.md3",
-    "misc/itempickup.wav",
-    "shells",
-    IT_SHELLS,
-    500
+DEFINE(Shells
+    ,IF(ALL, CONFIGURE
+    ,   model               =   "models/items/a_shells.md3"
+    ,   sound               =   "misc/itempickup.wav"
+    ,   name                =   "shells"
+    ,   itemid              =   IT_SHELLS
+    )
+    ,IF(SV, CONFIGURE
+    ,   botvalue            =   500
+    )
 )
 
-bool Ammo_respondTo(entity this, int request)
-{
-    switch (request) {
-        default: return false;
-        case ITEM_SIGNAL(Default):
-            print(strcat(this.ammoName, " responding\n"));
-            return true;
-    }
-}
+#undef WITH
+#undef CONFIGURE
+#undef DEFINE