]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
items: clean up pickup value cvars
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 24 Feb 2025 14:27:43 +0000 (00:27 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 14 Mar 2025 18:10:33 +0000 (04:10 +1000)
- uses autocvars instead of copying in worldspawn
- removes unnecessary funcs
- removes duplicate/inconsistent _max and autocvar _max ammo globals

15 files changed:
qcsrc/common/items/item/ammo.qh
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/items/item/jetpack.qh
qcsrc/common/items/item/pickup.qh
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/mutators/mutator/nades/nade/heal.qc
qcsrc/common/mutators/mutator/nix/sv_nix.qc
qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc
qcsrc/common/resources/sv_resources.qc
qcsrc/server/items/items.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/spawning.qh
qcsrc/server/world.qc
qcsrc/server/world.qh

index 8397f1fcca78255a8a1ad24c149e6298943b00b5..096f5551a07e19ef92f959da86d633f390cf34fb 100644 (file)
@@ -13,7 +13,7 @@
 #endif
 
 #ifdef SVQC
-PROPERTY(float, g_pickup_ammo_anyway);
+bool autocvar_g_pickup_ammo_anyway;
 #endif
 
 CLASS(Ammo, Pickup)
@@ -21,7 +21,7 @@ CLASS(Ammo, Pickup)
     ATTRIB(Ammo, m_pickupevalfunc, float(entity player, entity item), ammo_pickupevalfunc);
     ATTRIB(Ammo, m_respawntime, float(), GET(g_pickup_respawntime_ammo));
     ATTRIB(Ammo, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_ammo));
-    ATTRIB(Ammo, m_pickupanyway, float(), GET(g_pickup_ammo_anyway));
+    ATTRIB(Ammo, m_pickupanyway, bool, autocvar_g_pickup_ammo_anyway);
 #endif
 ENDCLASS(Ammo)
 
@@ -35,11 +35,12 @@ MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
 #endif
 
 #ifdef SVQC
-PROPERTY(int, g_pickup_shells);
+int autocvar_g_pickup_shells;
+int autocvar_g_pickup_shells_max;
 void ammo_shells_init(Pickup this, entity item)
 {
     if(!GetResource(item, RES_SHELLS))
-        SetResourceExplicit(item, RES_SHELLS, g_pickup_shells);
+        SetResourceExplicit(item, RES_SHELLS, autocvar_g_pickup_shells);
 }
 #endif
 
@@ -69,11 +70,12 @@ MODEL(Bullets_ITEM, Item_Model("a_bullets.mdl"));
 #endif
 
 #ifdef SVQC
-PROPERTY(int, g_pickup_nails);
+int autocvar_g_pickup_nails;
+int autocvar_g_pickup_nails_max;
 void ammo_bullets_init(Pickup this, entity item)
 {
     if(!GetResource(item, RES_BULLETS))
-        SetResourceExplicit(item, RES_BULLETS, g_pickup_nails);
+        SetResourceExplicit(item, RES_BULLETS, autocvar_g_pickup_nails);
 }
 #endif
 
@@ -103,11 +105,12 @@ MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
 #endif
 
 #ifdef SVQC
-PROPERTY(int, g_pickup_rockets);
+int autocvar_g_pickup_rockets;
+int autocvar_g_pickup_rockets_max;
 void ammo_rockets_init(Pickup this, entity item)
 {
     if(!GetResource(item, RES_ROCKETS))
-        SetResourceExplicit(item, RES_ROCKETS, g_pickup_rockets);
+        SetResourceExplicit(item, RES_ROCKETS, autocvar_g_pickup_rockets);
 }
 #endif
 
@@ -137,11 +140,12 @@ MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
 #endif
 
 #ifdef SVQC
-PROPERTY(int, g_pickup_cells);
+int autocvar_g_pickup_cells;
+int autocvar_g_pickup_cells_max;
 void ammo_cells_init(Pickup this, entity item)
 {
     if(!GetResource(item, RES_CELLS))
-        SetResourceExplicit(item, RES_CELLS, g_pickup_cells);
+        SetResourceExplicit(item, RES_CELLS, autocvar_g_pickup_cells);
 }
 #endif
 
index 12c0f6acd6f9af4dd80d0d198d1321f27fb66928..8e99c4ca4050f5cc4da650ac8a0d388e8f735ab6 100644 (file)
@@ -17,15 +17,15 @@ MODEL(ArmorSmall_ITEM, Item_Model("item_armor_small.md3"));
 SOUND(ArmorSmall, Item_Sound("armor1"));
 #endif
 #ifdef SVQC
-PROPERTY(float, g_pickup_armorsmall_anyway);
-PROPERTY(int, g_pickup_armorsmall);
-PROPERTY(int, g_pickup_armorsmall_max);
+bool autocvar_g_pickup_armorsmall_anyway;
+int autocvar_g_pickup_armorsmall;
+int autocvar_g_pickup_armorsmall_max;
 void item_armorsmall_init(Pickup this, entity item)
 {
     if(!item.max_armorvalue)
-        item.max_armorvalue = g_pickup_armorsmall_max;
+        item.max_armorvalue = autocvar_g_pickup_armorsmall_max;
     if(!GetResource(item, RES_ARMOR))
-        SetResourceExplicit(item, RES_ARMOR, g_pickup_armorsmall);
+        SetResourceExplicit(item, RES_ARMOR, autocvar_g_pickup_armorsmall);
 }
 #endif
 
@@ -53,7 +53,7 @@ CLASS(ArmorSmall, Armor)
 /* itemid       */ ATTRIB(ArmorSmall, m_itemid, int, IT_RESOURCE);
 /* respawntime  */ ATTRIB(ArmorSmall, m_respawntime, float(), GET(g_pickup_respawntime_armor_small));
 /*              */ ATTRIB(ArmorSmall, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_armor_small));
-/* pickupanyway */ ATTRIB(ArmorSmall, m_pickupanyway, float(), GET(g_pickup_armorsmall_anyway));
+/* pickupanyway */ ATTRIB(ArmorSmall, m_pickupanyway, bool, autocvar_g_pickup_armorsmall_anyway);
 /* iteminit     */ ATTRIB(ArmorSmall, m_iteminit, void(Pickup this, entity item), item_armorsmall_init);
 #endif
 ENDCLASS(ArmorSmall)
@@ -66,15 +66,15 @@ MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
 SOUND(ArmorMedium, Item_Sound("armor10"));
 #endif
 #ifdef SVQC
-PROPERTY(float, g_pickup_armormedium_anyway);
-PROPERTY(int, g_pickup_armormedium);
-PROPERTY(int, g_pickup_armormedium_max);
+bool autocvar_g_pickup_armormedium_anyway;
+int autocvar_g_pickup_armormedium;
+int autocvar_g_pickup_armormedium_max;
 void item_armormedium_init(Pickup this, entity item)
 {
     if(!item.max_armorvalue)
-        item.max_armorvalue = g_pickup_armormedium_max;
+        item.max_armorvalue = autocvar_g_pickup_armormedium_max;
     if(!GetResource(item, RES_ARMOR))
-        SetResourceExplicit(item, RES_ARMOR, g_pickup_armormedium);
+        SetResourceExplicit(item, RES_ARMOR, autocvar_g_pickup_armormedium);
 }
 #endif
 
@@ -102,7 +102,7 @@ CLASS(ArmorMedium, Armor)
 /* itemid       */ ATTRIB(ArmorMedium, m_itemid, int, IT_RESOURCE);
 /* respawntime  */ ATTRIB(ArmorMedium, m_respawntime, float(), GET(g_pickup_respawntime_armor_medium));
 /*              */ ATTRIB(ArmorMedium, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_armor_medium));
-/* pickupanyway */ ATTRIB(ArmorMedium, m_pickupanyway, float(), GET(g_pickup_armormedium_anyway));
+/* pickupanyway */ ATTRIB(ArmorMedium, m_pickupanyway, bool, autocvar_g_pickup_armormedium_anyway);
 /* iteminit     */ ATTRIB(ArmorMedium, m_iteminit, void(Pickup this, entity item), item_armormedium_init);
 #endif
 ENDCLASS(ArmorMedium)
@@ -115,15 +115,15 @@ MODEL(ArmorBig_ITEM, Item_Model("item_armor_big.md3"));
 SOUND(ArmorBig, Item_Sound("armor17_5"));
 #endif
 #ifdef SVQC
-PROPERTY(float, g_pickup_armorbig_anyway);
-PROPERTY(int, g_pickup_armorbig);
-PROPERTY(int, g_pickup_armorbig_max);
+bool autocvar_g_pickup_armorbig_anyway;
+int autocvar_g_pickup_armorbig;
+int autocvar_g_pickup_armorbig_max;
 void item_armorbig_init(Pickup this, entity item)
 {
     if(!item.max_armorvalue)
-        item.max_armorvalue = g_pickup_armorbig_max;
+        item.max_armorvalue = autocvar_g_pickup_armorbig_max;
     if(!GetResource(item, RES_ARMOR))
-        SetResourceExplicit(item, RES_ARMOR, g_pickup_armorbig);
+        SetResourceExplicit(item, RES_ARMOR, autocvar_g_pickup_armorbig);
 }
 #endif
 
@@ -151,7 +151,7 @@ CLASS(ArmorBig, Armor)
 /* itemid       */ ATTRIB(ArmorBig, m_itemid, int, IT_RESOURCE);
 /* respawntime  */ ATTRIB(ArmorBig, m_respawntime, float(), GET(g_pickup_respawntime_armor_big));
 /*              */ ATTRIB(ArmorBig, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_armor_big));
-/* pickupanyway */ ATTRIB(ArmorBig, m_pickupanyway, float(), GET(g_pickup_armorbig_anyway));
+/* pickupanyway */ ATTRIB(ArmorBig, m_pickupanyway, bool, autocvar_g_pickup_armorbig_anyway);
 /* iteminit     */ ATTRIB(ArmorBig, m_iteminit, void(Pickup this, entity item), item_armorbig_init);
 #endif
 ENDCLASS(ArmorBig)
@@ -164,15 +164,15 @@ MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
 SOUND(ArmorMega, Item_Sound("armor25"));
 #endif
 #ifdef SVQC
-PROPERTY(float, g_pickup_armormega_anyway);
-PROPERTY(int, g_pickup_armormega);
-PROPERTY(int, g_pickup_armormega_max);
+bool autocvar_g_pickup_armormega_anyway;
+int autocvar_g_pickup_armormega;
+int autocvar_g_pickup_armormega_max;
 void item_armormega_init(Pickup this, entity item)
 {
     if(!item.max_armorvalue)
-        item.max_armorvalue = g_pickup_armormega_max;
+        item.max_armorvalue = autocvar_g_pickup_armormega_max;
     if(!GetResource(item, RES_ARMOR))
-        SetResourceExplicit(item, RES_ARMOR, g_pickup_armormega);
+        SetResourceExplicit(item, RES_ARMOR, autocvar_g_pickup_armormega);
 }
 #endif
 
@@ -202,7 +202,7 @@ CLASS(ArmorMega, Armor)
 /* itemid       */ ATTRIB(ArmorMega, m_itemid, int, IT_RESOURCE);
 /* respawntime  */ ATTRIB(ArmorMega, m_respawntime, float(), GET(g_pickup_respawntime_armor_mega));
 /*              */ ATTRIB(ArmorMega, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_armor_mega));
-/* pickupanyway */ ATTRIB(ArmorMega, m_pickupanyway, float(), GET(g_pickup_armormega_anyway));
+/* pickupanyway */ ATTRIB(ArmorMega, m_pickupanyway, bool, autocvar_g_pickup_armormega_anyway);
 /* iteminit     */ ATTRIB(ArmorMega, m_iteminit, void(Pickup this, entity item), item_armormega_init);
 #endif
 ENDCLASS(ArmorMega)
index b8bc83ff4380b06f4e09500a31229badde088e1e..4edb9873379651efd7bd550deac76ba63a572833 100644 (file)
@@ -17,15 +17,15 @@ MODEL(HealthSmall_ITEM, Item_Model("g_h1.md3"));
 SOUND(HealthSmall, Item_Sound("minihealth"));
 #endif
 #ifdef SVQC
-PROPERTY(float, g_pickup_healthsmall_anyway);
-PROPERTY(int, g_pickup_healthsmall);
-PROPERTY(int, g_pickup_healthsmall_max);
+bool autocvar_g_pickup_healthsmall_anyway;
+int autocvar_g_pickup_healthsmall;
+int autocvar_g_pickup_healthsmall_max;
 void item_healthsmall_init(Pickup this, entity item)
 {
     if(!item.max_health)
-        item.max_health = g_pickup_healthsmall_max;
+        item.max_health = autocvar_g_pickup_healthsmall_max;
     if(!GetResource(item, RES_HEALTH))
-        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : g_pickup_healthsmall);
+        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : autocvar_g_pickup_healthsmall);
 }
 #endif
 
@@ -53,7 +53,7 @@ CLASS(HealthSmall, Health)
 /* itemid       */ ATTRIB(HealthSmall, m_itemid, int, IT_RESOURCE);
 /* respawntime  */ ATTRIB(HealthSmall, m_respawntime, float(), GET(g_pickup_respawntime_health_small));
 /*              */ ATTRIB(HealthSmall, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_health_small));
-/* pickupanyway */ ATTRIB(HealthSmall, m_pickupanyway, float(), GET(g_pickup_healthsmall_anyway));
+/* pickupanyway */ ATTRIB(HealthSmall, m_pickupanyway, bool, autocvar_g_pickup_healthsmall_anyway);
 /* iteminit     */ ATTRIB(HealthSmall, m_iteminit, void(Pickup this, entity item), item_healthsmall_init);
 #endif
 ENDCLASS(HealthSmall)
@@ -66,15 +66,15 @@ MODEL(HealthMedium_ITEM, Item_Model("g_h25.md3"));
 SOUND(HealthMedium, Item_Sound("mediumhealth"));
 #endif
 #ifdef SVQC
-PROPERTY(float, g_pickup_healthmedium_anyway);
-PROPERTY(int, g_pickup_healthmedium);
-PROPERTY(int, g_pickup_healthmedium_max);
+bool autocvar_g_pickup_healthmedium_anyway;
+int autocvar_g_pickup_healthmedium;
+int autocvar_g_pickup_healthmedium_max;
 void item_healthmedium_init(Pickup this, entity item)
 {
     if(!item.max_health)
-        item.max_health = g_pickup_healthmedium_max;
+        item.max_health = autocvar_g_pickup_healthmedium_max;
     if(!GetResource(item, RES_HEALTH))
-        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : g_pickup_healthmedium);
+        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : autocvar_g_pickup_healthmedium);
 }
 #endif
 
@@ -102,7 +102,7 @@ CLASS(HealthMedium, Health)
 /* itemid       */ ATTRIB(HealthMedium, m_itemid, int, IT_RESOURCE);
 /* respawntime  */ ATTRIB(HealthMedium, m_respawntime, float(), GET(g_pickup_respawntime_health_medium));
 /*              */ ATTRIB(HealthMedium, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_health_medium));
-/* pickupanyway */ ATTRIB(HealthMedium, m_pickupanyway, float(), GET(g_pickup_healthmedium_anyway));
+/* pickupanyway */ ATTRIB(HealthMedium, m_pickupanyway, bool, autocvar_g_pickup_healthmedium_anyway);
 /* iteminit     */ ATTRIB(HealthMedium, m_iteminit, void(Pickup this, entity item), item_healthmedium_init);
 #endif
 ENDCLASS(HealthMedium)
@@ -115,15 +115,15 @@ MODEL(HealthBig_ITEM, Item_Model("g_h50.md3"));
 SOUND(HealthBig, Item_Sound("mediumhealth"));
 #endif
 #ifdef SVQC
-PROPERTY(float, g_pickup_healthbig_anyway);
-PROPERTY(int, g_pickup_healthbig);
-PROPERTY(int, g_pickup_healthbig_max);
+bool autocvar_g_pickup_healthbig_anyway;
+int autocvar_g_pickup_healthbig;
+int autocvar_g_pickup_healthbig_max;
 void item_healthbig_init(Pickup this, entity item)
 {
     if(!item.max_health)
-        item.max_health = g_pickup_healthbig_max;
+        item.max_health = autocvar_g_pickup_healthbig_max;
     if(!GetResource(item, RES_HEALTH))
-        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : g_pickup_healthbig);
+        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : autocvar_g_pickup_healthbig);
 }
 #endif
 
@@ -151,7 +151,7 @@ CLASS(HealthBig, Health)
 /* itemid       */ ATTRIB(HealthBig, m_itemid, int, IT_RESOURCE);
 /* respawntime  */ ATTRIB(HealthBig, m_respawntime, float(), GET(g_pickup_respawntime_health_big));
 /*              */ ATTRIB(HealthBig, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_health_big));
-/* pickupanyway */ ATTRIB(HealthBig, m_pickupanyway, float(), GET(g_pickup_healthbig_anyway));
+/* pickupanyway */ ATTRIB(HealthBig, m_pickupanyway, bool, autocvar_g_pickup_healthbig_anyway);
 /* iteminit     */ ATTRIB(HealthBig, m_iteminit, void(Pickup this, entity item), item_healthbig_init);
 #endif
 ENDCLASS(HealthBig)
@@ -164,15 +164,15 @@ MODEL(HealthMega_ITEM, Item_Model("g_h100.md3"));
 SOUND(HealthMega, Item_Sound("megahealth"));
 #endif
 #ifdef SVQC
-PROPERTY(float, g_pickup_healthmega_anyway);
-PROPERTY(int, g_pickup_healthmega);
-PROPERTY(int, g_pickup_healthmega_max);
+bool autocvar_g_pickup_healthmega_anyway;
+int autocvar_g_pickup_healthmega;
+int autocvar_g_pickup_healthmega_max;
 void item_healthmega_init(Pickup this, entity item)
 {
     if(!item.max_health)
-        item.max_health = g_pickup_healthmega_max;
+        item.max_health = autocvar_g_pickup_healthmega_max;
     if(!GetResource(item, RES_HEALTH))
-        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : g_pickup_healthmega);
+        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : autocvar_g_pickup_healthmega);
 }
 #endif
 
@@ -202,7 +202,7 @@ CLASS(HealthMega, Health)
 /* itemid       */ ATTRIB(HealthMega, m_itemid, int, IT_RESOURCE);
 /* respawntime  */ ATTRIB(HealthMega, m_respawntime, float(), GET(g_pickup_respawntime_health_mega));
 /*              */ ATTRIB(HealthMega, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_health_mega));
-/* pickupanyway */ ATTRIB(HealthMega, m_pickupanyway, float(), GET(g_pickup_healthmega_anyway));
+/* pickupanyway */ ATTRIB(HealthMega, m_pickupanyway, bool, autocvar_g_pickup_healthmega_anyway);
 /* iteminit     */ ATTRIB(HealthMega, m_iteminit, void(Pickup this, entity item), item_healthmega_init);
 #endif
 ENDCLASS(HealthMega)
index 358c70981e031fc3fd8b1565eb05ab476fe2999f..db92ed6c20680d3bff9e19e9a3ef45ab5b1364d0 100644 (file)
@@ -17,14 +17,14 @@ MODEL(Jetpack_ITEM, Item_Model("g_jetpack.md3"));
 
 #ifdef SVQC
 bool autocvar_g_powerups_jetpack = true;
-PROPERTY(int, g_pickup_fuel_jetpack);
+int autocvar_g_pickup_fuel_jetpack;
 void powerup_jetpack_init(Pickup def, entity item)
 {
     if(!autocvar_g_powerups || !autocvar_g_powerups_jetpack)
         def.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
 
     if(!GetResource(item, RES_FUEL))
-        SetResourceExplicit(item, RES_FUEL, g_pickup_fuel_jetpack);
+        SetResourceExplicit(item, RES_FUEL, autocvar_g_pickup_fuel_jetpack);
 }
 #endif
 
@@ -56,11 +56,12 @@ MODEL(JetpackFuel_ITEM, Item_Model("g_fuel.md3"));
 #endif
 
 #ifdef SVQC
-PROPERTY(int, g_pickup_fuel);
+int autocvar_g_pickup_fuel;
+int autocvar_g_pickup_fuel_max;
 void ammo_fuel_init(Pickup this, entity item)
 {
     if(!GetResource(item, RES_FUEL))
-        SetResourceExplicit(item, RES_FUEL, g_pickup_fuel);
+        SetResourceExplicit(item, RES_FUEL, autocvar_g_pickup_fuel);
 }
 #endif
 
index 95c9d81a019eba844499bb714ad40d23ff326d21..87f421056886b17b5b126f2460cc3204bf987587 100644 (file)
@@ -53,7 +53,7 @@ CLASS(Pickup, GameItem)
     ATTRIB(Pickup, m_pickupevalfunc, float(entity player, entity item), generic_pickupevalfunc);
     ATTRIB(Pickup, m_respawntime, float());
     ATTRIB(Pickup, m_respawntimejitter, float());
-    ATTRIB(Pickup, m_pickupanyway, float());
+    ATTRIB(Pickup, m_pickupanyway, bool);
     ATTRIB(Pickup, m_iteminit, void(Pickup this, entity item));
     float Item_GiveTo(entity item, entity player);
     METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player));
index 4600fe2e7e4d7446471c359b775853492deb9bb2..32a6da4de528dd0c51958917b4454a1224085155 100644 (file)
@@ -102,11 +102,11 @@ bool M_Mage_Defend_Heal_Check(entity this, entity targ)
                case 0: return (GetResource(targ, RES_HEALTH) < autocvar_g_balance_health_regenstable);
                case 1:
                {
-                       return ((GetResource(targ, RES_CELLS) && GetResource(targ, RES_CELLS) < g_pickup_cells_max)
-                               ||  (GetResource(targ, RES_ROCKETS) && GetResource(targ, RES_ROCKETS) < g_pickup_rockets_max)
-                               ||  (GetResource(targ, RES_BULLETS) && GetResource(targ, RES_BULLETS) < g_pickup_nails_max)
-                               ||  (GetResource(targ, RES_SHELLS) && GetResource(targ, RES_SHELLS) < g_pickup_shells_max)
-                                       );
+                       return ((GetResource(targ, RES_CELLS) && GetResource(targ, RES_CELLS) < autocvar_g_pickup_cells_max)
+                            || (GetResource(targ, RES_ROCKETS) && GetResource(targ, RES_ROCKETS) < autocvar_g_pickup_rockets_max)
+                            || (GetResource(targ, RES_BULLETS) && GetResource(targ, RES_BULLETS) < autocvar_g_pickup_nails_max)
+                            || (GetResource(targ, RES_SHELLS) && GetResource(targ, RES_SHELLS) < autocvar_g_pickup_shells_max)
+                       );
                }
                case 2: return (GetResource(targ, RES_ARMOR) < autocvar_g_balance_armor_regenstable);
        }
@@ -238,10 +238,10 @@ void M_Mage_Defend_Heal(entity this)
                                }
                                case 1:
                                {
-                                       if(GetResource(it, RES_CELLS)) GiveResourceWithLimit(it, RES_CELLS, 1, g_pickup_cells_max);
-                                       if(GetResource(it, RES_ROCKETS)) GiveResourceWithLimit(it, RES_ROCKETS, 1, g_pickup_rockets_max);
-                                       if(GetResource(it, RES_SHELLS)) GiveResourceWithLimit(it, RES_SHELLS, 2, g_pickup_shells_max);
-                                       if(GetResource(it, RES_BULLETS)) GiveResourceWithLimit(it, RES_BULLETS, 5, g_pickup_nails_max);
+                                       if(GetResource(it, RES_CELLS)) GiveResourceWithLimit(it, RES_CELLS, 1, autocvar_g_pickup_cells_max);
+                                       if(GetResource(it, RES_ROCKETS)) GiveResourceWithLimit(it, RES_ROCKETS, 1, autocvar_g_pickup_rockets_max);
+                                       if(GetResource(it, RES_SHELLS)) GiveResourceWithLimit(it, RES_SHELLS, 2, autocvar_g_pickup_shells_max);
+                                       if(GetResource(it, RES_BULLETS)) GiveResourceWithLimit(it, RES_BULLETS, 5, autocvar_g_pickup_nails_max);
                                        // TODO: fuel?
                                        fx = EFFECT_AMMO_REGEN;
                                        break;
index 9d376762a3e360ece6eb7a814254b64f04f8e0e9..e1330dc5f14ec8e00f1abc3746b4c4b2e1373c8e 100644 (file)
@@ -16,7 +16,7 @@ void nade_heal_touch(entity this, entity toucher)
 
                if ( health_factor > 0 )
                {
-                       maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max;
+                       maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : autocvar_g_pickup_healthmega_max;
                        float hp = GetResource(toucher, RES_HEALTH);
                        if (hp < maxhealth)
                        {
index 863cfb505b73d345dfd1c8e7f69c70a8f123b1a0..f1b436176e9a3749f05be0038b4798a23bab8b58 100644 (file)
@@ -19,11 +19,6 @@ float autocvar_g_balance_nix_roundtime;
 bool autocvar_g_nix_with_healtharmor;
 bool autocvar_g_nix_with_blaster;
 bool autocvar_g_nix_with_powerups;
-int autocvar_g_pickup_cells_max;
-int autocvar_g_pickup_fuel_max;
-int autocvar_g_pickup_nails_max;
-int autocvar_g_pickup_rockets_max;
-int autocvar_g_pickup_shells_max;
 
 float g_nix_with_blaster;
 // WEAPONTODO
index e484d011341beea82308ff62823cf322b11e9496..6da2bdbbb462c35f0ccabc031460051a454821f8 100644 (file)
@@ -29,7 +29,7 @@ MUTATOR_HOOKFUNCTION(vh, GrappleHookThink)
                entity dmgent = ((SAME_TEAM(hook_owner, hook_aiment) && autocvar_g_vampirehook_teamheal) ? hook_owner : hook_aiment);
                Damage(dmgent, thehook, hook_owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, DMG_NOWEP, thehook.origin, '0 0 0');
                entity targ = ((SAME_TEAM(hook_owner, hook_aiment)) ? hook_aiment : hook_owner);
-               Heal(targ, hook_owner, autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
+               Heal(targ, hook_owner, autocvar_g_vampirehook_health_steal, autocvar_g_pickup_healthsmall_max);
 
                if(dmgent == hook_owner)
                        TakeResource(dmgent, RES_HEALTH, autocvar_g_vampirehook_damage); // FIXME: friendly fire?!
index a59ae045c627498ff79389ef79b661cf3136c279..d0db7c016ba70b1ba03bcf558837604b86f3cebf 100644 (file)
@@ -30,22 +30,22 @@ float GetResourceLimit(entity e, Resource res_type)
                }
                case RES_SHELLS:
                {
-                       limit = g_pickup_shells_max;
+                       limit = autocvar_g_pickup_shells_max;
                        break;
                }
                case RES_BULLETS:
                {
-                       limit = g_pickup_nails_max;
+                       limit = autocvar_g_pickup_nails_max;
                        break;
                }
                case RES_ROCKETS:
                {
-                       limit = g_pickup_rockets_max;
+                       limit = autocvar_g_pickup_rockets_max;
                        break;
                }
                case RES_CELLS:
                {
-                       limit = g_pickup_cells_max;
+                       limit = autocvar_g_pickup_cells_max;
                        break;
                }
                case RES_FUEL:
index 6b9b4c41e81ac514ea3141700eb6457a2eb29754..e6e7b3f08e5e3c6b626d5deda395a85cad1dc3dc 100644 (file)
@@ -552,11 +552,11 @@ bool Item_GiveTo(entity item, entity player)
        bool pickedup = false;
        pickedup |= Item_GiveAmmoTo(item, player, RES_HEALTH, item.max_health);
        pickedup |= Item_GiveAmmoTo(item, player, RES_ARMOR, item.max_armorvalue);
-       pickedup |= Item_GiveAmmoTo(item, player, RES_SHELLS, g_pickup_shells_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RES_BULLETS, g_pickup_nails_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RES_ROCKETS, g_pickup_rockets_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RES_CELLS, g_pickup_cells_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RES_FUEL, g_pickup_fuel_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_SHELLS, autocvar_g_pickup_shells_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_BULLETS, autocvar_g_pickup_nails_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_ROCKETS, autocvar_g_pickup_rockets_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_CELLS, autocvar_g_pickup_cells_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_FUEL, autocvar_g_pickup_fuel_max);
        if (item.itemdef.instanceOfWeaponPickup)
        {
                WepSet w, wp;
@@ -1041,7 +1041,7 @@ void StartItem(entity this, entity def)
                LOG_WARNF("No pickup sound set for a %s", this.classname);
 
        if(!this.pickup_anyway && def.m_pickupanyway)
-               this.pickup_anyway = def.m_pickupanyway();
+               this.pickup_anyway = def.m_pickupanyway;
 
        // bones_was_here TODO: implement sv_cullentities_dist and replace g_items_maxdist with it
        if(!this.fade_end)
index 3a20ec80eeea031044035ce66ce583ad18d0e049..aafdac6c622cb452be61661b80c1821b6cb4e7ff 100644 (file)
@@ -146,7 +146,7 @@ void weapon_defaultspawnfunc(entity this, Weapon wpn)
        #endif
 
        // pickup anyway
-       if (g_pickup_weapons_anyway)
+       if (autocvar_g_pickup_weapons_anyway)
                this.pickup_anyway = true;
 
        if(!this.owner)
index e0f1a61a9aa08def978a619c730e8f6810b37605..47ee0848663eb38fba39dbdae0a2f1ac569b38c4 100644 (file)
@@ -3,6 +3,8 @@
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 
+bool autocvar_g_pickup_weapons_anyway;
+
 string W_Apply_Weaponreplace(string in);
 
 void weapon_defaultspawnfunc(entity this, Weapon e);
index 5e3f4e610fe5510d509235f1c4ed7e4e9a850086..218f0664b11b4b40f697866f82e5f54992a90e5d 100644 (file)
@@ -2202,45 +2202,6 @@ void readlevelcvars()
        g_pickup_respawntimejitter_health_mega = cvar("g_pickup_respawntimejitter_health_mega");
        g_pickup_respawntimejitter_powerup = cvar("g_pickup_respawntimejitter_powerup");
 
-       g_pickup_shells = cvar("g_pickup_shells");
-       g_pickup_shells_max = cvar("g_pickup_shells_max");
-       g_pickup_nails = cvar("g_pickup_nails");
-       g_pickup_nails_max = cvar("g_pickup_nails_max");
-       g_pickup_rockets = cvar("g_pickup_rockets");
-       g_pickup_rockets_max = cvar("g_pickup_rockets_max");
-       g_pickup_cells = cvar("g_pickup_cells");
-       g_pickup_cells_max = cvar("g_pickup_cells_max");
-       g_pickup_fuel = cvar("g_pickup_fuel");
-       g_pickup_fuel_jetpack = cvar("g_pickup_fuel_jetpack");
-       g_pickup_fuel_max = cvar("g_pickup_fuel_max");
-       g_pickup_armorsmall = cvar("g_pickup_armorsmall");
-       g_pickup_armorsmall_max = cvar("g_pickup_armorsmall_max");
-       g_pickup_armorsmall_anyway = cvar("g_pickup_armorsmall_anyway");
-       g_pickup_armormedium = cvar("g_pickup_armormedium");
-       g_pickup_armormedium_max = cvar("g_pickup_armormedium_max");
-       g_pickup_armormedium_anyway = cvar("g_pickup_armormedium_anyway");
-       g_pickup_armorbig = cvar("g_pickup_armorbig");
-       g_pickup_armorbig_max = cvar("g_pickup_armorbig_max");
-       g_pickup_armorbig_anyway = cvar("g_pickup_armorbig_anyway");
-       g_pickup_armormega = cvar("g_pickup_armormega");
-       g_pickup_armormega_max = cvar("g_pickup_armormega_max");
-       g_pickup_armormega_anyway = cvar("g_pickup_armormega_anyway");
-       g_pickup_healthsmall = cvar("g_pickup_healthsmall");
-       g_pickup_healthsmall_max = cvar("g_pickup_healthsmall_max");
-       g_pickup_healthsmall_anyway = cvar("g_pickup_healthsmall_anyway");
-       g_pickup_healthmedium = cvar("g_pickup_healthmedium");
-       g_pickup_healthmedium_max = cvar("g_pickup_healthmedium_max");
-       g_pickup_healthmedium_anyway = cvar("g_pickup_healthmedium_anyway");
-       g_pickup_healthbig = cvar("g_pickup_healthbig");
-       g_pickup_healthbig_max = cvar("g_pickup_healthbig_max");
-       g_pickup_healthbig_anyway = cvar("g_pickup_healthbig_anyway");
-       g_pickup_healthmega = cvar("g_pickup_healthmega");
-       g_pickup_healthmega_max = cvar("g_pickup_healthmega_max");
-       g_pickup_healthmega_anyway = cvar("g_pickup_healthmega_anyway");
-
-       g_pickup_ammo_anyway = cvar("g_pickup_ammo_anyway");
-       g_pickup_weapons_anyway = cvar("g_pickup_weapons_anyway");
-
        g_weapon_stay = cvar(strcat("g_", GetGametype(), "_weapon_stay"));
        if(!g_weapon_stay)
                g_weapon_stay = cvar("g_weapon_stay");
index 9a07bb60dc87da155775b5c6586a9f81551bbc8b..4e2d9dfd2c889b4a017be4b6ebd2242d88686085 100644 (file)
@@ -72,12 +72,6 @@ string cache_lastmutatormsg;
 float default_player_alpha;
 float default_weapon_alpha;
 
-float g_pickup_shells_max;
-float g_pickup_nails_max;
-float g_pickup_rockets_max;
-float g_pickup_cells_max;
-float g_pickup_fuel_max;
-float g_pickup_weapons_anyway;
 float g_weaponarena;
 WepSet g_weaponarena_weapons;
 float g_weaponarena_random; // TODO