From ea7bc44faa97a8adf2ee7c949a44ab0bb5c7c4cb Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Mon, 19 Jun 2023 08:18:23 +1000 Subject: [PATCH] overkill: optimise replacement of powerups with superweapons We can use the itemdefs to skip the classname search. --- .../common/mutators/mutator/overkill/sv_overkill.qc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index d4a1f4aeb..53eb25575 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -225,22 +225,26 @@ MUTATOR_HOOKFUNCTION(ok, FilterItem) } if (item.classname == "item_strength") { - entity wep = new(weapon_okhmg); + entity wep = spawn(); Item_CopyFields(item, wep); wep.ok_item = true; wep.respawntime = g_pickup_respawntime_superweapon; wep.pickup_anyway = true; - Item_Initialize(wep, "weapon_okhmg"); // doesn't actually use spawnfunc + wep.itemdef = WEP_OVERKILL_HMG; + wep.lifetime = -1; + Item_Initialise(wep); return true; } else if (item.classname == "item_shield") { - entity wep = new(weapon_okrpc); + entity wep = spawn(); Item_CopyFields(item, wep); wep.ok_item = true; wep.respawntime = g_pickup_respawntime_superweapon; wep.pickup_anyway = true; - Item_Initialize(wep, "weapon_okrpc"); // doesn't actually use spawnfunc + wep.itemdef = WEP_OVERKILL_RPC; + wep.lifetime = -1; + Item_Initialise(wep); return true; } return true; -- 2.39.2