From 1b1780946edebfbf1e8ec2cf095b56fa76733e2b Mon Sep 17 00:00:00 2001
From: Vanessa Ezekowitz <vanessaezekowitz@gmail.com>
Date: Sat, 12 Sep 2015 07:18:16 +0200
Subject: [PATCH] add facedir to tool workshop

---
 technic/machines/switching_station.lua |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua
index 46a911d..d6f23a3 100644
--- a/technic/machines/switching_station.lua
+++ b/technic/machines/switching_station.lua
@@ -83,7 +83,7 @@
 end
 
 -- Generic function to add found connected nodes to the right classification array
-local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos)
+local check_node_subp = function(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, pos, machines, tier, sw_pos, from_below)
 	technic.get_or_load_node(pos)
 	local meta = minetest.get_meta(pos)
 	local name = minetest.get_node(pos).name
@@ -100,7 +100,8 @@
 			add_new_cable_node(PR_nodes, pos)
 			add_new_cable_node(RE_nodes, pos)
 		elseif machines[name] == "SPECIAL" and
-				(pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) then
+				(pos.x ~= sw_pos.x or pos.y ~= sw_pos.y or pos.z ~= sw_pos.z) and
+				from_below then
 			-- Another switching station -> disable it
 			add_new_cable_node(SP_nodes, pos)
 			meta:set_int("active", 0)
@@ -125,7 +126,7 @@
 		{x=pos.x,   y=pos.y,   z=pos.z-1}}
 	--print("ON")
 	for i, cur_pos in pairs(positions) do
-		check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos)
+		check_node_subp(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes, cur_pos, machines, tier, sw_pos, i == 3)
 	end
 end
 
@@ -170,6 +171,7 @@
 -----------------------------------------------
 minetest.register_abm({
 	nodenames = {"technic:switching_station"},
+	label = "Switching Station", -- allows the mtt profiler to profile this abm individually
 	interval   = 1,
 	chance     = 1,
 	action = function(pos, node, active_object_count, active_object_count_wider)
@@ -291,8 +293,8 @@
 		--dprint("Total BA demand:"..BA_eu_demand)
 
 		meta:set_string("infotext",
-				technic.format(S("%s. Supply: %e Demand: %e"),
-				machine_name, PR_eu_supply, RE_eu_demand))
+				S("@1. Supply: @2 Demand: @3",
+				machine_name, technic.prettynum(PR_eu_supply), technic.prettynum(RE_eu_demand)))
 
 		-- If the PR supply is enough for the RE demand supply them all
 		if PR_eu_supply >= RE_eu_demand then

--
Gitblit v1.8.0