NSMonster: add spawn key "leap_damage", to define the sort of damage the monster can apply when leaping towards you.
This commit is contained in:
parent
571ef536a1
commit
83202a6174
2 changed files with 30 additions and 0 deletions
|
@ -494,6 +494,9 @@ private:
|
|||
float m_flWalkSpeed;
|
||||
float m_flRunSpeed;
|
||||
|
||||
float m_flLeapDamage;
|
||||
bool m_bLeapAttacked;
|
||||
|
||||
nonvirtual void _LerpTurnToEnemy(void);
|
||||
nonvirtual void _LerpTurnToPos(vector);
|
||||
nonvirtual void _LerpTurnToYaw(vector);
|
||||
|
|
|
@ -92,6 +92,8 @@ NSMonster::NSMonster(void)
|
|||
|
||||
m_flWalkSpeed = autocvar_ai_walkSpeed;
|
||||
m_flRunSpeed = autocvar_ai_runSpeed;
|
||||
m_flLeapDamage = 0;
|
||||
m_bLeapAttacked = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -196,6 +198,8 @@ NSMonster::Save(float handle)
|
|||
SaveString(handle, "m_strBodyOnDraw", m_strBodyOnDraw);
|
||||
SaveFloat(handle, "m_flWalkSpeed", m_flWalkSpeed);
|
||||
SaveFloat(handle, "m_flRunSpeed", m_flRunSpeed);
|
||||
SaveFloat(handle, "m_flLeapDamage", m_flLeapDamage);
|
||||
SaveBool(handle, "m_bLeapAttacked", m_bLeapAttacked);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -437,6 +441,12 @@ NSMonster::Restore(string strKey, string strValue)
|
|||
case "m_flRunSpeed":
|
||||
m_flRunSpeed = ReadFloat(strValue);
|
||||
break;
|
||||
case "m_flLeapDamage":
|
||||
m_flLeapDamage = ReadFloat(strValue);
|
||||
break;
|
||||
case "m_bLeapAttacked":
|
||||
m_bLeapAttacked = ReadBool(strValue);
|
||||
break;
|
||||
default:
|
||||
super::Restore(strKey, strValue);
|
||||
break;
|
||||
|
@ -1313,6 +1323,11 @@ NSMonster::Physics(void)
|
|||
input_angles = angles;
|
||||
m_bTurning = false;
|
||||
|
||||
/* unset the leap attack */
|
||||
if (m_bLeapAttacked == true && HasFlags(FL_ONGROUND) == true) {
|
||||
m_bLeapAttacked = false;
|
||||
}
|
||||
|
||||
/* when stuck in a sequence, forget enemies, combat stance */
|
||||
if (GetSequenceState() != SEQUENCESTATE_NONE) {
|
||||
m_eEnemy = __NULL__;
|
||||
|
@ -1381,6 +1396,15 @@ NSMonster::Physics(void)
|
|||
void
|
||||
NSMonster::Touch(entity eToucher)
|
||||
{
|
||||
/* leap test, are we no longer on the ground? */
|
||||
if (m_flLeapDamage && m_bLeapAttacked == false)
|
||||
if (HasFlags(FL_ONGROUND) == false) {
|
||||
if (eToucher.takedamage == DAMAGE_YES) {
|
||||
Damage_Apply(eToucher, this, m_flLeapDamage, WEAPON_NONE, DMG_BLUNT);
|
||||
m_bLeapAttacked = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (movetype != MOVETYPE_WALK)
|
||||
return;
|
||||
|
||||
|
@ -1766,6 +1790,9 @@ NSMonster::SpawnKey(string strKey, string strValue)
|
|||
case "health":
|
||||
base_health = Skill_GetDefValue(strValue);
|
||||
break;
|
||||
case "leap_damage":
|
||||
m_flLeapDamage = Skill_GetDefValue(strValue);
|
||||
break;
|
||||
default:
|
||||
NSSurfacePropEntity::SpawnKey(strKey, strValue);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue