1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-25 05:35:25 +02:00

Script API: Check that SAOs are still usable before attempting to use them

This commit is contained in:
sfan5
2020-02-11 13:23:03 +01:00
parent b14aa1c847
commit 91eef646a5
3 changed files with 8 additions and 10 deletions

View File

@@ -864,7 +864,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, session_t p
m_peer_id(peer_id_),
m_is_singleplayer(is_singleplayer)
{
assert(m_peer_id != 0); // pre-condition
SANITY_CHECK(m_peer_id != PEER_ID_INEXISTENT);
m_prop.hp_max = PLAYER_MAX_HP_DEFAULT;
m_prop.breath_max = PLAYER_MAX_BREATH_DEFAULT;
@@ -1393,7 +1393,7 @@ bool PlayerSAO::setWieldedItem(const ItemStack &item)
void PlayerSAO::disconnected()
{
m_peer_id = 0;
m_peer_id = PEER_ID_INEXISTENT;
m_pending_removal = true;
}