mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-04-30 05:01:41 -04:00
fix error caused by invalid facedir
This commit is contained in:
parent
17a3c7c760
commit
6cab343216
1 changed files with 6 additions and 0 deletions
|
@ -10,6 +10,9 @@ end
|
|||
local function get_other_bed_pos(pos, n)
|
||||
local node = core.get_node(pos)
|
||||
local dir = core.facedir_to_dir(node.param2)
|
||||
if not dir then
|
||||
return -- There are 255 possible param2 values. Ignore bad ones.
|
||||
end
|
||||
local other
|
||||
if n == 2 then
|
||||
other = vector.subtract(pos, dir)
|
||||
|
@ -124,6 +127,9 @@ function beds.register_bed(name, def)
|
|||
|
||||
on_rotate = function(pos, node, user, _, new_param2)
|
||||
local dir = minetest.facedir_to_dir(node.param2)
|
||||
if not dir then
|
||||
return false
|
||||
end
|
||||
-- old position of the top node
|
||||
local p = vector.add(pos, dir)
|
||||
local node2 = minetest.get_node_or_nil(p)
|
||||
|
|
Loading…
Add table
Reference in a new issue