summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej 'agaran' Pijanka <agaran@pld-linux.org>2017-03-15 21:33:18 +0100
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-03-15 19:00:22 -0400
commit10307f23a78b33af50dc4a5f3d1baafb4ee4b0d9 (patch)
tree396e53f3cdfa84a2ea25e580c957bcf1a9b5fb8f
parent7d5329834dd749eca2bcc5d07c5cc016bd743a38 (diff)
Do not run converters twice.
-rw-r--r--technic/machines/supply_converter.lua7
-rw-r--r--technic/machines/switching_station.lua10
2 files changed, 11 insertions, 6 deletions
diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua
index cddd5e4..a94b9e2 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"