NSMonster: Add 'dead' boolean spawn key. Will decide if the monster starts 'dead'

This commit is contained in:
Marco Cawthorne 2023-09-18 15:51:35 -07:00
parent c71daa033e
commit c8d29078da
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 20 additions and 0 deletions

View File

@ -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;

View File

@ -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;