summaryrefslogtreecommitdiff
path: root/src/server/luaentity_sao.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2021-02-15 20:41:19 +0100
committerGitHub <noreply@github.com>2021-02-15 20:41:19 +0100
commit7832b6843e73410e15677d1324d582b4b7c7e824 (patch)
tree2b7ab359ecb16a43e37dffdbf591d8a930ec0235 /src/server/luaentity_sao.cpp
parentf018737b0646e0961a46a74765945d6039e47b88 (diff)
downloadminetest-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.cpp10
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;