From 438c0877f6ed03a25211ce70e2edd26b01703a8c Mon Sep 17 00:00:00 2001 From: KaylebJay <44441970+KaylebJay@users.noreply.github.com> Date: Wed, 24 Jun 2020 21:12:25 +0200 Subject: [PATCH] Add external machine registration support (#557) --- technic/tools/cans.lua | 29 +++++++++++++++++++++++++---- 1 files changed, 25 insertions(+), 4 deletions(-) diff --git a/technic/tools/cans.lua b/technic/tools/cans.lua index f12ec93..c79093f 100644 --- a/technic/tools/cans.lua +++ b/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 @@ -112,3 +115,21 @@ {'technic:zinc_ingot', 'technic:stainless_steel_ingot', 'technic:zinc_ingot'}, } }) + +technic.register_can({ + can_name = 'technic:river_water_can', + can_description = S("River Water Can"), + can_inventory_image = "technic_river_water_can.png", + can_capacity = 16, + liquid_source_name = "default:river_water_source", + liquid_flowing_name = "default:river_water_flowing", +}) + +minetest.register_craft({ + output = 'technic:river_water_can 1', + recipe = { + {'technic:zinc_ingot', 'technic:rubber', 'technic:zinc_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'}, + } +}) -- Gitblit v1.8.0