Skip to content
Browse files

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
  • Loading branch information
sofar authored and paramat committed Apr 4, 2016
1 parent 1977ae1 commit 874b1ae326c146da1743c2975bddfea4767ef701
Showing with 7 additions and 1 deletion.
  1. +7 −1 mods/beds/api.lua
@@ -59,6 +59,11 @@ function beds.register_bed(name, def)
return itemstack

local def = minetest.registered_nodes[minetest.get_node(pos).name]
if not def or not def.buildable_to then
return itemstack

local dir = minetest.dir_to_facedir(placer:get_look_dir())
local botpos = vector.add(pos, minetest.facedir_to_dir(dir))

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

if not minetest.registered_nodes[minetest.get_node(botpos).name].buildable_to then
local botdef = minetest.registered_nodes[minetest.get_node(botpos).name]
if not botdef or not botdef.buildable_to then
return itemstack

0 comments on commit 874b1ae

Please sign in to comment.