From 555166d58eea4fe40bb7f438109930a11c1e4258 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Wed, 12 May 2021 21:48:17 +0200 Subject: [PATCH] fix pipe and ta4 cable junction issues --- liquids/liquid_pipe.lua | 2 +- liquids/node_api.lua | 35 ++++++++++++++++------------------- power/ta4_cable.lua | 4 +++- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/liquids/liquid_pipe.lua b/liquids/liquid_pipe.lua index b392d17..ea4ff11 100644 --- a/liquids/liquid_pipe.lua +++ b/liquids/liquid_pipe.lua @@ -25,7 +25,7 @@ local Pipe = tubelib2.Tube:new({ dirs_to_check = {1,2,3,4,5,6}, max_tube_length = MAX_PIPE_LENGHT, show_infotext = false, - force_to_use_tubes = true, + force_to_use_tubes = false, tube_type = "pipe2", primary_node_names = { "techage:ta3_pipeS", "techage:ta3_pipeA", diff --git a/liquids/node_api.lua b/liquids/node_api.lua index b9735c7..87e9874 100644 --- a/liquids/node_api.lua +++ b/liquids/node_api.lua @@ -112,9 +112,9 @@ end -- remote inventory. function liquid.peek(pos, outdir) for _,item in ipairs(get_network_table(pos, outdir, "tank")) do - local liquid = LQD(item.pos) - if liquid and liquid.peek then - return liquid.peek(item.pos, item.indir) + local liq = LQD(item.pos) + if liq and liq.peek then + return liq.peek(item.pos, item.indir) end end end @@ -123,16 +123,16 @@ end -- return leftover amount function liquid.put(pos, outdir, name, amount, player_name) for _,item in ipairs(get_network_table(pos, outdir, "tank")) do - local liquid = LQD(item.pos) - if liquid and liquid.put and liquid.peek then + local liq = LQD(item.pos) + if liq and liq.put and liq.peek then -- wrong items? - local peek = liquid.peek(item.pos, item.indir) + local peek = liq.peek(item.pos, item.indir) if peek and peek ~= name then return amount or 0 end if player_name then local num = techage.get_node_number(pos) or "000" techage.mark_position(player_name, item.pos, "("..num..") put", "", 1) end - amount = liquid.put(item.pos, item.indir, name, amount) + amount = liq.put(item.pos, item.indir, name, amount) if not amount or amount == 0 then break end end end @@ -143,30 +143,27 @@ end -- return taken amount and item name function liquid.take(pos, outdir, name, amount, player_name) local taken = 0 - local item_name = nil for _,item in ipairs(get_network_table(pos, outdir, "tank")) do - local liquid = LQD(item.pos) - if liquid and liquid.take then + local liq = LQD(item.pos) + if liq and liq.take then if player_name then local num = techage.get_node_number(pos) techage.mark_position(player_name, item.pos, "("..num..") take", "", 1) end - local val, name = liquid.take(item.pos, item.indir, name, amount - taken) - if val and name then - taken = taken + val - item_name = name - if amount - taken == 0 then break end + taken, name = liq.take(item.pos, item.indir, name, amount) + if taken and name and taken > 0 then + break end end end - return taken, item_name + return taken, name end function liquid.untake(pos, outdir, name, amount) for _,item in ipairs(get_network_table(pos, outdir, "tank")) do - local liquid = LQD(item.pos) - if liquid and liquid.untake then - amount = liquid.untake(item.pos, item.indir, name, amount) + local liq = LQD(item.pos) + if liq and liq.untake then + amount = liq.untake(item.pos, item.indir, name, amount) if not amount or amount == 0 then break end end end diff --git a/power/ta4_cable.lua b/power/ta4_cable.lua index fd1d0cb..0abef4e 100644 --- a/power/ta4_cable.lua +++ b/power/ta4_cable.lua @@ -141,7 +141,9 @@ minetest.register_node("techage:ta4_power_box", { connect_back = {{-1/16, -1/16, 0, 1/16, 1/16, 1/2}}, connect_front = {{-1/16, -1/16, -1/2, 1/16, 1/16, 0}}, }, - connects_to = {"techage:ta4_power_cableA", "techage:ta4_power_cableS", "techage:ta4_solar_inverter"}, + connects_to = {"techage:ta4_power_cableA", "techage:ta4_power_cableS", + "techage:ta4_solar_inverter", "techage:ta4_solar_carrier", + "techage:ta4_solar_carrierB"}, after_place_node = function(pos, placer, itemstack, pointed_thing) Cable:after_place_node(pos)