Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function left()
- turtle.turnLeft()
- if turtle.detect() then
- --turtle.dig()
- end
- turtle.forward()
- turtle.turnRight()
- end
- local function right()
- turtle.turnRight()
- if turtle.detect() then
- --turtle.dig()
- end
- turtle.forward()
- turtle.turnLeft()
- end
- local function forward()
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- end
- local function back()
- turtle.back()
- end
- local function up()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- end
- local function down()
- turtle.down()
- end
- local atHopper = true
- while true do
- -- take items from hopper
- if atHopper then
- for i=1,6 do
- turtle.suck()
- select(i+1)
- end
- end
- turtle.select(1)
- --get total amount of coal
- local count = 0
- for i=1, 16 do
- local item = turtle.getItemDetail(i)
- if item then
- count = count + item.count
- end
- end
- if count >= 32 then
- --refuel
- atHopper = false
- count = count -2
- turtle.select(1)
- turtle.refuel(1)
- -- go to chest to distribute
- left()
- left()
- left()
- up()
- forward()
- -- distribute to chest
- for i=1,6 do
- turtle.select(i)
- turtle.drop(64)
- end
- --go back to hopper
- back()
- down()
- right()
- right()
- right()
- sleep(120)
- atHopper = true
- select(1)
- turtle.drop(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment