From f34edc7debba7bc1889e776e8819b1c648a812fa Mon Sep 17 00:00:00 2001 From: Maciej 'agaran' Pijanka Date: Wed, 15 Mar 2017 21:33:18 +0100 Subject: [PATCH] Do not run converters twice. --- technic/machines/supply_converter.lua | 7 ++++++- technic/machines/switching_station.lua | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua index 15c761d..019fb9d 100644 --- a/technic/machines/supply_converter.lua +++ b/technic/machines/supply_converter.lua @@ -58,7 +58,12 @@ local mesecons = { } } -local run = function(pos, node) +local run = function(pos, node, run_stage) + -- run only in producer stage. + if run_stage == technic.receiver then + return + end + local remain = 0.9 -- Machine information local machine_name = S("Supply Converter") diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua index f925817..8ace874 100644 --- a/technic/machines/switching_station.lua +++ b/technic/machines/switching_station.lua @@ -218,7 +218,7 @@ minetest.register_abm({ end -- Run all the nodes - local function run_nodes(list) + local function run_nodes(list, run_stage) for _, pos2 in ipairs(list) do technic.get_or_load_node(pos2) local node2 = minetest.get_node(pos2) @@ -227,14 +227,14 @@ minetest.register_abm({ nodedef = minetest.registered_nodes[node2.name] end if nodedef and nodedef.technic_run then - nodedef.technic_run(pos2, node2) + nodedef.technic_run(pos2, node2, run_stage) end end end - run_nodes(PR_nodes) - run_nodes(RE_nodes) - run_nodes(BA_nodes) + run_nodes(PR_nodes, technic.producer) + run_nodes(RE_nodes, technic.receiver) + run_nodes(BA_nodes, technic.battery) -- Strings for the meta data local eu_demand_str = tier.."_EU_demand"