]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/item/powerup.qh
Add an item init attribute function, so the item's default values aren't applied...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / powerup.qh
index aaec88eeee770536e8bcabd19201d618be410f4f..ef0d223b61067eae3c2058f24606c8d3e926fd7e 100644 (file)
@@ -22,6 +22,14 @@ MODEL(Strength_ITEM, Item_Model("g_strength.md3"));
 SOUND(Strength, Item_Sound("powerup"));
 #endif
 
+#ifdef SVQC
+float autocvar_g_balance_powerup_strength_time;
+void powerup_strength_init(entity item)
+{
+    if(!item.strength_finished)
+        item.strength_finished = autocvar_g_balance_powerup_strength_time;
+}
+#endif
 REGISTER_ITEM(Strength, Powerup) {
 #ifdef GAMEQC
     this.m_model            =   MDL_Strength_ITEM;
@@ -35,6 +43,9 @@ REGISTER_ITEM(Strength, Powerup) {
     this.m_waypoint         =   _("Strength");
     this.m_waypointblink    =   2;
     this.m_itemid           =   IT_STRENGTH;
+#ifdef SVQC
+    this.m_iteminit         =   powerup_strength_init;
+#endif
 }
 
 #ifdef GAMEQC
@@ -42,6 +53,14 @@ MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
 SOUND(Shield, Item_Sound("powerup_shield"));
 #endif
 
+#ifdef SVQC
+float autocvar_g_balance_powerup_invincible_time;
+void powerup_shield_init(entity item)
+{
+    if(!item.invincible_finished)
+        item.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+}
+#endif
 REGISTER_ITEM(Shield, Powerup) {
 #ifdef GAMEQC
     this.m_model            =   MDL_Shield_ITEM;
@@ -55,4 +74,7 @@ REGISTER_ITEM(Shield, Powerup) {
     this.m_waypoint         =   _("Shield");
     this.m_waypointblink    =   2;
     this.m_itemid           =   IT_INVINCIBLE;
+#ifdef SVQC
+    this.m_iteminit         =   powerup_shield_init;
+#endif
 }