diff --git a/hive.lua b/hive.lua index 2ff37c7..3a64913 100644 --- a/hive.lua +++ b/hive.lua @@ -15,6 +15,7 @@ end local function hive_dig(pos, player) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() + if not inv:is_empty("honey") then return false end @@ -37,7 +38,14 @@ xdecor.register("hive", { on_punch = function(pos, node, puncher, pointed_thing) local health = puncher:get_hp() puncher:set_hp(health-4) - end + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local to_stack = inv:get_stack(listname, index) + + if listname == "honey" then return 0 end + end, }) minetest.register_abm({ diff --git a/init.lua b/init.lua index 0b3c285..76e3a3d 100644 --- a/init.lua +++ b/init.lua @@ -5,7 +5,7 @@ dofile(modpath.."/handlers/nodeboxes.lua") dofile(modpath.."/handlers/registration.lua") dofile(modpath.."/crafts.lua") dofile(modpath.."/hive.lua") -dofile(modpath.."/itemframes.lua") +dofile(modpath.."/itemframe.lua") dofile(modpath.."/mailbox.lua") dofile(modpath.."/rope.lua") dofile(modpath.."/nodes.lua") diff --git a/itemframes.lua b/itemframe.lua similarity index 100% rename from itemframes.lua rename to itemframe.lua diff --git a/worktable.lua b/worktable.lua index 2ae71b4..0a00b94 100644 --- a/worktable.lua +++ b/worktable.lua @@ -99,13 +99,24 @@ local function xdig(pos, player) local inv = meta:get_inventory() if not inv:is_empty("input") or not inv:is_empty("output") - or not inv:is_empty("fuel") or not inv:is_empty("src") then + or not inv:is_empty("fuel") or not inv:is_empty("src") then return false end - return true end +local function xput(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local to_stack = inv:get_stack(listname, index) + + if listname == "output" then + return 0 + else + return 99 + end +end + xdecor.register("worktable", { description = "Work Table", groups = {snappy=3}, @@ -117,7 +128,8 @@ xdecor.register("worktable", { }, on_construct = xconstruct, on_receive_fields = xfields, - can_dig = xdig + can_dig = xdig, + allow_metadata_inventory_put = xput }) local function light(mat)