Advertisement
Guest User

obras.lua

a guest
Aug 26th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. local function diggo()
  2.     turtle.digDown()
  3.     turtle.dig()
  4.     if turtle.detect() then
  5.         while turtle.detect() do
  6.             turtle.dig()
  7.             sleep(1)
  8.         end
  9.     end
  10. end
  11. print("Cuantos bloques de largo quieres diggar?")
  12. local dig = read()
  13. print("Cuantos bloques de ancho quieres diggar?")
  14. local dig2 = read()
  15. local fuel = turtle.getFuelLevel()
  16. local total = dig*dig2*2+dig2+dig2
  17. local neces = total-fuel
  18. local coal = neces/80
  19. if neces>fuel then
  20.     while neces>fuel do
  21.         print("Necesitas "..neces.." de combustible. Hay "..fuel.." disponible.")
  22.         print("Introduce "..math.ceil(coal).." de carbon en el primer hueco y dale a enter.")
  23.         read()
  24.         turtle.select(1)
  25.         turtle.refuel()
  26.         fuel = turtle.getFuelLevel()
  27.     end
  28.     print(fuel.." combustible disponible.")
  29. end
  30. print("Diggando...")
  31. for u=1,dig2 do
  32.     for i=1,dig do
  33.         diggo()
  34.         turtle.forward()
  35.     end
  36.     turtle.turnLeft()
  37.     turtle.turnLeft()
  38.     for u=1,dig do
  39.         turtle.forward()
  40.     end
  41.     turtle.turnRight()
  42.     turtle.forward()
  43.     turtle.turnRight()
  44. end
  45. turtle.turnRight()
  46. for o=1,dig2-1 do
  47.     turtle.forward()
  48. end
  49. turtle.turnLeft()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement