#include "weaponsystem.qh"
#include "../resources.qh"
-#include "../mutators/_mod.qh"
+#include <server/mutators/_mod.qh>
#include <common/t_items.qh>
+#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 = "";
void weapon_defaultspawnfunc(entity this, Weapon e)
{
Weapon wpn = e;
- if (this.classname != "droppedweapon" && this.classname != "replacedweapon")
+ e = wpn = wpn.m_spawnfunc_hookreplace(wpn, this);
+ this.classname = wpn.m_canonical_spawnfunc;
+ 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;
}
}
}
+ if (!Item_IsDefinitionAllowed(wpn.m_pickup))
+ {
+ delete(this);
+ startitem_failed = true;
+ return;
+ }
+
if (!this.respawntime)
{
if (wpn.spawnflags & WEP_FLAG_SUPERWEAPON)