Skip to content

Commit

Permalink
fix trigger_hurt_remote charging armor above max
Browse files Browse the repository at this point in the history
also fix batteries not charging up to startarmor setting
  • Loading branch information
wootguy committed Sep 7, 2024
1 parent ff5bdb3 commit 69d4559
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dlls/item/CItemBattery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CItemBattery : public CItem
return FALSE;
}

float healthcap = m_healthcap > 0 ? m_healthcap : MAX_NORMAL_BATTERY;
float healthcap = m_healthcap > 0 ? m_healthcap : mp_startarmor.value;

if ((pPlayer->pev->armorvalue < healthcap) &&
(pPlayer->pev->weapons & (1 << WEAPON_SUIT)))
Expand All @@ -72,7 +72,7 @@ class CItemBattery : public CItem

// Suit reports new power level
// For some reason this wasn't working in release build -- round it.
pct = (int)((float)(pPlayer->pev->armorvalue * 100.0) * (1.0 / MAX_NORMAL_BATTERY) + 0.5);
pct = (int)((float)(pPlayer->pev->armorvalue * 100.0) * (1.0 / mp_startarmor.value) + 0.5);
pct = (pct / 5);
if (pct > 0)
pct--;
Expand Down
1 change: 1 addition & 0 deletions dlls/triggers/CTriggerHurtRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void CTriggerHurtRemote::HurtTarget(CBaseEntity* loser) {
else {
if (pev->spawnflags & SF_RHURT_DO_ARMOR) {
loser->pev->armorvalue = V_max(loser->pev->armorvalue - m_armorDmg, 0);
loser->pev->armorvalue = V_min(mp_startarmor.value, loser->pev->armorvalue);
}

if (pev->dmg > 0) {
Expand Down

0 comments on commit 69d4559

Please sign in to comment.