From fd1993807d7ada76969f782bd831a2dbc206bca0 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 20 Aug 2017 21:49:54 +1000 Subject: [PATCH] Add a temporary flag for weapons that penetrate walls (rifle), to avoid a direct weapon reference --- qcsrc/common/weapons/weapon.qh | 1 + qcsrc/common/weapons/weapon/rifle.qh | 2 +- qcsrc/server/weapons/tracing.qc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index ea2e2e173..4be22446b 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -198,6 +198,7 @@ const int WEP_TYPE_MELEE_PRI = 0x400; // primary attack is melee swing (for const int WEP_TYPE_MELEE_SEC = 0x800; // secondary attack is melee swing (for animation) const int WEP_FLAG_DUALWIELD = 0x1000; // weapon can be dual wielded const int WEP_FLAG_NODUAL = 0x2000; // weapon doesn't work well with dual wielding (fireball etc just explode on fire), doesn't currently prevent anything +const int WEP_FLAG_PENETRATEWALLS = 0x4000; // weapon has high calibur bullets that can penetrate thick walls (WEAPONTODO) // variables: string weaponorder_byid; diff --git a/qcsrc/common/weapons/weapon/rifle.qh b/qcsrc/common/weapons/weapon/rifle.qh index 29520f545..ed5496f05 100644 --- a/qcsrc/common/weapons/weapon/rifle.qh +++ b/qcsrc/common/weapons/weapon/rifle.qh @@ -3,7 +3,7 @@ CLASS(Rifle, Weapon) /* ammotype */ ATTRIB(Rifle, ammo_field, .int, ammo_nails); /* impulse */ ATTRIB(Rifle, impulse, int, 7); -/* flags */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN); +/* flags */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS); /* rating */ ATTRIB(Rifle, bot_pickupbasevalue, float, 7000); /* color */ ATTRIB(Rifle, wpcolor, vector, '0.5 1 0'); /* modelname */ ATTRIB(Rifle, mdl, string, "campingrifle"); diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index f657789f8..8eaa0280a 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -30,7 +30,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect float oldsolid = ent.dphitcontentsmask; if(!IS_CLIENT(ent)) antilag = false; // no antilag for non-clients! - if (IS_PLAYER(ent) && ent.(weaponentity).m_weapon == WEP_RIFLE) + if (IS_PLAYER(ent) && (ent.(weaponentity).m_weapon.spawnflags & WEP_FLAG_PENETRATEWALLS)) ent.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE; else ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE; -- 2.39.2