From: terencehill Date: Sat, 6 May 2023 13:22:44 +0000 (+0200) Subject: Instagib: fix ammo from other games not getting replaced by vaporizer cells (if enabl... X-Git-Tag: xonotic-v0.8.6~114^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6743d0b5f6d84c9bc1f718bacb167e687f7b5d81;p=xonotic%2Fxonotic-data.pk3dir.git Instagib: fix ammo from other games not getting replaced by vaporizer cells (if enabled by the g_instagib_ammo_convert_ cvars, disabled by default) --- diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 5e2482d97..3a7d563d8 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -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; } diff --git a/qcsrc/server/compat/quake3.qh b/qcsrc/server/compat/quake3.qh index d2c547b6f..1253c92a9 100644 --- a/qcsrc/server/compat/quake3.qh +++ b/qcsrc/server/compat/quake3.qh @@ -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