mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-18 00:08:28 +01:00
Fix indentation and coding style
This commit is contained in:
parent
95aac90b67
commit
27f3a8ab31
675
tubes.lua
675
tubes.lua
@ -1,6 +1,6 @@
|
|||||||
-- This file supplies the various kinds of pneumatic tubes
|
-- This file supplies the various kinds of pneumatic tubes
|
||||||
|
|
||||||
pipeworks.tubenodes={}
|
pipeworks.tubenodes = {}
|
||||||
|
|
||||||
minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000")
|
minetest.register_alias("pipeworks:tube", "pipeworks:tube_000000")
|
||||||
|
|
||||||
@ -215,333 +215,334 @@ end
|
|||||||
|
|
||||||
-- now let's actually call that function to get the real work done!
|
-- now let's actually call that function to get the real work done!
|
||||||
|
|
||||||
local noctr_textures={"pipeworks_tube_noctr.png","pipeworks_tube_noctr.png","pipeworks_tube_noctr.png",
|
local noctr_textures = {"pipeworks_tube_noctr.png","pipeworks_tube_noctr.png","pipeworks_tube_noctr.png",
|
||||||
"pipeworks_tube_noctr.png","pipeworks_tube_noctr.png","pipeworks_tube_noctr.png"}
|
"pipeworks_tube_noctr.png","pipeworks_tube_noctr.png","pipeworks_tube_noctr.png"}
|
||||||
local plain_textures={"pipeworks_tube_plain.png","pipeworks_tube_plain.png","pipeworks_tube_plain.png",
|
local plain_textures = {"pipeworks_tube_plain.png","pipeworks_tube_plain.png","pipeworks_tube_plain.png",
|
||||||
"pipeworks_tube_plain.png","pipeworks_tube_plain.png","pipeworks_tube_plain.png"}
|
"pipeworks_tube_plain.png","pipeworks_tube_plain.png","pipeworks_tube_plain.png"}
|
||||||
local end_textures={"pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks_tube_end.png",
|
local end_textures = {"pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks_tube_end.png",
|
||||||
"pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks_tube_end.png"}
|
"pipeworks_tube_end.png","pipeworks_tube_end.png","pipeworks_tube_end.png"}
|
||||||
local short_texture="pipeworks_tube_short.png"
|
local short_texture = "pipeworks_tube_short.png"
|
||||||
local inv_texture="pipeworks_tube_inv.png"
|
local inv_texture = "pipeworks_tube_inv.png"
|
||||||
|
|
||||||
pipeworks.register_tube("pipeworks:tube","Pneumatic tube segment",plain_textures,noctr_textures,end_textures,short_texture,inv_texture)
|
pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment", plain_textures, noctr_textures, end_textures, short_texture, inv_texture)
|
||||||
|
|
||||||
|
|
||||||
local mese_noctr_textures={"pipeworks_mese_tube_noctr_1.png","pipeworks_mese_tube_noctr_2.png","pipeworks_mese_tube_noctr_3.png",
|
|
||||||
"pipeworks_mese_tube_noctr_4.png","pipeworks_mese_tube_noctr_5.png","pipeworks_mese_tube_noctr_6.png"}
|
|
||||||
local mese_plain_textures={"pipeworks_mese_tube_plain_1.png","pipeworks_mese_tube_plain_2.png","pipeworks_mese_tube_plain_3.png",
|
|
||||||
"pipeworks_mese_tube_plain_4.png","pipeworks_mese_tube_plain_5.png","pipeworks_mese_tube_plain_6.png"}
|
|
||||||
local mese_end_textures={"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png",
|
|
||||||
"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png"}
|
|
||||||
local mese_short_texture="pipeworks_mese_tube_short.png"
|
|
||||||
local mese_inv_texture="pipeworks_mese_tube_inv.png"
|
|
||||||
|
|
||||||
if pipeworks.enable_mese_tube then
|
if pipeworks.enable_mese_tube then
|
||||||
pipeworks.register_tube("pipeworks:mese_tube","Mese pneumatic tube segment",mese_plain_textures,mese_noctr_textures,
|
local mese_noctr_textures = {"pipeworks_mese_tube_noctr_1.png","pipeworks_mese_tube_noctr_2.png","pipeworks_mese_tube_noctr_3.png",
|
||||||
mese_end_textures,mese_short_texture,mese_inv_texture,
|
"pipeworks_mese_tube_noctr_4.png","pipeworks_mese_tube_noctr_5.png","pipeworks_mese_tube_noctr_6.png"}
|
||||||
{tube={can_go=function(pos,node,velocity,stack)
|
local mese_plain_textures = {"pipeworks_mese_tube_plain_1.png","pipeworks_mese_tube_plain_2.png","pipeworks_mese_tube_plain_3.png",
|
||||||
tbl={}
|
"pipeworks_mese_tube_plain_4.png","pipeworks_mese_tube_plain_5.png","pipeworks_mese_tube_plain_6.png"}
|
||||||
local meta=minetest.get_meta(pos)
|
local mese_end_textures = {"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png",
|
||||||
local inv=meta:get_inventory()
|
"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png"}
|
||||||
local found=false
|
local mese_short_texture = "pipeworks_mese_tube_short.png"
|
||||||
local name=stack:get_name()
|
local mese_inv_texture = "pipeworks_mese_tube_inv.png"
|
||||||
for i,vect in ipairs(pipeworks.meseadjlist) do
|
pipeworks.register_tube("pipeworks:mese_tube", "Mese pneumatic tube segment", mese_plain_textures, mese_noctr_textures,
|
||||||
if meta:get_int("l"..tostring(i).."s")==1 then
|
mese_end_textures, mese_short_texture, mese_inv_texture,
|
||||||
for _,st in ipairs(inv:get_list("line"..tostring(i))) do
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
if st:get_name()==name then
|
local tbl = {}
|
||||||
found=true
|
local meta = minetest.get_meta(pos)
|
||||||
table.insert(tbl,vect)
|
local inv = meta:get_inventory()
|
||||||
end
|
local found = false
|
||||||
end
|
local name = stack:get_name()
|
||||||
end
|
for i, vect in ipairs(pipeworks.meseadjlist) do
|
||||||
end
|
if meta:get_int("l"..tostring(i).."s") == 1 then
|
||||||
if found==false then
|
for _, st in ipairs(inv:get_list("line"..tostring(i))) do
|
||||||
for i,vect in ipairs(pipeworks.meseadjlist) do
|
if st:get_name() == name then
|
||||||
if meta:get_int("l"..tostring(i).."s")==1 then
|
found = true
|
||||||
if inv:is_empty("line"..tostring(i)) then
|
table.insert(tbl, vect)
|
||||||
table.insert(tbl,vect)
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
if found == false then
|
||||||
return tbl
|
for i, vect in ipairs(pipeworks.meseadjlist) do
|
||||||
end},
|
if meta:get_int("l"..tostring(i).."s") == 1 then
|
||||||
on_construct = function(pos)
|
if inv:is_empty("line"..tostring(i)) then
|
||||||
local meta = minetest.get_meta(pos)
|
table.insert(tbl, vect)
|
||||||
local inv = meta:get_inventory()
|
end
|
||||||
for i=1,6 do
|
end
|
||||||
meta:set_int("l"..tostring(i).."s",1)
|
end
|
||||||
inv:set_size("line"..tostring(i), 6*1)
|
end
|
||||||
end
|
return tbl
|
||||||
meta:set_string("formspec",
|
end},
|
||||||
"size[8,11]"..
|
on_construct = function(pos)
|
||||||
"list[current_name;line1;1,0;6,1;]"..
|
local meta = minetest.get_meta(pos)
|
||||||
"list[current_name;line2;1,1;6,1;]"..
|
local inv = meta:get_inventory()
|
||||||
"list[current_name;line3;1,2;6,1;]"..
|
for i = 1, 6 do
|
||||||
"list[current_name;line4;1,3;6,1;]"..
|
meta:set_int("l"..tostring(i).."s", 1)
|
||||||
"list[current_name;line5;1,4;6,1;]"..
|
inv:set_size("line"..tostring(i), 6*1)
|
||||||
"list[current_name;line6;1,5;6,1;]"..
|
end
|
||||||
"image[0,0;1,1;pipeworks_white.png]"..
|
meta:set_string("formspec",
|
||||||
"image[0,1;1,1;pipeworks_black.png]"..
|
"size[8,11]"..
|
||||||
"image[0,2;1,1;pipeworks_green.png]"..
|
"list[current_name;line1;1,0;6,1;]"..
|
||||||
"image[0,3;1,1;pipeworks_yellow.png]"..
|
"list[current_name;line2;1,1;6,1;]"..
|
||||||
"image[0,4;1,1;pipeworks_blue.png]"..
|
"list[current_name;line3;1,2;6,1;]"..
|
||||||
"image[0,5;1,1;pipeworks_red.png]"..
|
"list[current_name;line4;1,3;6,1;]"..
|
||||||
"button[7,0;1,1;button1;On]"..
|
"list[current_name;line5;1,4;6,1;]"..
|
||||||
"button[7,1;1,1;button2;On]"..
|
"list[current_name;line6;1,5;6,1;]"..
|
||||||
"button[7,2;1,1;button3;On]"..
|
"image[0,0;1,1;pipeworks_white.png]"..
|
||||||
"button[7,3;1,1;button4;On]"..
|
"image[0,1;1,1;pipeworks_black.png]"..
|
||||||
"button[7,4;1,1;button5;On]"..
|
"image[0,2;1,1;pipeworks_green.png]"..
|
||||||
"button[7,5;1,1;button6;On]"..
|
"image[0,3;1,1;pipeworks_yellow.png]"..
|
||||||
"list[current_player;main;0,7;8,4;]")
|
"image[0,4;1,1;pipeworks_blue.png]"..
|
||||||
meta:set_string("infotext", "Mese pneumatic tube")
|
"image[0,5;1,1;pipeworks_red.png]"..
|
||||||
end,
|
"button[7,0;1,1;button1;On]"..
|
||||||
on_receive_fields=function(pos,formname,fields,sender)
|
"button[7,1;1,1;button2;On]"..
|
||||||
local meta=minetest.get_meta(pos)
|
"button[7,2;1,1;button3;On]"..
|
||||||
local i
|
"button[7,3;1,1;button4;On]"..
|
||||||
for key,_ in pairs(fields) do i=key end
|
"button[7,4;1,1;button5;On]"..
|
||||||
if i==nil then return end
|
"button[7,5;1,1;button6;On]"..
|
||||||
i=string.sub(i,-1)
|
"list[current_player;main;0,7;8,4;]")
|
||||||
newstate=1-meta:get_int("l"..i.."s")
|
meta:set_string("infotext", "Mese pneumatic tube")
|
||||||
meta:set_int("l"..i.."s",newstate)
|
end,
|
||||||
local frm="size[8,11]"..
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
"list[current_name;line1;1,0;6,1;]"..
|
local meta = minetest.get_meta(pos)
|
||||||
"list[current_name;line2;1,1;6,1;]"..
|
local i
|
||||||
"list[current_name;line3;1,2;6,1;]"..
|
if fields.quit then return end
|
||||||
"list[current_name;line4;1,3;6,1;]"..
|
for key, _ in pairs(fields) do i = key end
|
||||||
"list[current_name;line5;1,4;6,1;]"..
|
if i == nil then return end
|
||||||
"list[current_name;line6;1,5;6,1;]"..
|
i = string.sub(i,-1)
|
||||||
"image[0,0;1,1;pipeworks_white.png]"..
|
newstate = 1 - meta:get_int("l"..i.."s")
|
||||||
"image[0,1;1,1;pipeworks_black.png]"..
|
meta:set_int("l"..i.."s",newstate)
|
||||||
"image[0,2;1,1;pipeworks_green.png]"..
|
local frm = "size[8,11]"..
|
||||||
"image[0,3;1,1;pipeworks_yellow.png]"..
|
"list[current_name;line1;1,0;6,1;]"..
|
||||||
"image[0,4;1,1;pipeworks_blue.png]"..
|
"list[current_name;line2;1,1;6,1;]"..
|
||||||
"image[0,5;1,1;pipeworks_red.png]"
|
"list[current_name;line3;1,2;6,1;]"..
|
||||||
for i=1,6 do
|
"list[current_name;line4;1,3;6,1;]"..
|
||||||
local st=meta:get_int("l"..tostring(i).."s")
|
"list[current_name;line5;1,4;6,1;]"..
|
||||||
if st==0 then
|
"list[current_name;line6;1,5;6,1;]"..
|
||||||
frm=frm.."button[7,"..tostring(i-1)..";1,1;button"..tostring(i)..";Off]"
|
"image[0,0;1,1;pipeworks_white.png]"..
|
||||||
else
|
"image[0,1;1,1;pipeworks_black.png]"..
|
||||||
frm=frm.."button[7,"..tostring(i-1)..";1,1;button"..tostring(i)..";On]"
|
"image[0,2;1,1;pipeworks_green.png]"..
|
||||||
end
|
"image[0,3;1,1;pipeworks_yellow.png]"..
|
||||||
end
|
"image[0,4;1,1;pipeworks_blue.png]"..
|
||||||
frm=frm.."list[current_player;main;0,7;8,4;]"
|
"image[0,5;1,1;pipeworks_red.png]"
|
||||||
meta:set_string("formspec",frm)
|
for i = 1, 6 do
|
||||||
end,
|
local st = meta:get_int("l"..tostring(i).."s")
|
||||||
can_dig = function(pos,player)
|
if st == 0 then
|
||||||
local meta = minetest.get_meta(pos);
|
frm = frm.."button[7,"..tostring(i-1)..";1,1;button"..tostring(i)..";Off]"
|
||||||
local inv = meta:get_inventory()
|
else
|
||||||
return (inv:is_empty("line1") and inv:is_empty("line2") and inv:is_empty("line3") and
|
frm = frm.."button[7,"..tostring(i-1)..";1,1;button"..tostring(i)..";On]"
|
||||||
inv:is_empty("line4") and inv:is_empty("line5") and inv:is_empty("line6"))
|
end
|
||||||
end
|
end
|
||||||
}, true)
|
frm = frm.."list[current_player;main;0,7;8,4;]"
|
||||||
|
meta:set_string("formspec", frm)
|
||||||
|
end,
|
||||||
|
can_dig = function(pos, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return (inv:is_empty("line1") and inv:is_empty("line2") and inv:is_empty("line3") and
|
||||||
|
inv:is_empty("line4") and inv:is_empty("line5") and inv:is_empty("line6"))
|
||||||
|
end
|
||||||
|
}, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
if pipeworks.enable_detector_tube then
|
if pipeworks.enable_detector_tube then
|
||||||
|
local detector_plain_textures = {"pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png",
|
||||||
local detector_plain_textures={"pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png",
|
"pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png"}
|
||||||
"pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png","pipeworks_detector_tube_plain.png"}
|
local detector_inv_texture = "pipeworks_detector_tube_inv.png"
|
||||||
local detector_inv_texture="pipeworks_detector_tube_inv.png"
|
pipeworks.register_tube("pipeworks:detector_tube_on", "Detector tube segment on (you hacker you)", detector_plain_textures, noctr_textures,
|
||||||
|
end_textures, short_texture, detector_inv_texture,
|
||||||
pipeworks.register_tube("pipeworks:detector_tube_on","Detector tube segment on (you hacker you)",detector_plain_textures,noctr_textures,
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
end_textures,short_texture,detector_inv_texture,
|
local meta = minetest.get_meta(pos)
|
||||||
{tube={can_go=function(pos,node,velocity,stack)
|
local name = minetest.get_node(pos).name
|
||||||
local meta = minetest.get_meta(pos)
|
local nitems = meta:get_int("nitems")+1
|
||||||
local name = minetest.get_node(pos).name
|
meta:set_int("nitems", nitems)
|
||||||
local nitems=meta:get_int("nitems")+1
|
minetest.after(0.1, minetest.registered_nodes[name].item_exit, pos)
|
||||||
meta:set_int("nitems", nitems)
|
return pipeworks.notvel(pipeworks.meseadjlist,velocity)
|
||||||
minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
|
end},
|
||||||
return pipeworks.notvel(pipeworks.meseadjlist,velocity)
|
groups = {mesecon = 2, not_in_creative_inventory = 1},
|
||||||
end},
|
drop = "pipeworks:detector_tube_off_1",
|
||||||
groups={mesecon=2,not_in_creative_inventory=1},
|
mesecons = {receptor = {state = "on",
|
||||||
drop="pipeworks:detector_tube_off_000000",
|
rules = pipeworks.mesecons_rules}},
|
||||||
mesecons={receptor={state="on",
|
item_exit = function(pos)
|
||||||
rules=pipeworks.mesecons_rules}},
|
local meta = minetest.get_meta(pos)
|
||||||
item_exit = function(pos)
|
local nitems = meta:get_int("nitems")-1
|
||||||
local meta = minetest.get_meta(pos)
|
local name = minetest.get_node(pos).name
|
||||||
local nitems=meta:get_int("nitems")-1
|
if nitems == 0 then
|
||||||
local name = minetest.get_node(pos).name
|
minetest.set_node(pos,{name = string.gsub(name, "on", "off")})
|
||||||
if nitems==0 then
|
mesecon:receptor_off(pos, pipeworks.mesecons_rules)
|
||||||
minetest.set_node(pos,{name=string.gsub(name,"on","off")})
|
else
|
||||||
mesecon:receptor_off(pos,pipeworks.mesecons_rules)
|
meta:set_int("nitems", nitems)
|
||||||
else
|
end
|
||||||
meta:set_int("nitems", nitems)
|
end,
|
||||||
end
|
on_construct = function(pos)
|
||||||
end,
|
local meta = minetest.get_meta(pos)
|
||||||
on_construct = function(pos)
|
meta:set_int("nitems", 1)
|
||||||
local meta = minetest.get_meta(pos)
|
local name = minetest.get_node(pos).name
|
||||||
meta:set_int("nitems", 1)
|
minetest.after(0.1, minetest.registered_nodes[name].item_exit,pos)
|
||||||
local name = minetest.get_node(pos).name
|
end})
|
||||||
minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
|
pipeworks.register_tube("pipeworks:detector_tube_off", "Detector tube segment", detector_plain_textures, noctr_textures,
|
||||||
end})
|
end_textures, short_texture, detector_inv_texture,
|
||||||
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
pipeworks.register_tube("pipeworks:detector_tube_off","Detector tube segment",detector_plain_textures,noctr_textures,
|
local name = minetest.get_node(pos).name
|
||||||
end_textures,short_texture,detector_inv_texture,
|
minetest.set_node(pos,{name = string.gsub(name, "off", "on")})
|
||||||
{tube={can_go=function(pos,node,velocity,stack)
|
mesecon:receptor_on(pos, pipeworks.mesecons_rules)
|
||||||
local name = minetest.get_node(pos).name
|
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
|
||||||
minetest.set_node(pos,{name=string.gsub(name,"off","on")})
|
end},
|
||||||
mesecon:receptor_on(pos,pipeworks.mesecons_rules)
|
groups = {mesecon = 2},
|
||||||
return pipeworks.notvel(pipeworks.meseadjlist,velocity)
|
mesecons = {receptor = {state = "off",
|
||||||
end},
|
rules = pipeworks.mesecons_rules}}
|
||||||
groups={mesecon=2},
|
|
||||||
mesecons={receptor={state="off",
|
|
||||||
rules=pipeworks.mesecons_rules}}
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local conductor_plain_textures={"pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png",
|
|
||||||
"pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png","pipeworks_conductor_tube_plain.png"}
|
|
||||||
local conductor_noctr_textures={"pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png",
|
|
||||||
"pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png","pipeworks_conductor_tube_noctr.png"}
|
|
||||||
local conductor_end_textures={"pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png",
|
|
||||||
"pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png","pipeworks_conductor_tube_end.png"}
|
|
||||||
local conductor_short_texture="pipeworks_conductor_tube_short.png"
|
|
||||||
local conductor_inv_texture="pipeworks_conductor_tube_inv.png"
|
|
||||||
|
|
||||||
local conductor_on_plain_textures={"pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png",
|
|
||||||
"pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png","pipeworks_conductor_tube_on_plain.png"}
|
|
||||||
local conductor_on_noctr_textures={"pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png",
|
|
||||||
"pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png","pipeworks_conductor_tube_on_noctr.png"}
|
|
||||||
local conductor_on_end_textures={"pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png",
|
|
||||||
"pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png","pipeworks_conductor_tube_on_end.png"}
|
|
||||||
|
|
||||||
if pipeworks.enable_conductor_tube then
|
if pipeworks.enable_conductor_tube then
|
||||||
pipeworks.register_tube("pipeworks:conductor_tube_off","Conductor tube segment",conductor_plain_textures,conductor_noctr_textures,
|
local conductor_plain_textures = {"pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png",
|
||||||
conductor_end_textures,conductor_short_texture,conductor_inv_texture,
|
"pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png"}
|
||||||
{groups={mesecon=2},
|
local conductor_noctr_textures = {"pipeworks_conductor_tube_noctr.png", "pipeworks_conductor_tube_noctr.png", "pipeworks_conductor_tube_noctr.png",
|
||||||
mesecons={conductor={state="off",
|
"pipeworks_conductor_tube_noctr.png", "pipeworks_conductor_tube_noctr.png", "pipeworks_conductor_tube_noctr.png"}
|
||||||
rules=pipeworks.mesecons_rules,
|
local conductor_end_textures = {"pipeworks_conductor_tube_end.png", "pipeworks_conductor_tube_end.png", "pipeworks_conductor_tube_end.png",
|
||||||
onstate="pipeworks:conductor_tube_on_#id"}}
|
"pipeworks_conductor_tube_end.png", "pipeworks_conductor_tube_end.png", "pipeworks_conductor_tube_end.png"}
|
||||||
|
local conductor_short_texture = "pipeworks_conductor_tube_short.png"
|
||||||
|
local conductor_inv_texture = "pipeworks_conductor_tube_inv.png"
|
||||||
|
|
||||||
|
local conductor_on_plain_textures = {"pipeworks_conductor_tube_on_plain.png", "pipeworks_conductor_tube_on_plain.png", "pipeworks_conductor_tube_on_plain.png",
|
||||||
|
"pipeworks_conductor_tube_on_plain.png", "pipeworks_conductor_tube_on_plain.png", "pipeworks_conductor_tube_on_plain.png"}
|
||||||
|
local conductor_on_noctr_textures = {"pipeworks_conductor_tube_on_noctr.png", "pipeworks_conductor_tube_on_noctr.png", "pipeworks_conductor_tube_on_noctr.png",
|
||||||
|
"pipeworks_conductor_tube_on_noctr.png", "pipeworks_conductor_tube_on_noctr.png", "pipeworks_conductor_tube_on_noctr.png"}
|
||||||
|
local conductor_on_end_textures = {"pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png",
|
||||||
|
"pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png"}
|
||||||
|
|
||||||
|
pipeworks.register_tube("pipeworks:conductor_tube_off", "Conductor tube segment", conductor_plain_textures, conductor_noctr_textures,
|
||||||
|
conductor_end_textures, conductor_short_texture, conductor_inv_texture,
|
||||||
|
{groups = {mesecon = 2},
|
||||||
|
mesecons = {conductor = {state = "off",
|
||||||
|
rules = pipeworks.mesecons_rules,
|
||||||
|
onstate = "pipeworks:conductor_tube_on_#id"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
pipeworks.register_tube("pipeworks:conductor_tube_on","Conductor tube segment on (you hacker you)",conductor_on_plain_textures,conductor_on_noctr_textures,
|
pipeworks.register_tube("pipeworks:conductor_tube_on", "Conductor tube segment on (you hacker you)", conductor_on_plain_textures, conductor_on_noctr_textures,
|
||||||
conductor_on_end_textures,conductor_short_texture,conductor_inv_texture,
|
conductor_on_end_textures, conductor_short_texture, conductor_inv_texture,
|
||||||
{groups={mesecon=2,not_in_creative_inventory=1},
|
{groups = {mesecon = 2, not_in_creative_inventory = 1},
|
||||||
drop="pipeworks:conductor_tube_off_000000",
|
drop = "pipeworks:conductor_tube_off_1",
|
||||||
mesecons={conductor={state="on",
|
mesecons = {conductor = {state = "on",
|
||||||
rules=pipeworks.mesecons_rules,
|
rules = pipeworks.mesecons_rules,
|
||||||
offstate="pipeworks:conductor_tube_off_#id"}}
|
offstate = "pipeworks:conductor_tube_off_#id"}}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local accelerator_noctr_textures={"pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png",
|
|
||||||
"pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png","pipeworks_accelerator_tube_noctr.png"}
|
|
||||||
local accelerator_plain_textures={"pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png",
|
|
||||||
"pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png","pipeworks_accelerator_tube_plain.png"}
|
|
||||||
local accelerator_end_textures={"pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png",
|
|
||||||
"pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png","pipeworks_accelerator_tube_end.png"}
|
|
||||||
local accelerator_short_texture="pipeworks_accelerator_tube_short.png"
|
|
||||||
local accelerator_inv_texture="pipeworks_accelerator_tube_inv.png"
|
|
||||||
|
|
||||||
if pipeworks.enable_accelerator_tube then
|
if pipeworks.enable_accelerator_tube then
|
||||||
pipeworks.register_tube("pipeworks:accelerator_tube","Accelerator pneumatic tube segment",accelerator_plain_textures,
|
local accelerator_noctr_textures = {"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png",
|
||||||
accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture,
|
"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png"}
|
||||||
{tube={can_go=function(pos,node,velocity,stack)
|
local accelerator_plain_textures = {"pipeworks_accelerator_tube_plain.png" ,"pipeworks_accelerator_tube_plain.png", "pipeworks_accelerator_tube_plain.png",
|
||||||
velocity.speed=velocity.speed+1
|
"pipeworks_accelerator_tube_plain.png", "pipeworks_accelerator_tube_plain.png", "pipeworks_accelerator_tube_plain.png"}
|
||||||
return pipeworks.notvel(pipeworks.meseadjlist,velocity)
|
local accelerator_end_textures = {"pipeworks_accelerator_tube_end.png", "pipeworks_accelerator_tube_end.png", "pipeworks_accelerator_tube_end.png",
|
||||||
end}
|
"pipeworks_accelerator_tube_end.png", "pipeworks_accelerator_tube_end.png", "pipeworks_accelerator_tube_end.png"}
|
||||||
|
local accelerator_short_texture = "pipeworks_accelerator_tube_short.png"
|
||||||
|
local accelerator_inv_texture = "pipeworks_accelerator_tube_inv.png"
|
||||||
|
|
||||||
|
pipeworks.register_tube("pipeworks:accelerator_tube", "Accelerator pneumatic tube segment", accelerator_plain_textures,
|
||||||
|
accelerator_noctr_textures, accelerator_end_textures, accelerator_short_texture, accelerator_inv_texture,
|
||||||
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
|
velocity.speed = velocity.speed+1
|
||||||
|
return pipeworks.notvel(pipeworks.meseadjlist, velocity)
|
||||||
|
end}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if pipeworks.enable_crossing_tube then
|
if pipeworks.enable_crossing_tube then
|
||||||
pipeworks.register_tube("pipeworks:crossing_tube","Crossing tube segment",accelerator_plain_textures,
|
-- FIXME: The textures are not the correct ones
|
||||||
accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture,
|
pipeworks.register_tube("pipeworks:crossing_tube", "Crossing tube segment", accelerator_plain_textures,
|
||||||
{tube={can_go=function(pos,node,velocity,stack)
|
accelerator_noctr_textures, accelerator_end_textures, accelerator_short_texture, accelerator_inv_texture,
|
||||||
return {velocity}
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
end}
|
return {velocity}
|
||||||
|
end}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local sand_noctr_textures={"pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png",
|
|
||||||
"pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png","pipeworks_sand_tube_noctr.png"}
|
|
||||||
local sand_plain_textures={"pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png",
|
|
||||||
"pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png","pipeworks_sand_tube_plain.png"}
|
|
||||||
local sand_end_textures={"pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png",
|
|
||||||
"pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.png"}
|
|
||||||
local sand_short_texture="pipeworks_sand_tube_short.png"
|
|
||||||
local sand_inv_texture="pipeworks_sand_tube_inv.png"
|
|
||||||
|
|
||||||
if pipeworks.enable_sand_tube then
|
if pipeworks.enable_sand_tube then
|
||||||
pipeworks.register_tube("pipeworks:sand_tube","Sand pneumatic tube segment",sand_plain_textures,sand_noctr_textures,sand_end_textures,
|
local sand_noctr_textures = {"pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png",
|
||||||
sand_short_texture,sand_inv_texture,
|
"pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png"}
|
||||||
{groups={sand_tube=1}})
|
local sand_plain_textures = {"pipeworks_sand_tube_plain.png", "pipeworks_sand_tube_plain.png", "pipeworks_sand_tube_plain.png",
|
||||||
|
"pipeworks_sand_tube_plain.png", "pipeworks_sand_tube_plain.png", "pipeworks_sand_tube_plain.png"}
|
||||||
|
local sand_end_textures = {"pipeworks_sand_tube_end.png", "pipeworks_sand_tube_end.png", "pipeworks_sand_tube_end.png",
|
||||||
|
"pipeworks_sand_tube_end.png", "pipeworks_sand_tube_end.png", "pipeworks_sand_tube_end.png"}
|
||||||
|
local sand_short_texture = "pipeworks_sand_tube_short.png"
|
||||||
|
local sand_inv_texture = "pipeworks_sand_tube_inv.png"
|
||||||
|
|
||||||
minetest.register_abm({nodenames={"group:sand_tube"},interval=1,chance=1,
|
pipeworks.register_tube("pipeworks:sand_tube", "Sand pneumatic tube segment", sand_plain_textures, sand_noctr_textures, sand_end_textures,
|
||||||
action=function(pos, node, active_object_count, active_object_count_wider)
|
sand_short_texture, sand_inv_texture,
|
||||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 2)) do
|
{groups = {sand_tube = 1}})
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
|
||||||
if object:get_luaentity().itemstring ~= "" then
|
minetest.register_abm({nodenames = {"group:sand_tube"},
|
||||||
local titem=pipeworks.tube_item(pos,object:get_luaentity().itemstring)
|
interval = 1,
|
||||||
titem:get_luaentity().start_pos = {x=pos.x,y=pos.y-1,z=pos.z}
|
chance = 1,
|
||||||
titem:setvelocity({x=0.01,y=1,z=-0.01})
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
titem:setacceleration({x=0, y=0, z=0})
|
for _, object in ipairs(minetest.get_objects_inside_radius(pos, 2)) do
|
||||||
end
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
object:get_luaentity().itemstring = ""
|
if object:get_luaentity().itemstring ~= "" then
|
||||||
object:remove()
|
local titem = pipeworks.tube_item(pos,object:get_luaentity().itemstring)
|
||||||
end
|
titem:get_luaentity().start_pos = {x = pos.x, y = pos.y-1, z = pos.z}
|
||||||
end
|
titem:setvelocity({x = 0.01, y = 1, z = -0.01})
|
||||||
end
|
titem:setacceleration({x = 0, y = 0, z = 0})
|
||||||
|
end
|
||||||
|
object:get_luaentity().itemstring = ""
|
||||||
|
object:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local mese_sand_noctr_textures={"pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png",
|
|
||||||
"pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png","pipeworks_mese_sand_tube_noctr.png"}
|
|
||||||
local mese_sand_plain_textures={"pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png",
|
|
||||||
"pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png","pipeworks_mese_sand_tube_plain.png"}
|
|
||||||
local mese_sand_end_textures={"pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png",
|
|
||||||
"pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png","pipeworks_mese_sand_tube_end.png"}
|
|
||||||
local mese_sand_short_texture="pipeworks_mese_sand_tube_short.png"
|
|
||||||
local mese_sand_inv_texture="pipeworks_mese_sand_tube_inv.png"
|
|
||||||
|
|
||||||
if pipeworks.enable_mese_sand_tube then
|
if pipeworks.enable_mese_sand_tube then
|
||||||
pipeworks.register_tube("pipeworks:mese_sand_tube","Mese sand pneumatic tube segment",mese_sand_plain_textures,mese_sand_noctr_textures,mese_sand_end_textures,
|
local mese_sand_noctr_textures = {"pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png",
|
||||||
mese_sand_short_texture,mese_sand_inv_texture,
|
"pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png"}
|
||||||
{groups={mese_sand_tube=1},
|
local mese_sand_plain_textures = {"pipeworks_mese_sand_tube_plain.png", "pipeworks_mese_sand_tube_plain.png", "pipeworks_mese_sand_tube_plain.png",
|
||||||
on_construct = function(pos)
|
"pipeworks_mese_sand_tube_plain.png", "pipeworks_mese_sand_tube_plain.png", "pipeworks_mese_sand_tube_plain.png"}
|
||||||
local meta = minetest.env:get_meta(pos)
|
local mese_sand_end_textures = {"pipeworks_mese_sand_tube_end.png", "pipeworks_mese_sand_tube_end.png", "pipeworks_mese_sand_tube_end.png",
|
||||||
meta:set_int("dist", 0)
|
"pipeworks_mese_sand_tube_end.png", "pipeworks_mese_sand_tube_end.png", "pipeworks_mese_sand_tube_end.png"}
|
||||||
meta:set_string("formspec",
|
local mese_sand_short_texture = "pipeworks_mese_sand_tube_short.png"
|
||||||
"size[2,1]"..
|
local mese_sand_inv_texture = "pipeworks_mese_sand_tube_inv.png"
|
||||||
"field[.5,.5;1.5,1;dist;distance;${dist}]")
|
|
||||||
meta:set_string("infotext", "Mese sand pneumatic tube")
|
pipeworks.register_tube("pipeworks:mese_sand_tube", "Mese sand pneumatic tube segment", mese_sand_plain_textures, mese_sand_noctr_textures,
|
||||||
end,
|
mese_sand_end_textures, mese_sand_short_texture,mese_sand_inv_texture,
|
||||||
on_receive_fields=function(pos,formname,fields,sender)
|
{groups = {mese_sand_tube = 1},
|
||||||
local meta=minetest.env:get_meta(pos)
|
on_construct = function(pos)
|
||||||
local dist
|
local meta = minetest.env:get_meta(pos)
|
||||||
_, dist = pcall(tonumber, fields.dist)
|
meta:set_int("dist", 0)
|
||||||
if dist and 0 <= dist and dist <= 8 then meta:set_int("dist", dist) end
|
meta:set_string("formspec",
|
||||||
end,
|
"size[2,1]"..
|
||||||
|
"field[.5,.5;1.5,1;dist;distance;${dist}]")
|
||||||
|
meta:set_string("infotext", "Mese sand pneumatic tube")
|
||||||
|
end,
|
||||||
|
on_receive_fields = function(pos,formname,fields,sender)
|
||||||
|
local meta = minetest.env:get_meta(pos)
|
||||||
|
local dist
|
||||||
|
_, dist = pcall(tonumber, fields.dist)
|
||||||
|
if dist and 0 <= dist and dist <= 8 then meta:set_int("dist", dist) end
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local function get_objects_with_square_radius(pos, rad)
|
local function get_objects_with_square_radius(pos, rad)
|
||||||
rad = rad + .5;
|
rad = rad + .5;
|
||||||
local objs = {}
|
local objs = {}
|
||||||
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, math.sqrt(3)*rad)) do
|
for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, math.sqrt(3)*rad)) do
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
local opos = object:getpos()
|
local opos = object:getpos()
|
||||||
if pos.x - rad <= opos.x and opos.x <= pos.x + rad and pos.y - rad <= opos.y and opos.y <= pos.y + rad and pos.z - rad <= opos.z and opos.z <= pos.z + rad then
|
if pos.x - rad <= opos.x and opos.x <= pos.x + rad and pos.y - rad <= opos.y and opos.y <= pos.y + rad and pos.z - rad <= opos.z and opos.z <= pos.z + rad then
|
||||||
objs[#objs + 1] = object
|
objs[#objs + 1] = object
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return objs
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_abm({nodenames={"group:mese_sand_tube"},interval=1,chance=1,
|
|
||||||
action=function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
for _,object in ipairs(get_objects_with_square_radius(pos, minetest.env:get_meta(pos):get_int("dist"))) do
|
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
|
||||||
if object:get_luaentity().itemstring ~= "" then
|
|
||||||
local titem=pipeworks.tube_item(pos,object:get_luaentity().itemstring)
|
|
||||||
titem:get_luaentity().start_pos = {x=pos.x,y=pos.y-1,z=pos.z}
|
|
||||||
titem:setvelocity({x=0.01,y=1,z=-0.01})
|
|
||||||
titem:setacceleration({x=0, y=0, z=0})
|
|
||||||
end
|
|
||||||
object:get_luaentity().itemstring = ""
|
|
||||||
object:remove()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return objs
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_abm({nodenames = {"group:mese_sand_tube"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
|
for _,object in ipairs(get_objects_with_square_radius(pos, minetest.env:get_meta(pos):get_int("dist"))) do
|
||||||
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
|
if object:get_luaentity().itemstring ~= "" then
|
||||||
|
local titem = pipeworks.tube_item(pos, object:get_luaentity().itemstring)
|
||||||
|
titem:get_luaentity().start_pos = {x = pos.x, y = pos.y-1, z = pos.z}
|
||||||
|
titem:setvelocity({x = 0.01, y = 1, z = -0.01})
|
||||||
|
titem:setacceleration({x = 0, y = 0, z = 0})
|
||||||
|
end
|
||||||
|
object:get_luaentity().itemstring = ""
|
||||||
|
object:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -549,55 +550,55 @@ local function facedir_to_right_dir(facedir)
|
|||||||
|
|
||||||
--find the other directions
|
--find the other directions
|
||||||
local backdir = minetest.facedir_to_dir(facedir)
|
local backdir = minetest.facedir_to_dir(facedir)
|
||||||
local topdir = ({[0]={x=0, y=1, z=0},
|
local topdir = ({[0] = {x = 0, y = 1, z = 0},
|
||||||
{x=0, y=0, z=1},
|
{x = 0, y = 0, z = 1},
|
||||||
{x=0, y=0, z=-1},
|
{x = 0, y = 0, z = -1},
|
||||||
{x=1, y=0, z=0},
|
{x = 1, y = 0, z = 0},
|
||||||
{x=-1, y=0, z=0},
|
{x = -1, y = 0, z = 0},
|
||||||
{x=0, y=-1, z=0}})[math.floor(facedir/4)]
|
{x = 0, y = -1, z = 0}})[math.floor(facedir/4)]
|
||||||
|
|
||||||
--return a cross product
|
--return a cross product
|
||||||
return {x=topdir.y*backdir.z - backdir.y*topdir.z,
|
return {x = topdir.y*backdir.z - backdir.y*topdir.z,
|
||||||
y=topdir.z*backdir.x - backdir.z*topdir.x,
|
y = topdir.z*backdir.x - backdir.z*topdir.x,
|
||||||
z=topdir.x*backdir.y - backdir.x*topdir.y}
|
z = topdir.x*backdir.y - backdir.x*topdir.y}
|
||||||
end
|
end
|
||||||
|
|
||||||
if pipeworks.enable_one_way_tube then
|
if pipeworks.enable_one_way_tube then
|
||||||
minetest.register_node("pipeworks:one_way_tube", {
|
minetest.register_node("pipeworks:one_way_tube", {
|
||||||
description = "One way tube",
|
description = "One way tube",
|
||||||
tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png",
|
tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png",
|
||||||
"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"},
|
"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
node_box = {type="fixed",
|
node_box = {type="fixed",
|
||||||
fixed = {{-1/2, -9/64, -9/64, 1/2, 9/64, 9/64}}},
|
fixed = {{-1/2, -9/64, -9/64, 1/2, 9/64, 9/64}}},
|
||||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1},
|
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
end,
|
end,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
end,
|
end,
|
||||||
tube={connect_sides={left=1, right=1},
|
tube = {connect_sides = {left = 1, right = 1},
|
||||||
can_go=function(pos,node,velocity,stack)
|
can_go = function(pos, node, velocity, stack)
|
||||||
return velocity
|
return velocity
|
||||||
end,
|
end,
|
||||||
insert_object = function(pos,node,stack,direction)
|
insert_object = function(pos, node, stack, direction)
|
||||||
item1=pipeworks.tube_item(pos,stack)
|
item1 = pipeworks.tube_item(pos, stack)
|
||||||
item1:get_luaentity().start_pos = pos
|
item1:get_luaentity().start_pos = pos
|
||||||
item1:setvelocity({x=direction.x*direction.speed, y=direction.y*direction.speed, z=direction.z*direction.speed})
|
item1:setvelocity({x = direction.x*direction.speed, y = direction.y*direction.speed, z = direction.z*direction.speed})
|
||||||
item1:setacceleration({x=0, y=0, z=0})
|
item1:setacceleration({x = 0, y = 0, z = 0})
|
||||||
return ItemStack("")
|
return ItemStack("")
|
||||||
end,
|
end,
|
||||||
can_insert=function(pos,node,stack,direction)
|
can_insert = function(pos, node, stack, direction)
|
||||||
local dir = facedir_to_right_dir(node.param2)
|
local dir = facedir_to_right_dir(node.param2)
|
||||||
if dir.x == direction.x and dir.y == direction.y and dir.z == direction.z then
|
if dir.x == direction.x and dir.y == direction.y and dir.z == direction.z then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end},
|
end},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user