diff options
author | stujones11 <stujones111@gmail.com> | 2017-08-24 09:01:16 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-08-24 10:01:16 +0200 |
commit | ac4884c3d677ef51bcce47f95ccd49d874022692 (patch) | |
tree | d7474c9c8914a6147a157245182fa8f201b51646 /src/content_sao.cpp | |
parent | 01c319d7784c3db614a53745e5af62c43cf45c90 (diff) | |
download | minetest-ac4884c3d677ef51bcce47f95ccd49d874022692.tar.gz minetest-ac4884c3d677ef51bcce47f95ccd49d874022692.tar.bz2 minetest-ac4884c3d677ef51bcce47f95ccd49d874022692.zip |
Make entity selection and collision boxes independently settable (#6218)
* Make entity selection and collision boxes independently settable
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r-- | src/content_sao.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp index bc5fb164b..4debc354f 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -752,12 +752,12 @@ bool LuaEntitySAO::getCollisionBox(aabb3f *toset) const bool LuaEntitySAO::getSelectionBox(aabb3f *toset) const { - if (!m_prop.is_visible) { + if (!m_prop.is_visible || !m_prop.pointable) { return false; } - toset->MinEdge = m_prop.collisionbox.MinEdge * BS; - toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS; + toset->MinEdge = m_prop.selectionbox.MinEdge * BS; + toset->MaxEdge = m_prop.selectionbox.MaxEdge * BS; return true; } @@ -786,6 +786,8 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, RemotePlayer *player_, u16 peer_id m_prop.physical = false; m_prop.weight = 75; m_prop.collisionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f); + m_prop.selectionbox = aabb3f(-0.3f, 0.0f, -0.3f, 0.3f, 1.77f, 0.3f); + m_prop.pointable = true; // start of default appearance, this should be overwritten by LUA m_prop.visual = "upright_sprite"; m_prop.visual_size = v2f(1, 2); @@ -1426,12 +1428,12 @@ bool PlayerSAO::getCollisionBox(aabb3f *toset) const bool PlayerSAO::getSelectionBox(aabb3f *toset) const { - if (!m_prop.is_visible) { + if (!m_prop.is_visible || !m_prop.pointable) { return false; } - toset->MinEdge = m_prop.collisionbox.MinEdge * BS; - toset->MaxEdge = m_prop.collisionbox.MaxEdge * BS; + toset->MinEdge = m_prop.selectionbox.MinEdge * BS; + toset->MaxEdge = m_prop.selectionbox.MaxEdge * BS; return true; } |