Added couple checks for AddExperience
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user