X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fspawning.qc;h=17f2ddeeee2bb567271f1f689c8376494168a5a6;hb=cac7a0ffc2bb7212fdd92f5c9782b09b65279fe1;hp=8501110059da65ab869611209480e540f4bea5f2;hpb=7f6f1dc979173320c7ffe7dfe647a52686f447c2;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index 850111005..17f2ddeee 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -1,10 +1,14 @@ #include "spawning.qh" #include "weaponsystem.qh" +#include "../resources.qh" #include "../mutators/_mod.qh" #include +#include #include +.bool m_isreplaced; ///< Holds whether the weapon has been replaced. + string W_Apply_Weaponreplace(string in) { string out = ""; @@ -25,7 +29,9 @@ string W_Apply_Weaponreplace(string in) 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) { @@ -55,7 +61,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e) { entity replacement = spawn(); copyentity(this, replacement); - replacement.classname = "replacedweapon"; + replacement.m_isreplaced = true; weapon_defaultspawnfunc(replacement, it); break; } @@ -82,6 +88,13 @@ void weapon_defaultspawnfunc(entity this, Weapon e) } } + if (!Item_IsDefinitionAllowed(wpn.m_pickup)) + { + delete(this); + startitem_failed = true; + return; + } + if (!this.respawntime) { if (wpn.spawnflags & WEP_FLAG_SUPERWEAPON) @@ -101,7 +114,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e) this.superweapons_finished = autocvar_g_balance_superweapons_time; // if we don't already have ammo, give us some ammo - if (!GetResourceAmount(this, wpn.ammo_type)) + if ((wpn.ammo_type != RESOURCE_NONE) && !GetResourceAmount(this, wpn.ammo_type)) { switch (wpn.ammo_type) {