From 874b1ae326c146da1743c2975bddfea4767ef701 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 31 Mar 2016 07:21:40 -0700 Subject: [PATCH] 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 --- mods/beds/api.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/beds/api.lua b/mods/beds/api.lua index e2dd7edf..53d4e488 100644 --- a/mods/beds/api.lua +++ b/mods/beds/api.lua @@ -59,6 +59,11 @@ function beds.register_bed(name, def) return itemstack end + local def = minetest.registered_nodes[minetest.get_node(pos).name] + if not def or not def.buildable_to then + return itemstack + end + 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 end - 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 end -- 2.25.1