]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Instagib: fix ammo from other games not getting replaced by vaporizer cells (if enabl...
authorterencehill <piuntn@gmail.com>
Sat, 6 May 2023 13:22:44 +0000 (15:22 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 6 May 2023 13:22:44 +0000 (15:22 +0200)
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/server/compat/quake3.qh

index 5e2482d9767cc48b759e76113ea1d4b92d1200d5..3a7d563d8b77ef0964c75b7de770b37a85f2159e 100644 (file)
@@ -303,11 +303,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, SetWeaponArena)
        M_ARGV(0, string) = "off";
 }
 
-void replace_with_insta_cells(entity item)
+void instagib_replace_with_vaporizer_cells(entity item)
 {
        entity e = new(item_vaporizer_cells);
        Item_CopyFields(item, e);
-       spawnfunc_item_vaporizer_cells(e);
+       StartItem(e, ITEM_VaporizerCells);
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
@@ -329,36 +329,28 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
                return true;
        }
 
-       if(item.classname == "item_cells")
+       if(def == ITEM_Cells)
        {
                if(autocvar_g_instagib_ammo_convert_cells)
-               {
-                       replace_with_insta_cells(item);
-               }
+                       instagib_replace_with_vaporizer_cells(item);
                return true;
        }
-       else if(item.classname == "item_rockets")
+       else if(def == ITEM_Rockets)
        {
                if(autocvar_g_instagib_ammo_convert_rockets)
-               {
-                       replace_with_insta_cells(item);
-               }
+                       instagib_replace_with_vaporizer_cells(item);
                return true;
        }
-       else if(item.classname == "item_shells")
+       else if(def == ITEM_Shells)
        {
                if(autocvar_g_instagib_ammo_convert_shells)
-               {
-                       replace_with_insta_cells(item);
-               }
+                       instagib_replace_with_vaporizer_cells(item);
                return true;
        }
-       else if(item.classname == "item_bullets")
+       else if(def == ITEM_Bullets)
        {
                if(autocvar_g_instagib_ammo_convert_bullets)
-               {
-                       replace_with_insta_cells(item);
-               }
+                       instagib_replace_with_vaporizer_cells(item);
                return true;
        }
 
@@ -370,7 +362,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
 
        if(item.weapon == WEP_DEVASTATOR.m_id || item.weapon == WEP_VORTEX.m_id)
        {
-               replace_with_insta_cells(item);
+               instagib_replace_with_vaporizer_cells(item);
                return true;
        }
 
index d2c547b6f6e9d3bacce6388c7f5eed703c642be1..1253c92a93b4887d525152d86ffc7b33e6b2ae2e 100644 (file)
@@ -21,7 +21,7 @@ int GetAmmoConsumptionQ3(string netname);
        { \
                if(this.count && xonwep.ammo_type) \
                        SetResource(this, xonwep.ammo_type, this.count * GetAmmoConsumptionQ3(xonwep.netname)); \
-       SPAWNFUNC_BODY(GetAmmoItem(xonwep.ammo_type)) \
+               SPAWNFUNC_BODY(GetAmmoItem(xonwep.ammo_type)) \
        }
 
 // Ammo only, conditional