Advertisement
yokmama

Advanced Turtle Lumberjack

Jun 10th, 2016
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. -- advanced turtle lumberjack
  2. shell.run('clear')
  3. print("Slot1 ni Dirt, Slot2 ni Saplings, sosite Slot3 ni mokuzai wo set site kudasai.")
  4. print("Number of Trees To Plant?")
  5. local x = io.read()
  6. local dirt, sapling, log = 1, 2, 3
  7.  
  8. -- genzai ichi wo shokika
  9. turtle.up()
  10. turtle.turnLeft()
  11. turtle.turnLeft()
  12. turtle.back()
  13. turtle.back()
  14. turtle.back()
  15.  
  16. -- saisho no tuchi wo set
  17. for i = 0, x do
  18.   turtle.digDown()
  19.   turtle.select(dirt)
  20.   turtle.placeDown()
  21.   turtle.back()
  22.   turtle.select(sapling)
  23.   turtle.place()
  24.   turtle.back()
  25.   turtle.back()
  26.   turtle.back()
  27. end
  28. turtle.turnLeft()
  29. turtle.forward()
  30. turtle.turnRight()
  31.  
  32. --ki wo kiru
  33. while true do
  34.   -- 30 byou matu
  35.   os.sleep(30)
  36.   -- asodatte irunara kiru , soudenakattara skip suru
  37.   for i = 0, x do
  38.     turtle.forward()
  39.     turtle.forward()
  40.     turtle.forward()
  41.     turtle.forward()
  42.     turtle.turnRight()
  43.     turtle.select(log)
  44.     -- mosi ki ga sodatte irunara
  45.     if turtle.compare() then
  46.       turtle.dig()
  47.       turtle.forward()
  48.       -- ki wo kirirnagara ue he agaru
  49.       while turtle.detectUp() do
  50.       turtle.digUp()  
  51.       turtle.up()
  52.       end
  53.       -- jimen ni modoru
  54.       while not turtle.detectDown() do
  55.         turtle.down()
  56.       end
  57.       -- atarasii ki wo ueru
  58.       turtle.back()
  59.       turtle.select(sapling)
  60.       turtle.place()
  61.     end
  62.     turtle.turnLeft()
  63.   end
  64.   -- kado wo magaru
  65.   turtle.forward()
  66.   turtle.turnRight()
  67.   turtle.forward()
  68.   turtle.forward()
  69.   turtle.turnRight()
  70.   turtle.forward()
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement