Object properties: Fix loss of custom selectionbox

Only adjust it to the collisionbox value when the collisionbox was really set.
master
SmallJoker 2017-09-10 20:16:25 +02:00
parent 829bbafb27
commit 5f489efc69
1 changed files with 4 additions and 2 deletions

View File

@ -199,16 +199,18 @@ void read_object_properties(lua_State *L, int index,
getfloatfield(L, -1, "weight", prop->weight); getfloatfield(L, -1, "weight", prop->weight);
lua_getfield(L, -1, "collisionbox"); 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); prop->collisionbox = read_aabb3f(L, -1, 1.0);
lua_pop(L, 1); lua_pop(L, 1);
lua_getfield(L, -1, "selectionbox"); lua_getfield(L, -1, "selectionbox");
if (lua_istable(L, -1)) if (lua_istable(L, -1))
prop->selectionbox = read_aabb3f(L, -1, 1.0); prop->selectionbox = read_aabb3f(L, -1, 1.0);
else else if (collisionbox_defined)
prop->selectionbox = prop->collisionbox; prop->selectionbox = prop->collisionbox;
lua_pop(L, 1); lua_pop(L, 1);
getboolfield(L, -1, "pointable", prop->pointable); getboolfield(L, -1, "pointable", prop->pointable);
getstringfield(L, -1, "visual", prop->visual); getstringfield(L, -1, "visual", prop->visual);