From 6123493fd73a9c70210eb89274b5690caf562823 Mon Sep 17 00:00:00 2001
From: RealBadAngel <mk@realbadangel.pl>
Date: Sun, 03 Feb 2013 19:28:51 +0100
Subject: [PATCH] Added API functions to register LV and MV machines

---
 technic/battery_box_mv.lua |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/technic/technic/battery_box_mv.lua b/technic/battery_box_mv.lua
similarity index 93%
rename from technic/technic/battery_box_mv.lua
rename to technic/battery_box_mv.lua
index ae448e0..ab51e94 100644
--- a/technic/technic/battery_box_mv.lua
+++ b/technic/battery_box_mv.lua
@@ -1,3 +1,14 @@
+MV_machines = {}
+
+registered_MV_machines_count=0
+
+function register_MV_machine (string1,string2)
+registered_MV_machines_count=registered_MV_machines_count+1
+MV_machines[registered_MV_machines_count]={}
+MV_machines[registered_MV_machines_count].machine_name=string1
+MV_machines[registered_MV_machines_count].machine_type=string2
+end
+
 minetest.register_craft({
 	output = 'technic:mv_battery_box 1',
 	recipe = {
@@ -6,8 +17,6 @@
 		{'', 'technic:mv_cable', ''},
 	}
 }) 
-
-
 
 mv_battery_box_formspec =
 	"invsize[8,9;]"..
@@ -316,6 +325,15 @@
 function check_MV_node_subp (PR_nodes,RE_nodes,MV_nodes,pos1)
 meta = minetest.env:get_meta(pos1)
 if meta:get_float("mv_cablelike")==1 then new_node_added=add_new_MVcable_node(MV_nodes,pos1) end
-if minetest.env:get_node(pos1).name == "technic:solar_panel_mv" then 	new_node_added=add_new_MVcable_node(PR_nodes,pos1) end		
+for i in ipairs(MV_machines) do
+	if minetest.env:get_node(pos1).name == MV_machines[i].machine_name then 
+		if MV_machines[i].machine_type == "PR" then
+			new_node_added=add_new_MVcable_node(PR_nodes,pos1) 
+			end
+		if MV_machines[i].machine_type == "RE" then
+			new_node_added=add_new_MVcable_node(RE_nodes,pos1) 
+			end
+	end
 end
-		
+end
+

--
Gitblit v1.8.0