aboutsummaryrefslogtreecommitdiff
path: root/src/script/common/c_content.cpp
diff options
context:
space:
mode:
authorLars Müller <34514239+appgurueu@users.noreply.github.com>2022-10-30 16:53:14 +0100
committerGitHub <noreply@github.com>2022-10-30 16:53:14 +0100
commit077627181ee2eac3c0dacc3d8dc49825837e474c (patch)
treea8a6298198738f2edb30bd7e733a7a0d2005affa /src/script/common/c_content.cpp
parentb8292319924994352d56d6111faa73fe315d149a (diff)
downloadminetest-077627181ee2eac3c0dacc3d8dc49825837e474c.tar.xz
Allow rotating entity selectionboxes (#12379)
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r--src/script/common/c_content.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index cbe2d328c..6203ea78c 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -236,10 +236,12 @@ void read_object_properties(lua_State *L, int index,
lua_pop(L, 1);
lua_getfield(L, -1, "selectionbox");
- if (lua_istable(L, -1))
+ if (lua_istable(L, -1)) {
+ getboolfield(L, -1, "rotate", prop->rotate_selectionbox);
prop->selectionbox = read_aabb3f(L, -1, 1.0);
- else if (collisionbox_defined)
+ } else if (collisionbox_defined) {
prop->selectionbox = prop->collisionbox;
+ }
lua_pop(L, 1);
getboolfield(L, -1, "pointable", prop->pointable);
@@ -377,6 +379,8 @@ void push_object_properties(lua_State *L, ObjectProperties *prop)
push_aabb3f(L, prop->collisionbox);
lua_setfield(L, -2, "collisionbox");
push_aabb3f(L, prop->selectionbox);
+ lua_pushboolean(L, prop->rotate_selectionbox);
+ lua_setfield(L, -2, "rotate");
lua_setfield(L, -2, "selectionbox");
lua_pushboolean(L, prop->pointable);
lua_setfield(L, -2, "pointable");
@@ -1880,7 +1884,7 @@ void push_pointed_thing(lua_State *L, const PointedThing &pointed, bool csm,
if (hitpoint && (pointed.type != POINTEDTHING_NOTHING)) {
push_v3f(L, pointed.intersection_point / BS); // convert to node coords
lua_setfield(L, -2, "intersection_point");
- push_v3s16(L, pointed.intersection_normal);
+ push_v3f(L, pointed.intersection_normal);
lua_setfield(L, -2, "intersection_normal");
lua_pushinteger(L, pointed.box_id + 1); // change to Lua array index
lua_setfield(L, -2, "box_id");