From c8d29078da18152f3c2d6d5ae618015c6d8be755 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Mon, 18 Sep 2023 15:51:35 -0700 Subject: [PATCH] NSMonster: Add 'dead' boolean spawn key. Will decide if the monster starts 'dead' --- src/shared/NSMonster.h | 3 +++ src/shared/NSMonster.qc | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/shared/NSMonster.h b/src/shared/NSMonster.h index 799f30f9..57dd5f9a 100644 --- a/src/shared/NSMonster.h +++ b/src/shared/NSMonster.h @@ -236,6 +236,7 @@ capable of fighting if prompted to. ## KEYS - BEHAVIOUR - "health" : Starting health. +- "dead" : Whether to start the monster in a dead state (0 or 1). - "team" : Alliance. See allianceState_t for which numerical values to pick. - "speed_walk" : Walk speed in units per second. - "speed_run" : Run speed in units per second. @@ -499,6 +500,8 @@ private: float _m_flMeleeDelay; float _m_flBurstCount; bool _m_bShouldThrow; + bool _m_bStartDead; + float _m_flFrame; /* save these please */ float _m_flReloadTracker; diff --git a/src/shared/NSMonster.qc b/src/shared/NSMonster.qc index 7b255af5..b2bc4f33 100644 --- a/src/shared/NSMonster.qc +++ b/src/shared/NSMonster.qc @@ -1664,6 +1664,16 @@ NSMonster::Respawn(void) } else { m_bWeaponDrawn = false; } + + /* start dead (corpse) */ + if (_m_bStartDead) { + RemoveFlags(FL_MONSTER); + SetMovetype(MOVETYPE_NONE); + SetSolid(SOLID_CORPSE); + SetHealth(base_health); + SetState(MONSTER_DEAD); + SetFrame(_m_flFrame); + } } void @@ -1818,6 +1828,13 @@ NSMonster::SpawnKey(string strKey, string strValue) case "leap_damage": m_flLeapDamage = Skill_GetDefValue(strValue); break; + /* simple tweaks */ + case "dead": + _m_bStartDead = ReadBool(strValue); + break; + case "frame": + _m_flFrame = ReadFloat(strValue); + break; default: NSSurfacePropEntity::SpawnKey(strKey, strValue); break;