Added couple checks for AddExperience

This commit is contained in:
2025-01-29 21:21:31 +03:00
parent f9f2ba3fbd
commit b12fb3e050
2 changed files with 16 additions and 4 deletions

View File

@@ -28,11 +28,11 @@ public:
IPhysicsObject *pPhysObj = pEvent->pObjects[!index];
CBaseEntity *pOther = static_cast<CBaseEntity *>(pPhysObj->GetGameData());
if( pOther->IsPlayer())
if( pOther->IsPlayer() && !AlreadyGrabbedBySomeone)
{
CHL2MP_Player* loc = ToHL2MPPlayer(pOther);
loc->AddExperience(15);
AlreadyGrabbedBySomeone= true;
AlreadyGrabbedBySomeone = true;
SetCollisionGroup(COLLISION_GROUP_DEBRIS);
UTIL_Remove(this);
return;

View File

@@ -526,7 +526,21 @@ void CHL2MP_Player::ResetAnimation( void )
void CHL2MP_Player::AddExperience( int exp )
{
if(m_PolyLocal.m_iPolyLevel == MAX_POLYLEVEL -1)
{
Msg("PolyLevel is %hu == MAX_POLYLEVEL\n", m_PolyLocal.m_iPolyLevel+1);
return;
}
m_PolyLocal.m_iExpPerLevel += exp;
Msg("%d ExpPerLevel \n", m_PolyLocal.m_iExpPerLevel);
if(m_PolyLocal.m_iExpPerLevel >= g_iaTableExpPerLevel[m_PolyLocal.m_iPolyLevel])
{
m_PolyLocal.m_iExpPerLevel = m_PolyLocal.m_iExpPerLevel-g_iaTableExpPerLevel[m_PolyLocal.m_iPolyLevel];
m_PolyLocal.m_iPolyLevel++;
Msg("PolyLevel++ is %hu\n", m_PolyLocal.m_iPolyLevel);
}
}
@@ -575,8 +589,6 @@ void CHL2MP_Player::PostThink( void )
m_PlayerAnimState.Update();
Msg("%d\n",m_PolyLocal.m_iExpPerLevel);
// Store the eye angles pitch so the client can compute its animation state correctly.
m_angEyeAngles = EyeAngles();