{
return cvar_string(sprintf("g_random_items_replace_%s", class_name));
}
- if (item.classname == "replacedweapon")
- {
- Weapon w = Weapons_from(item.weapon);
- if (w != WEP_Null)
- {
- return cvar_string(sprintf("g_random_items_replace_weapon_%s", w.netname));
- }
- }
return "";
}
#include <server/items.qh>
#include <common/weapons/_all.qh>
+.bool m_isreplaced; ///< Holds whether the weapon has been replaced.
+
string W_Apply_Weaponreplace(string in)
{
string out = "";
Weapon wpn = e;
e = wpn = wpn.m_spawnfunc_hookreplace(wpn, this);
this.classname = wpn.m_canonical_spawnfunc;
- if (!Item_IsLoot(this) && this.classname != "replacedweapon")
+ if (!Item_IsLoot(this) && !this.m_isreplaced)
{
if (e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
{
{
entity replacement = spawn();
copyentity(this, replacement);
- replacement.classname = "replacedweapon";
+ replacement.m_isreplaced = true;
weapon_defaultspawnfunc(replacement, it);
break;
}