Add Flow Limiter mode to TA4 pump
This commit is contained in:
parent
3426712006
commit
15a4765b6f
@ -89,6 +89,10 @@ Available worlds will be converted to 'lsqlite3', but there is no way back, so:
|
||||
|
||||
### History
|
||||
|
||||
**2022-09-03 V1.09**
|
||||
- Change the way items are pushed
|
||||
- Add "Flow Limiter" mode to TA4 pump and TA4 pusher
|
||||
|
||||
**2022-06-06 V1.08**
|
||||
- Native support for the mod Beduino added
|
||||
|
||||
|
@ -1,195 +0,0 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2022 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA3/TA4 Item Flow Limiter
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
-- Consumer Related Data
|
||||
local CRD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).consumer end
|
||||
local Tube = techage.Tube
|
||||
|
||||
local STANDBY_TICKS = 8
|
||||
local CYCLE_TIME = 8
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
return "size[6,3]" ..
|
||||
"box[0,-0.1;5.8,0.5;#c6e8ff]" ..
|
||||
"label[0.2,-0.1;" .. minetest.colorize("#000000", S("Item Flow Limiter")) .. "]" ..
|
||||
"field[0.3,1.2;3.3,1;number;" .. S("Number of items") .. ";" .. (nvm.limit or 0) .. "]" ..
|
||||
"button[3.5,0.9;2.5,1;store;" .. S("Store") .. "]" ..
|
||||
"image_button[2.5,2;1,1;".. self:get_state_button_image(nvm) .. ";state_button;]" ..
|
||||
"tooltip[2.5,2;1,1;" .. self:get_state_tooltip(nvm) .. "]"
|
||||
end
|
||||
|
||||
local function keep_running(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
CRD(pos).State:is_active(nvm)
|
||||
end
|
||||
|
||||
local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
||||
if fields.number and fields.store then
|
||||
nvm.limit = tonumber(fields.number) or 0
|
||||
nvm.num_items = 0
|
||||
CRD(pos).State:stop(pos, nvm)
|
||||
end
|
||||
CRD(pos).State:state_button_event(pos, nvm, fields)
|
||||
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
|
||||
end
|
||||
|
||||
local function can_start(pos, nvm, state)
|
||||
nvm.num_items = 0
|
||||
return true
|
||||
end
|
||||
|
||||
local tiles = {}
|
||||
-- '#' will be replaced by the stage number
|
||||
-- '{power}' will be replaced by the power PNG
|
||||
tiles.pas = {
|
||||
"techage_filling_ta#.png^techage_frame_ta#_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta#.png^techage_frame_ta#_bottom.png^techage_appl_arrow.png",
|
||||
"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_appl_flow_limiter.png^techage_frame_ta#.png",
|
||||
"techage_filling_ta#.png^techage_appl_flow_limiter.png^techage_frame_ta#.png",
|
||||
}
|
||||
|
||||
tiles.act = tiles.pas
|
||||
|
||||
local tubing = {
|
||||
-- push item through until limit is reached
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
print("on_push_item", stack:get_name(), stack:get_count())
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local count = math.min(stack:get_count(), (nvm.limit or 0) - (nvm.num_items or 0))
|
||||
if nvm.techage_state == techage.RUNNING and count > 0 and in_dir == M(pos):get_int("push_dir") then
|
||||
local leftover = techage.safe_push_items(pos, in_dir, ItemStack({name = stack:get_name(), count = count}))
|
||||
|
||||
local num_pushed
|
||||
if not leftover then
|
||||
num_pushed = 0
|
||||
elseif leftover == true then
|
||||
num_pushed = count
|
||||
else
|
||||
num_pushed = count - leftover:get_count()
|
||||
end
|
||||
|
||||
if num_pushed == 0 then
|
||||
return false
|
||||
else
|
||||
nvm.num_items = (nvm.num_items or 0) + num_pushed
|
||||
if nvm.num_items == nvm.limit then
|
||||
CRD(pos).State:stop(pos, nvm)
|
||||
end
|
||||
stack:set_count(stack:get_count() - num_pushed)
|
||||
return stack
|
||||
end
|
||||
end
|
||||
return false
|
||||
end,
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "set" then -- set limit
|
||||
local nvm = techage.get_nvm(pos)
|
||||
CRD(pos).State:stop(pos, nvm)
|
||||
nvm.limit = tonumber(payload) or 0
|
||||
nvm.num_items = 0
|
||||
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
|
||||
return true
|
||||
elseif topic == "count" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return nvm.num_items or 0
|
||||
else
|
||||
return CRD(pos).State:on_receive_message(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
||||
if topic == 68 and payload then -- set limit
|
||||
local nvm = techage.get_nvm(pos)
|
||||
CRD(pos).State:stop(pos, nvm)
|
||||
nvm.limit = payload[1] or 0
|
||||
nvm.num_items = 0
|
||||
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
|
||||
return 0
|
||||
else
|
||||
return CRD(pos).State:on_beduino_receive_cmnd(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
on_beduino_request_data = function(pos, src, topic, payload)
|
||||
if topic == 150 then -- Request count
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return 0, {nvm.num_items or 0}
|
||||
else
|
||||
return CRD(pos).State:on_beduino_request_data(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("item_flow_limiter", S("Item Flow Limiter"), tiles, {
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
formspec = formspec,
|
||||
tubing = tubing,
|
||||
can_start = can_start,
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = M(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
meta:set_int("pull_dir", techage.side_to_outdir("L", node.param2))
|
||||
meta:set_int("push_dir", techage.side_to_outdir("R", node.param2))
|
||||
local nvm = techage.get_nvm(pos)
|
||||
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
|
||||
end,
|
||||
ta_rotate_node = function(pos, node, new_param2)
|
||||
Tube:after_dig_node(pos)
|
||||
minetest.swap_node(pos, {name = node.name, param2 = new_param2})
|
||||
Tube:after_place_node(pos)
|
||||
local meta = M(pos)
|
||||
meta:set_int("pull_dir", techage.side_to_outdir("L", new_param2))
|
||||
meta:set_int("push_dir", techage.side_to_outdir("R", new_param2))
|
||||
end,
|
||||
on_receive_fields = on_receive_fields,
|
||||
node_timer = keep_running,
|
||||
on_rotate = screwdriver.disallow,
|
||||
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
num_items = {0,2,6,12},
|
||||
tube_sides = {L=1, R=1},
|
||||
}, {false, false, true, true})
|
||||
|
||||
minetest.register_craft({
|
||||
output = node_name_ta3,
|
||||
recipe = {
|
||||
{"", "techage:iron_ingot", ""},
|
||||
{"techage:baborium_ingot", node_name_ta2, "techage:usmium_nuggets"},
|
||||
{"", "techage:vacuum_tube", ""},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = node_name_ta4,
|
||||
recipe = {
|
||||
{"", "techage:iron_ingot", ""},
|
||||
{"", node_name_ta3, ""},
|
||||
{"", "techage:ta4_wlanchip", ""},
|
||||
},
|
||||
})
|
@ -18,7 +18,7 @@ local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local DESCRIPTION = S("TA4 8x2000 Chest")
|
||||
local STACK_SIZE = 200
|
||||
local STACK_SIZE = 2000
|
||||
|
||||
local function gen_stack(inv, idx)
|
||||
inv[idx] = {name = "", count = 0}
|
||||
|
@ -525,9 +525,9 @@ end
|
||||
|
||||
-- Put the given stack into the given ItemList/inventory.
|
||||
-- Function returns:
|
||||
-- - true, if all items are moved
|
||||
-- - false, if no item is moved
|
||||
-- - leftover, if less than all items are moved
|
||||
-- - true, if all items are moved
|
||||
-- - false, if no item is moved
|
||||
-- - leftover, if less than all items are moved
|
||||
-- (true/false is the legacy mode and can't be removed)
|
||||
function techage.put_items(inv, listname, item, idx)
|
||||
local leftover
|
||||
@ -540,7 +540,7 @@ function techage.put_items(inv, listname, item, idx)
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
local cnt = leftover:get_count()
|
||||
if cnt == item:get_count() then
|
||||
return false
|
||||
@ -549,7 +549,7 @@ function techage.put_items(inv, listname, item, idx)
|
||||
else
|
||||
return leftover
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- Return "full", "loaded", or "empty" depending
|
||||
|
@ -677,11 +677,11 @@ local function move_nodes2(pos, meta, lpos1, line, max_speed, height)
|
||||
|
||||
local lpos2 = {}
|
||||
for idx = 1, #lpos1 do
|
||||
|
||||
|
||||
local pos1 = lpos1[idx]
|
||||
local pos2 = vector.add(lpos1[idx], line)
|
||||
lpos2[idx] = pos2
|
||||
|
||||
|
||||
if not minetest.is_protected(pos1, owner) and not minetest.is_protected(pos2, owner) then
|
||||
if is_simple_node(pos1) and is_valid_dest(pos2) then
|
||||
move_node(pos, idx, pos1, {line}, max_speed, height, false, false)
|
||||
@ -701,7 +701,7 @@ local function move_nodes2(pos, meta, lpos1, line, max_speed, height)
|
||||
return false, lpos1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
meta:set_string("status", "")
|
||||
return true, lpos2
|
||||
end
|
||||
@ -795,14 +795,14 @@ end
|
||||
function flylib.exchange_node(pos, name, param2)
|
||||
local meta = M(pos)
|
||||
local move_block
|
||||
|
||||
|
||||
-- consider stored "objects"
|
||||
if meta:contains("ta_move_block") then
|
||||
move_block = meta:get_string("ta_move_block")
|
||||
end
|
||||
|
||||
|
||||
minetest.swap_node(pos, {name = name, param2 = param2})
|
||||
|
||||
|
||||
if move_block then
|
||||
meta:set_string("ta_move_block", move_block)
|
||||
end
|
||||
@ -811,14 +811,14 @@ end
|
||||
function flylib.remove_node(pos)
|
||||
local meta = M(pos)
|
||||
local move_block
|
||||
|
||||
|
||||
-- consider stored "objects"
|
||||
if meta:contains("ta_move_block") then
|
||||
move_block = meta:get_string("ta_move_block")
|
||||
end
|
||||
|
||||
|
||||
minetest.remove_node(pos)
|
||||
|
||||
|
||||
if move_block then
|
||||
local node = minetest.deserialize(move_block)
|
||||
minetest.add_node(pos, node)
|
||||
|
@ -288,7 +288,7 @@ function techage.can_dig_node(name, ndef)
|
||||
if SimpleNodes[name] ~= nil then
|
||||
return SimpleNodes[name]
|
||||
end
|
||||
|
||||
|
||||
if ndef.groups and ndef.groups.techage_door == 1 then
|
||||
SimpleNodes[name] = true
|
||||
return true
|
||||
|
@ -97,8 +97,8 @@ minetest.register_globalstep(function(dtime)
|
||||
SystemTime = SystemTime + dtime
|
||||
local key = pop()
|
||||
if key and NvmStore[key] then
|
||||
-- minetest.log("warning",
|
||||
-- string.format("[TA Storage] SystemTime = %.3f, #JobQueue = %d, in_use = %s",
|
||||
-- minetest.log("warning",
|
||||
-- string.format("[TA Storage] SystemTime = %.3f, #JobQueue = %d, in_use = %s",
|
||||
-- SystemTime, last - first, NvmStore[key].in_use))
|
||||
local t = minetest.get_us_time()
|
||||
if NvmStore[key].in_use then
|
||||
|
@ -72,7 +72,7 @@ end
|
||||
local api = {}
|
||||
|
||||
function api.store_mapblock_data(key, mapblock_data)
|
||||
if use_marshal then
|
||||
if use_marshal then
|
||||
set_block(key, marshal.encode(mapblock_data))
|
||||
else
|
||||
set_block(key, minetest.serialize(mapblock_data))
|
||||
|
@ -229,6 +229,7 @@ techage.manual_DE.aTitel = {
|
||||
"3,TA4 Elektronikfabrik / Electronic Fab",
|
||||
"3,TA4 Injektor / Injector",
|
||||
"3,TA4 Recycler",
|
||||
"3,TA4 Item Durchlaufbegrenzer / Item Flow Limiter",
|
||||
"1,TA5: Zukunft",
|
||||
"2,Energiequellen",
|
||||
"3,TA5 Fusionsreaktor",
|
||||
@ -1892,7 +1893,13 @@ techage.manual_DE.aText = {
|
||||
"\n",
|
||||
"Siehe TA3 Pumpe.\n"..
|
||||
"\n"..
|
||||
"Die TA4 Pumpe pumpt 8 Einheiten Flüssigkeit alle zwei Sekunden. Zusätzlich unterstützt die Pumpe das Kommando 'flowrate'. Damit kann die Gesamtdurchflussmenge durch die Pumpe abgefragt werden.\n"..
|
||||
"Die TA4 Pumpe pumpt 8 Einheiten Flüssigkeit alle zwei Sekunden. \n"..
|
||||
"\n"..
|
||||
"In der Betriebsart \"Durchflussbegrenzer\" kann die Anzahl der Einheiten\\, die von der Pumpe gepumpt werden\\, begrenzt werden. Die Betriebsart Durchflussbegrenzer kann über das Gabelschlüssel-Menü aktiviert werden\\, indem im Menü die Anzahl an Einheiten konfiguriert wird. Sobald die konfigurierte Anzahl an Einheiten gepumpt wurden\\, schaltet sich die Pumpe ab. Wird die Pumpe wieder eingeschaltet\\, pumpt sie wieder die konfigurierte Anzahl an Einheiten und schaltet sich dann ab.\n"..
|
||||
"\n"..
|
||||
"Der Durchflussbegrenzer kann auch per Lua- oder Beduino Controller konfiguriert und gestartet werden.\n"..
|
||||
"\n"..
|
||||
"Zusätzlich unterstützt die Pumpe das Kommando 'flowrate'. Damit kann die Gesamtdurchflussmenge durch die Pumpe abgefragt werden.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
@ -2007,6 +2014,10 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Die Funktion entspricht der von TA3. \n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Maschinen zur Überwindung von Raum und Zeit\\, neue Energiequellen und andere Errungenschaften prägen dein Leben. \n"..
|
||||
"\n"..
|
||||
"Für die Herstellung und Nutzung von TA5 Maschinen und Blöcken sind Erfahrungspunkte (experience points) notwendig. Diese können nur über den Teilchenbeschleuniger aus TA4 erarbeitet werden.\n"..
|
||||
@ -2358,6 +2369,7 @@ techage.manual_DE.aItemName = {
|
||||
"ta4_electronicfab",
|
||||
"ta4_injector",
|
||||
"ta4_recycler",
|
||||
"ta4_item_flow_limiter_pas",
|
||||
"techage_ta5",
|
||||
"",
|
||||
"",
|
||||
@ -2615,6 +2627,7 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta5_fusion_reactor",
|
||||
"",
|
||||
"",
|
||||
|
@ -135,6 +135,7 @@ techage.manual_EN.aTitel = {
|
||||
"3,TA3 Gravel Rinser",
|
||||
"3,TA3 Grinder",
|
||||
"3,TA3 Injector",
|
||||
"3,TA3 Item Flow Limiter",
|
||||
"2,Tools",
|
||||
"3,Techage Info Tool",
|
||||
"3,TechAge Programmer",
|
||||
@ -229,6 +230,7 @@ techage.manual_EN.aTitel = {
|
||||
"3,TA4 Electronic Fab",
|
||||
"3,TA4 Injector",
|
||||
"3,TA4 Recycler",
|
||||
"3,TA4 Item Flow Limiter",
|
||||
"1,TA5: Future",
|
||||
"2,Energy Sources",
|
||||
"3,TA5 Fusion Reactor",
|
||||
@ -1264,6 +1266,16 @@ techage.manual_EN.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"The Flow Limiter limits the number of items that can be pushed through by using a slider. This allows the number of items that are put into an oven\\, for example\\, to be precisely adapted to the recipe.\n"..
|
||||
"\n"..
|
||||
"The Flow Limiter must be configured via the menu and then started. If the configured number of items has been passed\\, the block switches off. The next time the Flow Limiter is switched on\\, it again transmits the configured number of items.\n"..
|
||||
"\n"..
|
||||
"*Note: The Flow Limiter must be placed behind the pusher.*\n"..
|
||||
"\n"..
|
||||
"The Flow Limiter can also be configured and started using a Lua or Beduino controller.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"",
|
||||
"The Techage Info Tool (open-ended wrench) has several functions. It shows the time\\, position\\, temperature and biome when an unknown block is clicked on.\n"..
|
||||
"If you click on a TechAge block with command interface\\, all available data will be shown (see also \"Logic / switching blocks\").\n"..
|
||||
@ -1888,7 +1900,13 @@ techage.manual_EN.aText = {
|
||||
"\n",
|
||||
"See TA3 pump.\n"..
|
||||
"\n"..
|
||||
"The TA4 pump pumps 8 units of liquid every two seconds. The pump also supports the 'flowrate' command. This means that the total flow rate through the pump can be queried. \n"..
|
||||
"The TA4 pump pumps 8 units of liquid every two seconds. \n"..
|
||||
"\n"..
|
||||
"In the \"Flow limiter\" mode\\, the number of units pumped by the pump can be limited. The flow limiter mode can be activated via the open-end wrench menu by configuring the number of units in the menu. Once the configured number of units have been pumped\\, the pump will turn off. When the pump is turned on again\\, it will pump the configured number of units again and then turn off.\n"..
|
||||
"\n"..
|
||||
"The flow limiter can also be configured and started using a Lua or Beduino controller.\n"..
|
||||
"\n"..
|
||||
"The pump also supports the 'flowrate' command. This allows the total flow rate through the pump to be queried.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
@ -2004,6 +2022,10 @@ techage.manual_EN.aText = {
|
||||
"\n"..
|
||||
" \n"..
|
||||
"\n",
|
||||
"The function corresponds to that of TA3.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Machines to overcome space and time\\, new sources of energy and other achievements shape your life.\n"..
|
||||
"\n"..
|
||||
"Experience points are required for the manufacture and use of TA5 machines and blocks. These can only be worked out using the collider from TA4.\n"..
|
||||
@ -2259,6 +2281,7 @@ techage.manual_EN.aItemName = {
|
||||
"ta3_gravelrinser",
|
||||
"ta3_grinder",
|
||||
"ta3_injector",
|
||||
"ta3_item_flow_limiter_pas",
|
||||
"",
|
||||
"ta3_end_wrench",
|
||||
"ta3_programmer",
|
||||
@ -2353,6 +2376,7 @@ techage.manual_EN.aItemName = {
|
||||
"ta4_electronicfab",
|
||||
"ta4_injector",
|
||||
"ta4_recycler",
|
||||
"ta4_item_flow_limiter_pas",
|
||||
"techage_ta5",
|
||||
"",
|
||||
"",
|
||||
@ -2520,6 +2544,7 @@ techage.manual_EN.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta4_windturbine",
|
||||
"",
|
||||
"",
|
||||
@ -2609,6 +2634,7 @@ techage.manual_EN.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta5_fusion_reactor",
|
||||
"",
|
||||
"",
|
||||
|
2
init.lua
2
init.lua
@ -198,7 +198,6 @@ dofile(MP.."/basic_machines/recycler.lua")
|
||||
dofile(MP.."/basic_machines/concentrator.lua")
|
||||
dofile(MP.."/basic_machines/recipeblock.lua")
|
||||
dofile(MP.."/basic_machines/ta5_chest.lua")
|
||||
dofile(MP.."/basic_machines/flow_limiter.lua")
|
||||
|
||||
-- Liquids II
|
||||
dofile(MP.."/liquids/tank.lua")
|
||||
@ -318,6 +317,7 @@ end
|
||||
dofile(MP.."/.test/sink.lua")
|
||||
dofile(MP.."/.test/testblock.lua")
|
||||
dofile(MP.."/.test/minichest.lua")
|
||||
dofile(MP.."/.test/minitank.lua")
|
||||
|
||||
-- Solar
|
||||
dofile(MP.."/solar/minicell.lua")
|
||||
|
@ -67,4 +67,4 @@ techage.register_mobs_mods("mobf_trader")
|
||||
techage.register_mobs_mods("ts_vehicles_cars")
|
||||
|
||||
-- Used as e.g. crane cable
|
||||
techage.register_simple_nodes({"techage:power_lineS"}, true)
|
||||
techage.register_simple_nodes({"techage:power_lineS"}, true)
|
||||
|
@ -25,12 +25,21 @@ local COUNTDOWN_TICKS = 4
|
||||
local CYCLE_TIME = 2
|
||||
local CAPA = 4
|
||||
|
||||
local WRENCH_MENU = {{
|
||||
type = "output",
|
||||
name = "flowrate",
|
||||
label = S("Total flow rate"),
|
||||
tooltip = S("Total flow rate in liquid units"),
|
||||
}}
|
||||
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",
|
||||
},
|
||||
}
|
||||
|
||||
local State3 = techage.NodeStates:new({
|
||||
node_name_passive = "techage:t3_pump",
|
||||
@ -48,11 +57,8 @@ local State4 = techage.NodeStates:new({
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
})
|
||||
|
||||
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")
|
||||
local taken, name = liquid.take(pos, Pipe, Flip[outdir], nil, capa, mem.dbg_cycles > 0)
|
||||
local function pump(pos, mem, nvm, state, outdir, units)
|
||||
local taken, name = liquid.take(pos, Pipe, Flip[outdir], nil, units, mem.dbg_cycles > 0)
|
||||
if taken > 0 then
|
||||
local leftover = liquid.put(pos, Pipe, outdir, name, taken, mem.dbg_cycles > 0)
|
||||
if leftover and leftover > 0 then
|
||||
@ -66,13 +72,39 @@ local function pumping(pos, nvm, state, capa)
|
||||
state:blocked(pos, nvm)
|
||||
return 0
|
||||
end
|
||||
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
return taken - leftover
|
||||
end
|
||||
state:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
return taken
|
||||
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")
|
||||
|
||||
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
|
||||
end
|
||||
state:idle(pos, nvm)
|
||||
return 0
|
||||
end
|
||||
|
||||
@ -119,6 +151,14 @@ local function on_rightclick(pos, node, clicker)
|
||||
elseif node.name == "techage:t4_pump" then
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.dbg_cycles = 5
|
||||
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
|
||||
State4:start(pos, nvm)
|
||||
elseif node.name == "techage:t4_pump_on" then
|
||||
State4:stop(pos, nvm)
|
||||
@ -285,12 +325,34 @@ techage.register_node({"techage:t4_pump", "techage:t4_pump_on"}, {
|
||||
end
|
||||
end,
|
||||
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
||||
return State4:on_beduino_receive_cmnd(pos, topic, payload)
|
||||
if topic == 69 and payload then -- set limit
|
||||
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
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if nvm.limit then
|
||||
nvm.num_items = 0
|
||||
end
|
||||
return State4:on_beduino_receive_cmnd(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
on_beduino_request_data = function(pos, src, topic, payload)
|
||||
if topic == 137 then -- Total Flow Rate
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return 0, {nvm.flowrate or 0}
|
||||
elseif topic == 151 then -- Request count
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return 0, {nvm.num_items or 0}
|
||||
else
|
||||
return State4:on_beduino_request_data(pos, topic, payload)
|
||||
end
|
||||
|
@ -460,7 +460,6 @@ Error: Invalid path !!=Fehler: Ungültiger Pfad !!
|
||||
|
||||
Error: Recording is missing !!=Fehler: Aufzeichnung fehlt !!
|
||||
Flight route (A to B)=Flug Route (A nach B)
|
||||
Move=Bewege
|
||||
See chat output=Siehe chat Ausgabe
|
||||
TA5 Fly Controller=TA5 Flug Controller
|
||||
Test=Test
|
||||
@ -480,6 +479,7 @@ Store=Speichern
|
||||
Click on all blocks that shall be moved=Klicke auf alle Blöcke, die verschoben werden sollen
|
||||
Maximum Speed=Maximalgeschwindigkeit
|
||||
Maximum speed for moving blocks=Maximale Geschwindigkeit für bewegliche Blöcke
|
||||
Move=Bewege
|
||||
Move A-B=Bewege A-B
|
||||
Move B-A=Bewege B-A
|
||||
Move block height=Move Block Höhe
|
||||
@ -495,7 +495,6 @@ TA2 Flywheel=TA2 Schwungrad
|
||||
|
||||
Area already loaded or max. number of Forceload Blocks reached!=Bereich bereits geladen oder maximale Anzahl von Forceload Blöcken erreicht!
|
||||
List of your Forceload Blocks:=Liste der Forceload Blöcke
|
||||
Priv missing=Rechte fehlen
|
||||
Punch the block to make the area visible.=Schlage auf den Bock um den Bereich anzuzeigen.
|
||||
Show all forceload blocks in a 64x64x64 range=Zeige alle Forceload Blöcke im Umkreis von 64x64x64 Blöcken
|
||||
Techage Forceload Block=Techage Forceload Block
|
||||
@ -870,15 +869,27 @@ TA1 Pine Wood Board=TA1 Kiefernholzbrett
|
||||
|
||||
TA4 Streetlamp Solar Cell=TA4 Straßenlampen-Solarzelle
|
||||
|
||||
### minichest.lua ###
|
||||
|
||||
Test Chest=
|
||||
|
||||
### minitank.lua ###
|
||||
|
||||
Test Mini Tank=
|
||||
|
||||
### movecontroller.lua ###
|
||||
|
||||
Error: Invalid distance !!=Fehler: Ungültige Entfernung !!
|
||||
Handover to A=Übergabe an A
|
||||
Handover to B=Übergabe an B
|
||||
Move distance=Entfernung
|
||||
Move distance (A to B)=Entfernung (A nach B)
|
||||
Number of the next movecontroller=Nummer des nächsten Move Controllers
|
||||
Number of the previous movecontroller=Nummer des vorhergehenden Move Controllers
|
||||
Object offset=Objekt Offset
|
||||
Operational mode=Betriebsmodus
|
||||
Reset=Rücksetzen
|
||||
Switch to the remote controlled 'move xyz' mode=Wechseln in den ferngesteuerten 'move xyz'-Modus
|
||||
TA4 Move Controller=TA4 Move Controller
|
||||
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=Y-Offset für Nicht-Spieler Objekte wie Fahrzeuge (-0.5 bis 0.5)
|
||||
|
||||
@ -1010,6 +1021,8 @@ Allow to dig/place Techage power lines nearby power poles=Erlaubt TODO
|
||||
|
||||
### pump.lua ###
|
||||
|
||||
Number of liquid units that are allowed to be pumped=Anzahl der Flüssigkeitseinheiten, die gepumpt werden dürfen
|
||||
Number of units=Anzahl der Einheiten
|
||||
TA3 Pump=TA3 Pumpe
|
||||
TA4 Pump=TA4 Pumpe
|
||||
|
||||
@ -1120,6 +1133,7 @@ stopped=gestoppt
|
||||
### sequencer2.lua ###
|
||||
|
||||
- 'goto <num>' (jump to another line)@n= - 'goto <num>' (springe zu einer anderen Zeile)@n
|
||||
- 'nop' (do nothing)@n= - 'nop' (mache nichts)@n
|
||||
- 'send <node num> <cmnd>' (techage command)@n= - 'send <node num> <cmnd>' (techage Kommando)@n
|
||||
- 'stop' (stop the execution)@n= - 'stop' (stoppe die Ausführung)@n
|
||||
- 1 corresponds to 100 ms@n= - 1 entspricht 100 ms@n
|
||||
|
@ -460,7 +460,6 @@ Error: Invalid path !!=
|
||||
|
||||
Error: Recording is missing !!=
|
||||
Flight route (A to B)=
|
||||
Move=
|
||||
See chat output=
|
||||
TA5 Fly Controller=
|
||||
Test=
|
||||
@ -480,6 +479,7 @@ Store=
|
||||
Click on all blocks that shall be moved=
|
||||
Maximum Speed=
|
||||
Maximum speed for moving blocks=
|
||||
Move=
|
||||
Move A-B=
|
||||
Move B-A=
|
||||
Move block height=
|
||||
@ -495,7 +495,6 @@ TA2 Flywheel=
|
||||
|
||||
Area already loaded or max. number of Forceload Blocks reached!=
|
||||
List of your Forceload Blocks:=
|
||||
Priv missing=
|
||||
Punch the block to make the area visible.=
|
||||
Show all forceload blocks in a 64x64x64 range=
|
||||
Techage Forceload Block=
|
||||
@ -870,15 +869,27 @@ TA1 Pine Wood Board=
|
||||
|
||||
TA4 Streetlamp Solar Cell=
|
||||
|
||||
### minichest.lua ###
|
||||
|
||||
Test Chest=
|
||||
|
||||
### minitank.lua ###
|
||||
|
||||
Test Mini Tank=
|
||||
|
||||
### movecontroller.lua ###
|
||||
|
||||
Error: Invalid distance !!=
|
||||
Handover to A=
|
||||
Handover to B=
|
||||
Move distance=
|
||||
Move distance (A to B)=
|
||||
Number of the next movecontroller=
|
||||
Number of the previous movecontroller=
|
||||
Object offset=
|
||||
Operational mode=
|
||||
Reset=
|
||||
Switch to the remote controlled 'move xyz' mode=
|
||||
TA4 Move Controller=
|
||||
Y-offset for non-player objects like vehicles (-0.5 to 0.5)=
|
||||
|
||||
@ -1010,6 +1021,8 @@ Allow to dig/place Techage power lines nearby power poles=
|
||||
|
||||
### pump.lua ###
|
||||
|
||||
Number of liquid units that are allowed to be pumped=
|
||||
Number of units=
|
||||
TA3 Pump=
|
||||
TA4 Pump=
|
||||
|
||||
@ -1120,6 +1133,7 @@ stopped=
|
||||
### sequencer2.lua ###
|
||||
|
||||
- 'goto <num>' (jump to another line)@n=
|
||||
- 'nop' (do nothing)@n=
|
||||
- 'send <node num> <cmnd>' (techage command)@n=
|
||||
- 'stop' (stop the execution)@n=
|
||||
- 1 corresponds to 100 ms@n=
|
||||
|
@ -826,6 +826,18 @@ The processing power is up to 8 times one item every 4 seconds.
|
||||
[ta3_injector|image]
|
||||
|
||||
|
||||
### TA3 Item Flow Limiter
|
||||
|
||||
The Flow Limiter limits the number of items that can be pushed through by using a slider. This allows the number of items that are put into an oven, for example, to be precisely adapted to the recipe.
|
||||
|
||||
The Flow Limiter must be configured via the menu and then started. If the configured number of items has been passed, the block switches off. The next time the Flow Limiter is switched on, it again transmits the configured number of items.
|
||||
|
||||
**Note: The Flow Limiter must be placed behind the pusher.**
|
||||
|
||||
The Flow Limiter can also be configured and started using a Lua or Beduino controller.
|
||||
|
||||
[ta3_item_flow_limiter_pas|image]
|
||||
|
||||
|
||||
|
||||
## Tools
|
||||
|
@ -804,7 +804,13 @@ In einen TA4 Tank passen 2000 Einheiten oder 200 Fässer einer Flüssigkeit.
|
||||
|
||||
Siehe TA3 Pumpe.
|
||||
|
||||
Die TA4 Pumpe pumpt 8 Einheiten Flüssigkeit alle zwei Sekunden. Zusätzlich unterstützt die Pumpe das Kommando `flowrate`. Damit kann die Gesamtdurchflussmenge durch die Pumpe abgefragt werden.
|
||||
Die TA4 Pumpe pumpt 8 Einheiten Flüssigkeit alle zwei Sekunden.
|
||||
|
||||
In der Betriebsart "Durchflussbegrenzer" kann die Anzahl der Einheiten, die von der Pumpe gepumpt werden, begrenzt werden. Die Betriebsart Durchflussbegrenzer kann über das Gabelschlüssel-Menü aktiviert werden, indem im Menü die Anzahl an Einheiten konfiguriert wird. Sobald die konfigurierte Anzahl an Einheiten gepumpt wurden, schaltet sich die Pumpe ab. Wird die Pumpe wieder eingeschaltet, pumpt sie wieder die konfigurierte Anzahl an Einheiten und schaltet sich dann ab.
|
||||
|
||||
Der Durchflussbegrenzer kann auch per Lua- oder Beduino Controller konfiguriert und gestartet werden.
|
||||
|
||||
Zusätzlich unterstützt die Pumpe das Kommando `flowrate`. Damit kann die Gesamtdurchflussmenge durch die Pumpe abgefragt werden.
|
||||
|
||||
[ta4_pump|image]
|
||||
|
||||
@ -957,3 +963,8 @@ Die Verarbeitungsleistung beträgt ein Item alle 8 s. Der Block benötigt hierf
|
||||
|
||||
[ta4_recycler|image]
|
||||
|
||||
### TA4 Item Durchlaufbegrenzer / Item Flow Limiter
|
||||
|
||||
Die Funktion entspricht der von TA3.
|
||||
|
||||
[ta4_item_flow_limiter_pas|image]
|
@ -796,7 +796,13 @@ A TA4 tank can hold 2000 units or 200 barrels of liquid.
|
||||
|
||||
See TA3 pump.
|
||||
|
||||
The TA4 pump pumps 8 units of liquid every two seconds. The pump also supports the `flowrate` command. This means that the total flow rate through the pump can be queried.
|
||||
The TA4 pump pumps 8 units of liquid every two seconds.
|
||||
|
||||
In the "Flow limiter" mode, the number of units pumped by the pump can be limited. The flow limiter mode can be activated via the open-end wrench menu by configuring the number of units in the menu. Once the configured number of units have been pumped, the pump will turn off. When the pump is turned on again, it will pump the configured number of units again and then turn off.
|
||||
|
||||
The flow limiter can also be configured and started using a Lua or Beduino controller.
|
||||
|
||||
The pump also supports the `flowrate` command. This allows the total flow rate through the pump to be queried.
|
||||
|
||||
[ta4_pump|image]
|
||||
|
||||
@ -949,3 +955,10 @@ The machine can disassemble pretty much any Techage and Hyperloop blocks. But no
|
||||
The processing power is one item every 8 s. The block requires 16 ku of electricity for this.
|
||||
|
||||
[ta4_recycler|image]
|
||||
|
||||
### TA4 Item Flow Limiter
|
||||
|
||||
The function corresponds to that of TA3.
|
||||
|
||||
[ta4_item_flow_limiter_pas|image]
|
||||
|
||||
|
@ -228,6 +228,7 @@
|
||||
- [TA4 Elektronikfabrik / Electronic Fab](./manual_ta4_DE.md#ta4-elektronikfabrik--electronic-fab)
|
||||
- [TA4 Injektor / Injector](./manual_ta4_DE.md#ta4-injektor--injector)
|
||||
- [TA4 Recycler](./manual_ta4_DE.md#ta4-recycler)
|
||||
- [TA4 Item Durchlaufbegrenzer / Item Flow Limiter](./manual_ta4_DE.md#ta4-item-durchlaufbegrenzer--item-flow-limiter)
|
||||
- [TA5: Zukunft](./manual_ta5_DE.md#ta5:-zukunft)
|
||||
- [Energiequellen](./manual_ta5_DE.md#energiequellen)
|
||||
- [TA5 Fusionsreaktor](./manual_ta5_DE.md#ta5-fusionsreaktor)
|
||||
|
@ -134,6 +134,7 @@
|
||||
- [TA3 Gravel Rinser](./manual_ta3_EN.md#ta3-gravel-rinser)
|
||||
- [TA3 Grinder](./manual_ta3_EN.md#ta3-grinder)
|
||||
- [TA3 Injector](./manual_ta3_EN.md#ta3-injector)
|
||||
- [TA3 Item Flow Limiter](./manual_ta3_EN.md#ta3-item-flow-limiter)
|
||||
- [Tools](./manual_ta3_EN.md#tools)
|
||||
- [Techage Info Tool](./manual_ta3_EN.md#techage-info-tool)
|
||||
- [TechAge Programmer](./manual_ta3_EN.md#techage-programmer)
|
||||
@ -228,6 +229,7 @@
|
||||
- [TA4 Electronic Fab](./manual_ta4_EN.md#ta4-electronic-fab)
|
||||
- [TA4 Injector](./manual_ta4_EN.md#ta4-injector)
|
||||
- [TA4 Recycler](./manual_ta4_EN.md#ta4-recycler)
|
||||
- [TA4 Item Flow Limiter](./manual_ta4_EN.md#ta4-item-flow-limiter)
|
||||
- [TA5: Future](./manual_ta5_EN.md#ta5:-future)
|
||||
- [Energy Sources](./manual_ta5_EN.md#energy-sources)
|
||||
- [TA5 Fusion Reactor](./manual_ta5_EN.md#ta5-fusion-reactor)
|
||||
|
@ -20,7 +20,7 @@ local Cable = techage.ElectricCable
|
||||
local power = networks.power
|
||||
|
||||
local function can_dig(pos, digger)
|
||||
if digger and digger:is_player() then
|
||||
if digger and digger:is_player() then
|
||||
if M(pos):get_string("owner") == digger:get_player_name() then
|
||||
return true
|
||||
end
|
||||
|
@ -57,7 +57,7 @@ end
|
||||
local function add_chest_entity(pos, nvm)
|
||||
local mem = techage.get_mem(pos)
|
||||
local length
|
||||
|
||||
|
||||
if not nvm.capa or nvm.capa == 0 then
|
||||
length = (nvm.length or MAX_ROPE_LEN) * (1 - (nvm.load or 0))
|
||||
else
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 286 B |
Loading…
Reference in New Issue
Block a user