mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-15 09:25:37 +02:00
Fix player HP desync between client and server
This commit is contained in:
@@ -462,7 +462,7 @@ void PlayerSAO::rightClick(ServerActiveObject *clicker)
|
||||
m_env->getScriptIface()->on_rightclickplayer(this, clicker);
|
||||
}
|
||||
|
||||
void PlayerSAO::setHP(s32 hp, const PlayerHPChangeReason &reason)
|
||||
void PlayerSAO::setHP(s32 hp, const PlayerHPChangeReason &reason, bool send)
|
||||
{
|
||||
if (hp == (s32)m_hp)
|
||||
return; // Nothing to do
|
||||
@@ -490,7 +490,8 @@ void PlayerSAO::setHP(s32 hp, const PlayerHPChangeReason &reason)
|
||||
if ((hp == 0) != (oldhp == 0))
|
||||
m_properties_sent = false;
|
||||
|
||||
m_env->getGameDef()->SendPlayerHPOrDie(this, reason);
|
||||
if (send)
|
||||
m_env->getGameDef()->SendPlayerHPOrDie(this, reason);
|
||||
}
|
||||
|
||||
void PlayerSAO::setBreath(const u16 breath, bool send)
|
||||
|
Reference in New Issue
Block a user