Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------Tunneling Automaton - V2------
- ----Variables----
- t = turtle
- orientation = 1
- ----Basic Controls----
- --Turning--
- function turnLeft()
- if orientation == 4 then
- orientation = 0
- else
- orientation = orientation + 1
- end
- t.turnLeft()
- end
- function turnRight()
- if orientation == 1 then
- orientation = 4
- else
- orientation = orientation - 1
- end
- t.turnRight()
- end
- function reorient()
- if orientation == 2 then
- turnLeft()
- elseif orientation == 3 then
- turnLeft()
- turnLeft()
- elseif orientation == 4 then
- turnRight()
- end
- end
- --Digging--
- function digUp()
- t.digUp()
- end
- function digDown()
- t.digDown()
- end
- function digForward()
- t.digForward()
- end
- function digLeft()
- turnLeft()
- digForward()
- end
- function digRight()
- turnRight()
- digForward()
- end
- --Moving--
- function moveUp()
- t.up()
- end
- function moveDown()
- t.down()
- end
- function moveForward()
- t.forward()
- end
- function moveLeft()
- turnLeft()
- moveForward()
- end
- function moveRight()
- turnRight()
- moveFoward()
- end
- --Digging and Moving--
- function goUp()
- if t.detectUp() then
- digUp()
- moveUp()
- else
- moveUp()
- end
- end
- function goDown()
- if t.detectDown() then
- digDown()
- moveDown()
- else
- moveDown()
- end
- end
- function goForward()
- if t.detect() then
- digForward()
- moveForward()
- else
- moveForward()
- end
- end
- function goRight()
- turnRight()
- if t.detect() then
- digForward()
- moveForward()
- else
- moveForward()
- end
- end
- function goLeft()
- turnLeft()
- if t.detect() then
- digForward()
- moveForward()
- else
- moveForward()
- end
- end
- ----Inventory----
- --Check if any slots are free--
- function freeSlots()
- num = 16
- spaceLeft = false
- while num > 0 do
- if t.getItemCount(num) == 0 then
- spaceLeft = true
- end
- num = num - 1
- end
- return spaceLeft
- end
- function placeStorageChest()
- t.select(1)
- digUp()
- t.placeUp()
- end
- function placeFuelChest()
- t.select(2)
- digUp()
- t.placeUp()
- end
- function placeChunkLoader()
- t.select(3)
- digUp()
- t.placeUp()
- end
- function getFuel()
- t.select(2)
- t.suckUp(10)
- end
- function store()
- num = 16
- while num > 3 do
- t.dropUp()
- num = num - 1
- end
- end
- function fuel()
- t.select(2)
- t.refuel()
- end
- ----Mining----
- function shaft
- //ADD mining shaft, add check fuel left and refill, add chunk loaders
- ----Main Loop----
- function main()
- end
- --Run--
- main()
Add Comment
Please, Sign In to add comment