notvel function can't be local - made global and confined to pipeworks.{}

This commit is contained in:
Vanessa Ezekowitz 2013-12-15 16:05:35 -05:00
parent a4a74413c0
commit 41ce9be8f3
2 changed files with 5 additions and 5 deletions

View File

@ -222,7 +222,7 @@ end
local adjlist={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=-1,y=0,z=0}} local adjlist={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=1,y=0,z=0},{x=-1,y=0,z=0}}
local function notvel(tbl,vel) function pipeworks.notvel(tbl,vel)
local tbl2={} local tbl2={}
for _,val in ipairs(tbl) do for _,val in ipairs(tbl) do
if val.x~=-vel.x or val.y~=-vel.y or val.z~=-vel.z then table.insert(tbl2,val) end if val.x~=-vel.x or val.y~=-vel.y or val.z~=-vel.z then table.insert(tbl2,val) end
@ -255,7 +255,7 @@ local function go_next(pos,velocity,stack)
if minetest.registered_nodes[cnode.name] and minetest.registered_nodes[cnode.name].tube and minetest.registered_nodes[cnode.name].tube.can_go then if minetest.registered_nodes[cnode.name] and minetest.registered_nodes[cnode.name].tube and minetest.registered_nodes[cnode.name].tube.can_go then
can_go=minetest.registered_nodes[cnode.name].tube.can_go(pos,node,vel,stack) can_go=minetest.registered_nodes[cnode.name].tube.can_go(pos,node,vel,stack)
else else
can_go=notvel(adjlist,vel) can_go=pipeworks.notvel(adjlist,vel)
end end
local meta = nil local meta = nil
for _,vect in ipairs(can_go) do for _,vect in ipairs(can_go) do

View File

@ -341,7 +341,7 @@ if pipeworks.enable_detector_tube then
local nitems=meta:get_int("nitems")+1 local nitems=meta:get_int("nitems")+1
meta:set_int("nitems", nitems) meta:set_int("nitems", nitems)
minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos) minetest.after(0.1,minetest.registered_nodes[name].item_exit,pos)
return notvel(pipeworks.meseadjlist,velocity) return pipeworks.notvel(pipeworks.meseadjlist,velocity)
end}, end},
groups={mesecon=2,not_in_creative_inventory=1}, groups={mesecon=2,not_in_creative_inventory=1},
drop="pipeworks:detector_tube_off_000000", drop="pipeworks:detector_tube_off_000000",
@ -371,7 +371,7 @@ if pipeworks.enable_detector_tube then
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
minetest.set_node(pos,{name=string.gsub(name,"off","on")}) minetest.set_node(pos,{name=string.gsub(name,"off","on")})
mesecon:receptor_on(pos,mesecons_rules) mesecon:receptor_on(pos,mesecons_rules)
return notvel(pipeworks.meseadjlist,velocity) return pipeworks.notvel(pipeworks.meseadjlist,velocity)
end}, end},
groups={mesecon=2}, groups={mesecon=2},
mesecons={receptor={state="off", mesecons={receptor={state="off",
@ -428,7 +428,7 @@ if pipeworks.enable_accelerator_tube then
accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture, accelerator_noctr_textures,accelerator_end_textures,accelerator_short_texture,accelerator_inv_texture,
{tube={can_go=function(pos,node,velocity,stack) {tube={can_go=function(pos,node,velocity,stack)
velocity.speed=velocity.speed+1 velocity.speed=velocity.speed+1
return notvel(pipeworks.meseadjlist,velocity) return pipeworks.notvel(pipeworks.meseadjlist,velocity)
end} end}
}) })
end end