From 7832b6843e73410e15677d1324d582b4b7c7e824 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 15 Feb 2021 20:41:19 +0100 Subject: Server-side authority for attached players (#10952) The server must have authority about attachments. This commit ignores any player movement packets as long they're attached. --- src/server/luaentity_sao.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/server/luaentity_sao.cpp') diff --git a/src/server/luaentity_sao.cpp b/src/server/luaentity_sao.cpp index 5f35aaed8..3bcbe107b 100644 --- a/src/server/luaentity_sao.cpp +++ b/src/server/luaentity_sao.cpp @@ -146,15 +146,11 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) // Each frame, parent position is copied if the object is attached, otherwise it's calculated normally // If the object gets detached this comes into effect automatically from the last known origin - if(isAttached()) - { - v3f pos = m_env->getActiveObject(m_attachment_parent_id)->getBasePosition(); - m_base_position = pos; + if (auto *parent = getParent()) { + m_base_position = parent->getBasePosition(); m_velocity = v3f(0,0,0); m_acceleration = v3f(0,0,0); - } - else - { + } else { if(m_prop.physical){ aabb3f box = m_prop.collisionbox; box.MinEdge *= BS; -- cgit v1.2.3