Skip to content

Commit

Permalink
Fix zombie regen clamping health values above max health
Browse files Browse the repository at this point in the history
  • Loading branch information
Vauff committed Dec 15, 2024
1 parent 950fff7 commit f59badc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/zombiereborn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,10 @@ bool CZRRegenTimer::Execute()
if (!pPawn || !pPawn->IsAlive())
return false;

// Do we even need to regen?
if (pPawn->m_iHealth() >= pPawn->m_iMaxHealth())
return true;

int iHealth = pPawn->m_iHealth() + m_iRegenAmount;
pPawn->m_iHealth = pPawn->m_iMaxHealth() < iHealth ? pPawn->m_iMaxHealth() : iHealth;
return true;
Expand Down

0 comments on commit f59badc

Please sign in to comment.