From: bones_was_here Date: Sun, 18 Jun 2023 22:18:23 +0000 (+1000) Subject: overkill: optimise replacement of powerups with superweapons X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ea7bc44faa97a8adf2ee7c949a44ab0bb5c7c4cb;p=xonotic%2Fxonotic-data.pk3dir.git overkill: optimise replacement of powerups with superweapons We can use the itemdefs to skip the classname search. --- 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;