From 6123493fd73a9c70210eb89274b5690caf562823 Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Sun, 3 Feb 2013 19:28:51 +0100 Subject: [PATCH] Added API functions to register LV and MV machines --- technic/alloy_furnace.lua | 3 + technic/alloy_furnace_mv.lua | 3 + technic/battery_box.lua | 40 ++++---- technic/battery_box_mv.lua | 28 ++++-- technic/electric_furnace.lua | 16 ++-- technic/electric_furnace_mv.lua | 4 +- technic/generator.lua | 5 +- technic/geothermal.lua | 5 +- technic/grinder.lua | 25 ++--- technic/init.lua | 6 +- technic/injector1.lua | 160 ++++++++++++++++++++++++-------- technic/music_player.lua | 6 +- technic/solar_panel.lua | 4 +- technic/solar_panel_mv.lua | 4 +- technic/tool_workshop.lua | 3 + technic/water_mill.lua | 5 +- 16 files changed, 212 insertions(+), 105 deletions(-) diff --git a/technic/alloy_furnace.lua b/technic/alloy_furnace.lua index fedb0fe..149688e 100644 --- a/technic/alloy_furnace.lua +++ b/technic/alloy_furnace.lua @@ -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 = diff --git a/technic/alloy_furnace_mv.lua b/technic/alloy_furnace_mv.lua index bf57d30..1d78f6e 100644 --- a/technic/alloy_furnace_mv.lua +++ b/technic/alloy_furnace_mv.lua @@ -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") diff --git a/technic/battery_box.lua b/technic/battery_box.lua index f5827a4..3f61221 100644 --- a/technic/battery_box.lua +++ b/technic/battery_box.lua @@ -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 diff --git a/technic/battery_box_mv.lua b/technic/battery_box_mv.lua index c48adce..ab51e94 100644 --- a/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 = { @@ -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 diff --git a/technic/electric_furnace.lua b/technic/electric_furnace.lua index 22e053b..e9d3236 100644 --- a/technic/electric_furnace.lua +++ b/technic/electric_furnace.lua @@ -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") diff --git a/technic/electric_furnace_mv.lua b/technic/electric_furnace_mv.lua index c3e7eff..fd90b14 100644 --- a/technic/electric_furnace_mv.lua +++ b/technic/electric_furnace_mv.lua @@ -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") diff --git a/technic/generator.lua b/technic/generator.lua index c8ac802..ae899a6 100644 --- a/technic/generator.lua +++ b/technic/generator.lua @@ -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") diff --git a/technic/geothermal.lua b/technic/geothermal.lua index 8f3a7d7..93aa423 100644 --- a/technic/geothermal.lua +++ b/technic/geothermal.lua @@ -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") diff --git a/technic/grinder.lua b/technic/grinder.lua index 686ffd3..8d72c70 100644 --- a/technic/grinder.lua +++ b/technic/grinder.lua @@ -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") diff --git a/technic/init.lua b/technic/init.lua index 8629f06..249757a 100644 --- a/technic/init.lua +++ b/technic/init.lua @@ -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") diff --git a/technic/injector1.lua b/technic/injector1.lua index 537e478..7de4581 100644 --- a/technic/injector1.lua +++ b/technic/injector1.lua @@ -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 1 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 1 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 1 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 1 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 1 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 1 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 + diff --git a/technic/music_player.lua b/technic/music_player.lua index 0a6474a..ecb1e09 100644 --- a/technic/music_player.lua +++ b/technic/music_player.lua @@ -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") diff --git a/technic/solar_panel.lua b/technic/solar_panel.lua index 02a8f69..93f2b63 100644 --- a/technic/solar_panel.lua +++ b/technic/solar_panel.lua @@ -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") diff --git a/technic/solar_panel_mv.lua b/technic/solar_panel_mv.lua index 93e21e7..4deb42e 100644 --- a/technic/solar_panel_mv.lua +++ b/technic/solar_panel_mv.lua @@ -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") diff --git a/technic/tool_workshop.lua b/technic/tool_workshop.lua index f47469e..cf39c56 100644 --- a/technic/tool_workshop.lua +++ b/technic/tool_workshop.lua @@ -95,3 +95,6 @@ minetest.register_abm({ "list[current_player;main;0,5;8,4;]") end }) + +register_LV_machine ("technic:tool_workshop","RE") + diff --git a/technic/water_mill.lua b/technic/water_mill.lua index 6e0120d..596dcd1 100644 --- a/technic/water_mill.lua +++ b/technic/water_mill.lua @@ -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") -- 2.30.2