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/script/common | |
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/script/common')
-rw-r--r-- | src/script/common/c_content.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 47443493b..4360f63bb 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -197,6 +197,13 @@ void read_object_properties(lua_State *L, int index, prop->collisionbox = read_aabb3f(L, -1, 1.0); lua_pop(L, 1); + lua_getfield(L, -1, "selectionbox"); + if (lua_istable(L, -1)) + prop->selectionbox = read_aabb3f(L, -1, 1.0); + else + prop->selectionbox = prop->collisionbox; + lua_pop(L, 1); + getboolfield(L, -1, "pointable", prop->pointable); getstringfield(L, -1, "visual", prop->visual); getstringfield(L, -1, "mesh", prop->mesh); @@ -296,6 +303,10 @@ void push_object_properties(lua_State *L, ObjectProperties *prop) lua_setfield(L, -2, "weight"); push_aabb3f(L, prop->collisionbox); lua_setfield(L, -2, "collisionbox"); + push_aabb3f(L, prop->selectionbox); + lua_setfield(L, -2, "selectionbox"); + lua_pushboolean(L, prop->pointable); + lua_setfield(L, -2, "pointable"); lua_pushlstring(L, prop->visual.c_str(), prop->visual.size()); lua_setfield(L, -2, "visual"); lua_pushlstring(L, prop->mesh.c_str(), prop->mesh.size()); |