From 0d97fe1a8c344ab2060200fd3b2e3f4731b0a486 Mon Sep 17 00:00:00 2001
From: Vanessa Ezekowitz <vanessaezekowitz@gmail.com>
Date: Wed, 15 Mar 2017 19:06:40 -0400
Subject: update technic

---
 technic/machines/supply_converter.lua  |  9 +++++++--
 technic/machines/switching_station.lua | 10 +++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

(limited to 'technic')

diff --git a/technic/machines/supply_converter.lua b/technic/machines/supply_converter.lua
index 15c761d..a94b9e2 100644
--- a/technic/machines/supply_converter.lua
+++ b/technic/machines/supply_converter.lua
@@ -58,13 +58,18 @@ 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")
 	local meta          = minetest.get_meta(pos)
 	local enabled = meta:get_int("enabled") ~= 0 and (meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0)
-	local demand = enabled and meta:get_int("power") or 10000
+	local demand = enabled and meta:get_int("power") or 0
 
 	local pos_up        = {x=pos.x, y=pos.y+1, z=pos.z}
 	local pos_down      = {x=pos.x, y=pos.y-1, z=pos.z}
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"
-- 
cgit v1.2.3