Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Gioves vBeta 0.2
- local enderChestSlot = 16
- local coalChestSlot = 15
- local coalEmplacement = 14
- local firstSlot = 1
- local lastSlot = 4
- local i=0 -- var for loop
- function emptyIfFull(fin) --check if the turtle is full and empty it
- if (turtle.getItemCount(lastSlot) > 0) or (fin == true) then
- print("Vidange des items...")
- while not turtle.up() do
- turtle.digUp()
- end
- turtle.down()
- turtle.select(enderChestSlot)
- turtle.placeUp()
- for slot=firstSlot,lastSlot do
- turtle.select(slot)
- while turtle.getItemCount(slot) > 0 do
- turtle.dropUp(turtle.getItemCount(slot))
- if turtle.getItemCount(slot) > 0 then
- sleep(1)
- end
- end
- end
- print("Fin")
- turtle.select(enderChestSlot)
- turtle.digUp()
- end
- end
- function fillCoal() --fill the fuel of the turtle
- if turtle.getFuelLevel()<160 then
- print("Remplissage de Coal...")
- while not turtle.up() do
- turtle.digUp()
- sleep(0.10)
- end
- turtle.select(coalChestSlot)
- turtle.down()
- turtle.placeUp()
- turtle.select(coalEmplacement)
- turtle.suckUp(4)
- turtle.refuel(4)
- print("Fin")
- turtle.select(coalChestSlot)
- turtle.digUp()
- end
- end
- --Main program
- local length = 0
- local width = 0
- local i = 1
- local j = 2
- local leftright = false --turn left right/left at the end of the path
- print("Bibiche la depopeuse de dune v0.2 Beta.")
- print("Info : longueur face a la turtle, largeur vers la droite. Placez l'enderchest a coal dans le slot 15. Placez l'enderchest a minerais dans le slot 16.Renvoie tout les deux stacks environ.")
- print("Donnez la longueur a creuser :")
- length = tonumber(read())-1
- print("Donnez la largeur a creuser :")
- width = tonumber(read())
- print("Sable previsionnel :")
- print(length*width*4)
- print("En cour...")
- if (length<=0) or (width<=0) then
- print("Erreur sur la taille donnee !")
- else
- for i=1,width do
- for j=1,length do
- while not turtle.forward() do
- turtle.dig()
- end
- fillCoal()
- emptyIfFull()
- end
- if(leftright==false) and (i~=width) then
- turtle.turnRight()
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.turnRight()
- leftright = true
- elseif(leftright == true) and (i~=width) then
- turtle.turnLeft()
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.turnLeft()
- leftright=false
- end
- end
- emptyIfFull(true)
- print("Travail termine : sable envoye dans l'enderchest")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement