item_health: take mega health away over time.

This commit is contained in:
Marco Cawthorne 2023-04-16 12:21:52 -07:00
parent b085cf6021
commit 2a988b7364
Signed by: eukara
GPG key ID: CE2032F0A2882A22
2 changed files with 23 additions and 14 deletions

View file

@ -62,6 +62,7 @@ item_health::Touch(entity eToucher)
Sound_Play(eToucher, CHAN_ITEM, "item_health_mega.pickup");
pl.health = bound(0, pl.health + 100, 200);
pl.m_megaHealthTime = time + 1.0f;
} else {
if (pl.health >= 100)
return;

View file

@ -139,6 +139,7 @@ class player:NSClientPlayer
float m_invisFinishTime;
float m_invulnFinishTime;
float m_enviroFinishTime;
float m_megaHealthTime;
#endif
virtual void Physics_Jump(void);
@ -480,20 +481,6 @@ player::Restore(string strKey, string strValue)
void
player::EvaluateEntity(void)
{
/* the generic client attributes */
NSClientPlayer::EvaluateEntity();
EVALUATE_FIELD(anim_top, PLAYER_TOPFRAME)
EVALUATE_FIELD(anim_top_time, PLAYER_TOPFRAME)
EVALUATE_FIELD(anim_top_delay, PLAYER_TOPFRAME)
EVALUATE_FIELD(anim_bottom, PLAYER_BOTTOMFRAME)
EVALUATE_FIELD(anim_bottom_time, PLAYER_BOTTOMFRAME)
EVALUATE_FIELD(ammo_shells, PLAYER_AMMO1)
EVALUATE_FIELD(ammo_nails, PLAYER_AMMO1)
EVALUATE_FIELD(ammo_rockets, PLAYER_AMMO1)
EVALUATE_FIELD(ammo_cells, PLAYER_AMMO1)
if (g_items & ITEM_QUAD) {
if (m_quadFinishTime < time) {
g_items &= ~ITEM_QUAD;
@ -517,6 +504,27 @@ player::EvaluateEntity(void)
g_items &= ~ITEM_ENVIROSUIT;
}
}
if (health > 100) {
if (m_megaHealthTime < time) {
health -= 1;
m_megaHealthTime = time + 1.0f;
}
}
/* the generic client attributes */
NSClientPlayer::EvaluateEntity();
EVALUATE_FIELD(anim_top, PLAYER_TOPFRAME)
EVALUATE_FIELD(anim_top_time, PLAYER_TOPFRAME)
EVALUATE_FIELD(anim_top_delay, PLAYER_TOPFRAME)
EVALUATE_FIELD(anim_bottom, PLAYER_BOTTOMFRAME)
EVALUATE_FIELD(anim_bottom_time, PLAYER_BOTTOMFRAME)
EVALUATE_FIELD(ammo_shells, PLAYER_AMMO1)
EVALUATE_FIELD(ammo_nails, PLAYER_AMMO1)
EVALUATE_FIELD(ammo_rockets, PLAYER_AMMO1)
EVALUATE_FIELD(ammo_cells, PLAYER_AMMO1)
}
/*