Another fix for excessive food drain
This commit is contained in:
parent
960fcaa90c
commit
174906efca
@ -2141,6 +2141,8 @@ void cPlayer::ApplyFoodExhaustionFromMovement()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have just teleported, apply no exhaustion
|
||||
if (m_bIsTeleporting)
|
||||
{
|
||||
m_bIsTeleporting = false;
|
||||
@ -2153,6 +2155,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);
|
||||
Movement.y = 0; // Only take XZ movement into account
|
||||
|
Loading…
Reference in New Issue
Block a user