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.
master
MarkuBu 2017-04-13 13:58:34 +02:00 committed by paramat
parent 858c722974
commit efd509f796
1 changed files with 2 additions and 2 deletions

View File

@ -706,13 +706,14 @@ function core.pointed_thing_to_face_pos(placer, pointed_thing)
local oc = {} local oc = {}
for c, v in pairs(pos_off) do for c, v in pairs(pos_off) do
if v == 0 then if nc or v == 0 then
oc[#oc + 1] = c oc[#oc + 1] = c
else else
offset = v offset = v
nc = c nc = c
end end
end end
local fine_pos = {[nc] = node_pos[nc] + offset} local fine_pos = {[nc] = node_pos[nc] + offset}
camera_pos.y = camera_pos.y + 1.625 + eye_offset_first.y / 10 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] 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 end
return fine_pos return fine_pos
end end