Skip to content
Snippets Groups Projects
Commit e9e25590 authored by jp's avatar jp
Browse files

Prevent placing items in some slots and rename itemframe file

parent 89b1db07
No related branches found
No related tags found
No related merge requests found
......@@ -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({
......
......@@ -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")
......
File moved
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment