From 9f38cef4274e5b09a5fbabab22b4e783e7267233 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Sat, 10 Sep 2022 20:42:31 +0200 Subject: [PATCH] Improve repairkit for pumps --- basic_machines/pusher.lua | 4 ++-- liquids/pump.lua | 2 +- locale/techage.de.tr | 2 ++ locale/template.txt | 2 ++ logic/signallamp.lua | 8 ++++---- tools/repairkit.lua | 10 ++++++++++ 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/basic_machines/pusher.lua b/basic_machines/pusher.lua index f6f45d7..4365cf2 100644 --- a/basic_machines/pusher.lua +++ b/basic_machines/pusher.lua @@ -53,7 +53,7 @@ local function ta4_formspec(self, pos, nvm) "box[0,-0.1;7.8,0.5;#c6e8ff]".. "label[3,-0.1;"..minetest.colorize("#000000", S("Pusher")).."]".. techage.question_mark_help(7.5, S("Optionally configure\nthe pusher with one item")).. - techage.wrench_image(7.4, -0.05) .. + techage.wrench_image(7.4, -0.05) .. "list[context;main;3.5,0.8;1,1;]".. "image_button[3.5,2;1,1;".. self:get_state_button_image(nvm) ..";state_button;]".. "tooltip[3.5,2;1,1;"..self:get_state_tooltip(nvm).."]".. @@ -123,7 +123,7 @@ end local function pushing(pos, crd, meta, nvm) local pull_dir = meta:get_int("pull_dir") local push_dir = meta:get_int("push_dir") - + if not nvm.limit then local num = nvm.item_count or nvm.num_items or crd.num_items num = push(pos, crd, meta, nvm, pull_dir, push_dir, num) diff --git a/liquids/pump.lua b/liquids/pump.lua index aa6ad00..b56cf47 100644 --- a/liquids/pump.lua +++ b/liquids/pump.lua @@ -86,7 +86,7 @@ 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 diff --git a/locale/techage.de.tr b/locale/techage.de.tr index 97f6ffc..a6de983 100644 --- a/locale/techage.de.tr +++ b/locale/techage.de.tr @@ -1098,6 +1098,8 @@ Biome=Biom Node owner=Blockbesitzer Position=Position Position temperature=Positionstemperatur +Pump connected to no/empty tank(s).=Pumpe an keine/leere Tank(s) angeschlossen. +Pump connected to tank(s) with: @1=Pumpe an Tank(s) angeschlossen mit: @1 TechAge Info Tool (use @= read status info)=TechAge Info Werkzeug TechAge Repair Kit=TechAge Reparaturset diff --git a/locale/template.txt b/locale/template.txt index 59c4b38..8c26558 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -1098,6 +1098,8 @@ Biome= Node owner= Position= Position temperature= +Pump connected to no/empty tank(s).= +Pump connected to tank(s) with: @1= TechAge Info Tool (use @= read status info)= TechAge Repair Kit= diff --git a/logic/signallamp.lua b/logic/signallamp.lua index 1c7c6cc..97a75a1 100644 --- a/logic/signallamp.lua +++ b/logic/signallamp.lua @@ -197,8 +197,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end) -register_signallamp("techage:signal_lamp", - S("TechAge Signal Lamp"), +register_signallamp("techage:signal_lamp", + S("TechAge Signal Lamp"), {"techage_signal_lamp.png^[colorize:#000000:100"}, { type = "fixed", @@ -209,8 +209,8 @@ register_signallamp("techage:signal_lamp", } ) -register_signallamp("techage:signal_lamp2", - S("TechAge Signal Lamp 2 "), +register_signallamp("techage:signal_lamp2", + S("TechAge Signal Lamp 2 "), {"techage_signallamp2.png"} ) diff --git a/tools/repairkit.lua b/tools/repairkit.lua index 58ba18c..fab6f38 100644 --- a/tools/repairkit.lua +++ b/tools/repairkit.lua @@ -115,6 +115,16 @@ local function read_state(itemstack, user, pointed_thing) if owner ~= "" then minetest.chat_send_player(user:get_player_name(), S("Node owner")..": "..owner.." ") end + if ndef and ndef.networks and ndef.networks.pipe2 and ndef.networks.pipe2.ntype == "pump" then + local tbl = networks.liquid.get_liquids(pos, Pipe2) + if #tbl > 0 then + local names = table.concat(tbl, ", ") + minetest.chat_send_player(user:get_player_name(), S("Pump connected to tank(s) with: @1", names)) + else + minetest.chat_send_player(user:get_player_name(), S("Pump connected to no/empty tank(s).")) + end + end + minetest.chat_send_player(user:get_player_name(), S("Position")..": "..minetest.pos_to_string(pos).." ") itemstack:add_wear(65636/200) return itemstack