Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function side()
- for i,v in pairs(peripheral.getNames()) do
- if peripheral.getType(v) == "quadbase" then
- return v
- end
- end
- end
- function gotoCoords(x,y,z,fromPosx,fromPosy,fromPosz)
- if gps.locate() ~= nil and side() == "top" then
- local a,b,c = gps.locate()
- fromPosx = a
- fromPosy = b + 2
- fromPosz = c
- end
- local program = {}
- table.insert(program,"up "..tostring(150 - fromPosy))
- table.insert(program,"east "..tostring(fromPosx - x))
- table.insert(program,"north "..tostring(fromPosz - z))
- table.insert(program,"down "..tostring(150 - y))
- return program
- end
- function qReturn(tCode,x,y,z,fromPosx,fromPosy,fromPosz)
- if gps.locate() ~= nil and side() == "top" then
- local a,b,c = gps.locate()
- x = a
- y = b + 2
- z = c
- end
- local program = tCode
- table.insert(program,"up "..tostring(150 - fromPosy))
- table.insert(program,"east "..tostring(fromPosx - x))
- table.insert(program,"north "..tostring(fromPosz - z))
- table.insert(program,"down "..tostring(150 - y))
- return program
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement