aboutsummaryrefslogtreecommitdiff
path: root/builtin/common
diff options
context:
space:
mode:
authorMarkuBu <markus.burrer@gmail.com>2017-04-13 13:58:34 +0200
committerparamat <mat.gregory@virginmedia.com>2017-04-19 02:01:42 +0100
commitefd509f796a4870243ce97012aa27940993f4a79 (patch)
treee206653a8711a5114c1441d853d3fad9bd0b73e3 /builtin/common
parent858c72297409ca54092c3c908279d2a05fef58cd (diff)
downloadminetest-efd509f796a4870243ce97012aa27940993f4a79.tar.gz
minetest-efd509f796a4870243ce97012aa27940993f4a79.tar.bz2
minetest-efd509f796a4870243ce97012aa27940993f4a79.zip
Pointed thing to face pos: Fix crash if opening door with slab or stair
Avoids crash caused when 'pointed thing -under' and '-above' are not face-neighbours, for example in the case of pointing to the top half of a door.
Diffstat (limited to 'builtin/common')
-rw-r--r--builtin/common/misc_helpers.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index 1c7ff3958..fc284c843 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -706,13 +706,14 @@ function core.pointed_thing_to_face_pos(placer, pointed_thing)
local oc = {}
for c, v in pairs(pos_off) do
- if v == 0 then
+ if nc or v == 0 then
oc[#oc + 1] = c
else
offset = v
nc = c
end
end
+
local fine_pos = {[nc] = node_pos[nc] + offset}
camera_pos.y = camera_pos.y + 1.625 + eye_offset_first.y / 10
local f = (node_pos[nc] + offset - camera_pos[nc]) / look_dir[nc]
@@ -722,4 +723,3 @@ function core.pointed_thing_to_face_pos(placer, pointed_thing)
end
return fine_pos
end
-