fix bucket dispense function

This commit is contained in:
AFCMS 2021-07-14 09:18:15 +02:00
parent d26b1b1402
commit b0127fc1c3

View file

@ -205,11 +205,16 @@ function mcl_buckets.register_liquid(def)
_on_dispense = function(stack, pos, droppos, dropnode, dropdir) _on_dispense = function(stack, pos, droppos, dropnode, dropdir)
local iname = stack:get_name() local iname = stack:get_name()
local buildable = minetest.registered_nodes[dropnode.name].buildable_to or dropnode.name == "mcl_portals:portal" 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 local result
-- Fail placement of liquid if def.extra_check then
elseif buildable then result = def.extra_check(droppos, nil)
-- buildable; replace the node 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 local node_place
if type(def.source_place) == "function" then if type(def.source_place) == "function" then
node_place = def.source_place(droppos) node_place = def.source_place(droppos)