Added API functions to register LV and MV machines
authorRealBadAngel <mk@realbadangel.pl>
Sun, 3 Feb 2013 18:28:51 +0000 (19:28 +0100)
committerRealBadAngel <mk@realbadangel.pl>
Sun, 3 Feb 2013 18:28:51 +0000 (19:28 +0100)
16 files changed:
technic/alloy_furnace.lua
technic/alloy_furnace_mv.lua
technic/battery_box.lua
technic/battery_box_mv.lua
technic/electric_furnace.lua
technic/electric_furnace_mv.lua
technic/generator.lua
technic/geothermal.lua
technic/grinder.lua
technic/init.lua
technic/injector1.lua
technic/music_player.lua
technic/solar_panel.lua
technic/solar_panel_mv.lua
technic/tool_workshop.lua
technic/water_mill.lua

index fedb0fe5b2286d0066648323e76158dff720cb21..149688e858cf52e7c0702376d2882cfc907946e1 100644 (file)
@@ -198,6 +198,9 @@ end
 return nil
 end
 
+register_LV_machine ("technic:alloy_furnace","RE")
+register_LV_machine ("technic:alloy_furnace_active","RE")
+
 --coal driven alloy furnace:
 
 coal_alloy_furnace_formspec =
index bf57d3087294198be20832c81b3170f9c27351a6..1d78f6e6ec4a7070b262d4524863e840ec9b23dc 100644 (file)
@@ -265,3 +265,6 @@ function send_cooked_alloys (pos,x_velocity,z_velocity)
                        end
                end
 end
+
+register_MV_machine ("technic:mv_alloy_furnace","RE")
+register_MV_machine ("technic:mv_alloy_furnace_active","RE")
index f5827a498845367349ee9d610611fe159bc5f941..3f612213ff319bb0a3f7e5513c1dfdfc647c7980 100644 (file)
@@ -1,12 +1,21 @@
-power_tools ={}
+LV_machines = {}
+registered_LV_machines_count=0
+
+function register_LV_machine (string1,string2)
+registered_LV_machines_count=registered_LV_machines_count+1
+LV_machines[registered_LV_machines_count]={}
+LV_machines[registered_LV_machines_count].machine_name=string1
+LV_machines[registered_LV_machines_count].machine_type=string2
+end
 
-registered_power_tools_count=1
+power_tools ={}
+registered_power_tools_count=0
 
 function register_power_tool (string1,max_charge)
+registered_power_tools_count=registered_power_tools_count+1
 power_tools[registered_power_tools_count]={}
 power_tools[registered_power_tools_count].tool_name=string1
 power_tools[registered_power_tools_count].max_charge=max_charge
-registered_power_tools_count=registered_power_tools_count+1
 end
 
 register_power_tool ("technic:mining_drill",60000)
@@ -380,19 +389,14 @@ end
 function check_LV_node_subp (PR_nodes,RE_nodes,LV_nodes,pos1)
 meta = minetest.env:get_meta(pos1)
 if meta:get_float("cablelike")==1 then new_node_added=add_new_cable_node(LV_nodes,pos1) end
-if minetest.env:get_node(pos1).name == "technic:solar_panel" then      new_node_added=add_new_cable_node(PR_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:generator" then        new_node_added=add_new_cable_node(PR_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:generator_active" then         new_node_added=add_new_cable_node(PR_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:geothermal" then       new_node_added=add_new_cable_node(PR_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:geothermal_active" then        new_node_added=add_new_cable_node(PR_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:water_mill" then       new_node_added=add_new_cable_node(PR_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:water_mill_active" then        new_node_added=add_new_cable_node(PR_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:electric_furnace" then         new_node_added=add_new_cable_node(RE_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:electric_furnace_active" then  new_node_added=add_new_cable_node(RE_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:alloy_furnace" then    new_node_added=add_new_cable_node(RE_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:alloy_furnace_active" then     new_node_added=add_new_cable_node(RE_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:tool_workshop" then    new_node_added=add_new_cable_node(RE_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:music_player" then     new_node_added=add_new_cable_node(RE_nodes,pos1) end            
-if minetest.env:get_node(pos1).name == "technic:grinder" then  new_node_added=add_new_cable_node(RE_nodes,pos1) end            
+for i in ipairs(LV_machines) do
+       if minetest.env:get_node(pos1).name == LV_machines[i].machine_name then 
+               if LV_machines[i].machine_type == "PR" then
+                       new_node_added=add_new_cable_node(PR_nodes,pos1) 
+                       end
+               if LV_machines[i].machine_type == "RE" then
+                       new_node_added=add_new_cable_node(RE_nodes,pos1) 
+                       end
+       end
+end
 end
-               
\ No newline at end of file
index c48adce78cc08d10f658fafe62c984d9593a1ef3..ab51e94fcee0b644f338f483db34f7f0b8550a4f 100644 (file)
@@ -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 = {
@@ -7,8 +18,6 @@ minetest.register_craft({
        }
 }) 
 
-
-
 mv_battery_box_formspec =
        "invsize[8,9;]"..
        "image[1,1;1,2;technic_power_meter_bg.png]"..
@@ -316,10 +325,15 @@ end
 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
-if minetest.env:get_node(pos1).name == "technic:mv_electric_furnace"           then    new_node_added=add_new_MVcable_node(RE_nodes,pos1) end
-if minetest.env:get_node(pos1).name == "technic:mv_electric_furnace_active" then       new_node_added=add_new_MVcable_node(RE_nodes,pos1) end
-if minetest.env:get_node(pos1).name == "technic:mv_alloy_furnace" then         new_node_added=add_new_MVcable_node(RE_nodes,pos1) end
-if minetest.env:get_node(pos1).name == "technic:mv_alloy_furnace_active" then  new_node_added=add_new_MVcable_node(RE_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
 
index 22e053bdc14c36b94ee998535e03145b7dd1b273..e9d3236236da943abc02170862886bd8ed4d479d 100644 (file)
@@ -145,12 +145,10 @@ minetest.register_abm({
                                end
                                meta:set_string("src_time", 0)
                        end
-                       end             
+                       end
                end
-               
-               
 
-               
+
                if srclist then
                        cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
                        if cooked.time>0 then 
@@ -162,12 +160,14 @@ minetest.register_abm({
                        end
 
                end
-       
+
                                hacky_swap_node(pos,"technic:electric_furnace")
                                meta:set_string("infotext","Furnace inactive")
                                meta:set_string("furnace_is_cookin",0)
                                meta:set_string("src_time", 0)
-               
-       
-end,           
+
+end,
 })
+
+register_LV_machine ("technic:electric_furnace","RE")
+register_LV_machine ("technic:electric_furnace_active","RE")
index c3e7eff8532c154cb7541bb450b70289a5f25afe..fd90b14332f6d4b52788b256bf902b812bd521f3 100644 (file)
@@ -262,7 +262,6 @@ function send_cooked_items (pos,x_velocity,z_velocity)
                        if stack then
                        local item0=stack:to_table()
                        if item0 then 
-                               print (dump(item0))
                                item0["count"]="1"
                                local item1=tube_item({x=pos.x,y=pos.y,z=pos.z},item0)
                                item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z}
@@ -275,3 +274,6 @@ function send_cooked_items (pos,x_velocity,z_velocity)
                        end
                end
 end
+
+register_MV_machine ("technic:mv_electric_furnace","RE")
+register_MV_machine ("technic:mv_electric_furnace_active","RE")
index c8ac802a4b3de15c03400220bca383a38d947d2d..ae899a659f9bc99d51322d5b6a15c1ef0cef8b07 100644 (file)
@@ -137,12 +137,13 @@ minetest.register_abm({
                                                (percent)..":default_furnace_fire_fg.png]"..
                                "list[current_player;main;0,5;8,4;]"
                                )
-                               
+
        if burn_time==0 then
                hacky_swap_node (pos,"technic:generator")
        end
-               
 
        end
 }) 
 
+register_LV_machine ("technic:generator","PR")
+register_LV_machine ("technic:generator_active","PR")
index 8f3a7d733f66789d569e03f4edb0b0295654a6a2..93aa423169c34d2afedae4f4c2e0091d773e674a 100644 (file)
@@ -132,4 +132,7 @@ local node=minetest.env:get_node(pos)
 if node.name=="default:water_source" or node.name=="default:water_flowing"  then return 1 end
 if node.name=="default:lava_source" or node.name=="default:lava_flowing"  then return 2 end    
 return 0
-end
\ No newline at end of file
+end
+
+register_LV_machine ("technic:geothermal","PR")
+register_LV_machine ("technic:geothermal_active","PR")
index 686ffd3cf78c60da896adf85b98b861c690e84f6..8d72c70fbe419d2006c57c1dece3bc0899dd57a2 100644 (file)
@@ -190,7 +190,7 @@ grinder_formspec =
        "list[current_name;src;3,1;1,1;]"..
        "list[current_name;dst;5,1;2,2;]"..
        "list[current_player;main;0,5;8,4;]"
-       
+
 
 minetest.register_node("technic:grinder", {
        description = "Grinder",
@@ -219,7 +219,7 @@ minetest.register_node("technic:grinder", {
                inv:set_size("src", 1)
                inv:set_size("dst", 4)
                
-               end,    
+               end,
        can_dig = function(pos,player)
                local meta = minetest.env:get_meta(pos);
                local inv = meta:get_inventory()
@@ -257,18 +257,16 @@ minetest.register_abm({
                                "list[current_name;dst;5,1;2,2;]"..
                                "list[current_player;main;0,5;8,4;]"
                                )
-                               
+
                
 
                local inv = meta:get_inventory()
                
 --             local grinder_on = meta:get_float("grinder_on")
                
-               
                local srclist = inv:get_list("src")
                if inv:is_empty("src") then meta:set_float("grinder_on",0) end 
-       
-               
+
                if (meta:get_float("grinder_on") == 1) then
                        if charge>=grind_cost then
                        charge=charge-grind_cost;
@@ -285,17 +283,13 @@ minetest.register_abm({
                                        srcstack:take_item()
                                        inv:set_stack("src", 1, srcstack)
                                        if inv:is_empty("src") then meta:set_float("grinder_on",0) end 
-
-
-
                                else
                                        print("Grinder inventory full!")
                                end
                                meta:set_float("src_time", 0)
                        end
-                       end             
+                       end
                end
-               
                if (meta:get_float("grinder_on")==0) then
                local grinded=nil 
                if not inv:is_empty("src") then
@@ -304,11 +298,9 @@ minetest.register_abm({
                 grind_time=4
                 meta:set_float("grind_time",grind_time)
                 meta:set_float("src_time", 0)
-                return         
+                return
                end
                end
-               
-       
        end
 }) 
 
@@ -319,8 +311,9 @@ item_name=src_item["name"]
 
 local counter=registered_grinder_recipes_count-1
 for i=1, counter,1 do
-if     grinder_recipes[i].src_name==item_name then return ItemStack(grinder_recipes[i].dst_name) end
+       if      grinder_recipes[i].src_name==item_name then return ItemStack(grinder_recipes[i].dst_name) end
 end
 return nil
-               
 end
+
+register_LV_machine ("technic:grinder","RE")
index 8629f06c692cad2e3d08dee9870e2beb7d16d82c..249757a09d8c4b991842da15acc53c48eea274fe 100644 (file)
@@ -22,14 +22,14 @@ dofile(modpath.."/concrete.lua")
 dofile(modpath.."/items.lua")
 
 --LV machines
+dofile(modpath.."/wires.lua")
+dofile(modpath.."/battery_box.lua")
 dofile(modpath.."/alloy_furnaces_commons.lua")
 dofile(modpath.."/alloy_furnace.lua")
 dofile(modpath.."/solar_panel.lua")
 dofile(modpath.."/geothermal.lua")
 dofile(modpath.."/water_mill.lua")
 dofile(modpath.."/electric_furnace.lua")
-dofile(modpath.."/battery_box.lua")
-dofile(modpath.."/wires.lua")
 dofile(modpath.."/tool_workshop.lua")
 dofile(modpath.."/music_player.lua")
 dofile(modpath.."/generator.lua")
@@ -37,8 +37,8 @@ dofile(modpath.."/grinder.lua")
 
 --MV machines
 dofile(modpath.."/wires_mv.lua")
-dofile(modpath.."/solar_panel_mv.lua")
 dofile(modpath.."/battery_box_mv.lua")
+dofile(modpath.."/solar_panel_mv.lua")
 dofile(modpath.."/electric_furnace_mv.lua")
 dofile(modpath.."/alloy_furnace_mv.lua")
 
index 537e478b42acf6da6fa2c08966b97ed5f293dda3..7de45819d79fae226c44ea07cd9b028c0c4b2812 100644 (file)
@@ -5,8 +5,8 @@ minetest.register_craftitem("technic:injector", {
 
 minetest.register_node("technic:injector", {
        description = "Injector",
-       tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png",
-               "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_front.png"},
+       tiles = {"technic_injector_top.png", "technic_injector_bottom.png", "technic_injector_side.png",
+               "technic_injector_side.png", "technic_injector_side.png", "technic_injector_side.png"},
        paramtype2 = "facedir",
        groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
        legacy_facedir_simple = true,
@@ -32,7 +32,14 @@ minetest.register_node("technic:injector", {
        for _,stack in ipairs(inv:get_list("main")) do
                if stack:get_name() ~="" then 
                        inv:remove_item("main",stack)
-                       item1=tube_item({x=pos.x+.5,y=pos.y,z=pos.z},stack)
+                       pos1=pos
+                       pos1.y=pos1.y
+                       local x=pos1.x+1.5
+                       local z=pos1.z
+                       item1=tube_item({x=pos1.x,y=pos1.y,z=pos1.z},stack)
+                       item1:get_luaentity().start_pos = {x=pos1.x,y=pos1.y,z=pos1.z}
+                       item1:setvelocity({x=1, y=0, z=0})
+                       item1:setacceleration({x=0, y=0, z=0})
                        return
                        end
        end
@@ -41,33 +48,30 @@ end,
 
 
 function tube_item(pos, item)
+               local TUBE_nodes = {}
+               local CHEST_nodes = {}
+
+               TUBE_nodes[1]={}
+               TUBE_nodes[1].x=pos.x
+               TUBE_nodes[1].y=pos.y
+               TUBE_nodes[1].z=pos.z
+
+
+table_index=1
+       repeat
+       check_TUBE_node (TUBE_nodes,CHEST_nodes,table_index)
+       table_index=table_index+1
+       if TUBE_nodes[table_index]==nil then break end
+       until false
+found=table_index-1
+
+
+print("Found "..found.." tubes connected")
+print(dump(CHEST_nodes))
        -- Take item in any format
        local stack = ItemStack(item)
        local obj = minetest.env:add_entity(pos, "technic:tubed_item")
        obj:get_luaentity():set_item(stack:to_string())
-       obj:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z}
-       obj:setacceleration({x=0, y=0, z=0})
-       pos.x=pos.x+1
-       local meta = minetest.env:get_meta(pos)
-       if meta:get_int("tubelike")==1 then obj:setvelocity({x=1, y=0, z=0}) return obj end
-       pos.x=pos.x-2
-       meta = minetest.env:get_meta(pos)
-       if meta:get_int("tubelike")==1 then obj:setvelocity({x=-1, y=0, z=0}) return obj end
-       pos.x=pos.x+1
-       pos.z=pos.z+1
-       meta = minetest.env:get_meta(pos)
-       if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=0, z=1}) return obj end
-       pos.z=pos.z-2
-       meta = minetest.env:get_meta(pos)
-       if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=0, z=-1}) return obj end
-       pos.z=pos.z+1
-       pos.y=pos.y+1
-       meta = minetest.env:get_meta(pos)
-       if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=1, z=0}) return obj end
-       pos.y=pos.y-2
-       meta = minetest.env:get_meta(pos)
-       if meta:get_int("tubelike")==1 then obj:setvelocity({x=0, y=-2, z=0}) return obj end
-       pos.y=pos.y+1
        return obj
 end
 
@@ -82,7 +86,8 @@ minetest.register_entity("technic:tubed_item", {
                spritediv = {x=1, y=1},
                initial_sprite_basepos = {x=0, y=0},
                is_visible = false,
-               start_pos={}
+               start_pos={},
+               route={}
        },
        
        itemstring = '',
@@ -129,6 +134,7 @@ minetest.register_entity("technic:tubed_item", {
        end,
 
        on_activate = function(self, staticdata)
+--             print (dump(staticdata))
                if  staticdata=="" or staticdata==nil then return end
                local item = minetest.deserialize(staticdata)
                local stack = ItemStack(item.itemstring)
@@ -153,16 +159,23 @@ minetest.register_entity("technic:tubed_item", {
        local node = minetest.env:get_node(pos)
        local meta = minetest.env:get_meta(pos)
        tubelike=meta:get_int("tubelike")
+       local stack = ItemStack(self.itemstring)
+       local drop_pos=nil
+               
        local velocity=self.object:getvelocity()
        
-       if not velocity then return end
+       if velocity==nil then print ("wypadl") return end
 
        if math.abs(velocity.x)==1 then
                local next_node=math.abs(pos.x-self.start_pos.x)
                if next_node >= 1 then 
                        self.start_pos.x=self.start_pos.x+velocity.x
                        if check_pos_vector (self.start_pos, velocity)==0 then 
-                       check_next_step (self.start_pos, velocity) 
+                       if check_next_step (self.start_pos, velocity)==0 then
+                               drop_pos=minetest.env:find_node_near({x=self.start_pos.x,y=self.start_pos.y,z=self.start_pos.z+velocity.x}, 1, "air")
+                               if drop_pos then minetest.item_drop(stack, "", drop_pos) end
+                               self.object:remove()
+                               end
                        self.object:setpos(self.start_pos)
                        self.object:setvelocity(velocity)
                        return
@@ -175,10 +188,14 @@ minetest.register_entity("technic:tubed_item", {
                if next_node >= 1 then 
                        self.start_pos.y=self.start_pos.y+velocity.y
                        if check_pos_vector (self.start_pos, velocity)==0 then
-                       check_next_step (self.start_pos, velocity) 
+                       if check_next_step (self.start_pos, velocity)==0 then
+                               drop_pos=minetest.env:find_node_near({x=self.start_pos.x+velocity.x,y=self.start_pos.y+velocity.y,z=self.start_pos.z+velocity.z}, 1, "air")
+                               if drop_pos then minetest.item_drop(stack, "", drop_pos) end
+                               self.object:remove()
+                               end
                        self.object:setpos(self.start_pos)
                        self.object:setvelocity(velocity)
-                       return
+                       return 
                        end
                        end
                end
@@ -188,7 +205,11 @@ minetest.register_entity("technic:tubed_item", {
                if next_node >= 1 then 
                        self.start_pos.z=self.start_pos.z+velocity.z
                        if check_pos_vector (self.start_pos, velocity)==0 then
-                       check_next_step (self.start_pos, velocity) 
+                       if check_next_step (self.start_pos, velocity)==0 then
+                               drop_pos=minetest.env:find_node_near({x=self.start_pos.x+velocity.x,y=self.start_pos.y+velocity.y,z=self.start_pos.z+velocity.z}, 1, "air")
+                               if drop_pos then minetest.item_drop(stack, "", drop_pos) end
+                               self.object:remove()
+                               end
                        self.object:setpos(self.start_pos)
                        self.object:setvelocity(velocity)
                        return
@@ -196,6 +217,7 @@ minetest.register_entity("technic:tubed_item", {
                        end
                end
        end
+
 end
 })
 
@@ -207,33 +229,32 @@ local tubelike
 if velocity.x==0 then
 meta = minetest.env:get_meta({x=pos.x-1,y=pos.y,z=pos.z})
 tubelike=meta:get_int("tubelike")
-if tubelike==1 then velocity.x=-1 velocity.y=0 velocity.z=0 return end
+if tubelike==1 then velocity.x=-1 velocity.y=0 velocity.z=0 return end
 meta = minetest.env:get_meta({x=pos.x+1,y=pos.y,z=pos.z})
 tubelike=meta:get_int("tubelike")
-if tubelike==1 then velocity.x=1 velocity.y=0 velocity.z=0 return end
+if tubelike==1 then velocity.x=1 velocity.y=0 velocity.z=0 return end
 end
 
 if velocity.z==0 then
 meta = minetest.env:get_meta({x=pos.x,y=pos.y,z=pos.z+1})
 tubelike=meta:get_int("tubelike")
-if tubelike==1 then velocity.x=0 velocity.y=0 velocity.z=1 return end
+if tubelike==1 then velocity.x=0 velocity.y=0 velocity.z=1 return end
 meta = minetest.env:get_meta({x=pos.x,y=pos.y,z=pos.z-1})
 tubelike=meta:get_int("tubelike")
-if tubelike==1 then velocity.x=0 velocity.y=0 velocity.z=-1 return end
+if tubelike==1 then velocity.x=0 velocity.y=0 velocity.z=-1 return end
 end
 
 if velocity.y==0 then
 meta = minetest.env:get_meta({x=pos.x,y=pos.y+1,z=pos.z})
 tubelike=meta:get_int("tubelike")
-if tubelike==1 then velocity.x=0 velocity.y=1 velocity.z=0 return end
+if tubelike==1 then velocity.x=0 velocity.y=1 velocity.z=0 return end
 meta = minetest.env:get_meta({x=pos.x,y=pos.y-1,z=pos.z})
 tubelike=meta:get_int("tubelike")
-if tubelike==1 then velocity.x=0 velocity.y=-1 velocity.z=0 return end
+if tubelike==1 then velocity.x=0 velocity.y=-1 velocity.z=0 return end
 end
 
---velocity.x=0
---velocity.y=0
---velocity.z=0
+print ("spadl")
+return 0
 end
 
 function check_pos_vector (pos,velocity)
@@ -246,3 +267,60 @@ local meta=minetest.env:get_meta(added)
 if meta:get_int("tubelike")==1 then return 1 end
 return 0
 end
+
+function add_new_TUBE_node (TUBE_nodes,pos1,parent)
+local i=1
+       repeat
+               if TUBE_nodes[i]==nil then break end
+               if pos1.x==TUBE_nodes[i].x and pos1.y==TUBE_nodes[i].y and pos1.z==TUBE_nodes[i].z then return false end
+               i=i+1
+       until false
+TUBE_nodes[i]={}
+TUBE_nodes[i].x=pos1.x
+TUBE_nodes[i].y=pos1.y
+TUBE_nodes[i].z=pos1.z
+TUBE_nodes[i].parent_x=parent.x
+TUBE_nodes[i].parent_y=parent.y
+TUBE_nodes[i].parent_z=parent.z
+
+return true
+end
+
+function check_TUBE_node (TUBE_nodes,CHEST_nodes,i)
+               local pos1={}
+               local parent={}
+               pos1.x=TUBE_nodes[i].x
+               pos1.y=TUBE_nodes[i].y
+               pos1.z=TUBE_nodes[i].z
+               parent.x=pos1.x
+               parent.y=pos1.y
+               parent.z=pos1.z
+               new_node_added=false
+       
+               pos1.x=pos1.x+1
+               check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
+               pos1.x=pos1.x-2
+               check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
+               pos1.x=pos1.x+1
+               
+               pos1.y=pos1.y+1
+               check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
+               pos1.y=pos1.y-2
+               check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
+               pos1.y=pos1.y+1
+
+               pos1.z=pos1.z+1
+               check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
+               pos1.z=pos1.z-2
+               check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
+               pos1.z=pos1.z+1
+return new_node_added
+end
+
+function check_TUBE_node_subp (TUBE_nodes,CHEST_nodes,pos1,parent)
+meta = minetest.env:get_meta(pos1)
+if meta:get_float("tubelike")==1 then add_new_TUBE_node(TUBE_nodes,pos1,parent) return end
+nctr = minetest.env:get_node(pos1)
+if minetest.get_item_group(nctr.name, "tubedevice_receiver") == 1 then add_new_TUBE_node(CHEST_nodes,pos1,parent) return end
+end
+
index 0a6474a2a2b53c94f6a6a2e7d5f11a6d3e6d0bd8..ecb1e09d9ce8366358d331c1f6ed39da08aa8e5c 100644 (file)
@@ -115,12 +115,8 @@ minetest.register_abm({
                                "button[4,4;1,2;play;Play]"..
                                "button[6,4;1,2;stop;Stop]"..
                                "label[4,0;Current track "..tostring(music_player_current_track).."]"
-
                                )
-                               
-       
-       
-       
        end
 }) 
 
+register_LV_machine ("technic:music_player","RE")
index 02a8f69d1e08a979214ed73731ba802638dc880d..93f2b63873ffd3f9d3dc254a3a49599285891b5e 100644 (file)
@@ -73,4 +73,6 @@ minetest.register_abm(
                        meta:set_float("active",0)
                end
        end,
-}) 
\ No newline at end of file
+}) 
+
+register_LV_machine ("technic:solar_panel","PR")
index 93e21e7410bd57af86be67ab64aaeb82d84c85ef..4deb42ede7f01d453ddb91d67551ad2a69a90039 100644 (file)
@@ -73,4 +73,6 @@ minetest.register_abm(
                        meta:set_float("active",0)
                end
        end,
-}) 
\ No newline at end of file
+}) 
+
+register_MV_machine ("technic:solar_panel_mv","PR")
index f47469e226a909ed6a8ae4a9a86ab54f0d0b5061..cf39c5690962ff480ccf925f4a97685f24c0ccf0 100644 (file)
@@ -95,3 +95,6 @@ minetest.register_abm({
                                "list[current_player;main;0,5;8,4;]")
        end
 }) 
+
+register_LV_machine ("technic:tool_workshop","RE")
+
index 6e0120d9c06105930d83cd46c62ba5c334e98c12..596dcd1c563169b662309e598c6e8eb1349bc9ff 100644 (file)
@@ -125,4 +125,7 @@ function check_node_around_mill (pos)
 local node=minetest.env:get_node(pos)
 if node.name=="default:water_flowing"  then return 1 end
 return 0
-end
\ No newline at end of file
+end
+
+register_LV_machine ("technic:watermill","PR")
+register_LV_machine ("technic:watermill_active","PR")