fix bucket dispense function

This commit is contained in:
AFCMS 2021-07-14 09:18:15 +02:00
parent d26b1b1402
commit b0127fc1c3
1 changed files with 9 additions and 4 deletions

View File

@ -205,11 +205,16 @@ function mcl_buckets.register_liquid(def)
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
local iname = stack:get_name()
local buildable = minetest.registered_nodes[dropnode.name].buildable_to or dropnode.name == "mcl_portals:portal"
if not buildable then return stack end
if def.extra_check and def.extra_check(droppos, nil) == false then
-- Fail placement of liquid
elseif buildable then
-- buildable; replace the node
local result
if def.extra_check then
result = def.extra_check(droppos, nil)
if result == nil then result = true end
else
result = true
end
if result then -- Fail placement of liquid if result is false
local node_place
if type(def.source_place) == "function" then
node_place = def.source_place(droppos)