Do not run converters twice.

This commit is contained in:
Maciej 'agaran' Pijanka 2017-03-15 21:33:18 +01:00 committed by Vanessa Ezekowitz
parent 7d5329834d
commit 10307f23a7
2 changed files with 11 additions and 6 deletions

View File

@ -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 local remain = 0.9
-- Machine information -- Machine information
local machine_name = S("Supply Converter") local machine_name = S("Supply Converter")

View File

@ -218,7 +218,7 @@ minetest.register_abm({
end end
-- Run all the nodes -- Run all the nodes
local function run_nodes(list) local function run_nodes(list, run_stage)
for _, pos2 in ipairs(list) do for _, pos2 in ipairs(list) do
technic.get_or_load_node(pos2) technic.get_or_load_node(pos2)
local node2 = minetest.get_node(pos2) local node2 = minetest.get_node(pos2)
@ -227,14 +227,14 @@ minetest.register_abm({
nodedef = minetest.registered_nodes[node2.name] nodedef = minetest.registered_nodes[node2.name]
end end
if nodedef and nodedef.technic_run then if nodedef and nodedef.technic_run then
nodedef.technic_run(pos2, node2) nodedef.technic_run(pos2, node2, run_stage)
end end
end end
end end
run_nodes(PR_nodes) run_nodes(PR_nodes, technic.producer)
run_nodes(RE_nodes) run_nodes(RE_nodes, technic.receiver)
run_nodes(BA_nodes) run_nodes(BA_nodes, technic.battery)
-- Strings for the meta data -- Strings for the meta data
local eu_demand_str = tier.."_EU_demand" local eu_demand_str = tier.."_EU_demand"