From d749241081bc2a6beff83d5a4e30f6dcde6a37ef Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 22 Sep 2023 17:04:11 -0700 Subject: [PATCH] func_monsterclip: Initial implementation --- src/gs-entbase/server.src | 1 + src/gs-entbase/server/func_monsterclip.qc | 53 +++++++++++++++++++++++ src/shared/NSMonster.qc | 5 +++ 3 files changed, 59 insertions(+) create mode 100644 src/gs-entbase/server/func_monsterclip.qc diff --git a/src/gs-entbase/server.src b/src/gs-entbase/server.src index 3a25e2f6..5a4da6c8 100644 --- a/src/gs-entbase/server.src +++ b/src/gs-entbase/server.src @@ -50,6 +50,7 @@ server/func_plat.qc server/func_platrot.qc server/func_pendulum.qc server/func_vehiclecontrols.qc +server/func_monsterclip.qc server/light.qc server/logic_auto.qc server/stubs.qc diff --git a/src/gs-entbase/server/func_monsterclip.qc b/src/gs-entbase/server/func_monsterclip.qc new file mode 100644 index 00000000..a222504f --- /dev/null +++ b/src/gs-entbase/server/func_monsterclip.qc @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2023 Vera Visions LLC. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/*!QUAKED func_monsterclip (0 .5 .8) ? +# OVERVIEW +A clip isolated to monster entities, as long as they have a MONSTERCLIP +spawnflag set. + +# KEYS +- "targetname" : Name + +# TRIVIA +This entity was introduced in Half-Life (1998). +*/ +class +func_monsterclip:NSEntity +{ +public: + void func_monsterclip(void); + + virtual void Respawn(void); +}; + +void +func_monsterclip::func_monsterclip(void) +{ + +} + +void +func_monsterclip::Respawn(void) +{ + ClearAngles(); + SetOrigin(GetSpawnOrigin()); + SetModel(GetSpawnModel()); + SetSolid(SOLID_BSP); + SetMovetype(MOVETYPE_NONE); + SetSkin(-17); /* undocumented MONSTERCLIP */ + Hide(); +} \ No newline at end of file diff --git a/src/shared/NSMonster.qc b/src/shared/NSMonster.qc index 0b3df28d..8a8db495 100644 --- a/src/shared/NSMonster.qc +++ b/src/shared/NSMonster.qc @@ -1709,6 +1709,11 @@ NSMonster::Respawn(void) SetEyePos([0, 0, m_flEyeHeight]); ScheduleThink(AdjustSpawnPos, 0.0f); + if (HasSpawnFlags(MSF_MONSTERCLIP)) { + hitcontentsmaski = CONTENTBITS_BOXSOLID | CONTENTBIT_MONSTERCLIP; + } else { + hitcontentsmaski = CONTENTBITS_BOXSOLID; + } if (m_bWeaponStartsDrawn) { m_bWeaponDrawn = true;