diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2021-02-15 20:41:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-15 20:41:19 +0100 |
commit | 7832b6843e73410e15677d1324d582b4b7c7e824 (patch) | |
tree | 2b7ab359ecb16a43e37dffdbf591d8a930ec0235 /src/server/luaentity_sao.cpp | |
parent | f018737b0646e0961a46a74765945d6039e47b88 (diff) | |
download | minetest-7832b6843e73410e15677d1324d582b4b7c7e824.tar.gz minetest-7832b6843e73410e15677d1324d582b4b7c7e824.tar.bz2 minetest-7832b6843e73410e15677d1324d582b4b7c7e824.zip |
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.
Diffstat (limited to 'src/server/luaentity_sao.cpp')
-rw-r--r-- | src/server/luaentity_sao.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
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; |