diff --git a/README.md b/README.md index 11d58b6..7f13406 100644 --- a/README.md +++ b/README.md @@ -86,4 +86,7 @@ to 'lsqlite3' and 'lua-marshal', but there is no way back, so: - 2020-04-24 V0.06 * TA4 injector added - 2020-04-26 V0.07 * English translation added - 2020-05-22 V0.08 * Support for 'lua-marshal' and 'lsqlite3' added +- 2020-05-31 V0.09 * TA4 tubes upgraded, manuals updated + + diff --git a/basic_machines/consumer.lua b/basic_machines/consumer.lua index 13b92ed..0cc5239 100644 --- a/basic_machines/consumer.lua +++ b/basic_machines/consumer.lua @@ -202,6 +202,9 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState end local tubelib2_on_update2 = function(pos, outdir, tlib2, node) + if tNode.tubelib2_on_update2 then + tNode.tubelib2_on_update2(pos, outdir, tlib2, node) + end if tlib2.tube_type == "pipe2" then liquid.update_network(pos, outdir, tlib2) else diff --git a/basic_machines/distributor.lua b/basic_machines/distributor.lua index e822487..8e017db 100644 --- a/basic_machines/distributor.lua +++ b/basic_machines/distributor.lua @@ -17,6 +17,7 @@ local M = minetest.get_meta local N = minetest.get_node -- 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 S = techage.S @@ -184,6 +185,23 @@ local function allow_metadata_inventory_move(pos, from_list, from_index, to_list end end +local function tubelib2_on_update2(pos, outdir, tlib2, node) + local is_ta4_tube = true + for dir = 1,4 do + for i, pos, node in Tube:get_tube_line(pos, dir) do + is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name] + end + end + + local nvm = techage.get_nvm(pos) + local crd = CRD(pos) + if CRD(pos).stage == 4 and not is_ta4_tube then + nvm.num_items = crd.num_items / 2 + else + nvm.num_items = crd.num_items + end +end + local function push_item(pos, filter, item_name, num_items, nvm) local idx = 1 local num_pushed = 0 @@ -222,7 +240,7 @@ local function distributing(pos, inv, crd, nvm) local stack = inv:get_stack("src", idx) local item_name = stack:get_name() local num_items = stack:get_count() - local num_to_push = math.min(crd.num_items - sum_num_pushed, num_items) + local num_to_push = math.min((nvm.num_items or crd.num_items) - sum_num_pushed, num_items) num_pushed = 0 if item_filter[item_name] then @@ -240,7 +258,7 @@ local function distributing(pos, inv, crd, nvm) sum_num_pushed = sum_num_pushed + num_pushed stack:take_item(num_pushed) inv:set_stack("src", idx, stack) - if sum_num_pushed >= crd.num_items then + if sum_num_pushed >= (nvm.num_items or crd.num_items) then nvm.last_index = idx break end @@ -408,6 +426,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 = allow_metadata_inventory_put = allow_metadata_inventory_put, allow_metadata_inventory_move = allow_metadata_inventory_move, allow_metadata_inventory_take = allow_metadata_inventory_take, + tubelib2_on_update2 = tubelib2_on_update2, on_metadata_inventory_move = function(pos, from_list, from_index, to_list) if from_list ~= "src" or to_list ~= "src" then diff --git a/basic_machines/pusher.lua b/basic_machines/pusher.lua index fc68f4f..5fdf4b7 100644 --- a/basic_machines/pusher.lua +++ b/basic_machines/pusher.lua @@ -28,11 +28,12 @@ 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 = 2 local COUNTDOWN_TICKS = 4 local CYCLE_TIME = 2 - + local function ta4_formspec(self, pos, nvm) if CRD(pos).stage == 4 then -- TA4 node? return "size[8,7.2]".. @@ -89,7 +90,8 @@ end local function pushing(pos, crd, meta, nvm) local pull_dir = meta:get_int("pull_dir") local push_dir = meta:get_int("push_dir") - local items = techage.pull_items(pos, pull_dir, nvm.item_count or crd.num_items, nvm.item_name) + local num = nvm.item_count or nvm.num_items or crd.num_items + local items = techage.pull_items(pos, pull_dir, num, nvm.item_name) if items ~= nil then if techage.push_items(pos, push_dir, items) ~= true then -- place item back @@ -142,6 +144,27 @@ local function on_receive_fields(pos, formname, fields, player) end end +local function tubelib2_on_update2(pos, outdir, tlib2, node) + local pull_dir = M(pos):get_int("pull_dir") + local push_dir = M(pos):get_int("push_dir") + local is_ta4_tube = true + + for i, pos, node in Tube:get_tube_line(pos, pull_dir) do + is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name] + end + for i, pos, node in Tube:get_tube_line(pos, push_dir) do + is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name] + end + + local nvm = techage.get_nvm(pos) + local crd = CRD(pos) + if CRD(pos).stage == 4 and not is_ta4_tube then + nvm.num_items = crd.num_items / 2 + else + nvm.num_items = crd.num_items + end +end + local function can_start(pos, nvm, state) if CRD(pos).stage == 4 then -- TA4 node? local inv = M(pos):get_inventory() @@ -261,6 +284,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 = on_receive_fields = on_receive_fields, node_timer = keep_running, on_rotate = screwdriver.disallow, + tubelib2_on_update2 = tubelib2_on_update2, groups = {choppy=2, cracky=2, crumbly=2}, is_ground_content = false, diff --git a/basis/node_store.lua b/basis/node_store.lua index e4330bf..9877feb 100644 --- a/basis/node_store.lua +++ b/basis/node_store.lua @@ -107,7 +107,7 @@ minetest.register_globalstep(function(dtime) NvmStore[key] = nil -- remove unused data from cache end t = minetest.get_us_time() - t - if t > 10000 then + if t > 20000 then minetest.log("warning", "[TA Storage] duration = "..(t/1000.0).." ms") end end diff --git a/basis/tubes_ta4.lua b/basis/tubes_ta4.lua index 0d96b49..14bb6f0 100644 --- a/basis/tubes_ta4.lua +++ b/basis/tubes_ta4.lua @@ -110,3 +110,8 @@ minetest.register_craft({ {"basic_materials:plastic_sheet", "", "techage:aluminum"}, }, }) + +techage.TA4tubes = { + ["techage:ta4_tubeS"] = true, + ["techage:ta4_tubeA"] = true, +} diff --git a/doc/manual_DE.lua b/doc/manual_DE.lua index a91f372..77af185 100644 --- a/doc/manual_DE.lua +++ b/doc/manual_DE.lua @@ -1378,12 +1378,13 @@ techage.manual_DE.aText = { "\n".. "\n".. "\n", - "TA4 hat auch seine eigenen Röhren im TA4 Design. Diese entsprechen den Standard Röhren\\, sehen nur besser aus. \\;-)\n".. + "TA4 hat auch seine eigenen Röhren im TA4 Design. Diese können wie Standard Röhren eingesetzt werden.\n".. + "Aber: TA4 Schieber und TA4 Verteiler erreichen ihre volle Leistungsfähigkeit nur beim Einsatz mit TA4 Röhren.\n".. "\n".. "\n".. "\n", "Die Funktion entspricht grundsätzlich der von TA2/TA3. Zusätzlich kann aber über ein Menü konfiguriert werden\\, welche Gegenstände aus einer TA4 Kiste geholt und weiter transportiert werden sollen.\n".. - "Die Verarbeitungsleistung beträgt 12 Items alle 2 s.\n".. + "Die Verarbeitungsleistung beträgt 12 Items alle 2 s\\, sofern auf beiden Seiten TA4 Röhren verwendet werden. Anderenfalls sind es nur 6 Items alle 2 s.\n".. "\n".. "Der TA4 Schieber besitzt zwei zusätzliche Kommandos für den Lua Controller:\n".. "\n".. @@ -1424,7 +1425,7 @@ techage.manual_DE.aText = { "\n".. "\n", "Die Funktion entspricht der von TA2.\n".. - "Die Verarbeitungsleistung beträgt 24 Items alle 4 s.\n".. + "Die Verarbeitungsleistung beträgt 24 Items alle 4 s\\, sofern auf allen Seiten TA4 Röhren verwendet werden. Anderenfalls sind es nur 12 Items alle 4 s.\n".. "\n".. "\n".. "\n", diff --git a/doc/manual_EN.lua b/doc/manual_EN.lua index 6083fc4..0b694b8 100644 --- a/doc/manual_EN.lua +++ b/doc/manual_EN.lua @@ -1368,12 +1368,13 @@ techage.manual_EN.aText = { "\n".. "\n".. "\n", - "TA4 also has its own tubes in the TA4 design. These correspond to the standard tubes\\, only look better. \\;-)\n".. + "TA4 also has its own tubes in the TA4 design. These can be used like standard tubes.\n".. + "But: TA4 pushers and TA4 distributors only achieve their full performance when used with TA4 tubes.\n".. "\n".. "\n".. "\n", "The function basically corresponds to that of TA2 / TA3. In addition\\, a menu can be used to configure which objects should be taken from a TA4 chest and transported further.\n".. - "The processing power is 12 items every 2 s.\n".. + "The processing power is 12 items every 2 s\\, if TA4 tubes are used on both sides. Otherwise there are only 6 items every 2 s.\n".. "\n".. "The TA4 pusher has two additional commands for the Lua controller:\n".. "\n".. @@ -1414,7 +1415,7 @@ techage.manual_EN.aText = { "\n".. "\n", "The function corresponds to that of TA2.\n".. - "The processing power is 24 items every 4 s.\n".. + "The processing power is 24 items every 4 s\\, provided TA4 tubes are used on all sides. Otherwise there are only 12 items every 4 s.\n".. "\n".. "\n".. "\n", diff --git a/init.lua b/init.lua index a85c4a0..31ae6ab 100644 --- a/init.lua +++ b/init.lua @@ -24,8 +24,8 @@ elseif minetest.global_exists("ironage") then elseif minetest.global_exists("techpack") then minetest.log("error", "[techage] Techage can't be used together with the modpack techpack!") return -elseif minetest.global_exists("tubelib2") and tubelib2.version < 1.8 then - minetest.log("error", "[techage] Techage requires tubelib2 version 1.8 or newer!") +elseif minetest.global_exists("tubelib2") and tubelib2.version < 1.9 then + minetest.log("error", "[techage] Techage requires tubelib2 version 1.9 or newer!") return elseif minetest.global_exists("minecart") and minecart.version < 1.05 then minetest.log("error", "[techage] Techage requires minecart version 1.05 or newer!") diff --git a/manuals/manual_ta4_DE.md b/manuals/manual_ta4_DE.md index 2a04a31..b08d5bc 100644 --- a/manuals/manual_ta4_DE.md +++ b/manuals/manual_ta4_DE.md @@ -490,14 +490,15 @@ Mit der Wasserpumpe kann Wasser über Flüssigkeitsleitungen in Tanks gepumpt un ### TA4 Röhren / TA4 Tube -TA4 hat auch seine eigenen Röhren im TA4 Design. Diese entsprechen den Standard Röhren, sehen nur besser aus. ;-) +TA4 hat auch seine eigenen Röhren im TA4 Design. Diese können wie Standard Röhren eingesetzt werden. +Aber: TA4 Schieber und TA4 Verteiler erreichen ihre volle Leistungsfähigkeit nur beim Einsatz mit TA4 Röhren. [ta4_tube|image] ### TA4 Schieber / Pusher Die Funktion entspricht grundsätzlich der von TA2/TA3. Zusätzlich kann aber über ein Menü konfiguriert werden, welche Gegenstände aus einer TA4 Kiste geholt und weiter transportiert werden sollen. -Die Verarbeitungsleistung beträgt 12 Items alle 2 s. +Die Verarbeitungsleistung beträgt 12 Items alle 2 s, sofern auf beiden Seiten TA4 Röhren verwendet werden. Anderenfalls sind es nur 6 Items alle 2 s. Der TA4 Schieber besitzt zwei zusätzliche Kommandos für den Lua Controller: @@ -551,7 +552,7 @@ Der Kiste besitzt ein zusätzliches Kommandos für den Lua Controller: ### TA4 Verteiler / Distributor Die Funktion entspricht der von TA2. -Die Verarbeitungsleistung beträgt 24 Items alle 4 s. +Die Verarbeitungsleistung beträgt 24 Items alle 4 s, sofern auf allen Seiten TA4 Röhren verwendet werden. Anderenfalls sind es nur 12 Items alle 4 s. [ta4_distributor|image] diff --git a/manuals/manual_ta4_EN.md b/manuals/manual_ta4_EN.md index 2a5437b..9fc5120 100644 --- a/manuals/manual_ta4_EN.md +++ b/manuals/manual_ta4_EN.md @@ -490,14 +490,15 @@ With the water pump, water can be pumped through liquid lines in tanks and thus ### TA4 Tube -TA4 also has its own tubes in the TA4 design. These correspond to the standard tubes, only look better. ;-) +TA4 also has its own tubes in the TA4 design. These can be used like standard tubes. +But: TA4 pushers and TA4 distributors only achieve their full performance when used with TA4 tubes. [ta4_tube|image] ### TA4 Pusher The function basically corresponds to that of TA2 / TA3. In addition, a menu can be used to configure which objects should be taken from a TA4 chest and transported further. -The processing power is 12 items every 2 s. +The processing power is 12 items every 2 s, if TA4 tubes are used on both sides. Otherwise there are only 6 items every 2 s. The TA4 pusher has two additional commands for the Lua controller: @@ -551,7 +552,7 @@ The chest has an additional command for the Lua controller: ### TA4 Distributor The function corresponds to that of TA2. -The processing power is 24 items every 4 s. +The processing power is 24 items every 4 s, provided TA4 tubes are used on all sides. Otherwise there are only 12 items every 4 s. [ta4_distributor|image] diff --git a/manuals/ta4_lua_controller_EN.md b/manuals/ta4_lua_controller_EN.md index 3b6abfe..789fe32 100644 --- a/manuals/ta4_lua_controller_EN.md +++ b/manuals/ta4_lua_controller_EN.md @@ -372,7 +372,7 @@ In addition to Lua standard function the Lua Controller provides the following f | -------------------------------- | ------------ | ------------------------------------------------------------ | | "on", "off" | nil | turn a node on/off (machine, lamp,...) | | "red, "amber", "green", "off" | nil | set Signal Tower color | -| "red", "green", "blue", "yellow" | "on", "off" | Enable/disable a Distributor filter slot. | +| "port" | `=on/off` | Enable/disable a Distributor filter slot..
Example: `yellow=on`
colors: "red", "green", "blue", "yellow" | | "text" | text string | Text to be used for the Sensor Chest menu | | "reset" | nil | Reset the item counter of the TA4 Item Detector block | | "pull" | item string | Start the TA4 pusher to pull/push items.
Example: `default:dirt 8` | @@ -659,4 +659,4 @@ if num then $put_term(TERM, name..": "..text) end end -``` \ No newline at end of file +``` diff --git a/manuals/ta4_lua_controller_EN.pdf b/manuals/ta4_lua_controller_EN.pdf index e5d63d4..06a17c0 100644 Binary files a/manuals/ta4_lua_controller_EN.pdf and b/manuals/ta4_lua_controller_EN.pdf differ