diff --git a/basis/consumer.lua b/basis/consumer.lua index 0e9b5de..4b6402b 100644 --- a/basis/consumer.lua +++ b/basis/consumer.lua @@ -197,6 +197,8 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState on_metadata_inventory_move = tNode.on_metadata_inventory_move, on_metadata_inventory_put = tNode.on_metadata_inventory_put, on_metadata_inventory_take = tNode.on_metadata_inventory_take, + networks = tNode.networks, + tubelib2_on_update2 = tNode.tubelib2_on_update2, paramtype2 = "facedir", groups = table.copy(tNode.groups), diff --git a/basis/lib.lua b/basis/lib.lua index db4cd8d..c763a87 100644 --- a/basis/lib.lua +++ b/basis/lib.lua @@ -186,7 +186,7 @@ local function tooltip(name) end function techage.item_image(x, y, itemname) - return "box["..x..","..y..";0.87,0.9;#808080]".. + return "box["..x..","..y..";0.85,0.9;#808080]".. "item_image["..x..","..y..";1,1;"..itemname.."]".. "tooltip["..x..","..y..";1,1;"..tooltip(itemname)..";#0C3D32;#FFFFFF]" end diff --git a/basis/networks.lua b/basis/networks.lua index 3804f65..ac88286 100644 --- a/basis/networks.lua +++ b/basis/networks.lua @@ -32,7 +32,7 @@ local SideToDir = {B=1, R=2, F=3, L=4, D=5, U=6} local Flip = {[0]=0,3,4,1,2,6,5} -- 180 degree turn local function error(pos, msg) - minetest.log("error", msg.." at "..P2S(pos).." "..N(pos).name) + minetest.log("error", "[techage] "..msg.." at "..P2S(pos).." "..N(pos).name) end local function count_nodes(ntype, nodes) @@ -59,6 +59,11 @@ local function net_def(pos, net_name) return ndef and ndef.networks and ndef.networks[net_name] or {} end +local function net_def2(node_name, net_name) + local ndef = minetest.registered_nodes[node_name] + return ndef and ndef.networks and ndef.networks[net_name] or {} +end + -- Calculate the node outdir based on node.param2 and nominal dir (according to side) local function dir_to_outdir(dir, param2) if dir < 5 then @@ -74,6 +79,13 @@ local function indir_to_dir(indir, param2) return Flip[indir] end +local function outdir_to_dir(outdir, param2) + if outdir < 5 then + return ((outdir - param2 + 3) % 4) + 1 + end + return outdir +end + local function side_to_outdir(pos, side) return dir_to_outdir(SideToDir[side], techage.get_node_lvm(pos).param2) end @@ -92,6 +104,28 @@ local function get_node_connections(pos, net_name) return tbl end +-- determine all node sides with tube connections +local function node_connections(pos, tlib2) + local node = techage.get_node_lvm(pos) + local val = 0 + local sides = net_def(pos, tlib2.tube_type).sides + + if sides then + for dir = 1,6 do + val = val * 2 + local side = DirToSide[outdir_to_dir(dir, node.param2)] + if sides[side] then + if tlib2:connected(pos, dir) then + val = val + 1 + end + end + end + M(pos):set_int(tlib2.tube_type.."_conn", val) + else + error(pos, "sides missing") + end +end + local function pos_already_reached(pos) local key = minetest.hash_node_position(pos) if not Route[key] and NumNodes < MAX_NUM_NODES then @@ -102,7 +136,7 @@ local function pos_already_reached(pos) return true end --- check if the given pipe dir into the node is valid +-- check if the given pipe dir out of the node is valid local function valid_indir(pos, indir, param2, net_name) local sides = net_def(pos, net_name).sides if not sides then return false end @@ -112,93 +146,37 @@ local function valid_indir(pos, indir, param2, net_name) end -- do the walk through the tubelib2 network -local function connection_walk(pos, node, tlib2, clbk) - if clbk then clbk(pos, node) end +-- indir is the direction which should not be covered by the walk +-- (coming from there or is a different network) +local function connection_walk(pos, indir, node, tlib2, clbk) + if clbk then clbk(pos, indir, node) end for _,outdir in pairs(get_node_connections(pos, tlib2.tube_type)) do - local pos2, indir2 = tlib2:get_connected_node_pos(pos, outdir) - local node = techage.get_node_lvm(pos2) - if pos2 and not pos_already_reached(pos2) and - valid_indir(pos2, indir2, node.param2, tlib2.tube_type) then - connection_walk(pos2, node, tlib2, clbk) + if outdir ~= Flip[indir] then + local pos2, indir2 = tlib2:get_connected_node_pos(pos, outdir) + local node = techage.get_node_lvm(pos2) + if pos2 and not pos_already_reached(pos2) and + valid_indir(pos2, indir2, node.param2, tlib2.tube_type) then + connection_walk(pos2, indir2, node, tlib2, clbk) + end end end end --- determine all node sides with tube connections -local function node_connections(pos, tlib2) - local node = techage.get_node_lvm(pos) - local val = 0 - local sides = net_def(pos, tlib2.tube_type).sides - - if sides then - for dir = 1,6 do - val = val * 2 - local outdir = dir_to_outdir(dir, node.param2) - --if sides[DirToSide[outdir]] then -------------------------------------- TODO - local pos2 = tubelib2.get_pos(pos, dir) - local node2 = techage.get_node_lvm(pos2) - if tlib2.primary_node_names[node2.name] then - val = val + 1 - end - --end - end - M(pos):set_int(tlib2.tube_type.."_conn", val) - else - error(pos, "sides missing") - end -end --- determine network ID (largest hash number) -local function determine_netID(pos, tlib2) - Route = {} - NumNodes = 0 - pos_already_reached(pos) - local netID = minetest.hash_node_position(pos) - local tNetwork = {} - local node = techage.get_node_lvm(pos) - connection_walk(pos, node, tlib2, function(pos, node) - local new = minetest.hash_node_position(pos) - if netID <= new then - netID = new - end - end) - return netID -end - --- store network ID on each node and build network tables -local function store_netID(pos, netID, tlib2) +local function collect_network_nodes(pos, outdir, tlib2) Route = {} NumNodes = 0 pos_already_reached(pos) local netw = {} local node = techage.get_node_lvm(pos) local net_name = tlib2.tube_type - connection_walk(pos, node, tlib2, function(pos, node) + -- outdir corresponds to the indir coming from + connection_walk(pos, outdir, node, tlib2, function(pos, indir, node) local ntype = net_def(pos, net_name).ntype + print("collect_network_nodes", P2S(pos), ntype) if ntype then if not netw[ntype] then netw[ntype] = {} end - netw[ntype][#netw[ntype] + 1] = pos - local mem = tubelib2.get_mem(pos) - mem[net_name] = mem[net_name] or {} - mem[net_name].netID = netID - end - end) - netw.best_before = minetest.get_gametime() + BEST_BEFORE - return netw -end - -local function collect_network_nodes(pos, netID, tlib2) - Route = {} - NumNodes = 0 - pos_already_reached(pos) - local netw = {} - local node = techage.get_node_lvm(pos) - local net_name = tlib2.tube_type - connection_walk(pos, node, tlib2, function(pos, node) - local ntype = net_def(pos, net_name).ntype - if ntype then - if not netw[ntype] then netw[ntype] = {} end - netw[ntype][#netw[ntype] + 1] = pos + netw[ntype][#netw[ntype] + 1] = {pos = pos, indir = indir} end end) netw.best_before = minetest.get_gametime() + BEST_BEFORE @@ -230,6 +208,13 @@ minetest.after(60, remove_outdated_networks) -- -- API Functions -- + +-- Table fo a 180 degree turn +techage.networks.Flip = Flip + +-- techage.networks.net_def(pos, net_name) +techage.networks.net_def = net_def + techage.networks.AllSides = Sides -- table for all 6 node sides -- techage.networks.side_to_outdir(pos, side) @@ -239,45 +224,49 @@ techage.networks.side_to_outdir = side_to_outdir -- valid_indir(pos, indir, param2, net_name) techage.networks.valid_indir = valid_indir --- Store tubelib2 connection dirs as node meta and --- update network tables. --- Function to be called from tubelib2_on_update2 --- tlib2 is the tubelib2 instance -function techage.networks.update_network(pos, tlib2) - node_connections(pos, tlib2) - local netID = determine_netID(pos, tlib2) - if not Networks[tlib2.tube_type] then - Networks[tlib2.tube_type] = {} - end - Networks[tlib2.tube_type][netID] = store_netID(pos, netID, tlib2) +-- techage.networks.node_connections(pos, tlib2) +techage.networks.node_connections = node_connections + +-- techage.networks.collect_network_nodes(pos, outdir, tlib2) +techage.networks.collect_network_nodes = collect_network_nodes + +function techage.networks.connection_walk(pos, outdir, tlib2, clbk) + Route = {} + NumNodes = 0 + pos_already_reached(pos) -- don't consider the start pos + local node = techage.get_node_lvm(pos) + connection_walk(pos, outdir, node, tlib2, clbk) + return NumNodes end -function techage.networks.get_network(pos, tlib2) - local mem = tubelib2.get_mem(pos) - local netID = mem[tlib2.tube_type] and mem[tlib2.tube_type].netID - if netID then - if not Networks[tlib2.tube_type] then - Networks[tlib2.tube_type] = {} - end - if not Networks[tlib2.tube_type][netID] then - Networks[tlib2.tube_type][netID] = collect_network_nodes(pos, netID, tlib2) or {} - end +function techage.networks.get_network(netID, tlib2) + if Networks[tlib2.tube_type] and Networks[tlib2.tube_type][netID] then Networks[tlib2.tube_type][netID].best_before = minetest.get_gametime() + BEST_BEFORE return Networks[tlib2.tube_type][netID] end end -function techage.networks.get_network_table(pos, tlib2, ntype) - return techage.networks.get_network(pos, tlib2)[ntype] or {} +function techage.networks.set_network(netID, tlib2, network) + if netID then + if not Networks[tlib2.tube_type] then + Networks[tlib2.tube_type] = {} + end + Networks[tlib2.tube_type][netID] = network + Networks[tlib2.tube_type][netID].best_before = minetest.get_gametime() + BEST_BEFORE + end end -function techage.networks.connection_walk(pos, tlib2, clbk) - Route = {} - NumNodes = 0 - pos_already_reached(pos) -- don't consider the start pos - local node = techage.get_node_lvm(pos) - connection_walk(pos, node, tlib2, clbk) - return NumNodes +function techage.networks.trigger_network(netID, tlib2) + if not Networks[tlib2.tube_type] then + Networks[tlib2.tube_type] = {} + end + Networks[tlib2.tube_type][netID].best_before = minetest.get_gametime() + BEST_BEFORE +end + +function techage.networks.delete_network(netID, tlib2) + if Networks[tlib2.tube_type] and Networks[tlib2.tube_type][netID] then + Networks[tlib2.tube_type][netID] = nil + end end function techage.networks.connections(pos, tlib2) diff --git a/chemistry/ta4_doser.lua b/chemistry/ta4_doser.lua index 939a7fa..1b01b55 100644 --- a/chemistry/ta4_doser.lua +++ b/chemistry/ta4_doser.lua @@ -204,9 +204,9 @@ minetest.register_node("techage:ta4_doser", { description = S("TA4 Doser"), tiles = { -- up, down, right, left, back, front - "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_pipe.png", "techage_filling_ta4.png^techage_frame_ta4.png", - "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_pump.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_pump.png^techage_appl_hole_pipe.png", }, on_receive_fields = on_receive_fields, @@ -224,7 +224,7 @@ minetest.register_node("techage:ta4_doser_on", { description = S("TA4 Doser"), tiles = { -- up, down, right, left, back, front - "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_pipe.png", "techage_filling_ta4.png^techage_frame_ta4.png", { image = "techage_filling8_ta4.png^techage_frame8_ta4.png^techage_appl_pump8.png", diff --git a/chemistry/ta4_pump.lua b/chemistry/ta4_pump.lua deleted file mode 100644 index a772395..0000000 --- a/chemistry/ta4_pump.lua +++ /dev/null @@ -1,92 +0,0 @@ ---[[ - - TechAge - ======= - - Copyright (C) 2019 Joachim Stolberg - - GPL v3 - See LICENSE.txt for more information - - TA4 Pump - -]]-- - -local S2P = minetest.string_to_pos -local P2S = minetest.pos_to_string -local M = minetest.get_meta -local S = techage.S -local Pipe = techage.LiquidPipe -local networks = techage.networks - -minetest.register_node("techage:ta4_pump", { - description = S("TA4 Pump"), - tiles = { - -- up, down, right, left, back, front - "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_biogas.png^techage_appl_color_top.png", - "techage_filling_ta4.png^techage_frame_ta4.png", - "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_pump.png^techage_appl_hole_biogas.png", - }, - after_place_node = function(pos, placer) - M(pos):set_int("pipe_dir", networks.side_to_outdir(pos, "R")) - Pipe:after_place_node(pos) - minetest.get_node_timer(pos):start(5) - end, - on_timer = function(pos, elapsed) --- networks.connection_walk(pos, Pipe, function(pos, node) --- print("on_timer", P2S(pos), node.name) --- end) - local mem = tubelib2.get_mem(pos) - local nw = networks.get_network(pos, Pipe) - if nw then - for _,pos in ipairs(nw.tank or {}) do - techage.mark_position("singleplayer", pos, "", "", 3) - end - end - return true - end, - tubelib2_on_update2 = function(pos, node, tlib2) - networks.update_network(pos, tlib2) - end, - after_dig_node = function(pos, oldnode, oldmetadata, digger) - Pipe:after_dig_node(pos) - end, - networks = { - pipe = { - sides = {R = 1}, -- Pipe connection side - ntype = "pump", - }, - }, - paramtype2 = "facedir", - on_rotate = screwdriver.disallow, - groups = {cracky=2}, - is_ground_content = false, - sounds = default.node_sound_metal_defaults(), -}) - -minetest.register_node("techage:ta4_pump_on", { - description = S("TA4 Pump"), - tiles = { - -- up, down, right, left, back, front - "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_biogas.png^techage_appl_color_top.png", - "techage_filling_ta4.png^techage_frame_ta4.png", - { - image = "techage_filling8_ta4.png^techage_frame8_ta4.png^techage_appl_pump8.png", - backface_culling = false, - animation = { - type = "vertical_frames", - aspect_w = 32, - aspect_h = 32, - length = 2.0, - }, - }, - }, - - paramtype2 = "facedir", - on_rotate = screwdriver.disallow, - groups = {cracky=2}, - is_ground_content = false, - sounds = default.node_sound_metal_defaults(), -}) - - Pipe:add_secondary_node_names({"techage:ta4_pump", "techage:ta4_pump_on"}) \ No newline at end of file diff --git a/coal_power_station/firebox.lua b/coal_power_station/firebox.lua index d69fc6c..3ee5338 100644 --- a/coal_power_station/firebox.lua +++ b/coal_power_station/firebox.lua @@ -18,6 +18,9 @@ local M = minetest.get_meta local S = techage.S local firebox = techage.firebox +local oilburner = techage.oilburner +local Pipe = techage.LiquidPipe +local liquid = techage.liquid local CYCLE_TIME = 2 local BURN_CYCLE_FACTOR = 0.5 @@ -182,6 +185,118 @@ minetest.register_node("techage:coalfirehole_on", { groups = {not_in_creative_inventory=1}, }) +local function on_timer2(pos, elapsed) + local mem = tubelib2.get_mem(pos) + if mem.running then + oilburner.formspec_update(pos, mem) + -- trigger generator and provide power ratio 0..1 + local ratio = techage.transfer( + {x=pos.x, y=pos.y+2, z=pos.z}, + nil, -- outdir + "trigger", -- topic + (mem.power_level or 4)/4.0, -- payload + nil, -- network + {"techage:coalboiler_top"} -- nodenames + ) + ratio = math.max((ratio or 0.02), 0.02) + mem.burn_cycles = (mem.burn_cycles or 0) - ratio + mem.liquid = mem.liquid or {} + mem.liquid.amount = mem.liquid.amount or 0 + if mem.burn_cycles <= 0 then + local taken = firebox.get_fuel(pos) + if mem.liquid.amount > 0 then + mem.liquid.amount = mem.liquid.amount - 1 + mem.burn_cycles = oilburner.Oilburntime / CYCLE_TIME * BURN_CYCLE_FACTOR + mem.burn_cycles_total = mem.burn_cycles + else + mem.running = false + firehole(pos, false) + M(pos):set_string("formspec", oilburner.formspec(mem)) + return false + end + end + return true + end +end + +local function start_firebox2(pos, mem) + print("start_firebox2", mem.running, mem.liquid and mem.liquid.amount) + if not mem.running and mem.liquid.amount > 0 then + mem.running = true + on_timer2(pos, 0) + firehole(pos, true) + minetest.get_node_timer(pos):start(CYCLE_TIME) + end +end + +minetest.register_node("techage:oilfirebox", { + description = S("TA3 Power Station Oil Firebox"), + inventory_image = "techage_coal_boiler_inv.png", + tiles = {"techage_coal_boiler_mesh_top.png"}, + drawtype = "mesh", + mesh = "techage_boiler_large.obj", + selection_box = { + type = "fixed", + fixed = {-13/32, -16/32, -13/32, 13/32, 16/32, 13/32}, + }, + + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + + on_timer = on_timer2, + can_dig = oilburner.can_dig, + allow_metadata_inventory_put = oilburner.allow_metadata_inventory_put, + allow_metadata_inventory_take = oilburner.allow_metadata_inventory_take, + on_receive_fields = oilburner.on_receive_fields, + on_rightclick = oilburner.on_rightclick, + + on_construct = function(pos) + local mem = tubelib2.init_mem(pos) + techage.add_node(pos, "techage:oilfirebox") + mem.running = false + mem.burn_cycles = 0 + mem.liquid = {} + mem.liquid.amount = 0 + local meta = M(pos) + meta:set_string("formspec", oilburner.formspec(mem)) + local inv = meta:get_inventory() + inv:set_size('fuel', 1) + firehole(pos, false) + end, + + on_destruct = function(pos) + firehole(pos, nil) + end, + + on_metadata_inventory_put = function(pos, listname, index, stack, player) + local mem = tubelib2.get_mem(pos) + mem.liquid = mem.liquid or {} + mem.liquid.amount = mem.liquid.amount or 0 + start_firebox2(pos, mem) + oilburner.on_metadata_inventory_put(pos, listname, index, stack, player) + end, + + liquid = { + capa = oilburner.CAPACITY, + peek = liquid.srv_peek, + put = function(pos, indir, name, amount) + liquid.srv_put(pos, indir, name, amount) + local mem = tubelib2.get_mem(pos) + mem.liquid = mem.liquid or {} + mem.liquid.amount = mem.liquid.amount or 0 + start_firebox2(pos, mem) + end, + take = liquid.srv_take, + }, + networks = oilburner.networks, +}) + +Pipe:add_secondary_node_names({"techage:oilfirebox"}) + + techage.register_node({"techage:coalfirebox"}, { on_pull_item = function(pos, in_dir, num) local meta = minetest.get_meta(pos) @@ -231,10 +346,19 @@ minetest.register_craft({ }, }) +minetest.register_craft({ + output = "techage:oilfirebox", + recipe = { + {'', 'techage:coalfirebox', ''}, + {'', 'techage:ta3_barrel_empty', ''}, + {'', '', ''}, + }, +}) + minetest.register_lbm({ label = "[techage] Power Station firebox", name = "techage:steam_engine", - nodenames = {"techage:coalfirebox"}, + nodenames = {"techage:coalfirebox", "techage:oilfirebox"}, run_at_every_load = true, action = function(pos, node) minetest.get_node_timer(pos):start(CYCLE_TIME) diff --git a/energy_storage/heatexchanger.lua b/energy_storage/heatexchanger.lua index 46d1dab..645f531 100644 --- a/energy_storage/heatexchanger.lua +++ b/energy_storage/heatexchanger.lua @@ -252,8 +252,8 @@ minetest.register_node("techage:heatexchanger3", { -- up, down, right, left, back, front "techage_filling_ta4.png^techage_frame_ta4_top.png", "techage_hole_ta4.png", - "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_hole_biogas.png", - "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_hole_pipe.png", + "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_hole_pipe.png", "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png", "techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png", }, @@ -328,8 +328,8 @@ minetest.register_node("techage:heatexchanger1", { -- up, down, right, left, back, front "techage_hole_ta4.png^techage_appl_arrow_white.png", "techage_filling_ta4.png^techage_frame_ta4.png", - "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_biogas.png", - "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_pipe.png", + "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_pipe.png", "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png", "techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png", }, diff --git a/energy_storage/turbine.lua b/energy_storage/turbine.lua index 47d452f..ca3e4e6 100644 --- a/energy_storage/turbine.lua +++ b/energy_storage/turbine.lua @@ -75,10 +75,10 @@ minetest.register_node("techage:ta4_turbine", { description = S("TA4 Turbine"), tiles = { -- up, down, right, left, back, front - "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_pipe.png", "techage_filling_ta4.png^techage_frame_ta4.png", "techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta4.png", - "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_pipe.png", "techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta4.png", "techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta4.png", }, @@ -93,10 +93,10 @@ minetest.register_node("techage:ta4_turbine", { minetest.register_node("techage:ta4_turbine_on", { tiles = { -- up, down, right, left, back, front - "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_hole_pipe.png", "techage_filling_ta4.png^techage_frame_ta4.png", "techage_filling_ta4.png^techage_appl_open.png^techage_frame_ta4.png", - "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_biogas.png", + "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_pipe.png", { image = "techage_filling4_ta4.png^techage_appl_turbine4.png^techage_frame4_ta4.png", backface_culling = false, diff --git a/furnace/booster.lua b/furnace/booster.lua index f0e4c8d..4ac988a 100644 --- a/furnace/booster.lua +++ b/furnace/booster.lua @@ -72,7 +72,7 @@ minetest.register_node("techage:ta3_booster", { -- up, down, right, left, back, front "techage_filling_ta3.png^techage_appl_arrow.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_frame_ta3.png", - "techage_filling_ta3.png^techage_appl_hole_biogas.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_hole_electric.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_compressor.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_compressor.png^[transformFX^techage_frame_ta3.png", @@ -91,7 +91,7 @@ minetest.register_node("techage:ta3_booster_on", { -- up, down, right, left, back, front "techage_filling_ta3.png^techage_appl_arrow.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_frame_ta3.png", - "techage_filling_ta3.png^techage_appl_hole_biogas.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", "techage_filling_ta3.png^techage_appl_hole_electric.png^techage_frame_ta3.png", { image = "techage_filling4_ta3.png^techage_appl_compressor4.png^techage_frame4_ta3.png", diff --git a/furnace/firebox.lua b/furnace/firebox.lua index 643e052..ec34d82 100644 --- a/furnace/firebox.lua +++ b/furnace/firebox.lua @@ -76,7 +76,7 @@ minetest.register_node("techage:furnace_firebox", { "techage_concrete.png^techage_appl_open.png^techage_frame_ta3.png", "techage_concrete.png^techage_frame_ta3.png", "techage_concrete.png^techage_frame_ta3.png", - "techage_concrete.png^techage_appl_hole_biogas.png^techage_frame_ta3.png", + "techage_concrete.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", "techage_concrete.png^techage_frame_ta3.png", "techage_concrete.png^techage_appl_firehole.png^techage_frame_ta3.png", }, diff --git a/init.lua b/init.lua index 44cdbc3..fccfb82 100644 --- a/init.lua +++ b/init.lua @@ -5,8 +5,8 @@ elseif minetest.global_exists("ironage") then minetest.log("error", "[techage] Techage can't be used together with the mod ironage!") elseif minetest.global_exists("techpack") then minetest.log("error", "[techage] Techage can't be used together with the modpack techpack!") -elseif minetest.global_exists("tubelib2") and tubelib2.version < 1.5 then - minetest.log("error", "[techage] Techage requires tubelib2 version 1.5 or newer!") +elseif minetest.global_exists("tubelib2") and tubelib2.version < 1.6 then + minetest.log("error", "[techage] Techage requires tubelib2 version 1.6 or newer!") else techage = { NodeDef = {}, -- node registration info @@ -118,11 +118,12 @@ else dofile(MP.."/basic_machines/liquidsampler.lua") -- Liquids + dofile(MP.."/liquids/liquid_pipe.lua") dofile(MP.."/liquids/liquid.lua") dofile(MP.."/liquids/barrel.lua") - dofile(MP.."/liquids/oil.lua") - dofile(MP.."/liquids/liquid_pipe.lua") dofile(MP.."/liquids/tank.lua") + dofile(MP.."/liquids/pump.lua") + dofile(MP.."/liquids/oil_lib.lua") -- Coal power station dofile(MP.."/coal_power_station/firebox.lua") @@ -157,6 +158,7 @@ else dofile(MP.."/lamps/industriallamp3.lua") -- Oil + dofile(MP.."/oil/oil.lua") dofile(MP.."/oil/explore.lua") dofile(MP.."/oil/tower.lua") dofile(MP.."/oil/drillbox.lua") @@ -188,7 +190,7 @@ else -- Test dofile(MP.."/recipe_checker.lua") - --dofile(MP.."/.test/sink.lua") + dofile(MP.."/.test/sink.lua") dofile(MP.."/.test/source.lua") --dofile(MP.."/.test/akku.lua") --dofile(MP.."/.test/switch.lua") @@ -213,7 +215,6 @@ else -- Chemistry dofile(MP.."/chemistry/ta4_reactor.lua") - dofile(MP.."/chemistry/ta4_pump.lua") dofile(MP.."/chemistry/ta4_doser.lua") -- Hydrogen diff --git a/liquids/barrel.lua b/liquids/barrel.lua index cd8222d..fb6d81d 100644 --- a/liquids/barrel.lua +++ b/liquids/barrel.lua @@ -15,7 +15,7 @@ local S = techage.S minetest.register_craftitem("techage:ta3_barrel_empty", { - description = S("TA Barrel"), + description = S("TA Empty Barrel"), inventory_image = "techage_barrel_inv.png", }) @@ -29,7 +29,7 @@ minetest.register_craft({ }) minetest.register_craftitem("techage:liquid", { - description = S("TA Liquid"), + description = S("empty"), inventory_image = "techage_liquid_inv.png", groups = {not_in_creative_inventory=1}, diff --git a/liquids/liquid.lua b/liquids/liquid.lua index 52578e0..efbb62b 100644 --- a/liquids/liquid.lua +++ b/liquids/liquid.lua @@ -8,154 +8,226 @@ GPL v3 See LICENSE.txt for more information - Helper functions for liquid transportation (peer, put, take) + Liquid transportation API via Pipe(s) (peer, put, take) ]]-- local M = minetest.get_meta local N = function(pos) return minetest.get_node(pos).name end local LQD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).liquid end -local Pipe = techage.BiogasPipe +local Pipe = techage.LiquidPipe + +local net_def = techage.networks.net_def +local networks = techage.networks techage.liquid = {} -local LiquidDefs = {} +local LiquidDef = {} +local ContainerDef = {} -local function get_dest_node(pos, outdir) - local pos2, indir = Pipe:get_connected_node_pos(pos, outdir) - local node = techage.get_node_lvm(pos2) - local liquid = (minetest.registered_nodes[node.name] or {}).liquid - if liquid then - return pos2, indir, liquid - end -end +-- +-- Networks +-- -local function peek(stack, liquid) - liquid.amount = liquid.amount or 0 - return liquid.amount + stack:get_count() * 10 -end - -local function put(stack, liquid, amount) - liquid.amount = liquid.amount or 0 - if liquid.amount + amount > 1 then - local num = math.floor((liquid.amount + amount) / 10) - if stack:get_free_space() >= num then - stack:set_count(stack:get_count() + num) - liquid.amount = liquid.amount + amount - num - return 0 - else - local res = liquid.amount + amount - 1 - liquid.amount = 1 - return res +-- determine network ID (largest hash number) +local function determine_netID(pos, outdir) + local netID = 0 + networks.connection_walk(pos, outdir, Pipe, function(pos, indir, node) + local ntype = net_def(pos, "pipe").ntype + if ntype and ntype ~= "pump" then + local new = minetest.hash_node_position(pos) + if netID <= new then + netID = new + end end - else - liquid.amount = liquid.amount + amount - return 0 - end + end) + return netID end -local function take(stack, liquid, amount) - local res - liquid.amount = liquid.amount or 0 - if liquid.amount >= amount then - liquid.amount = liquid.amount - amount - res = amount - elseif amount > 10 then - local num = math.floor((liquid.amount + amount) / 10) - if stack:get_count() >= num then - stack:set_count(stack:get_count() - num) - liquid.amount = num + liquid.amount - amount - res = amount +-- store network ID on each node +local function store_netID(pos, outdir, netID) + networks.connection_walk(pos, outdir, Pipe, function(pos, indir, node) + local ntype = net_def(pos, "pipe").ntype + if ntype and ntype ~= "pump" then + local mem = tubelib2.get_mem(pos) + mem.pipe = mem.pipe or {} + mem.pipe.netID = netID end - elseif stack:get_count() > 0 then - stack:set_count(stack:get_count() - 1) - liquid.amount = 1 + liquid.amount - amount - res = amount - elseif liquid.amount > 0 then - res = liquid.amount - liquid.amount = 0 - else - res = 0 - end - return res + end) end +-- delete network and ID on each node +local function delete_netID(pos, outdir) + local netID = 0 + networks.connection_walk(pos, outdir, Pipe, function(pos, indir, node) + local ntype = net_def(pos, "pipe").ntype + if ntype and ntype ~= "pump" then + local mem = tubelib2.get_mem(pos) + if mem.pipe and mem.pipe.netID then + netID = mem.pipe.netID + mem.pipe.netID = nil + end + end + end) + networks.delete_network(netID, Pipe) +end + + +local function get_network_table(pos, outdir, ntype) + local pos2 = Pipe:get_connected_node_pos(pos, outdir) + local mem = tubelib2.get_mem(pos2) + if not mem.pipe or not mem.pipe.netID then + local netID = determine_netID(pos, outdir) + store_netID(pos, outdir, netID) + mem.pipe = mem.pipe or {} + mem.pipe.netID = netID + end + local netw = networks.get_network(mem.pipe.netID, Pipe) + if not netw then + netw = networks.collect_network_nodes(pos, outdir, Pipe) + networks.set_network(mem.pipe.netID, Pipe, netw) + end + return netw[ntype] or {} +end + + -- -- Client remote functions -- --- Determine and return liquid 'name' and 'amount' from the +-- Determine and return liquid 'name' from the -- remote inventory. function techage.liquid.peek(pos, outdir) - local pos2, indir, liquid = get_dest_node(pos, outdir) - print("peek", indir, liquid) - if liquid and liquid.peek then - return liquid.peek(pos2, indir) + 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) + end end end -- Add given amount of liquid to the remote inventory. -- return leftover amount function techage.liquid.put(pos, outdir, name, amount) - local pos2, indir, liquid = get_dest_node(pos, outdir) - if liquid and liquid.put then - return liquid.put(pos2, indir, name, amount) + 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 + -- wrong items? + local peek = liquid.peek(item.pos, item.indir) + if peek and peek ~= name then return amount end + techage.mark_position("singleplayer", item.pos, "put", "", 1) ------------------- debug + amount = liquid.put(item.pos, item.indir, name, amount) + if amount == 0 then break end + end end return amount end -- Take given amount of liquid for the remote inventory. --- return taken amount +-- return taken amount and item name function techage.liquid.take(pos, outdir, name, amount) - local pos2, indir, liquid = get_dest_node(pos, outdir) - if liquid and liquid.take then - return liquid.take(pos2, indir, name, amount) + 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 + techage.mark_position("singleplayer", item.pos, "take", "", 1) ------------------- debug + 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 + end + end end - return 0 + return taken, item_name end -- -- Server local functions -- -function techage.liquid.srv_peek(pos, listname) +function techage.liquid.srv_peek(pos, indir) local mem = tubelib2.get_mem(pos) - if mem.liquid and mem.liquid.name then - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local stack = inv:get_stack(listname, 1) - return mem.liquid.name, peek(stack, mem.liquid) - end + mem.liquid = mem.liquid or {} + return mem.liquid.name end -function techage.liquid.srv_put(pos, listname, name, amount) +function techage.liquid.srv_put(pos, indir, name, amount) local mem = tubelib2.get_mem(pos) - if mem.liquid and not mem.liquid.name or mem.liquid.name == name then + mem.liquid = mem.liquid or {} + if not mem.liquid.name then mem.liquid.name = name - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local stack = inv:get_stack(listname, 1) - return put(stack, mem.liquid, amount) + mem.liquid.amount = amount + return 0 + elseif mem.liquid.name == name then + mem.liquid.amount = mem.liquid.amount or 0 + local capa = LQD(pos).capa + if mem.liquid.amount + amount <= capa then + mem.liquid.amount = mem.liquid.amount + amount + return 0 + else + local rest = mem.liquid.amount + amount - capa + mem.liquid.amount = capa + return rest + end end + return amount end -function techage.liquid.srv_take(pos, listname, name, amount) +function techage.liquid.srv_take(pos, indir, name, amount) local mem = tubelib2.get_mem(pos) - if mem.liquid and mem.liquid.name == name then - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local stack = inv:get_stack(listname, 1) - return take(stack, mem.liquid, amount) + mem.liquid = mem.liquid or {} + if not name or mem.liquid.name == name then + name = mem.liquid.name + mem.liquid.amount = mem.liquid.amount or 0 + if mem.liquid.amount > amount then + mem.liquid.amount = mem.liquid.amount - amount + return amount, name + else + local rest = mem.liquid.amount + local name = mem.liquid.name + mem.liquid.amount = 0 + mem.liquid.name = nil + return rest, name + end end + return 0 +end + +-- +-- Further API functions +-- + +-- like: register_liquid("techage:ta3_barrel_oil", "techage:ta3_barrel_empty", 10, "techage:oil") +function techage.register_liquid(full_container, empty_container, container_size, inv_item) + LiquidDef[full_container] = {container = empty_container, size = container_size, inv_item = inv_item} + ContainerDef[empty_container] = ContainerDef[empty_container] or {} + ContainerDef[empty_container][inv_item] = full_container +end + +function techage.liquid.get_liquid_def(full_container) + return LiquidDef[full_container] +end + +function techage.liquid.is_container_empty(container_name) + return ContainerDef[container_name] +end + +function techage.liquid.get_full_container(empty_container, inv_item) + return ContainerDef[empty_container] and ContainerDef[empty_container][inv_item] +end + +-- To be called from each node via 'tubelib2_on_update2' +-- 'output' is optional and only needed for nodes with two +-- different networks. +function techage.liquid.update_network(pos, outdir) + networks.node_connections(pos, Pipe) + delete_netID(pos, outdir) end +techage.register_liquid("bucket:bucket_water", "bucket:bucket_empty", 1, "default:water_source") +techage.register_liquid("bucket:bucket_river_water", "bucket:bucket_empty", 1, "default:river_water_source") +techage.register_liquid("bucket:bucket_lava", "bucket:bucket_empty", 1, "default:lava_source") -function techage.register_liquid(name, container, size, inv_item) - LiquidDefs[name] = {container = container, size = size, inv_item = inv_item} -end - -function techage.liquid.get_liquid_def(name) - return LiquidDefs[name] -end - \ No newline at end of file diff --git a/liquids/liquid_pipe.lua b/liquids/liquid_pipe.lua index 4241d33..050c3ef 100644 --- a/liquids/liquid_pipe.lua +++ b/liquids/liquid_pipe.lua @@ -25,7 +25,6 @@ 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, tube_type = "pipe", primary_node_names = {"techage:ta3_pipeS", "techage:ta3_pipeA"}, secondary_node_names = {}, @@ -145,13 +144,14 @@ techage.register_junction("techage:ta3_junctionpipe", 1/8, Boxes, nil, { sounds = default.node_sound_metal_defaults(), after_place_node = function(pos, placer, itemstack, pointed_thing) - Pipe:after_place_node(pos) - end, - tubelib2_on_update2 = function(pos, node, tlib2) - print("tubelib2_on_update2 pipe") local name = "techage:ta3_junctionpipe"..techage.junction_type(pos, Pipe) minetest.swap_node(pos, {name = name, param2 = 0}) - networks.update_network(pos, Pipe) + Pipe:after_place_node(pos) + end, + tubelib2_on_update2 = function(pos, dir1, tlib2, node) + local name = "techage:ta3_junctionpipe"..techage.junction_type(pos, Pipe) + minetest.swap_node(pos, {name = name, param2 = 0}) + techage.liquid.update_network(pos) end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) diff --git a/liquids/oil_lib.lua b/liquids/oil_lib.lua new file mode 100644 index 0000000..b59ba98 --- /dev/null +++ b/liquids/oil_lib.lua @@ -0,0 +1,168 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019 Joachim Stolberg + + GPL v3 + See LICENSE.txt for more information + + Oil burner lib + +]]-- + +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S +local Pipe = techage.LiquidPipe +local liquid = techage.liquid + +techage.oilburner = {} + +local CAPACITY = 50 + +techage.oilburner.CAPACITY = CAPACITY +techage.oilburner.Oilburntime = 50 + +minetest.after(1, function() + local fuel,_ = minetest.get_craft_result({method = "fuel", width = 1, items = {"techage:oil_source"}}) + techage.oilburner.Oilburntime = fuel.time +end) + +techage.oilburner.liquid = { + capa = CAPACITY, + peek = liquid.srv_peek, + put = liquid.srv_put, + take = liquid.srv_take, +} + +techage.oilburner.networks = { + pipe = { + sides = techage.networks.AllSides, -- Pipe connection sides + ntype = "tank", + }, +} + +local function formspec_oil(x, y, mem) + local itemname = "" + if mem.liquid and mem.liquid.amount and mem.liquid.amount > 0 then + itemname = "techage:oil_source "..mem.liquid.amount + end + local fuel_percent = 0 + if mem.running then + fuel_percent = ((mem.burn_cycles or 1) * 100) / (mem.burn_cycles_total or 1) + end + return "container["..x..","..y.."]".. + "background[0,0;2,2.05;techage_form_grey.png]".. + "image[0,0;1,1;techage_form_input_arrow.png]".. + "image[1,0;1,1;default_furnace_fire_bg.png^[lowpart:".. + fuel_percent..":default_furnace_fire_fg.png]".. + techage.item_image(1, 1, itemname).. + "list[context;fuel;0,1;1,1;]".. + "container_end[]" +end + +function techage.oilburner.formspec(mem) + local update = ((mem.countdown or 0) > 0 and mem.countdown) or S("Update") + return "size[8,6]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + formspec_oil(2, 0, mem).. + "button[5.5,0.5;2,1;update;"..update.."]".. + "list[current_player;main;0,2.3;8,4;]" +end + +local function fill_container(pos, inv, mem) + mem.liquid = mem.liquid or {} + mem.liquid.amount = mem.liquid.amount or 0 + local empty_container = inv:get_stack("fuel", 1):get_name() + local full_container = liquid.get_full_container(empty_container, "techage:oil_source") + local ldef = liquid.get_liquid_def(full_container) + if ldef and mem.liquid.amount - ldef.size >= 0 then + inv:remove_item("fuel", ItemStack(empty_container)) + inv:add_item("fuel", ItemStack(full_container)) + mem.liquid.amount = mem.liquid.amount - ldef.size + end +end + +local function empty_container(pos, inv, mem) + mem.liquid = mem.liquid or {} + mem.liquid.amount = mem.liquid.amount or 0 + local stack = inv:get_stack("fuel", 1) + if stack:get_count() == 1 then + local ldef = liquid.get_liquid_def(stack:get_name()) + if ldef and ldef.inv_item == "techage:oil_source" then + if mem.liquid.amount + ldef.size <= CAPACITY then + inv:remove_item("fuel", stack) + inv:add_item("fuel", ItemStack(ldef.container)) + mem.liquid.amount = mem.liquid.amount + ldef.size + mem.liquid.name = "techage:oil_source" + end + end + end +end + +local function move_item(pos, stack) + local mem = tubelib2.get_mem(pos) + local inv = M(pos):get_inventory() + if liquid.is_container_empty(stack:get_name()) then + fill_container(pos, inv, mem) + else + empty_container(pos, inv, mem) + end + M(pos):set_string("formspec", techage.oilburner.formspec(mem)) +end + +function techage.oilburner.allow_metadata_inventory_put(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return 1 +end + +function techage.oilburner.allow_metadata_inventory_take(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() +end + +function techage.oilburner.on_metadata_inventory_put(pos, listname, index, stack, player) + minetest.after(0.5, move_item, pos, stack) +end + +function techage.oilburner.can_dig(pos, player) + if minetest.is_protected(pos, player:get_player_name()) then + return false + end + local mem = tubelib2.get_mem(pos) + mem.liquid = mem.liquid or {} + mem.liquid.amount = mem.liquid.amount or 0 + local inv = M(pos):get_inventory() + return inv:is_empty("fuel") and mem.liquid.amount == 0 +end + +function techage.oilburner.on_rightclick(pos) + local mem = tubelib2.get_mem(pos) + mem.countdown = 10 + M(pos):set_string("formspec", techage.oilburner.formspec(mem)) +end + +function techage.oilburner.on_receive_fields(pos, formname, fields, player) + if minetest.is_protected(pos, player:get_player_name()) then + return + end + local mem = tubelib2.get_mem(pos) + mem.countdown = 10 + M(pos):set_string("formspec", techage.oilburner.formspec(mem)) +end + +function techage.oilburner.formspec_update(pos, mem) + if mem.countdown and mem.countdown > 0 then + mem.countdown = mem.countdown - 1 + M(pos):set_string("formspec", techage.oilburner.formspec(mem)) + end +end diff --git a/liquids/pump.lua b/liquids/pump.lua new file mode 100644 index 0000000..a11f26f --- /dev/null +++ b/liquids/pump.lua @@ -0,0 +1,296 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019 Joachim Stolberg + + GPL v3 + See LICENSE.txt for more information + + TA3/TA4 Pump + +]]-- + +local S2P = minetest.string_to_pos +local P2S = minetest.pos_to_string +local M = minetest.get_meta +local S = techage.S +local Pipe = techage.LiquidPipe +local networks = techage.networks +local liquid = techage.liquid +local Flip = techage.networks.Flip + +local STANDBY_TICKS = 10 +local COUNTDOWN_TICKS = 10 +local CYCLE_TIME = 2 +local CAPA = 4 + +local State3 = techage.NodeStates:new({ + node_name_passive = "techage:t3_pump", + node_name_active = "techage:t3_pump_on", + infotext_name = S("TA3 Pump"), + cycle_time = CYCLE_TIME, + standby_ticks = STANDBY_TICKS, +}) + +local State4 = techage.NodeStates:new({ + node_name_passive = "techage:t4_pump", + node_name_active = "techage:t4_pump_on", + infotext_name = S("TA4 Pump"), + cycle_time = CYCLE_TIME, + standby_ticks = STANDBY_TICKS, +}) + +local function pumping(pos, mem, state, capa) + local outdir = M(pos):get_int("outdir") + local taken, name = liquid.take(pos, Flip[outdir], nil, capa) + if taken > 0 then + local leftover = liquid.put(pos, outdir, name, taken) + if leftover and leftover > 0 then + liquid.put(pos, Flip[outdir], name, leftover) + state:blocked(pos, mem) + return + end + state:keep_running(pos, mem, COUNTDOWN_TICKS) + return + end + state:idle(pos, mem) +end + +local function after_place_node3(pos, placer) + local mem = tubelib2.init_mem(pos) + local number = techage.add_node(pos, "techage:t3_pump") + State3:node_init(pos, mem, number) + M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) + Pipe:after_place_node(pos) +end + +local function after_place_node4(pos, placer) + local mem = tubelib2.init_mem(pos) + local number = techage.add_node(pos, "techage:t4_pump") + State4:node_init(pos, mem, number) + M(pos):set_int("outdir", networks.side_to_outdir(pos, "R")) + Pipe:after_place_node(pos) +end + +local function node_timer3(pos, elapsed) + local mem = tubelib2.get_mem(pos) + pumping(pos, mem, State3, CAPA) + return true +end + +local function node_timer4(pos, elapsed) + local mem = tubelib2.get_mem(pos) + pumping(pos, mem, State4, CAPA * 2) + return true +end + +local function on_rightclick(pos, node, clicker) + local mem = tubelib2.get_mem(pos) + if node.name == "techage:t3_pump" then + State3:start(pos, mem) + elseif node.name == "techage:t3_pump_on" then + State3:stop(pos, mem) + elseif node.name == "techage:t4_pump" then + State4:start(pos, mem) + elseif node.name == "techage:t4_pump_on" then + State4:stop(pos, mem) + end +end + +local function tubelib2_on_update2(pos, outdir, tlib2, node) + liquid.update_network(pos, outdir) +end + +local function after_dig_node(pos, oldnode, oldmetadata, digger) + Pipe:after_dig_node(pos) +end + +local ta3_tiles_pas = { + -- up, down, right, left, back, front + "techage_filling_ta3.png^techage_frame_ta3_top.png^techage_appl_arrow.png", + "techage_filling_ta3.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_appl_pump.png^techage_frame_ta3.png^[transformFX", + "techage_filling_ta3.png^techage_appl_pump.png^techage_frame_ta3.png", +} + +local ta4_tiles_pas = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png", + "techage_filling_ta4.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta4.png^[transformFX", + "techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta4.png", +} + +local ta3_tiles_act = { + -- up, down, right, left, back, front + "techage_filling_ta3.png^techage_frame_ta3_top.png^techage_appl_arrow.png", + "techage_filling_ta3.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", + "techage_filling_ta3.png^techage_appl_hole_pipe.png^techage_frame_ta3.png", + { + image = "techage_filling8_ta3.png^techage_appl_pump8.png^techage_frame8_ta3.png^[transformFX", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 2.0, + }, + }, + { + image = "techage_filling8_ta3.png^techage_appl_pump8.png^techage_frame8_ta3.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 2.0, + }, + }, +} + +local ta4_tiles_act = { + -- up, down, right, left, back, front + "techage_filling_ta4.png^techage_frame_ta4_top.png^techage_appl_arrow.png", + "techage_filling_ta4.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta4.png", + "techage_filling_ta4.png^techage_appl_hole_pipe.png^techage_frame_ta4.png", + { + image = "techage_filling8_ta4.png^techage_appl_pump8.png^techage_frame8_ta4.png^[transformFX", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 2.0, + }, + }, + { + image = "techage_filling8_ta4.png^techage_appl_pump8.png^techage_frame8_ta4.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 32, + aspect_h = 32, + length = 2.0, + }, + }, +} + +local nworks = { + pipe = { + sides = {L = 1, R = 1}, -- Pipe connection side + ntype = "pump", + }, +} + +minetest.register_node("techage:t3_pump", { + description = S("TA3 Pump"), + tiles = ta3_tiles_pas, + after_place_node = after_place_node3, + on_rightclick = on_rightclick, + tubelib2_on_update2 = tubelib2_on_update2, + --on_timer = node_timer3, + after_dig_node = after_dig_node, + on_rotate = screwdriver.disallow, + networks = nworks, + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:t3_pump_on", { + description = S("TA3 Pump"), + tiles = ta3_tiles_act, + --after_place_node = after_place_node3, + on_rightclick = on_rightclick, + tubelib2_on_update2 = tubelib2_on_update2, + on_timer = node_timer3, + after_dig_node = after_dig_node, + on_rotate = screwdriver.disallow, + networks = nworks, + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + diggable = false, + groups = {not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:t4_pump", { + description = S("TA4 Pump"), + tiles = ta4_tiles_pas, + after_place_node = after_place_node4, + on_rightclick = on_rightclick, + tubelib2_on_update2 = tubelib2_on_update2, + --on_timer = node_timer4, + after_dig_node = after_dig_node, + on_rotate = screwdriver.disallow, + networks = nworks, + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + groups = {cracky=2}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +minetest.register_node("techage:t4_pump_on", { + description = S("TA4 Pump"), + tiles = ta4_tiles_act, + --after_place_node = after_place_node4, + on_rightclick = on_rightclick, + tubelib2_on_update2 = tubelib2_on_update2, + on_timer = node_timer4, + after_dig_node = after_dig_node, + on_rotate = screwdriver.disallow, + networks = nworks, + paramtype2 = "facedir", + on_rotate = screwdriver.disallow, + diggable = false, + groups = {not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_metal_defaults(), +}) + +techage.register_node({"techage:t3_pump", "techage:t3_pump_on"}, { + on_recv_message = function(pos, src, topic, payload) + local resp = State3:on_receive_message(pos, topic, payload) + if resp then + return resp + else + return "unsupported" + end + end, + on_node_load = function(pos) + State3:on_node_load(pos) + end, +}) + +techage.register_node({"techage:t4_pump", "techage:t4_pump_on"}, { + on_recv_message = function(pos, src, topic, payload) + local resp = State4:on_receive_message(pos, topic, payload) + if resp then + return resp + else + return "unsupported" + end + end, + on_node_load = function(pos) + State4:on_node_load(pos) + end, +}) + +Pipe:add_secondary_node_names({ + "techage:t3_pump", "techage:t3_pump_on", + "techage:t4_pump", "techage:t4_pump_on", +}) + + \ No newline at end of file diff --git a/liquids/tank.lua b/liquids/tank.lua index 2816cbe..f4919cf 100644 --- a/liquids/tank.lua +++ b/liquids/tank.lua @@ -16,14 +16,17 @@ local S2P = minetest.string_to_pos local P2S = minetest.pos_to_string local M = minetest.get_meta local S = techage.S +local LQD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).liquid end local Pipe = techage.LiquidPipe local liquid = techage.liquid -local networks = techage.networks -local function formspec_tank(x, y, liquid) +local CAPACITY = 1000 + + +local function formspec_tank(x, y, mem) local itemname = "techage:liquid" - if liquid.amount and liquid.amount > 0 and liquid.name then - itemname = liquid.name.." "..liquid.amount + if mem.liquid and mem.liquid.amount and mem.liquid.amount > 0 and mem.liquid.name then + itemname = mem.liquid.name.." "..mem.liquid.amount end return "container["..x..","..y.."]".. "background[0,0;3,2.05;techage_form_grey.png]".. @@ -37,74 +40,72 @@ local function formspec_tank(x, y, liquid) "container_end[]" end -local function formspec(liquid) +local function formspec(mem) + local update = ((mem.countdown or 0) > 0 and mem.countdown) or S("Update") return "size[8,6]".. default.gui_bg.. default.gui_bg_img.. default.gui_slots.. - formspec_tank(2.5, 0, liquid).. + formspec_tank(2, 0, mem).. + "button[5.5,0.5;2,1;update;"..update.."]".. "list[current_player;main;0,2.3;8,4;]" end -local function liquid_item(mem, stack) - if mem.liquid and stack:get_count() == 1 then - if not mem.liquid.name or mem.liquid.name == stack:get_name() then - local def = techage.liquid.get_liquid_def(stack:get_name()) - if def then - return def.size, def.container, def.inv_item +local function fill_container(pos, inv) + local mem = tubelib2.get_mem(pos) + mem.liquid = mem.liquid or {} + mem.liquid.amount = mem.liquid.amount or 0 + local empty_container = inv:get_stack("src", 1):get_name() + local full_container = liquid.get_full_container(empty_container, mem.liquid.name) + local ldef = liquid.get_liquid_def(full_container) + if ldef and mem.liquid.amount - ldef.size >= 0 then + if inv:room_for_item("dst", ItemStack(full_container)) then + inv:remove_item("src", ItemStack(empty_container)) + inv:add_item("dst", ItemStack(full_container)) + mem.liquid.amount = mem.liquid.amount - ldef.size + if mem.liquid.amount == 0 then + mem.liquid.name = nil end end end end -local function move_item(mem, inv, stack) - local amount, giving_back, inv_item = liquid_item(mem, stack) - if amount and inv:room_for_item("dst", ItemStack(giving_back)) then - mem.liquid.name = inv_item - mem.liquid.amount = (mem.liquid.amount or 0) + amount - inv:remove_item("src", stack) - inv:add_item("dst", ItemStack(giving_back)) - M(pos):set_string("formspec", formspec(mem.liquid)) - return true +local function empty_container(pos, inv) + local mem = tubelib2.get_mem(pos) + mem.liquid = mem.liquid or {} + mem.liquid.amount = mem.liquid.amount or 0 + local stack = inv:get_stack("src", 1) + local ldef = liquid.get_liquid_def(stack:get_name()) + if ldef and (not mem.liquid.name or ldef.inv_item == mem.liquid.name) then + local capa = LQD(pos).capa + local amount = stack:get_count() * ldef.size + if mem.liquid.amount + amount <= capa then + if inv:room_for_item("dst", ItemStack(ldef.container)) then + inv:remove_item("src", stack) + inv:add_item("dst", ItemStack(ldef.container)) + mem.liquid.amount = mem.liquid.amount + amount + mem.liquid.name = ldef.inv_item + end + end end - return false end -local function move_item2(pos, itemname, amount, giving_back, formspec) +local function move_item(pos, stack) local mem = tubelib2.get_mem(pos) local inv = M(pos):get_inventory() - if inv:room_for_item("dst", ItemStack(giving_back)) then - mem.liquid.name = itemname - mem.liquid.amount = (mem.liquid.amount or 0) + amount - inv:remove_item("src", ItemStack(itemname)) - inv:add_item("dst", ItemStack(giving_back)) - M(pos):set_string("formspec", formspec(mem.liquid)) + if liquid.is_container_empty(stack:get_name()) then + fill_container(pos, inv) + else + empty_container(pos, inv) end + M(pos):set_string("formspec", formspec(mem)) end -local function add_barrel(pos, stack, formspec) - local mem = tubelib2.get_mem(pos) - local inv = minetest.get_meta(pos):get_inventory() - if inv:room_for_item("src", stack) then - --minetest.after(0.5, move_item, pos, stack:get_name(), amount, giving_back, formspec) - return stack:get_count() - end - return 0 -end - -local function empty_barrel(pos, inv, stack) - local mem = tubelib2.get_mem(pos) - if inv:room_for_item("src", stack) then - return move_item(mem, inv, stack) - end - return false -end - local function allow_metadata_inventory_put(pos, listname, index, stack, player) if minetest.is_protected(pos, player:get_player_name()) then return 0 end - return add_barrel(pos, stack, formspec) + return 1 end local function allow_metadata_inventory_take(pos, listname, index, stack, player) @@ -114,19 +115,38 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player return stack:get_count() end +local function allow_metadata_inventory_move() + return 0 +end + +local function on_metadata_inventory_put(pos, listname, index, stack, player) + minetest.after(0.5, move_item, pos, stack) +end + local function on_rightclick(pos) local mem = tubelib2.get_mem(pos) - M(pos):set_string("formspec", formspec(mem.liquid)) - techage.networks.connections(pos, Pipe) - print(mem.pipe.netID) + mem.countdown = 10 + M(pos):set_string("formspec", formspec(mem)) + minetest.get_node_timer(pos):start(2) +end + +local function on_receive_fields(pos, formname, fields, player) + if minetest.is_protected(pos, player:get_player_name()) then + return + end + local mem = tubelib2.get_mem(pos) + mem.countdown = 10 + M(pos):set_string("formspec", formspec(mem)) + minetest.get_node_timer(pos):start(2) end local function can_dig(pos, player) if minetest.is_protected(pos, player:get_player_name()) then return false end + local mem = tubelib2.get_mem(pos) local inv = minetest.get_meta(pos):get_inventory() - return inv:is_empty("main") + return inv:is_empty("src") and inv:is_empty("dst") and (mem.liquid.amount or 0) == 0 end @@ -136,8 +156,8 @@ minetest.register_node("techage:ta3_tank", { -- up, down, right, left, back, front "techage_filling_ta3.png^techage_frame_ta3_top.png", "techage_filling_ta3.png^techage_frame_ta3.png", - "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_hole_biogas.png", - "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_hole_tube.png", + "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_tank.png", + "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_tank.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_tank.png", "techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_tank.png", }, @@ -154,49 +174,49 @@ minetest.register_node("techage:ta3_tank", { local number = techage.add_node(pos, "techage:ta3_tank") meta:set_string("node_number", number) meta:set_string("owner", placer:get_player_name()) - local node = minetest.get_node(pos) - local indir = techage.side_to_indir("R", node.param2) - meta:set_int("indir", indir) -- from liquid point of view - meta:set_string("formspec", formspec(mem.liquid)) + meta:set_string("formspec", formspec(mem)) meta:set_string("infotext", S("TA3 Tank").." "..number) Pipe:after_place_node(pos) end, - tubelib2_on_update2 = function(pos, node, tlib2) - networks.update_network(pos, tlib2) + tubelib2_on_update2 = function(pos, dir, tlib2, node) + liquid.update_network(pos) + end, + on_timer = function(pos, elapsed) + local mem = tubelib2.get_mem(pos) + mem.countdown = mem.countdown - 1 + M(pos):set_string("formspec", formspec(mem)) + return mem.countdown > 0 end, after_dig_node = function(pos, oldnode, oldmetadata, digger) Pipe:after_dig_node(pos) techage.remove_node(pos) end, liquid = { - peek = function(pos, indir) - print("ta3_tank.peek", indir, M(pos):get_int("indir")) - if indir == M(pos):get_int("indir") then - return liquid.srv_peek(pos, "main") - end - end, + capa = CAPACITY, + peek = liquid.srv_peek, put = function(pos, indir, name, amount) - if indir == M(pos):get_int("indir") then - return liquid.srv_put(pos, "main", name, amount) + local leftover = liquid.srv_put(pos, indir, name, amount) + local inv = M(pos):get_inventory() + if not inv:is_empty("src") and inv:is_empty("dst") then + fill_container(pos, inv) end + return leftover end, - take = function(pos, indir, name, amount) - if indir == M(pos):get_int("indir") then - return liquid.srv_take(pos, "main", name, amount) - end - end, - + take = liquid.srv_take, }, networks = { pipe = { - sides = {R = 1}, -- Pipe connection side + sides = techage.networks.AllSides, -- Pipe connection sides ntype = "tank", }, }, on_rightclick = on_rightclick, + on_receive_fields = on_receive_fields, can_dig = can_dig, allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_take = allow_metadata_inventory_take, + allow_metadata_inventory_move = allow_metadata_inventory_move, + on_metadata_inventory_put = on_metadata_inventory_put, paramtype2 = "facedir", on_rotate = screwdriver.disallow, groups = {cracky=2}, @@ -212,7 +232,7 @@ Pipe:add_secondary_node_names({"techage:ta3_tank"}) -- -- up, down, right, left, back, front -- "techage_filling_ta4.png^techage_frame_ta4_top.png", -- "techage_filling_ta4.png^techage_frame_ta4.png", --- "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_biogas.png", +-- "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_pipe.png", -- "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_hole_tube.png", -- "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_tank.png", -- "techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_tank.png", @@ -268,7 +288,7 @@ Pipe:add_secondary_node_names({"techage:ta3_tank"}) -- local node = minetest.get_node(pos) -- local indir = techage.side_to_indir("R", node.param2) -- meta:set_int("indir", indir) -- from liquid point of view --- meta:set_string("formspec", formspec(mem.liquid)) +-- meta:set_string("formspec", formspec(mem)) -- meta:set_string("infotext", S("TA4 Tank").." "..number) -- end, -- after_dig_node = function(pos, oldnode, oldmetadata, digger) @@ -276,31 +296,35 @@ Pipe:add_secondary_node_names({"techage:ta3_tank"}) -- end, --}) -local function valid_indir(meta, indir) - return tubelib2.Turn180Deg[meta:get_int("indir")] == indir -end techage.register_node({"techage:ta3_tank", "techage:ta4_tank"}, { on_pull_item = function(pos, in_dir, num) - local meta = M(pos) - if valid_indir(meta, in_dir) then - local inv = meta:get_inventory() - return techage.get_items(inv, "dst", num) + local inv = M(pos):get_inventory() + if not inv:is_empty("dst") then + local taken = techage.get_items(inv, "dst", num) + if not inv:is_empty("src") then + fill_container(pos, inv) + end + return taken end end, on_push_item = function(pos, in_dir, stack) - local meta = M(pos) - if valid_indir(meta, in_dir) then - local inv = meta:get_inventory() - return empty_barrel(pos, inv, stack) + local inv = M(pos):get_inventory() + if inv:room_for_item("src", stack) then + inv:add_item("src", stack) + if liquid.is_container_empty(stack:get_name()) then + fill_container(pos, inv) + else + empty_container(pos, inv) + end + return true end + return false end, on_unpull_item = function(pos, in_dir, stack) local meta = M(pos) - if valid_indir(meta, in_dir) then - local inv = meta:get_inventory() - return techage.put_items(inv, "dst", stack) - end + local inv = meta:get_inventory() + return techage.put_items(inv, "dst", stack) end, on_recv_message = function(pos, src, topic, payload) if topic == "state" then diff --git a/manuals/api.md b/manuals/api.md index aa871bd..24968e5 100644 --- a/manuals/api.md +++ b/manuals/api.md @@ -11,8 +11,8 @@ ``` +-------------------------------------------------------------+ +-------------------+ - | consumer | | Nodes | - | (tubing/commands/states/formspec/power/connections/node) | | (Pipe/Tube/Cable) | + | consumer | | liquid | + | (tubing/commands/states/formspec/power/connections/node) | | (Pipe/put/take) | +-------------------------------------------------------------+ +-------------------+ | | | | V V V V diff --git a/liquids/oil.lua b/oil/oil.lua similarity index 88% rename from liquids/oil.lua rename to oil/oil.lua index c5f37fb..d23a5aa 100644 --- a/liquids/oil.lua +++ b/oil/oil.lua @@ -125,12 +125,13 @@ minetest.register_craftitem("techage:ta3_barrel_oil", { stack_max = 1, }) -minetest.register_craftitem("techage:oil", { - description = S("TA Oil"), - inventory_image = "techage_oil_inv.png", - groups = {not_in_creative_inventory=1}, +--minetest.register_craftitem("techage:oil", { +-- description = S("TA Oil"), +-- inventory_image = "techage_oil_inv.png", +-- groups = {not_in_creative_inventory=1}, -}) - -techage.register_liquid("techage:ta3_barrel_oil", "techage:ta3_barrel_empty", 10, "techage:oil") +--}) +techage.register_liquid("techage:ta3_barrel_oil", "techage:ta3_barrel_empty", 10, "techage:oil_source") +techage.register_liquid("techage:bucket_oil", "bucket:bucket_empty", 1, "techage:oil_source") +techage.register_liquid("techage:oil_source", "", 1, "techage:oil_source") diff --git a/oil/pumpjack.lua b/oil/pumpjack.lua index 5034303..53d8518 100644 --- a/oil/pumpjack.lua +++ b/oil/pumpjack.lua @@ -17,6 +17,8 @@ local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end local M = minetest.get_meta local P = minetest.string_to_pos local S = techage.S +local Pipe = techage.LiquidPipe +local liquid = techage.liquid -- Consumer Related Data local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end @@ -26,12 +28,12 @@ local STANDBY_TICKS = 10 local COUNTDOWN_TICKS = 10 local CYCLE_TIME = 8 -local function has_oil_item(pos, meta) +local function has_oil(pos, meta) local storage_pos = meta:get_string("storage_pos") if storage_pos ~= "" then local amount = techage.explore.get_oil_amount(P(storage_pos)) if amount > 0 then - return ItemStack("techage:oil_source") + return true end end end @@ -66,9 +68,9 @@ local function on_rightclick(pos, node, clicker) end local function pumping(pos, crd, meta, mem) - local items = has_oil_item(pos, meta) - if items ~= nil then - if techage.push_items(pos, 6, items) ~= true then + if has_oil(pos, meta) then + --if techage.push_items(pos, 6, items) ~= true then + if liquid.put(pos, 6, "techage:oil_source", 1) > 0 then crd.State:blocked(pos, mem) return end @@ -103,8 +105,8 @@ local tiles = {} -- '#' will be replaced by the stage number tiles.pas = { - "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png", - "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png", + "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_hole_pipe.png", + "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_hole_pipe.png", "techage_appl_pumpjack.png^techage_frame_ta#.png", "techage_appl_pumpjack.png^techage_frame_ta#.png", "techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png^[transformR90]", @@ -112,8 +114,8 @@ tiles.pas = { } tiles.act = { -- up, down, right, left, back, front - "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png", - "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png", + "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_hole_pipe.png", + "techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_hole_pipe.png", { image = "techage_appl_pumpjack14.png^techage_frame14_ta#.png", backface_culling = false, @@ -169,6 +171,15 @@ local _, node_name_ta3, _ = end end end, + networks = { + pipe = { + sides = {U = 1}, -- Pipe connection side + ntype = "pump", + }, + }, + tubelib2_on_update2 = function(pos, outdir, tlib2, node) + liquid.update_network(pos, outdir) + end, on_rightclick = on_rightclick, on_receive_fields = on_receive_fields, node_timer = keep_running, @@ -191,3 +202,5 @@ minetest.register_craft({ }, }) +Pipe:add_secondary_node_names({"techage:ta3_pumpjack_pas", "techage:ta3_pumpjack_act"}) + diff --git a/textures/techage_appl_hole_biogas.png b/textures/techage_appl_hole_pipe.png similarity index 100% rename from textures/techage_appl_hole_biogas.png rename to textures/techage_appl_hole_pipe.png diff --git a/textures/techage_appl_pump.png b/textures/techage_appl_pump.png index c58f998..a369e0d 100644 Binary files a/textures/techage_appl_pump.png and b/textures/techage_appl_pump.png differ diff --git a/textures/techage_appl_pump8.png b/textures/techage_appl_pump8.png index e5ce81a..4310825 100644 Binary files a/textures/techage_appl_pump8.png and b/textures/techage_appl_pump8.png differ diff --git a/textures/techage_appl_pump_up.png b/textures/techage_appl_pump_up.png new file mode 100644 index 0000000..c58f998 Binary files /dev/null and b/textures/techage_appl_pump_up.png differ diff --git a/textures/techage_appl_pump_up8.png b/textures/techage_appl_pump_up8.png new file mode 100644 index 0000000..e5ce81a Binary files /dev/null and b/textures/techage_appl_pump_up8.png differ diff --git a/textures/techage_appl_tank.png b/textures/techage_appl_tank.png index 17f9888..449fed8 100644 Binary files a/textures/techage_appl_tank.png and b/textures/techage_appl_tank.png differ diff --git a/textures/techage_filling8_ta3.png b/textures/techage_filling8_ta3.png new file mode 100644 index 0000000..68920c1 Binary files /dev/null and b/textures/techage_filling8_ta3.png differ diff --git a/textures/techage_frame8_ta3.png b/textures/techage_frame8_ta3.png new file mode 100644 index 0000000..a7091bf Binary files /dev/null and b/textures/techage_frame8_ta3.png differ