Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI('signToDir.lua')
- tileTable = {['31'] = 1, ['13'] = 1, ['24'] = 2, ['42'] = 2, ['23'] = 3, ['32'] = 3, ['34'] = 4, ['43'] = 4, ['12'] = 5, ['21'] = 5, ['14'] = 6, ['41'] = 6}
- openTurtles = {}
- activeTurtles = {}
- jobs = {}
- activeJobs = {}
- tiles = {}
- homeX = 27
- homeY = 48
- local function printUsage()
- print( "Usages:" )
- print( "tunnelbot <startX> <startZ> <endX> <endZ>" )
- end
- local tArgs = { ... }
- if #tArgs < 1 then
- printUsage()
- return
- end
- function tunnelChunk(sx, sy, tx, ty)
- -- Generate jobs
- -- Get next position
- x = sx
- y = sy
- prevX = x
- prevY = y
- prevDirX = 1
- prevDirY = 1
- prevDir = 3
- while (x ~= tx or y ~= ty) do
- if x ~= tx then
- dirX = (tx - x) / math.abs(tx - x)
- end
- if y ~= ty then
- dirY = (ty - y) / math.abs(ty - y)
- end
- dir = 1
- prevX = x
- prevY = y
- if tiles[x..','..y + dirY] ~= null or x == tx then
- y = y + dirY
- dir = signToDir.toDirY(dirY)
- else
- x = x + dirX
- dir = signToDir.toDirX(dirY)
- end
- -- Choose tile
- print('')
- print("dirX: "..dirX)
- print("dirY: "..dirY)
- print("dir: "..dir)
- print("prevDir: "..prevDir)
- print("X: "..x)
- print("Y: "..y)
- print("Tile: "..tileTable[prevDir..dir])
- prevDir = dir
- end
- -- Use last and next position to choose tile
- -- If tile is same as existing dont create job
- print(jobs)
- -- Assign jobs
- end
- tunnelChunk(0, 0, 1, 1)
- --tunnelChunk(tArgs[1], tArgs[2], tArgs[3], tArgs[4])
Add Comment
Please, Sign In to add comment