2019-11-03 01:39:10 +03:00
|
|
|
--[[
|
|
|
|
|
|
|
|
TechAge
|
|
|
|
=======
|
|
|
|
|
2022-01-10 23:39:36 +03:00
|
|
|
Copyright (C) 2019-2022 Joachim Stolberg
|
2019-11-03 01:39:10 +03:00
|
|
|
|
2020-10-19 20:09:17 +03:00
|
|
|
AGPL v3
|
2019-11-03 01:39:10 +03:00
|
|
|
See LICENSE.txt for more information
|
2022-01-03 23:40:31 +03:00
|
|
|
|
2019-11-03 01:39:10 +03:00
|
|
|
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
|
2021-06-09 23:09:59 +03:00
|
|
|
local liquid = networks.liquid
|
|
|
|
local Flip = networks.Flip
|
2019-11-03 01:39:10 +03:00
|
|
|
|
2020-04-05 13:36:32 +03:00
|
|
|
local STANDBY_TICKS = 3
|
|
|
|
local COUNTDOWN_TICKS = 4
|
2019-11-03 01:39:10 +03:00
|
|
|
local CYCLE_TIME = 2
|
|
|
|
local CAPA = 4
|
|
|
|
|
2022-09-03 20:22:43 +03:00
|
|
|
local WRENCH_MENU = {
|
|
|
|
{
|
|
|
|
type = "output",
|
|
|
|
name = "flowrate",
|
|
|
|
label = S("Total flow rate"),
|
|
|
|
tooltip = S("Total flow rate in liquid units"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = "number",
|
|
|
|
name = "limit",
|
|
|
|
label = S("Number of units"),
|
|
|
|
tooltip = S("Number of liquid units that are allowed to be pumped"),
|
|
|
|
default = "0",
|
|
|
|
},
|
|
|
|
}
|
2021-11-28 16:42:18 +03:00
|
|
|
|
2019-11-03 01:39:10 +03:00
|
|
|
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,
|
|
|
|
})
|
|
|
|
|
2023-05-17 20:07:23 +03:00
|
|
|
local function handle_pump_limit(pos, nvm)
|
|
|
|
local val = M(pos):get_int("limit")
|
|
|
|
if val and val > 0 then
|
|
|
|
nvm.limit = val
|
|
|
|
nvm.num_items = 0
|
|
|
|
else
|
|
|
|
nvm.limit = nil
|
|
|
|
nvm.num_items = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-09-04 19:05:37 +03:00
|
|
|
-- Function returns the number of pumped units
|
2022-09-03 20:22:43 +03:00
|
|
|
local function pump(pos, mem, nvm, state, outdir, units)
|
|
|
|
local taken, name = liquid.take(pos, Pipe, Flip[outdir], nil, units, mem.dbg_cycles > 0)
|
2022-10-01 16:49:28 +03:00
|
|
|
if taken > 0 and name then
|
2021-06-09 23:09:59 +03:00
|
|
|
local leftover = liquid.put(pos, Pipe, outdir, name, taken, mem.dbg_cycles > 0)
|
|
|
|
if leftover and leftover > 0 then
|
2021-12-11 22:15:55 +03:00
|
|
|
-- air needs no tank
|
|
|
|
if name == "air" then
|
|
|
|
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
|
|
|
return 0
|
|
|
|
end
|
2021-06-09 23:09:59 +03:00
|
|
|
liquid.untake(pos, Pipe, Flip[outdir], name, leftover)
|
2020-09-19 16:09:09 +03:00
|
|
|
if leftover == taken then
|
|
|
|
state:blocked(pos, nvm)
|
2021-11-28 16:42:18 +03:00
|
|
|
return 0
|
2020-09-19 16:09:09 +03:00
|
|
|
end
|
2021-11-28 16:42:18 +03:00
|
|
|
return taken - leftover
|
2019-11-03 01:39:10 +03:00
|
|
|
end
|
2021-11-28 16:42:18 +03:00
|
|
|
return taken
|
2022-09-03 20:22:43 +03:00
|
|
|
else
|
|
|
|
state:idle(pos, nvm)
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local function pumping(pos, nvm, state, capa)
|
|
|
|
local mem = techage.get_mem(pos)
|
|
|
|
mem.dbg_cycles = (mem.dbg_cycles or 0) - 1
|
|
|
|
local outdir = M(pos):get_int("outdir")
|
2022-09-10 21:42:31 +03:00
|
|
|
|
2022-09-03 20:22:43 +03:00
|
|
|
if not nvm.limit then
|
|
|
|
local num = pump(pos, mem, nvm, state, outdir, capa)
|
|
|
|
if num > 0 then
|
|
|
|
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
|
|
|
end
|
|
|
|
return num
|
|
|
|
elseif nvm.num_items < nvm.limit then
|
|
|
|
local num = math.min(capa, nvm.limit - nvm.num_items)
|
|
|
|
num = pump(pos, mem, nvm, state, outdir, num)
|
|
|
|
if num > 0 then
|
|
|
|
nvm.num_items = nvm.num_items + num
|
|
|
|
if nvm.num_items >= nvm.limit then
|
|
|
|
state:stop(pos, nvm)
|
|
|
|
else
|
|
|
|
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return num
|
2019-11-03 01:39:10 +03:00
|
|
|
end
|
2021-11-28 16:42:18 +03:00
|
|
|
return 0
|
2019-11-03 01:39:10 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
local function after_place_node3(pos, placer)
|
2020-01-31 21:55:10 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
2019-11-03 01:39:10 +03:00
|
|
|
local number = techage.add_node(pos, "techage:t3_pump")
|
2020-01-31 21:55:10 +03:00
|
|
|
State3:node_init(pos, nvm, number)
|
2019-11-03 01:39:10 +03:00
|
|
|
M(pos):set_int("outdir", networks.side_to_outdir(pos, "R"))
|
|
|
|
Pipe:after_place_node(pos)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function after_place_node4(pos, placer)
|
2020-01-31 21:55:10 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
2019-11-03 01:39:10 +03:00
|
|
|
local number = techage.add_node(pos, "techage:t4_pump")
|
2020-01-31 21:55:10 +03:00
|
|
|
State4:node_init(pos, nvm, number)
|
2019-11-03 01:39:10 +03:00
|
|
|
M(pos):set_int("outdir", networks.side_to_outdir(pos, "R"))
|
|
|
|
Pipe:after_place_node(pos)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function node_timer3(pos, elapsed)
|
2020-01-31 21:55:10 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
pumping(pos, nvm, State3, CAPA)
|
|
|
|
return State3:is_active(nvm)
|
2022-01-03 23:40:31 +03:00
|
|
|
end
|
2019-11-03 01:39:10 +03:00
|
|
|
|
|
|
|
local function node_timer4(pos, elapsed)
|
2020-01-31 21:55:10 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
2021-11-28 16:42:18 +03:00
|
|
|
nvm.flowrate = (nvm.flowrate or 0) + pumping(pos, nvm, State4, CAPA * 2)
|
2020-01-31 21:55:10 +03:00
|
|
|
return State4:is_active(nvm)
|
2022-01-03 23:40:31 +03:00
|
|
|
end
|
2019-11-03 01:39:10 +03:00
|
|
|
|
|
|
|
local function on_rightclick(pos, node, clicker)
|
2020-04-02 21:38:14 +03:00
|
|
|
if minetest.is_protected(pos, clicker:get_player_name()) then
|
|
|
|
return
|
|
|
|
end
|
2022-01-03 23:40:31 +03:00
|
|
|
|
2020-01-31 21:55:10 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
2019-11-03 01:39:10 +03:00
|
|
|
if node.name == "techage:t3_pump" then
|
2021-06-09 23:09:59 +03:00
|
|
|
local mem = techage.get_mem(pos)
|
|
|
|
mem.dbg_cycles = 5
|
2020-01-31 21:55:10 +03:00
|
|
|
State3:start(pos, nvm)
|
2019-11-03 01:39:10 +03:00
|
|
|
elseif node.name == "techage:t3_pump_on" then
|
2020-01-31 21:55:10 +03:00
|
|
|
State3:stop(pos, nvm)
|
2019-11-03 01:39:10 +03:00
|
|
|
elseif node.name == "techage:t4_pump" then
|
2021-06-09 23:09:59 +03:00
|
|
|
local mem = techage.get_mem(pos)
|
|
|
|
mem.dbg_cycles = 5
|
2023-05-17 20:07:23 +03:00
|
|
|
handle_pump_limit(pos, nvm)
|
2020-01-31 21:55:10 +03:00
|
|
|
State4:start(pos, nvm)
|
2019-11-03 01:39:10 +03:00
|
|
|
elseif node.name == "techage:t4_pump_on" then
|
2020-01-31 21:55:10 +03:00
|
|
|
State4:stop(pos, nvm)
|
2019-11-03 01:39:10 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-06-30 11:15:11 +03:00
|
|
|
local function ta_rotate_node(pos, node, new_param2)
|
|
|
|
Pipe:after_dig_node(pos)
|
|
|
|
minetest.swap_node(pos, {name = node.name, param2 = new_param2})
|
|
|
|
Pipe:after_place_node(pos)
|
|
|
|
M(pos):set_int("outdir", techage.side_to_outdir("R", new_param2))
|
|
|
|
end
|
|
|
|
|
2019-11-03 01:39:10 +03:00
|
|
|
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
|
|
Pipe:after_dig_node(pos)
|
2023-04-10 17:52:24 +03:00
|
|
|
techage.remove_node(pos, oldnode, oldmetadata)
|
2020-01-31 21:55:10 +03:00
|
|
|
techage.del_mem(pos)
|
2019-11-03 01:39:10 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
local ta3_tiles_pas = {
|
|
|
|
-- up, down, right, left, back, front
|
|
|
|
"techage_filling_ta3.png^techage_frame_ta3_top.png^techage_appl_arrow.png",
|
2023-06-30 11:15:11 +03:00
|
|
|
"techage_filling_ta3.png^techage_frame_ta3_bottom.png^techage_appl_arrow.png",
|
2019-11-03 01:39:10 +03:00
|
|
|
"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",
|
2023-06-30 11:15:11 +03:00
|
|
|
"techage_filling_ta4.png^techage_frame_ta4_bottom.png^techage_appl_arrow.png",
|
2019-11-03 01:39:10 +03:00
|
|
|
"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",
|
2023-06-30 11:15:11 +03:00
|
|
|
"techage_filling_ta3.png^techage_frame_ta3_bottom.png^techage_appl_arrow.png",
|
2019-11-03 01:39:10 +03:00
|
|
|
"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",
|
|
|
|
{
|
2023-04-07 11:51:33 +03:00
|
|
|
name = "techage_filling8_ta3.png^techage_appl_pump8.png^techage_frame8_ta3.png^[transformFX",
|
2019-11-03 01:39:10 +03:00
|
|
|
backface_culling = false,
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 32,
|
|
|
|
aspect_h = 32,
|
|
|
|
length = 2.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2023-04-07 11:51:33 +03:00
|
|
|
name = "techage_filling8_ta3.png^techage_appl_pump8.png^techage_frame8_ta3.png",
|
2019-11-03 01:39:10 +03:00
|
|
|
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",
|
2023-06-30 11:15:11 +03:00
|
|
|
"techage_filling_ta4.png^techage_frame_ta4_bottom.png^techage_appl_arrow.png",
|
2019-11-03 01:39:10 +03:00
|
|
|
"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",
|
|
|
|
{
|
2023-04-07 11:51:33 +03:00
|
|
|
name = "techage_filling8_ta4.png^techage_appl_pump8.png^techage_frame8_ta4.png^[transformFX",
|
2019-11-03 01:39:10 +03:00
|
|
|
backface_culling = false,
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 32,
|
|
|
|
aspect_h = 32,
|
|
|
|
length = 2.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2023-04-07 11:51:33 +03:00
|
|
|
name = "techage_filling8_ta4.png^techage_appl_pump8.png^techage_frame8_ta4.png",
|
2019-11-03 01:39:10 +03:00
|
|
|
backface_culling = false,
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 32,
|
|
|
|
aspect_h = 32,
|
|
|
|
length = 2.0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
minetest.register_node("techage:t3_pump", {
|
|
|
|
description = S("TA3 Pump"),
|
|
|
|
tiles = ta3_tiles_pas,
|
|
|
|
after_place_node = after_place_node3,
|
|
|
|
on_rightclick = on_rightclick,
|
2019-11-03 18:21:42 +03:00
|
|
|
on_timer = node_timer3,
|
2019-11-03 01:39:10 +03:00
|
|
|
after_dig_node = after_dig_node,
|
2023-06-30 11:15:11 +03:00
|
|
|
ta_rotate_node = ta_rotate_node,
|
2019-11-03 01:39:10 +03:00
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
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,
|
|
|
|
on_timer = node_timer3,
|
|
|
|
after_dig_node = after_dig_node,
|
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
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,
|
2019-11-03 18:21:42 +03:00
|
|
|
on_timer = node_timer4,
|
2019-11-03 01:39:10 +03:00
|
|
|
after_dig_node = after_dig_node,
|
2023-06-30 11:15:11 +03:00
|
|
|
ta_rotate_node = ta_rotate_node,
|
2019-11-03 01:39:10 +03:00
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
groups = {cracky=2},
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = default.node_sound_metal_defaults(),
|
2021-11-28 16:42:18 +03:00
|
|
|
ta4_formspec = WRENCH_MENU,
|
2019-11-03 01:39:10 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
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,
|
|
|
|
on_timer = node_timer4,
|
|
|
|
after_dig_node = after_dig_node,
|
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
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)
|
2020-02-28 23:27:52 +03:00
|
|
|
return State3:on_receive_message(pos, topic, payload)
|
2019-11-03 01:39:10 +03:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
techage.register_node({"techage:t4_pump", "techage:t4_pump_on"}, {
|
|
|
|
on_recv_message = function(pos, src, topic, payload)
|
2022-09-04 19:05:37 +03:00
|
|
|
if topic == "limit" then -- Set pump limit
|
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
State4:stop(pos, nvm)
|
|
|
|
local val = tonumber(payload) or 0
|
|
|
|
if val and val > 0 then
|
|
|
|
nvm.limit = val
|
|
|
|
nvm.num_items = 0
|
|
|
|
M(pos):set_int("limit", val)
|
|
|
|
else
|
|
|
|
nvm.limit = nil
|
|
|
|
nvm.num_items = nil
|
|
|
|
M(pos):set_string("limit", "")
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
elseif topic == "count" then -- Get number of pumped units
|
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
return nvm.num_items or 0
|
|
|
|
elseif topic == "flowrate" then -- Get total number of pumped units
|
2021-11-28 16:42:18 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
return nvm.flowrate or 0
|
|
|
|
else
|
2023-05-17 20:07:23 +03:00
|
|
|
if topic == "on" then
|
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
handle_pump_limit(pos, nvm)
|
|
|
|
end
|
2021-11-28 16:42:18 +03:00
|
|
|
return State4:on_receive_message(pos, topic, payload)
|
|
|
|
end
|
2019-11-03 01:39:10 +03:00
|
|
|
end,
|
2022-06-05 22:20:43 +03:00
|
|
|
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
2023-01-08 16:00:36 +03:00
|
|
|
if (topic == 69 or topic == 21) and payload then -- Set pump limit
|
2022-09-03 20:22:43 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
State4:stop(pos, nvm)
|
|
|
|
if payload[1] > 0 then
|
|
|
|
nvm.limit = payload[1]
|
|
|
|
nvm.num_items = 0
|
|
|
|
M(pos):set_int("limit", payload[1])
|
|
|
|
else
|
|
|
|
nvm.limit = nil
|
|
|
|
nvm.num_items = nil
|
|
|
|
M(pos):set_string("limit", "")
|
|
|
|
end
|
|
|
|
return 0
|
|
|
|
else
|
2023-05-17 20:07:23 +03:00
|
|
|
if topic == 1 then
|
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
handle_pump_limit(pos, nvm)
|
2022-09-03 20:22:43 +03:00
|
|
|
end
|
|
|
|
return State4:on_beduino_receive_cmnd(pos, topic, payload)
|
|
|
|
end
|
2022-06-05 22:20:43 +03:00
|
|
|
end,
|
|
|
|
on_beduino_request_data = function(pos, src, topic, payload)
|
2022-09-04 19:05:37 +03:00
|
|
|
if topic == 137 then -- Get total number of pumped units
|
2022-06-05 22:20:43 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
return 0, {nvm.flowrate or 0}
|
2022-09-04 19:05:37 +03:00
|
|
|
elseif topic == 151 then -- Get number of pumped units
|
2022-09-03 20:22:43 +03:00
|
|
|
local nvm = techage.get_nvm(pos)
|
|
|
|
return 0, {nvm.num_items or 0}
|
2022-06-05 22:20:43 +03:00
|
|
|
else
|
|
|
|
return State4:on_beduino_request_data(pos, topic, payload)
|
|
|
|
end
|
|
|
|
end,
|
2019-11-03 01:39:10 +03:00
|
|
|
})
|
|
|
|
|
2021-06-09 23:09:59 +03:00
|
|
|
-- Pumps have to provide one output and one input side
|
|
|
|
liquid.register_nodes({
|
2019-11-03 01:39:10 +03:00
|
|
|
"techage:t3_pump", "techage:t3_pump_on",
|
|
|
|
"techage:t4_pump", "techage:t4_pump_on",
|
2021-06-09 23:09:59 +03:00
|
|
|
}, Pipe, "pump", {"L", "R"}, {})
|
|
|
|
|
2019-11-03 23:21:03 +03:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "techage:t3_pump 2",
|
|
|
|
recipe = {
|
|
|
|
{"group:wood", "techage:iron_ingot", "group:wood"},
|
|
|
|
{"techage:ta3_pipeS", "techage:usmium_nuggets", "techage:ta3_pipeS"},
|
|
|
|
{"group:wood", "techage:iron_ingot", "group:wood"},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "techage:t4_pump",
|
|
|
|
recipe = {
|
|
|
|
{"default:tin_ingot", "dye:blue", "default:steel_ingot"},
|
|
|
|
{"", "techage:t3_pump", ""},
|
|
|
|
{"", "", ""},
|
|
|
|
},
|
2022-01-04 21:40:27 +03:00
|
|
|
})
|