Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Pointed_thing_to_face_pos: Avoid crash when player is inside a node (#…
…7342)

Avoid crash in some situations when player is inside a node, causing
'above' to equal 'under'.
In this situation return 'under' which is the node position very close
to the face position that would normally be returned.
  • Loading branch information
paramat committed May 16, 2018
1 parent 04f7962 commit 45e4829
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builtin/common/misc_helpers.lua
Expand Up @@ -685,6 +685,12 @@ end
-- Returns the exact coordinate of a pointed surface
--------------------------------------------------------------------------------
function core.pointed_thing_to_face_pos(placer, pointed_thing)
-- Avoid crash in some situations when player is inside a node, causing
-- 'above' to equal 'under'.
if vector.equals(pointed_thing.above, pointed_thing.under) then
return pointed_thing.under
end

local eye_height = placer:get_properties().eye_height
local eye_offset_first = placer:get_eye_offset()
local node_pos = pointed_thing.under
Expand Down

0 comments on commit 45e4829

Please sign in to comment.