diff options
Diffstat (limited to 'games')
-rw-r--r-- | games/minimal/mods/default/init.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index 4468d1e0e..1ffe24837 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -1147,6 +1147,11 @@ minetest.register_node("default:chest", { local inv = meta:get_inventory() inv:set_size("main", 8*4) end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) minetest.log("action", player:get_player_name().. @@ -1200,6 +1205,11 @@ minetest.register_node("default:chest_locked", { local inv = meta:get_inventory() inv:set_size("main", 8*4) end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) local meta = minetest.env:get_meta(pos) @@ -1270,6 +1280,18 @@ minetest.register_node("default:furnace", { inv:set_size("src", 1) inv:set_size("dst", 4) end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("fuel") then + return false + elseif not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, }) minetest.register_node("default:furnace_active", { @@ -1291,6 +1313,18 @@ minetest.register_node("default:furnace_active", { inv:set_size("src", 1) inv:set_size("dst", 4) end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("fuel") then + return false + elseif not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, }) function hacky_swap_node(pos,name) |