Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Created by Chronno S. Trigger
- -- Http://www.youtube.com/chronnotrigg
- -- Version 2.0
- local size = {...}
- slot = 1
- function place(i)
- slotCheck()
- if turtle.compareDown() == false then
- turtle.digDown()
- end
- turtle.placeDown()
- for o=2,size[1] do
- if math.fmod(o,5) == 0 and math.fmod(i,4) == 0 then
- torch(i)
- end
- dig()
- attack()
- turtle.forward()
- slotCheck()
- if turtle.compareDown() == false then
- turtle.digDown()
- end
- turtle.placeDown()
- end
- end
- function slotCheck()
- if turtle.getItemCount(slot) == 0 then
- if slot == 15 then
- outOfItems()
- else
- slot = slot + 1
- turtle.select(slot)
- slotCheck()
- end
- end
- end
- function outOfItems()
- term.clear()
- term.setCursorPos(1,1)
- print("Out of items, please replace and press any key when ready")
- local event, param1 = os.pullEvent ("char")
- slot = 1
- turtle.select(slot)
- slotCheck()
- end
- function left()
- turtle.turnLeft()
- dig()
- attack()
- turtle.forward()
- turtle.turnLeft()
- end
- function right()
- turtle.turnRight()
- dig()
- attack()
- turtle.forward()
- turtle.turnRight()
- end
- function torch(i)
- if math.fmod(i,2) == 1 then
- turtle.turnLeft()
- turtle.select(16)
- if turtle.getItemCount(16) == 0 then
- term.clear()
- term.setCursorPos(1,1)
- print("Out of torches, please insert some more and press any key")
- local event, param1 = os.pullEvent ("char")
- end
- turtle.place()
- turtle.select(slot)
- turtle.turnRight()
- elseif math.fmod(i,2) == 0 then
- turtle.turnRight()
- turtle.select(16)
- if turtle.getItemCount(16) == 0 then
- term.clear()
- term.setCursorPos(1,1)
- print("Out of torches, please insert some more and press any key")
- local event, param1 = os.pullEvent ("char")
- end
- turtle.place()
- turtle.select(slot)
- turtle.turnLeft()
- end
- end
- function attack()
- if turtle.attack == true then
- attack()
- end
- end
- function dig()
- if turtle.dig() == true then
- os.sleep(1)
- dig()
- end
- end
- function home()
- if math.fmod(size[1],2) == 1 then
- turtle.digUp()
- turtle.up()
- turtle.turnRight()
- turtle.turnRight()
- for i=2,size[1] do
- attack()
- dig()
- turtle.forward()
- end
- turtle.turnRight()
- for i=2,size[1] do
- attack()
- dig()
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.down()
- elseif math.fmod(size[1],2) == 0 then
- turtle.up()
- turtle.turnRight()
- for i=2,size[1] do
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.down()
- end
- end
- place(1)
- for i=2,size[1] do
- if i == size[1] then
- break
- elseif math.fmod(i,2) == 1 then
- left()
- elseif math.fmod(i,2) == 0 then
- right()
- end
- place(i)
- end
- home()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement