]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/buffs/all.qh
Merge branch 'master' into Mario/use1
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / buffs / all.qh
index d34d32d071ef10f42c1d9f26ec12d6e8ff4a130e..8e1319b39bdcfeb16e6b7f164735b773f7a71fde 100644 (file)
@@ -1,9 +1,5 @@
 #ifndef BUFFS_ALL_H
 #define BUFFS_ALL_H
-// Welcome to the stuff behind the scenes
-// Below, you will find the list of buffs
-// Add new buffs here!
-// Note: Buffs also need spawnfuncs, which are set below
 
 #include <common/teams.qh>
 #include <common/util.qh>
 REGISTER_WAYPOINT(Buff, _("Buff"), '1 0.5 0', 1);
 REGISTER_RADARICON(Buff, 1);
 
-REGISTRY(Buffs, BITS(4))
+REGISTRY(Buffs, BITS(5))
 #define Buffs_from(i) _Buffs_from(i, BUFF_Null)
 REGISTER_REGISTRY(Buffs)
 REGISTRY_CHECK(Buffs)
 
 #define REGISTER_BUFF(id) \
-    REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff)); \
-    REGISTER_INIT_POST(BUFF_##id) { \
-        this.netname = this.m_name; \
-        this.m_itemid = BIT(this.m_id - 1); \
-        this.m_sprite = strzone(strcat("buff-", this.m_name)); \
-    } \
-    REGISTER_INIT(BUFF_##id)
+    REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff))
 
 #include <common/items/item/pickup.qh>
 CLASS(Buff, Pickup)
@@ -43,6 +33,14 @@ CLASS(Buff, Pickup)
 #endif
 ENDCLASS(Buff)
 
+STATIC_INIT(REGISTER_BUFFS) {
+    FOREACH(Buffs, true, {
+        it.netname = it.m_name; \
+        it.m_itemid = BIT(it.m_id - 1); \
+        it.m_sprite = strzone(strcat("buff-", it.m_name)); \
+    });
+}
+
 #ifdef SVQC
        // .int buffs = _STAT(BUFFS);
        void buff_Init(entity ent);