From 328633d60e8ea05f4268ea9b5192702525e29c6f Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Wed, 3 Oct 2012 03:44:57 -0400 Subject: [PATCH] Added a check to make sure there's room to place a fridge. --- refrigerator.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/refrigerator.lua b/refrigerator.lua index 1417ed1d..00703a86 100644 --- a/refrigerator.lua +++ b/refrigerator.lua @@ -38,6 +38,16 @@ minetest.register_node('homedecor:refrigerator', { local inv = meta:get_inventory() inv:set_size("main",50) end, + + after_place_node = function(pos, placer) + ntop = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}) + if ntop.name ~= "air" then + minetest.env:remove_node(pos) + placer:get_inventory():add_item("main", "homedecor:refrigerator") + minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a refrigerator!' ) + end + end, + can_dig = function(pos,player) local meta = minetest.env:get_meta(pos); local inv = meta:get_inventory()