mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Attachments: Fix attachments to temporary removed objects (#8989)
Does not clear the parent's attachment information when the child is deleted locally. Either it was removed permanently, or just temporary - we don't know, but it's up to the server to send a *detach from child" packet for the parent.
This commit is contained in:
parent
251038e136
commit
81c2370c8b
6 changed files with 70 additions and 31 deletions
|
@ -1107,14 +1107,14 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
|||
if (!send_recommended)
|
||||
return;
|
||||
|
||||
// If the object is attached client-side, don't waste bandwidth sending its
|
||||
// position or rotation to clients.
|
||||
if (m_position_not_sent && !isAttached()) {
|
||||
if (m_position_not_sent) {
|
||||
m_position_not_sent = false;
|
||||
float update_interval = m_env->getSendRecommendedInterval();
|
||||
v3f pos;
|
||||
if (isAttached()) // Just in case we ever do send attachment position too
|
||||
pos = m_env->getActiveObject(m_attachment_parent_id)->getBasePosition();
|
||||
// When attached, the position is only sent to clients where the
|
||||
// parent isn't known
|
||||
if (isAttached())
|
||||
pos = m_last_good_position;
|
||||
else
|
||||
pos = m_base_position;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue