Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Min is 3 for H--
- lengthMax = 50
- widthMax = 3
- heightMax = 3
- orientation = 4
- --N=4, E=3, S=2, W=1--
- orientations = {"north", "east", "south", "west"}
- startDirection = orientation
- xCurrent = 0
- zCurrent = 0
- yCurrent = 0
- xHome = 0
- zHome = 0
- yHome = 0
- zDiff = {-1, 0, 1, 0}
- xDiff = {0, 1, 0 ,-1}
- turn = 1
- turnLast = turn
- lengthCurrent = lengthMax
- placeTorch = 10
- width = widthMax
- finishWalk = widthMax
- heightMax = heightMax - 3
- height = heightMax
- ending = false
- kill = false
- said = false
- function torchCheck()
- while not(turtle.getItemDetail("minecraft:torch")) do
- if said == false then
- print("Gimme Some Fookin Torches! Slot.1 Plz")
- said = true
- sleep(1)
- end
- end
- said = false
- end
- function left()
- orientation = orientation - 1
- orientation = (orientation - 1) % 4
- orientation = orientation + 1
- turtle.turnLeft()
- end
- function right()
- orientation = orientation - 1
- orientation = (orientation + 1) % 4
- orientation = orientation + 1
- turtle.turnRight()
- end
- function look(direction)
- while direction ~= orientations[orientation] do
- right()
- end
- end
- function moveForward()
- while turtle.detect() do
- turtle.dig()
- end
- moved = false
- while not(moved) do
- moved = turtle.forward()
- end
- xCurrent = xCurrent + xDiff[orientation]
- zCurrent = zCurrent + zDiff[orientation]
- end
- function digForward()
- while turtle.detect() do
- turtle.dig()
- end
- end
- function digBelow()
- while turtle.detectDown() do
- turtle.digDown()
- end
- end
- function digAbove()
- while turtle.detectUp() do
- turtle.digUp()
- end
- end
- function moveUp()
- turtle.digUp()
- moved = false
- while not(moved) do
- digAbove()
- moved = turtle.up()
- end
- yCurrent = yCurrent + 1
- end
- function moveDown()
- turtle.digDown()
- moved = false
- while not(moved) do
- moved = turtle.down()
- end
- yCurrent = yCurrent - 1
- end
- function goDown()
- moved = false
- while not(moved) do
- turtle.digDown()
- moved = turtle.down()
- end
- yCurrent = yCurrent - 1
- end
- function goUp()
- moved = false
- while not(moved) do
- digAbove()
- moved = turtle.up()
- end
- yCurrent = yCurrent + 1
- end
- function upBreak()
- digAbove()
- goUp()
- digAbove()
- end
- function leftDig()
- left()
- moveForward()
- digAbove()
- digBelow()
- while height > 0 do
- upBreak()
- height = height - 1
- end
- height = heightMax
- while height > 0 do
- moveDown()
- height = height - 1
- end
- height = heightMax
- left()
- end
- function rightDig()
- right()
- moveForward()
- digAbove()
- digBelow()
- while height > 0 do
- upBreak()
- height = height - 1
- end
- height = heightMax
- while height > 0 do
- moveDown()
- height = height - 1
- end
- height = heightMax
- right()
- end
- function leftWalk()
- left()
- moveForward()
- digAbove()
- digBelow()
- while height > 0 do
- upBreak()
- height = height - 1
- end
- height = heightMax
- while height > 0 do
- moveDown()
- height = height - 1
- end
- height = heightMax
- end
- function rightWalk()
- right()
- moveForward()
- digAbove()
- digBelow()
- while height > 0 do
- upBreak()
- height = height - 1
- end
- height = heightMax
- while height > 0 do
- moveDown()
- height = height - 1
- end
- height = heightMax
- end
- function goto(xHome, zHome, yHome)
- while yHome < yCurrent do
- moveDown()
- end
- while yHome > yCurrent do
- moveUp()
- end
- if xHome < xCurrent then
- look("west")
- while xHome < xCurrent do
- moveForward()
- end
- end
- if xHome > xCurrent then
- look("east")
- while xHome > xCurrent do
- moveForward()
- end
- end
- if zHome < zCurrent then
- look("north")
- while zHome < zCurrent do
- moveForward()
- end
- end
- if zHome > zCurrent then
- look("south")
- while zHome > zCurrent do
- moveForward()
- end
- end
- while not(orientation == startDirection) do
- right()
- end
- end
- while true do
- if lengthCurrent > 0 and ending == false then
- torchCheck()
- moveForward()
- digAbove()
- digBelow()
- while height > 0 do
- upBreak()
- height = height - 1
- end
- height = heightMax
- while height > 0 do
- moveDown()
- height = height - 1
- end
- height = heightMax
- placeTorch = placeTorch - 1
- lengthCurrent = lengthCurrent - 1
- if placeTorch <= 0 then
- placeTorch = 10
- turtle.placeDown()
- end
- end
- if lengthCurrent <= 0 and turn == 1 and width > 0 then
- width = width - 1
- if width > 0 then
- rightDig()
- lengthCurrent = lengthMax
- turn = 2
- print("Turned Right")
- end
- end
- if lengthCurrent <= 0 and turn == 2 and width > 0 then
- width = width - 1
- if width > 0 then
- leftDig()
- lengthCurrent = lengthMax
- turn = 1
- print("Turned Left")
- end
- end
- if width <= 0 then
- turnLast = turn
- turn = 3
- ending = true
- end
- if width <= 0 and turn == 3 and ending == true then
- print("Final Walk Home")
- goto(xHome, zHome, yHome)
- kill = true
- turn = 4
- end
- if kill == true then
- print("Killing the Program")
- error()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement