Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------
- -- Bundt API (Turtle) --
- ------------------------
- -- Set up variables
- local modems = peripheral.find("modem")
- local tModem = modems
- tModem.open(8)
- local nServer = rednet.lookup("Map Server")
- local sConfigPath = "Bundt.Configuration"
- local sPositionPath = "Bundt.pos"
- local sMapPath = "BundtMap/"
- local sLabel = os.getComputerLabel() or "the turtle"
- local tCompass = {[0] = "south", [1] = "west", [2] = "north", [3] = "east"}
- local tMap = {}
- local tConfig = {}
- local tCurrentPos = {}
- -- localize some functions
- local serialize = textutils.serialize
- local unserialize = textutils.unserialize
- -- Local functions. --
- local function saveToFile(tTableToSave, sPath)
- local hFile = fs.open(sPath, "w")
- if type(hFile) == "table" then
- hFile.write(serialize(tTableToSave))
- hFile.close()
- return true
- end
- return false, hFile
- end
- local function loadFromFile(sPath)
- local hFile, value = fs.open(sPath, "r"), false
- if type(hFile) == "table" then
- value = hFile.readAll()
- value = unserialize(value)
- hFile.close()
- return value
- end
- return false, hFile
- end
- -- Attempts to obtain the position from the gps.
- function obtainPositionFromGPS()
- if gps then
- print("Obtaining position from the GPS...")
- local x, y, z = gps.locate(4)
- if x then
- print("Detected position from GPS.")
- print("X: "..x..", Y:"..y..", Z:"..z)
- print("If this is the correct position, press enter to save this value.")
- print("If this is incorrect press space to type in the correct position yourself.")
- while true do
- local event, nKeyPressed = os.pullEvent("key")
- if nKeyPressed == keys.enter then
- break
- elseif nKeyPressed == keys.space then
- return false
- end
- end
- tCurrentPos["x"], tCurrentPos["z"] = math.floor(x), math.floor(z)
- tCurrentPos["y"] = math.floor(y)
- return true
- end
- end
- return false
- end
- function obtainRotationFromGPS()
- if turtle.getFuelLevel() > 1 then
- if gps then
- print("Obtaining rotation from the GPS...")
- local x, y, z = gps.locate(4)
- if not x then
- return false
- end
- local x2, y2, z2 = 0, 0, 0
- for k=1, 4 do
- if turtle.forward(1) == true then
- x2, y2, z2 = gps.locate(1)
- sleep(.5)
- turtle.back(1)
- break
- else
- turtle.turnLeft()
- end
- end
- if not x2 then
- return false
- end
- -- Detect rotation.
- local nFacing = false
- if x ~= x2 and z ~= z2 then
- print("The position the GPS sent is incorrect.")
- return false
- end
- if x > x2 then
- print("x > x2")
- nFacing = 1
- elseif x < x2 then
- print("x < x2")
- nFacing = 3
- end
- if z > z2 then
- print("z > z2")
- nFacing = 2
- elseif z < z2 then
- print("z < z2")
- nFacing = 0
- end
- print("Detected which way "..sLabel.." is facing from GPS.")
- print("Facing direction "..nFacing.." ("..tostring(tCompass[nFacing])..")")
- print("If this turtle is actually facing "..tCompass[nFacing]..", press enter.")
- print("If this is not true press space to type in the correct direction yourself.")
- while true do
- local event, nKeyPressed = os.pullEvent("key")
- if nKeyPressed == keys.enter then
- break
- elseif nKeyPressed == keys.space then
- return false
- end
- end
- tCurrentPos["facing"] = nFacing
- return true
- end
- end
- return false
- end
- function askForPosition()
- term.setCursorPos(1, 1)
- term.clear()
- print("Please stand on top of "..(os.getComputerLabel() or " the turtle ").." and press F3.")
- print("Type in the position shown in the top left corner of the screen.")
- local x, y, z
- -- Ask the user to type in the correct position.
- term.write("x: ")
- while not x do
- x = tonumber(read())
- end
- term.write("y: ")
- while not y do
- y = tonumber(read())
- end
- term.write("z: ")
- while not z do
- z = tonumber(read())
- end
- tCurrentPos["x"], tCurrentPos["z"] = math.floor(x), math.floor(z)
- tCurrentPos["y"] = math.floor(y)
- end
- function askForRotation()
- term.setCursorPos(1, 1)
- term.clear()
- print("Press F3 and face south according to the debug menu.")
- tCurrentPos["facing"] = nFacing
- while true do
- print("If this turtle is facing you, press enter.")
- print("Else press space to make the turtle turn left.")
- local event, nKeyPressed = os.pullEvent("key")
- if nKeyPressed == keys.enter then
- break
- elseif nKeyPressed == keys.space then
- print("Turning left...")
- turtle.turnLeft()
- end
- end
- tCurrentPos["facing"] = 2
- end
- -- Global functions. --
- -- Reloads the configuration.
- function loadConfig()
- tConfig = loadFromFile(sConfigPath) or tConfig
- return tConfig
- end
- -- Reloads the position.
- function loadPosition()
- local vLoaded, err = loadFromFile(sPositionPath)
- if vLoaded == false then
- print(err)
- return false
- end
- tCurrentPos = vLoaded
- return tCurrentPos
- end
- -- Saves the configuration to the hard disk.
- function saveConfig()
- return saveToFile(tConfig, sConfigPath)
- end
- -- Saves the position to the hard disk.
- function savePosition()
- return saveToFile(tCurrentPos, sPositionPath)
- end
- -- Returns the current turtle position.
- function getTurtlePosition()
- if tCurrentPos["x"] then
- return tCurrentPos["x"], tCurrentPos["y"], tCurrentPos["z"]
- else
- loadPosition()
- if not tCurrentPos["x"] then
- if not obtainPositionFromGPS() then
- local ok, err = pcall(askForPosition)
- if not ok then
- error("Failed to ask for position!", 0)
- end
- end
- end
- savePosition()
- end
- return tCurrentPos["x"], tCurrentPos["y"], tCurrentPos["z"]
- end
- -- Returns the current turtle rotation.
- function getTurtleRotation()
- if tCurrentPos["facing"] then
- return tCurrentPos["facing"], tCompass[tCurrentPos["facing"]]
- else
- loadPosition()
- if not tCurrentPos["facing"] then
- if not obtainRotationFromGPS() then
- local ok, err = pcall(askForRotation)
- if not ok then
- error("Failed to ask for rotation!", 0)
- end
- end
- end
- savePosition()
- end
- return tCurrentPos["facing"], tCompass[tCurrentPos["facing"]]
- end
- -- Returns what direction the turtle is facing.
- function getTurtleDirection()
- local v1, v2 = getTurtleRotation()
- return v2
- end
- function faceDirection(direction)
- if getTurtleRotation() - direction < 0 then
- while getTurtleRotation() ~= direction do
- turtle.turnLeft()
- end
- else
- while getTurtleRotation() ~= direction do
- turtle.turnRight()
- end
- end
- end
- -- Moves the turtle north.
- function moveNorth(spaces)
- if not tCurrentPos["facing"] then
- getTurtleRotation()
- end
- faceDirection(2)
- turtle.forward(spaces)
- end
- -- Moves the turtle south.
- function moveSouth(spaces)
- if not tCurrentPos["facing"] then
- getTurtleRotation()
- end
- faceDirection(0)
- turtle.forward(spaces)
- end
- -- Moves the turtle west.
- function moveWest(spaces)
- if not tCurrentPos["facing"] then
- getTurtleRotation()
- end
- faceDirection(1)
- turtle.forward(spaces)
- end
- -- Moves the turtle east.
- function moveEast(spaces)
- if not tCurrentPos["facing"] then
- getTurtleRotation()
- end
- faceDirection(3)
- turtle.forward(spaces)
- end
- function goTo(x, y, z)
- local xOld, yOld, zOld = getTurtlePosition()
- if y > yOld then
- turtle.up(y - yOld)
- elseif y < yOld then
- turtle.down(yOld - y)
- end
- if x > xOld then
- moveEast(x - xOld)
- elseif x < xOld then
- moveWest(xOld - x)
- end
- if z > zOld then
- moveNorth(z - zOld)
- elseif x < xOld then
- moveSouth(zOld - z)
- end
- end
- function getBlockPosInFront()
- local direction = getTurtleRotation()
- local x, y, z = getTurtlePosition()
- if direction == 3 then
- x = x + 1
- elseif direction == 1 then
- x = x - 1
- elseif direction == 2 then
- z = z + 1
- elseif direction == 0 then
- z = z - 1
- end
- return x, y, z
- end
- function getBlockPosInBack()
- local direction = getTurtleRotation()
- local x, y, z = getTurtlePosition()
- if direction == 3 then
- x = x - 1
- elseif direction == 1 then
- x = x + 1
- elseif direction == 2 then
- z = z - 1
- elseif direction == 0 then
- z = z + 1
- end
- return x, y, z
- end
- -- Map API --
- local nDiv16 = 1/16
- tMap.terrain = {}
- tMap.legend = {}
- tMap.serializeLegend = {}
- function makeNewEntryInLegend(sCodeName, sMeta, sName, drawColor)
- if not tMap.legend[sCodeName] then
- tMap.legend[sCodeName] = {}
- end
- tMap.legend[sCodeName][tonumber(sMeta) or 0] = {#tMap.serializeLegend + 1, sName, drawColor}
- tMap.serializeLegend[#tMap.serializeLegend + 1] = {sCodeName, sMeta, sName, drawColor}
- end
- local white, orange, magenta, lightBlue, yellow, lime, pink, gray, lightGray, cyan, purple, blue, brown, green, red, black = colors.white, colors.orange, colors.magenta, colors.lightBlue, colors.yellow, colors.lime, colors.pink, colors.gray, colors.lightGray, colors.cyan, colors.purple, colors.blue, colors.brown, colors.green, colors.red, colors.black
- local buildEntries = {
- {"minecraft:stone", 0, "Stone", lightGray},
- {"minecraft:grass", 0, "Grass Block", green},
- {"minecraft:dirt", 0, "Dirt", brown},
- {"minecraft:dirt", 2, "Podzol", brown},
- {"minecraft:cobblestone", 0, "Cobblestone", gray},
- {"minecraft:planks", 0, "Oak Wood Planks", yellow},
- {"minecraft:planks", 1, "Spruce Wood Planks", brown},
- {"minecraft:planks", 2, "Birch Wood Planks", yellow},
- {"minecraft:planks", 3, "Jungle Wood Planks", brown},
- {"minecraft:planks", 4, "Acacia Wood Planks", red},
- {"minecraft:planks", 5, "Dark Oak Wood Planks", brown},
- {"minecraft:sapling", 0, "Oak Sapling", yellow},
- {"minecraft:bedrock", 0, "Bedrock", gray},
- {"minecraft:flowing_water", 0, "Water", blue},
- {"minecraft:flowing_lava", 0, "Lava", red},
- {"minecraft:sand", 0, "Sand", yellow},
- {"minecraft:sand", 1, "Red Sand", red},
- {"minecraft:gravel", 0, "Gravel", lightGray},
- {"minecraft:gold_ore", 0, "Gold Ore", yellow},
- {"minecraft:iron_ore", 0, "Iron Ore", brown},
- {"minecraft:coal_ore", 0, "Coal Ore", black},
- {"minecraft:log", 0, "Oak Wood", brown},
- {"minecraft:log", 1, "Spruce Wood", brown},
- {"minecraft:log", 2, "Birch Wood", white},
- {"minecraft:log", 3, "Jungle Wood", brown},
- {"minecraft:leaves", 0, "Oak Leaves", green},
- {"minecraft:leaves", 1, "Spruce Leaves", green},
- {"minecraft:leaves", 2, "Birch Leaves", green},
- {"minecraft:leaves", 3, "Jungle Leaves", green},
- {"minecraft:sponge", 0, "Sponge", yellow},
- {"minecraft:glass", 0, "Glass", lightBlue},
- {"minecraft:lapis_ore", 0, "Lapis Lazuli Ore", blue},
- {"minecraft:lapis_block", 0, "Lapis Lazuli Block", blue},
- {"minecraft:dispenser", 0, "Dispenser", yellow},
- {"minecraft:diamond_ore", 0, "Diamond Ore", cyan},
- {"ComputerCraft:CC-Computer", 0, "Computer", lightGray},
- {"ComputerCraft:CC-Computer", 13, "Advanced Computer", yellow},
- {"ComputerCraft:command_computer", 0, "Command Computer", brown},
- }
- for k, v in ipairs(buildEntries) do
- makeNewEntryInLegend(v[1], v[2], v[3], v[4])
- end
- function getChunk(x, y, z)
- if not tMap.terrain[x] then tMap.terrain[x] = {} end
- if not tMap.terrain[x][y] then tMap.terrain[x][y] = {} end
- if not tMap.terrain[x][y][z] then loadChunk(x, y, z) end
- if not tMap.terrain[x][y][z] then tMap.terrain[x][y][z] = {} end
- return tMap.terrain[x][y][z]
- end
- function getChunkWithBlock(x, y, z)
- x, y, z = x - (math.floor(x*nDiv16)*16), y - (math.floor(y*nDiv16)*16), z - (math.floor(z*nDiv16)*16)
- if not tMap.terrain[x] then tMap.terrain[x] = {} end
- if not tMap.terrain[x][y] then tMap.terrain[x][y] = {} end
- if not tMap.terrain[x][y][z] then loadChunk(x, y, z) end
- if not tMap.terrain[x][y][z] then tMap.terrain[x][y][z] = {} end
- return tMap.terrain[x][y][z]
- end
- function getChunkCorWithBlock(x, y, z)
- return math.floor(x*nDiv16), math.floor(y*nDiv16), math.floor(z*nDiv16)
- end
- function getBlock(x, y, z)
- local tChunk = getChunk(math.floor(x*nDiv16), math.floor(y*nDiv16), math.floor(z*nDiv16))
- local x2, y2, z2 = x - (math.floor(x*nDiv16)*16), y - (math.floor(y*nDiv16)*16), z - (math.floor(z*nDiv16)*16)
- if not tChunk[x2] then tChunk[x2] = {} end
- if not tChunk[x2][y2] then tChunk[x2][y2] = {} end
- if not tChunk[x2][y2][z2] then
- tChunk[x2][y2][z2] = 1
- end
- return tChunk[x2][y2][z2]
- end
- function getBlockWithinChunk(x, y, z, bx, by, bz)
- local tChunk = tMap.terrain[x][y][z]
- return tChunk[bx][by][bz]
- end
- function getLegendID(t)
- local sCodeName, nMetadata = t["name"], t["metadata"]
- if tMap.legend[sCodeName] then
- if tMap.legend[sCodeName][nMetadata] then
- return tMap.legend[sCodeName][nMetadata][1]
- end
- return tMap.legend[sCodeName][0][1]
- end
- end
- function updateBlock(x, y, z, t)
- local tChunk = getChunk(math.floor(x*nDiv16), math.floor(y*nDiv16), math.floor(z*nDiv16))
- local x2, y2, z2 = x - (math.floor(x*nDiv16)*16), y - (math.floor(y*nDiv16)*16), z - (math.floor(z*nDiv16)*16)
- if not tChunk[x2] then tChunk[x2] = {} end
- if not tChunk[x2][y2] then tChunk[x2][y2] = {} end
- if not tChunk[x2][y2][z2] then
- tChunk[x2][y2][z2] = 1
- end
- tChunk[x2][y2][z2] = getLegendID(t)
- return tBlock
- end
- -- Scanning functions --
- -- These functions scan blocks and update the map with the new information.
- function scanBlockInFront()
- local dx, dy, dz = getBlockPosInFront()
- local isOk, tInspectedBlock = turtle.inspect()
- updateBlock(dx, dy, dz, tInspectedBlock)
- local tBlock = getBlock(dx, dy, dz)
- return dx, dy, dz, tBlock
- end
- function scanBlockBehind()
- local dx, dy, dz = getBlockPosInBack()
- turtle.turnLeft()
- turtle.turnLeft()
- local isOk, tInspectedBlock = turtle.inspect()
- updateBlock(dx, dy, dz, tInspectedBlock)
- local tBlock = getBlock(dx, dy, dz)
- turtle.turnLeft()
- turtle.turnLeft()
- return dx, dy, dz, tBlock
- end
- function scanBlockAbove()
- local dx, dy, dz = getTurtlePosition()
- dy = dy + 1
- local isOk, tInspectedBlock = turtle.inspectUp()
- updateBlock(dx, dy, dz, tInspectedBlock)
- local tBlock = getBlock(dx, dy, dz)
- return dx, dy, dz, tBlock
- end
- function scanBlockBelow()
- local dx, dy, dz = getTurtlePosition()
- dy = dy - 1
- local isOk, tInspectedBlock = turtle.inspectDown()
- updateBlock(dx, dy, dz, tInspectedBlock)
- local tBlock = getBlock(dx, dy, dz)
- return dx, dy, dz, tBlock
- end
- -- This function scans all six blocks intersecting the turtle.
- function scanBlocksNearby(suppressSaving)
- for k=1, 4 do
- scanBlockInFront()
- turtle.turnLeft()
- end
- scanBlockAbove()
- scanBlockBelow()
- if not suppressSaving then
- saveChunk(getChunkCorWithBlock(getTurtlePosition()))
- end
- end
- -- Scans the area.
- function scanChunk(x, y, z)
- if not x then
- x, y, z = getTurtlePosition()
- end
- local nChunkX, nChunkY, nChunkZ = math.floor(x*nDiv16), math.floor(y*nDiv16), math.floor(z*nDiv16)
- local nStartX, nStartY, nStartZ = math.floor(x*nDiv16)*16, math.floor(y*nDiv16)*16, math.floor(z*nDiv16)*16
- local tChunk = getChunk(nChunkX, nChunkY, nChunkZ)
- goTo(nStartX, nStartY, nStartZ)
- for ky=0, 15 do
- for kx=0, 15 do
- if not tChunk[kx] then
- tChunk[kx] = {}
- end
- if not tChunk[kx][ky] then
- tChunk[kx][ky] = {}
- end
- for kz=0, 15 do
- goTo(nStartX + kx, nStartY + ky, nStartZ + kz)
- scanBlocksNearby(true)
- end
- end
- end
- saveChunk(x, y, z)
- end
- function getBlockName(id, metadata)
- if type(id) == "number" then
- return tMap.serializeLegend[id][3]
- else
- return tMap.legend[id][metadata][3]
- end
- end
- function getBlockColor(id, metadata)
- if type(id) == "number" then
- return tMap.serializeLegend[id][4]
- else
- return tMap.legend[id][metadata][4]
- end
- end
- function drawBlockInMap(x, y, z)
- local id = tonumber(getBlock(x, y, z)) or 1
- if not type(id) == "number" then id = 1 end
- if not tMap.serializeLegend[id or 1] then return false end
- local color = tMap.serializeLegend[id or 1][4] or colors.blue
- term.setBackgroundColor(color)
- term.write(" ")
- end
- -- Loads a terrain chunk.
- function loadChunk(x, y, z)
- local hFile = fs.open(sMapPath..x.."y"..y.."z"..z, "r")
- local m1, m2 = 16*16, 16*16*16
- if hFile then
- local sChunk = hFile.readAll()
- hFile.close()
- if not tMap.terrain[x] then tMap.terrain[x] = {} end
- if not tMap.terrain[x][y] then tMap.terrain[x][y] = {} end
- if not tMap.terrain[x][y][z] then tMap.terrain[x][y][z] = {} end
- local tChunk = tMap.terrain[x][y][z]
- for kx=1, 16 do
- tChunk[kx] = {}
- for ky=1, 16 do
- tChunk[kx][ky] = {}
- for kz=1, 16 do
- local begin = ((kx - 1)*m2) + (ky - 1)*m1 + kz - 1*4
- tChunk[kx][ky][kz] = tonumber(string.sub(sChunk, begin, begin + 4))
- end
- end
- end
- elseif nServer then
- rednet.send(nServer, textutils.serialize({x, y, z}), "Load Map")
- if not tMap.terrain[x] then tMap.terrain[x] = {} end
- if not tMap.terrain[x][y] then tMap.terrain[x][y] = {} end
- local senderId, message = rednet.recieve("Reply", 20)
- tMap.terrain[x][y][z] = textutils.unserialize(message)
- end
- end
- function padString(str)
- if #str >= 4 then
- return string.sub(str, 0, 4)
- end
- return string.rep("0", 4 - #str)..str
- end
- function saveChunk(x, y, z)
- local tChunk = getChunk(x, y, z)
- for kx=1, 16 do
- if not tChunk[kx] then tChunk[kx] = {} end
- for ky=1, 16 do
- if not tChunk[kx][ky] then tChunk[kx][ky] = {} end
- for kz=1, 16 do
- if not tChunk[kx][ky][kz] then tChunk[kx][ky][kz] = 0 end
- end
- end
- end
- local hFile = fs.open(sMapPath..x.."y"..y.."z"..z, "w")
- if hFile then
- for kx, vx in ipairs(tChunk) do
- for ky, vy in ipairs(vx) do
- for kz, vz in ipairs(vy) do
- hFile.write(padString(tostring(vz)) or "0000")
- end
- end
- end
- hFile.close()
- end
- if nServer then
- for k=1, 2 do
- sleep()
- rednet.send(nServer, textutils.serialize({tChunk, x, y, z}), "Update Map")
- end
- end
- end
- -- Override the turtle API --
- local forward = turtle.forward
- local back = turtle.back
- local up = turtle.up
- local down = turtle.down
- local turnLeft = turtle.turnLeft
- local turnRight = turtle.turnRight
- function turtle.forward(spaces)
- spaces = spaces or 1
- if tCurrentPos["x"] and tCurrentPos["facing"] then
- local spacesMoved, err = 0
- for k=1, spaces do
- err = forward(1)
- if not err then
- break
- end
- spacesMoved = spacesMoved + 1
- end
- if tCurrentPos["facing"] == 0 then
- tCurrentPos["z"] = tCurrentPos["z"] - spacesMoved
- elseif tCurrentPos["facing"] == 2 then
- tCurrentPos["z"] = tCurrentPos["z"] + spacesMoved
- end
- if tCurrentPos["facing"] == 1 then
- tCurrentPos["x"] = tCurrentPos["x"] - spacesMoved
- elseif tCurrentPos["facing"] == 3 then
- tCurrentPos["x"] = tCurrentPos["x"] + spacesMoved
- end
- savePosition()
- return err, spacesMoved
- else
- return forward(spaces)
- end
- end
- function turtle.back(spaces)
- spaces = spaces or 1
- if tCurrentPos["x"] and tCurrentPos["facing"] then
- local spacesMoved, err = 0
- for k=1, spaces do
- err = back(1)
- if not err then
- break
- end
- spacesMoved = spacesMoved + 1
- end
- if tCurrentPos["facing"] == 0 then
- tCurrentPos["z"] = tCurrentPos["z"] + spacesMoved
- elseif tCurrentPos["facing"] == 2 then
- tCurrentPos["z"] = tCurrentPos["z"] - spacesMoved
- end
- if tCurrentPos["facing"] == 1 then
- tCurrentPos["x"] = tCurrentPos["x"] + spacesMoved
- elseif tCurrentPos["facing"] == 3 then
- tCurrentPos["x"] = tCurrentPos["x"] - spacesMoved
- end
- savePosition()
- return err, spacesMoved
- else
- return back(spaces)
- end
- end
- function turtle.up(spaces)
- spaces = spaces or 1
- if tCurrentPos["x"] then
- local spacesMoved, err = 0
- for k=1, spaces do
- err = up(1)
- if not err then
- break
- end
- spacesMoved = spacesMoved + 1
- end
- tCurrentPos["y"] = tCurrentPos["y"] + spacesMoved
- savePosition()
- return err, spacesMoved
- else
- return up(spaces)
- end
- end
- function turtle.down(spaces)
- spaces = spaces or 1
- if tCurrentPos["x"] then
- local spacesMoved, err = 0
- for k=1, spaces do
- err = down(1)
- if not err then
- break
- end
- spacesMoved = spacesMoved - 1
- end
- tCurrentPos["y"] = tCurrentPos["y"] + spacesMoved
- savePosition()
- return err, spacesMoved
- else
- return down(spaces)
- end
- end
- function turtle.turnLeft(spaces)
- spaces = spaces or 1
- if tCurrentPos["facing"] then
- err = turnLeft()
- if tCurrentPos["facing"] == 3 then
- tCurrentPos["facing"] = 0
- else
- tCurrentPos["facing"] = tCurrentPos["facing"] + 1
- end
- savePosition()
- return err, spacesMoved
- else
- return turnLeft(spaces)
- end
- end
- function turtle.turnRight(spaces)
- spaces = spaces or 1
- if tCurrentPos["facing"] then
- err = turnRight()
- if tCurrentPos["facing"] == 0 then
- tCurrentPos["facing"] = 3
- else
- tCurrentPos["facing"] = tCurrentPos["facing"] - 1
- end
- savePosition()
- return err, spacesMoved
- else
- return turnRight(spaces)
- end
- end
- if fs.isDir("BundtMapModLegend") then
- for k, v in ipairs(fs.list("BundtMapModLegend")) do
- dofile(v)
- end
- end
- -- Finish initalization. --
- loadConfig()
- getTurtlePosition()
- getTurtleRotation()
- --loadChunk(getChunkCorWithBlock(getTurtlePosition()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement