forked from minetest-mods/technic
Added API functions to register LV and MV machines
This commit is contained in:
parent
5d799eb94f
commit
6123493fd7
|
@ -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 =
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
power_tools ={}
|
||||
LV_machines = {}
|
||||
registered_LV_machines_count=0
|
||||
|
||||
registered_power_tools_count=1
|
||||
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
|
||||
|
||||
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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
@ -149,8 +149,6 @@ minetest.register_abm({
|
|||
end
|
||||
|
||||
|
||||
|
||||
|
||||
if srclist then
|
||||
cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist})
|
||||
if cooked.time>0 then
|
||||
|
@ -168,6 +166,8 @@ minetest.register_abm({
|
|||
meta:set_string("furnace_is_cookin",0)
|
||||
meta:set_string("src_time", 0)
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
register_LV_machine ("technic:electric_furnace","RE")
|
||||
register_LV_machine ("technic:electric_furnace_active","RE")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -142,7 +142,8 @@ minetest.register_abm({
|
|||
hacky_swap_node (pos,"technic:generator")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
register_LV_machine ("technic:generator","PR")
|
||||
register_LV_machine ("technic:generator_active","PR")
|
||||
|
|
|
@ -133,3 +133,6 @@ if node.name=="default:water_source" or node.name=="default:water_flowing" then
|
|||
if node.name=="default:lava_source" or node.name=="default:lava_flowing" then return 2 end
|
||||
return 0
|
||||
end
|
||||
|
||||
register_LV_machine ("technic:geothermal","PR")
|
||||
register_LV_machine ("technic:geothermal_active","PR")
|
||||
|
|
|
@ -264,11 +264,9 @@ minetest.register_abm({
|
|||
|
||||
-- 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,9 +283,6 @@ 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
|
||||
|
@ -295,7 +290,6 @@ minetest.register_abm({
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (meta:get_float("grinder_on")==0) then
|
||||
local grinded=nil
|
||||
if not inv:is_empty("src") then
|
||||
|
@ -307,8 +301,6 @@ minetest.register_abm({
|
|||
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")
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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,7 +188,11 @@ 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
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -74,3 +74,5 @@ minetest.register_abm(
|
|||
end
|
||||
end,
|
||||
})
|
||||
|
||||
register_LV_machine ("technic:solar_panel","PR")
|
||||
|
|
|
@ -74,3 +74,5 @@ minetest.register_abm(
|
|||
end
|
||||
end,
|
||||
})
|
||||
|
||||
register_MV_machine ("technic:solar_panel_mv","PR")
|
||||
|
|
|
@ -95,3 +95,6 @@ minetest.register_abm({
|
|||
"list[current_player;main;0,5;8,4;]")
|
||||
end
|
||||
})
|
||||
|
||||
register_LV_machine ("technic:tool_workshop","RE")
|
||||
|
||||
|
|
|
@ -126,3 +126,6 @@ local node=minetest.env:get_node(pos)
|
|||
if node.name=="default:water_flowing" then return 1 end
|
||||
return 0
|
||||
end
|
||||
|
||||
register_LV_machine ("technic:watermill","PR")
|
||||
register_LV_machine ("technic:watermill_active","PR")
|
||||
|
|
Loading…
Reference in New Issue
Block a user