Advertisement
ColdIV

suicidePath

Jan 2nd, 2022 (edited)
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. -- pastebin run FuQ3WvPs jh0kMxQc suicidePath
  2. -- REFUELS ON START FROM SLOT 1
  3. -- EVERY OTHER SLOT HAS TO CONTAIN BUILDING BLOCKS
  4. local args = {...}
  5.  
  6. -- CONFIG -- EDIT BELOW
  7. local maxLength = -1 -- -1 means infinite, everything else is amount of forward steps
  8. -- END CONFIG / START CODE -- DO NOT EDIT BELOW
  9.  
  10. function hasBuildingBlock()
  11.     for i = 1, 16 do
  12.         local hasItem = turtle.getItemDetail(i)
  13.         if hasItem then
  14.             turtle.select(i)
  15.             return true
  16.         end
  17.     end
  18.    
  19.     return false
  20. end
  21.  
  22. function main ()
  23.     turtle.refuel()
  24.    
  25.     while maxLength == -1 or maxLength > 0 do
  26.         if hasBuildingBlock() then
  27.             turtle.placeDown()
  28.         else return end
  29.        
  30.         while not turtle.forward() do
  31.             turtle.dig()
  32.         end
  33.         while turtle.detectUp() do
  34.             turtle.digUp()
  35.         end
  36.         maxLength = maxLength - 1
  37.     end
  38. end
  39.  
  40. -- END CODE
  41.  
  42. if args[1] == "update" then
  43.     if args[2] == "run" then
  44.         shell.run("pastebin", "run", "FuQ3WvPs jh0kMxQc suicidePath run")
  45.     else
  46.         shell.run("pastebin", "run", "FuQ3WvPs jh0kMxQc suicidePath")
  47.     end
  48. else
  49.     -- RUN MAIN PROGRAM
  50.     main()
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement