diff options
author | SmallJoker <mk939@ymail.com> | 2017-09-10 20:16:25 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2017-09-10 20:26:03 +0200 |
commit | 5f489efc69e5e8e31891481d412ad569a6e1bcf8 (patch) | |
tree | 758764fbd858ef1a0c2bf4fcec8e2769dfdc1c08 | |
parent | 829bbafb271c8bbd268b959f6ef9b7b2a2fc8558 (diff) | |
download | minetest-5f489efc69e5e8e31891481d412ad569a6e1bcf8.tar.gz minetest-5f489efc69e5e8e31891481d412ad569a6e1bcf8.tar.bz2 minetest-5f489efc69e5e8e31891481d412ad569a6e1bcf8.zip |
Object properties: Fix loss of custom selectionbox
Only adjust it to the collisionbox value when the collisionbox was really set.
-rw-r--r-- | src/script/common/c_content.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 3932321a7..9e1fed2f1 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -199,16 +199,18 @@ void read_object_properties(lua_State *L, int index, getfloatfield(L, -1, "weight", prop->weight); lua_getfield(L, -1, "collisionbox"); - if(lua_istable(L, -1)) + bool collisionbox_defined = lua_istable(L, -1); + if (collisionbox_defined) 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 + else if (collisionbox_defined) prop->selectionbox = prop->collisionbox; lua_pop(L, 1); + getboolfield(L, -1, "pointable", prop->pointable); getstringfield(L, -1, "visual", prop->visual); |