1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-22 04:15:44 +02:00

Rework object attachment handling to fix bugs (#14825)

This commit is contained in:
sfan5
2024-08-12 15:32:18 +02:00
committed by GitHub
parent a0e33ba9ea
commit 85e717fcd1
17 changed files with 245 additions and 172 deletions

View File

@@ -233,13 +233,12 @@ void PlayerSAO::step(float dtime, bool send_recommended)
}
// If attached, check that our parent is still there. If it isn't, detach.
if (m_attachment_parent_id && !isAttached()) {
if (m_attachment_parent_id && !getParent()) {
// This is handled when objects are removed from the map
warningstream << "PlayerSAO::step() id=" << m_id <<
" is attached to nonexistent parent. This is a bug." << std::endl;
clearParentAttachment();
setBasePosition(m_last_good_position);
m_env->getGameDef()->SendMovePlayer(this);
setPos(m_last_good_position);
}
//dstream<<"PlayerSAO::step: dtime: "<<dtime<<std::endl;