1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-21 02:37:48 +00:00

proxy apis over wireless

This commit is contained in:
kepler155c@gmail.com
2017-10-24 23:01:40 -04:00
parent 84b2b8ce63
commit 7fd93e8a8b
7 changed files with 63 additions and 13 deletions

View File

@@ -24,6 +24,9 @@ function Routine:terminate()
end
function Routine:resume(event, ...)
if coroutine.status(self.co) == 'running' then
return
end
if not self.co then
error('Cannot resume a dead routine')

View File

@@ -148,7 +148,15 @@ end
function Point.adjacentPoints(pt)
local pts = { }
for _, hi in pairs(_G.turtle.getHeadings()) do
local headings = {
[ 0 ] = { xd = 1, zd = 0, yd = 0, heading = 0, direction = 'east' },
[ 1 ] = { xd = 0, zd = 1, yd = 0, heading = 1, direction = 'south' },
[ 2 ] = { xd = -1, zd = 0, yd = 0, heading = 2, direction = 'west' },
[ 3 ] = { xd = 0, zd = -1, yd = 0, heading = 3, direction = 'north' },
[ 4 ] = { xd = 0, zd = 0, yd = 1, heading = 4, direction = 'up' },
[ 5 ] = { xd = 0, zd = 0, yd = -1, heading = 5, direction = 'down' }
}
for _, hi in pairs(headings) do
table.insert(pts, { x = pt.x + hi.xd, y = pt.y + hi.yd, z = pt.z + hi.zd })
end