]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/powerups/powerup/strength.qh
powerups: fix #2857 and move g_powerups cvar out of server/items/items.qc
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / powerups / powerup / strength.qh
index ce1914966bd7f15ae0a2878301199a1abe22e314..79ef229f1cbbf751b5b0a39ac5b76ab7f6fa70d4 100644 (file)
@@ -14,21 +14,29 @@ SOUND(Strength, Item_Sound("powerup"));
 #endif
 
 #ifdef SVQC
+bool autocvar_g_powerups_strength;
 float autocvar_g_balance_powerup_strength_damage;
 float autocvar_g_balance_powerup_strength_force;
 float autocvar_g_balance_powerup_strength_selfdamage;
 float autocvar_g_balance_powerup_strength_selfforce;
 float autocvar_g_balance_powerup_strength_time;
-void powerup_strength_init(Pickup this, entity item)
+void powerup_strength_init(Pickup def, entity item)
 {
+    if(!autocvar_g_powerups || !autocvar_g_powerups_strength)
+        def.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+
     if(!item.strength_finished)
-        item.strength_finished = autocvar_g_balance_powerup_strength_time;
+        item.strength_finished = (item.count) ? item.count : autocvar_g_balance_powerup_strength_time;
 }
 #endif
 REGISTER_ITEM(Strength, Powerup) {
     this.m_canonical_spawnfunc = "item_strength";
+#ifdef SVQC
+    this.m_iteminit         =   powerup_strength_init;
+#endif
 #ifdef GAMEQC
-       this.spawnflags = ITEM_FLAG_NORMAL;
+    this.spawnflags         =   ITEM_FLAG_NORMAL;
+    this.m_itemid           =   IT_STRENGTH;
     this.m_model            =   MDL_Strength_ITEM;
     this.m_sound            =   SND_Strength;
     this.m_glow             =   true;
@@ -40,12 +48,6 @@ REGISTER_ITEM(Strength, Powerup) {
     this.m_color            =   '0 0 1';
     this.m_waypoint         =   _("Strength");
     this.m_waypointblink    =   2;
-#ifdef GAMEQC
-    this.m_itemid           =   IT_STRENGTH;
-#endif
-#ifdef SVQC
-    this.m_iteminit         =   powerup_strength_init;
-#endif
 }
 
 SPAWNFUNC_ITEM(item_strength, ITEM_Strength)