1
0
Fork 0

Another fix for excessive food drain

This commit is contained in:
Tiger Wang 2014-07-16 22:22:45 +01:00
parent 960fcaa90c
commit 174906efca
2 changed files with 10 additions and 1 deletions

View File

@ -2141,6 +2141,8 @@ void cPlayer::ApplyFoodExhaustionFromMovement()
{
return;
}
// If we have just teleported, apply no exhaustion
if (m_bIsTeleporting)
{
m_bIsTeleporting = false;
@ -2152,6 +2154,13 @@ void cPlayer::ApplyFoodExhaustionFromMovement()
{
return;
}
// Process exhaustion every two ticks as that is how frequently m_LastPos is updated
// Otherwise, we apply exhaustion for a 'movement' every tick, one of which is an already processed value
if (GetWorld()->GetWorldAge() % 2 != 0)
{
return;
}
// Calculate the distance travelled, update the last pos:
Vector3d Movement(GetPosition() - m_LastPos);

View File

@ -449,7 +449,7 @@ protected:
double m_FoodSaturationLevel;
/** Count-up to the healing or damaging action, based on m_FoodLevel */
int m_FoodTickTimer;
int m_FoodTickTimer;
/** A "buffer" which adds up hunger before it is substracted from m_FoodSaturationLevel or m_FoodLevel. Each action adds a little */
double m_FoodExhaustionLevel;