Prevent taking worktable's output stack when player inventory is full
This commit is contained in:
parent
f0d50395b9
commit
22cf219ca9
@ -31,9 +31,13 @@ function enchanting.on_put(pos, listname, _, stack, _)
|
||||
local stn = stack:get_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
if listname == "tool" and stn:find("sword") then
|
||||
if listname == "tool" then
|
||||
if stn:find("sword") then
|
||||
meta:set_string("formspec", enchanting.swords_fs())
|
||||
else meta:set_string("formspec", enchanting.tools_fs()) end
|
||||
else
|
||||
meta:set_string("formspec", enchanting.tools_fs())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function enchanting.is_allowed(toolname)
|
||||
|
@ -149,7 +149,7 @@ if minetest.get_modpath("bucket") then
|
||||
return itemstack
|
||||
else if original_bucket_on_use then
|
||||
return original_bucket_on_use(itemstack, user, pointed_thing)
|
||||
else return end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -104,15 +104,19 @@ function worktable.put(_, listname, _, stack, _)
|
||||
return 0
|
||||
end
|
||||
|
||||
function worktable.take(pos, listname, _, stack, _)
|
||||
function worktable.take(pos, listname, _, stack, player)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local user_inv = player:get_inventory()
|
||||
local inputstack = inv:get_stack("input", 1):get_name()
|
||||
local mod, node = inputstack:match("([%a_]+):([%a_]+)")
|
||||
|
||||
if listname == "forms" then
|
||||
if not worktable.contains(nodes[mod], node) then return 0 end
|
||||
if worktable.contains(nodes[mod], node) and
|
||||
user_inv:room_for_item("main", stack:get_name()) then
|
||||
return -1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user