Skip to content

Commit

Permalink
fix: Reset immunity effects always (#788)
Browse files Browse the repository at this point in the history
* Reset immunity effects always

* add new member m_bSpawnProtectionEffects
  • Loading branch information
Vaqtincha authored Dec 15, 2022
1 parent cf8deb9 commit 9801627
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions regamedll/dlls/API/CSPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ void CCSPlayer::Reset()
m_bGameForcingRespawn = false;
m_bAutoBunnyHopping = false;
m_bMegaBunnyJumping = false;
m_bSpawnProtectionEffects = false;
}

void CCSPlayer::OnSpawn()
Expand Down
10 changes: 6 additions & 4 deletions regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10247,6 +10247,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(SetSpawnProtection)(float flProtectionTime
#ifdef REGAMEDLL_ADD
if (respawn_immunity_effects.value > 0)
{
CSPlayer()->m_bSpawnProtectionEffects = true;
pev->rendermode = kRenderTransAdd;
pev->renderamt = 100.0f;

Expand All @@ -10268,19 +10269,20 @@ LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, RemoveSpawnProtection)
void CBasePlayer::__API_HOOK(RemoveSpawnProtection)()
{
#ifdef REGAMEDLL_ADD
if (respawn_immunity_effects.value > 0)
if (CSPlayer()->m_bSpawnProtectionEffects)
{
if (pev->rendermode == kRenderTransAdd &&
pev->renderamt == 100.0f)
if (pev->rendermode == kRenderTransAdd && pev->renderamt == 100.0f)
{
pev->renderamt = 255.0f;
pev->renderamt = 255.0f;
pev->rendermode = kRenderNormal;
}

MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pev);
WRITE_BYTE(STATUSICON_HIDE);
WRITE_STRING("suithelmet_full");
MESSAGE_END();

CSPlayer()->m_bSpawnProtectionEffects = false;
}

CSPlayer()->m_flSpawnProtectionEndTime = 0.0f;
Expand Down
4 changes: 3 additions & 1 deletion regamedll/public/regamedll/API/CSPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class CCSPlayer: public CCSMonster {
m_bGameForcingRespawn(false),
m_bAutoBunnyHopping(false),
m_bMegaBunnyJumping(false),
m_bPlantC4Anywhere(false)
m_bPlantC4Anywhere(false),
m_bSpawnProtectionEffects(false)
{
m_szModel[0] = '\0';
}
Expand Down Expand Up @@ -131,6 +132,7 @@ class CCSPlayer: public CCSMonster {
bool m_bAutoBunnyHopping;
bool m_bMegaBunnyJumping;
bool m_bPlantC4Anywhere;
bool m_bSpawnProtectionEffects;
};

// Inlines
Expand Down

0 comments on commit 9801627

Please sign in to comment.