From 636011bb12cd305cafb4e130690fa0fa6fa6405b Mon Sep 17 00:00:00 2001 From: Lyberta Date: Mon, 16 Oct 2017 08:20:14 +0300 Subject: [PATCH] Removed references to droppedweapon. --- qcsrc/common/gamemodes/gamemode/nexball/nexball.qc | 2 +- qcsrc/common/mutators/mutator/instagib/sv_instagib.qc | 2 +- qcsrc/common/t_items.qc | 6 +++--- qcsrc/server/bot/default/havocbot/roles.qc | 3 ++- qcsrc/server/miscfunctions.qc | 6 +++++- qcsrc/server/mutators/mutator/gamemode_cts.qc | 6 ++++-- qcsrc/server/weapons/selection.qc | 5 ++++- qcsrc/server/weapons/spawning.qc | 3 ++- qcsrc/server/weapons/throwing.qc | 2 +- 9 files changed, 23 insertions(+), 12 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 5a0ff2a2c..7eb8ecb4b 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -909,7 +909,7 @@ MUTATOR_HOOKFUNCTION(nb, FilterItem) { entity item = M_ARGV(0, entity); - if(item.classname == "droppedweapon") + if(Item_IsLoot(item)) if(item.weapon == WEP_NEXBALL.m_id) return true; diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 8716264f4..a81b4e795 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -427,7 +427,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem) return true; } - if(item.weapon == WEP_VAPORIZER.m_id && item.classname == "droppedweapon") + if(item.weapon == WEP_VAPORIZER.m_id && Item_IsLoot(item)) { SetResourceAmount(item, RESOURCE_CELLS, autocvar_g_instagib_ammo_drop); return false; diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index da491b718..81568e86a 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -1343,7 +1343,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default if(def.instanceOfWeaponPickup) { - if (this.classname != "droppedweapon") // if dropped, colormap is already set up nicely + if (!Item_IsLoot(this)) // if dropped, colormap is already set up nicely this.colormap = 1024; // color shirt=0 pants=0 grey else this.gravity = 1; @@ -1444,7 +1444,7 @@ void setItemGroupCount() void target_items_use(entity this, entity actor, entity trigger) { - if(actor.classname == "droppedweapon") + if(Item_IsLoot(actor)) { EXACTTRIGGER_TOUCH(this, trigger); delete(actor); @@ -1459,7 +1459,7 @@ void target_items_use(entity this, entity actor, entity trigger) EXACTTRIGGER_TOUCH(this, trigger); } - IL_EACH(g_items, it.enemy == actor && it.classname == "droppedweapon", + IL_EACH(g_items, it.enemy == actor && Item_IsLoot(it), { delete(it); }); diff --git a/qcsrc/server/bot/default/havocbot/roles.qc b/qcsrc/server/bot/default/havocbot/roles.qc index 94aed9c96..aa1884a33 100644 --- a/qcsrc/server/bot/default/havocbot/roles.qc +++ b/qcsrc/server/bot/default/havocbot/roles.qc @@ -2,6 +2,7 @@ #include #include +#include #include "havocbot.qh" #include "../cvars.qh" @@ -81,7 +82,7 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float continue; // Check if the item can be picked up safely - if(it.classname == "droppedweapon") + if(Item_IsLoot(it)) { if(!IS_ONGROUND(it)) continue; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index e3c6797f3..ef69905bd 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -8,6 +8,7 @@ #include "mutators/_mod.qh" #include "../common/t_items.qh" #include "resources.qh" +#include "items.qh" #include "weapons/accuracy.qh" #include "weapons/csqcprojectile.qh" #include "weapons/selection.qh" @@ -1437,10 +1438,13 @@ bool isPushable(entity e) return false; if(e.iscreature) return true; + if (Item_IsLoot(e)) + { + return true; + } switch(e.classname) { case "body": - case "droppedweapon": return true; case "bullet": // antilagged bullets can't hit this either return false; diff --git a/qcsrc/server/mutators/mutator/gamemode_cts.qc b/qcsrc/server/mutators/mutator/gamemode_cts.qc index 20f4b383d..ca892c52f 100644 --- a/qcsrc/server/mutators/mutator/gamemode_cts.qc +++ b/qcsrc/server/mutators/mutator/gamemode_cts.qc @@ -1,7 +1,7 @@ #include "gamemode_cts.qh" -#include #include +#include float autocvar_g_cts_finish_kill_delay; bool autocvar_g_cts_selfdamage; @@ -314,8 +314,10 @@ MUTATOR_HOOKFUNCTION(cts, FilterItem) { entity item = M_ARGV(0, entity); - if(item.classname == "droppedweapon") + if (Item_IsLoot(item)) + { return true; + } } MUTATOR_HOOKFUNCTION(cts, Damage_Calculate) diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 776d8d8d0..693d5a240 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -2,6 +2,7 @@ #include "weaponsystem.qh" #include +#include #include #include #include @@ -25,8 +26,10 @@ void Weapon_whereis(Weapon this, entity cl) if (!autocvar_g_showweaponspawns) return; IL_EACH(g_items, it.weapon == this.m_id && (!it.team || (it.ItemStatus & ITS_AVAILABLE)), { - if (it.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2) + if (Item_IsLoot(it) && (autocvar_g_showweaponspawns < 2)) + { continue; + } entity wp = WaypointSprite_Spawn( WP_Weapon, -2, 0, diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index 244c1c623..c1ff4e021 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -4,6 +4,7 @@ #include "../resources.qh" #include "../mutators/_mod.qh" #include +#include #include string W_Apply_Weaponreplace(string in) @@ -28,7 +29,7 @@ void weapon_defaultspawnfunc(entity this, Weapon e) Weapon wpn = e; e = wpn = wpn.m_spawnfunc_hookreplace(wpn, this); this.classname = wpn.m_canonical_spawnfunc; - if (this.classname != "droppedweapon" && this.classname != "replacedweapon") + if (!Item_IsLoot(this) && this.classname != "replacedweapon") { if (e.spawnflags & WEP_FLAG_MUTATORBLOCKED) { diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index 91602e750..ae745efd6 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -41,7 +41,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto Weapon info = Weapons_from(wpn); int ammotype = info.ammo_type; - entity wep = new(droppedweapon); + entity wep = spawn(); Item_SetLoot(wep, true); setorigin(wep, org); wep.velocity = velo; -- 2.39.2