Skip to content

Commit 874b1ae

Browse files
sofarparamat
authored andcommittedApr 4, 2016
Beds: Check for buildable_to for bottom half
We properly checked top half already, just not the top half target location. Assure both checked positions are not unknown nodes. Fixes #991
1 parent 1977ae1 commit 874b1ae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

Diff for: ‎mods/beds/api.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ function beds.register_bed(name, def)
5959
return itemstack
6060
end
6161

62+
local def = minetest.registered_nodes[minetest.get_node(pos).name]
63+
if not def or not def.buildable_to then
64+
return itemstack
65+
end
66+
6267
local dir = minetest.dir_to_facedir(placer:get_look_dir())
6368
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))
6469

@@ -68,7 +73,8 @@ function beds.register_bed(name, def)
6873
return itemstack
6974
end
7075

71-
if not minetest.registered_nodes[minetest.get_node(botpos).name].buildable_to then
76+
local botdef = minetest.registered_nodes[minetest.get_node(botpos).name]
77+
if not botdef or not botdef.buildable_to then
7278
return itemstack
7379
end
7480

0 commit comments

Comments
 (0)
Please sign in to comment.