Prevent placing items in some slots and rename itemframe file
This commit is contained in:
parent
89b1db07c8
commit
e9e255908f
10
hive.lua
10
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({
|
||||
|
2
init.lua
2
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")
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user