BobFred7
2020-05-01 b2a124dd8308e067869e0992a73b4b88df97ab64
Deal with lava cans wasting lava (#532)

Rather than replacing lava source with lava source, the lava can will now attempt to place lava to the node "above".
This change applies the same for all registered cans.
1 files modified
11 ■■■■■ changed files
technic/tools/cans.lua 11 ●●●●● patch | view | raw | blame | history
technic/tools/cans.lua
@@ -48,14 +48,17 @@
        on_place = function(itemstack, user, pointed_thing)
            if pointed_thing.type ~= "node" then return end
            local pos = pointed_thing.under
            local def = minetest.registered_nodes[minetest.get_node(pos).name] or {}
            local node_name = minetest.get_node(pos).name
            local def = minetest.registered_nodes[node_name] or {}
            if def.on_rightclick and user and not user:get_player_control().sneak then
                return def.on_rightclick(pos, minetest.get_node(pos), user, itemstack, pointed_thing)
            end
            if not def.buildable_to then
            if not def.buildable_to or node_name == data.liquid_source_name then
                pos = pointed_thing.above
                def = minetest.registered_nodes[minetest.get_node(pos).name] or {}
                if not def.buildable_to then return end
                node_name = minetest.get_node(pos).name
                def = minetest.registered_nodes[node_name] or {}
                -- Try to place node above the pointed source, or abort.
                if not def.buildable_to or node_name == data.liquid_source_name then return end
            end
            local charge = get_can_level(itemstack)
            if charge == 0 then return end