Advertisement
psychedelixx

Minecraft Turtle: Bridge

Apr 26th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. slot = 1
  2.  
  3. function getSlot()
  4.     while turtle.getItemCount(slot) == 0 and slot < 16 do
  5.         slot = slot + 1
  6.     end
  7.     if turtle.getItemCount(slot) == 0 and slot == 16 then
  8.         print("No more ressources... Fill me up and press enter")
  9.         read()
  10.         slot = 1
  11.     end
  12. end
  13.  
  14. local args = { ... }
  15. if #args < 1 then
  16.     print("")
  17.     print("Usage: bridge <length> <buildSides 0|1>")
  18.     print("")
  19.  
  20.     error()
  21. end
  22.  
  23. if #args >= 1 then
  24.     length = tonumber(args[1])
  25.     sides = 0
  26. end
  27.  
  28. if #args >= 2 then
  29.     length = tonumber(args[1])
  30.     sides = tonumber(args[2])
  31. end
  32.  
  33. if turtle.getFuelLevel() < length then
  34.     print("I need " .. length - turtle.getFuelLevel() .. " more fuel!")
  35. else
  36.     print("======== 2019 (c) psychedelixx ========")
  37.     print("Let's go!")
  38.  
  39.         while length > 0 do
  40.             print("Remaining: " .. length)
  41.  
  42.             t.dig()
  43.             t.forward()
  44.  
  45.             t.placeDown(slot)
  46.             getSlot()
  47.            
  48.             if sides == 1 then
  49.               t.placeLeft(slot)
  50.               getSlot()
  51.               t.placeRight(slot)
  52.               getSlot()
  53.             end
  54.            
  55.             length = length - 1
  56.         end
  57.  
  58.         t.place(slot)
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement