Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local coal = 16
- local food = 1
- local id = 88
- function init()
- while turtle.detectDown() == true do
- turtle.back()
- end
- while turtle.detect() do
- turtle.turnRight()
- end
- end
- function refuel()
- print("niveau de fuel :" .. turtle.getFuelLevel())
- if turtle.getFuelLevel() < 50 then
- turtle.turnRight()
- turtle.select(coal)
- turtle.suck()
- turtle.refuel()
- turtle.select(food)
- end
- end
- function deplacement()
- food = 1
- init()
- turtle.select(food)
- while turtle.forward() == true do
- if food < 14 and turtle.getItemCount(food) < 1 then
- food = food + 1
- turtle.select(food)
- end
- turtle.dropUp()
- end
- while turtle.back() == true do end
- end
- function vide()
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, 16 do
- turtle.select(i)
- turtle.suck()
- end
- turtle.select(16)
- turtle.drop()
- turtle.turnRight()
- turtle.turnRight()
- end
- -- programme principal
- init()
- while true do
- term.clear()
- refuel()
- deplacement()
- vide()
- for i = 0, 60 do
- os.startTimer(1)
- os.pullEvent("timer")
- term.clear()
- print("je pars dans :" .. 60-i .. " secondes")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement