local-ize a couple of variables, code style fixes

master
Vanessa Ezekowitz 2013-12-21 03:45:45 -05:00
parent e1435b1c2f
commit e5344edf98
1 changed files with 17 additions and 15 deletions

View File

@ -68,21 +68,23 @@ local teleport_short_texture="pipeworks_teleport_tube_short.png"
local teleport_inv_texture="pipeworks_teleport_tube_inv.png" local teleport_inv_texture="pipeworks_teleport_tube_inv.png"
pipeworks.register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",teleport_plain_textures, pipeworks.register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",teleport_plain_textures,
teleport_noctr_textures,teleport_end_textures,teleport_short_texture,teleport_inv_texture, teleport_noctr_textures,teleport_end_textures,teleport_short_texture,teleport_inv_texture, {
{tube={can_go=function(pos,node,velocity,stack) tube = {
velocity.x=0 can_go = function(pos,node,velocity,stack)
velocity.y=0 velocity.x = 0
velocity.z=0 velocity.y = 0
local meta = minetest.get_meta(pos) velocity.z = 0
channel=meta:get_string("channel") local meta = minetest.get_meta(pos)
local target=get_tubes_in_file(pos,channel) local channel = meta:get_string("channel")
if target[1]==nil then return {} end local target = get_tubes_in_file(pos,channel)
d=math.random(1,#target) if target[1] == nil then return {} end
pos.x=target[d].x local d = math.random(1,#target)
pos.y=target[d].y pos.x = target[d].x
pos.z=target[d].z pos.y = target[d].y
return pipeworks.meseadjlist pos.z = target[d].z
end}, return pipeworks.meseadjlist
end
},
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("channel","") meta:set_string("channel","")