Skip to content

Commit 5f489ef

Browse files
committedSep 10, 2017
Object properties: Fix loss of custom selectionbox
Only adjust it to the collisionbox value when the collisionbox was really set.
1 parent 829bbaf commit 5f489ef

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

Diff for: ‎src/script/common/c_content.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,18 @@ void read_object_properties(lua_State *L, int index,
199199
getfloatfield(L, -1, "weight", prop->weight);
200200

201201
lua_getfield(L, -1, "collisionbox");
202-
if(lua_istable(L, -1))
202+
bool collisionbox_defined = lua_istable(L, -1);
203+
if (collisionbox_defined)
203204
prop->collisionbox = read_aabb3f(L, -1, 1.0);
204205
lua_pop(L, 1);
205206

206207
lua_getfield(L, -1, "selectionbox");
207208
if (lua_istable(L, -1))
208209
prop->selectionbox = read_aabb3f(L, -1, 1.0);
209-
else
210+
else if (collisionbox_defined)
Has conversations. Original line has conversations.
210211
prop->selectionbox = prop->collisionbox;
211212
lua_pop(L, 1);
213+
212214
getboolfield(L, -1, "pointable", prop->pointable);
213215
getstringfield(L, -1, "visual", prop->visual);
214216

1 commit comments

Comments
 (1)

stujones11 commented on Sep 13, 2017

@stujones11
Contributor

@SmallJoker nice catch :)

Please sign in to comment.