]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/item.qh
Fix #2069 "LMS doesn't remove 25h on some maps (forest2, farewell, probably others)"
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item.qh
index 1d2c8d67138fb0853e7ae0ad929368794d7d3c00..030b4db1c089f53f06c62a1cb19590ac48b50977 100644 (file)
@@ -7,6 +7,10 @@
 #include <common/stats.qh>
 #endif
 
+#ifdef SVQC
+#include <server/items.qh>
+#endif
+
 const int IT_UNLIMITED_WEAPON_AMMO             =  BIT(0); // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
 const int IT_UNLIMITED_SUPERWEAPONS            =  BIT(1); // when this bit is set, superweapons don't expire. Checkpoints can give this powerup.
 
@@ -47,8 +51,27 @@ const int IT_PICKUPMASK                      = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FU
 .float  strength_finished = _STAT(STRENGTH_FINISHED);
 .float  invincible_finished = _STAT(INVINCIBLE_FINISHED);
 
+#define spawnfunc_body(item) \
+       if (!Item_IsDefinitionAllowed(item)) \
+       { \
+               startitem_failed = true; \
+               delete(this); \
+               return; \
+       } \
+       StartItem(this, item)
+
 #define SPAWNFUNC_ITEM(name, item) \
-    spawnfunc(name) { StartItem(this, item); }
+       spawnfunc(name) \
+       { \
+               spawnfunc_body(item); \
+       }
+
+#define SPAWNFUNC_ITEM_COND(name, cond, item1, item2) \
+       spawnfunc(name) \
+       { \
+               entity item = (cond) ? item1 : item2; \
+               spawnfunc_body(item); \
+       }
 
 #else
 
@@ -58,8 +81,9 @@ const int IT_PICKUPMASK                       = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FU
 
 enum
 {
-       ITEM_FLAG_INSTAGIB = BIT(0), ///< Item is usable in instagib.
-    ITEM_FLAG_MUTATORBLOCKED = BIT(1)
+       ITEM_FLAG_NORMAL = BIT(0), ///< Item is usable during normal gameplay.
+       ITEM_FLAG_MUTATORBLOCKED = BIT(1),
+       ITEM_FLAG_RESOURCE = BIT(2) ///< Item is is a resource, not a held item.
 };
 
 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)