mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Make entity selection and collision boxes independently settable (#6218)
* Make entity selection and collision boxes independently settable
This commit is contained in:
parent
01c319d778
commit
ac4884c3d6
6 changed files with 38 additions and 9 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue