SHARE
TWEET

process Trees and Champs

Serval_Mart-Lag May 29th, 2020 (edited) 496 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function do_forward()
  2.     while not turtle.forward() do
  3.         if not turtle.dig() then
  4.             turtle.attack()
  5.         end
  6.     end
  7. end
  8.  
  9. local function do_up()
  10.     while not turtle.up() do
  11.         if not turtle.digUp() then
  12.             turtle.attackUp()
  13.         end
  14.     end
  15. end
  16.  
  17. local function do_down()
  18.     while not turtle.down() do
  19.         if not turtle.digDown() then
  20.             turtle.attackDown()
  21.         end
  22.     end
  23. end
  24.  
  25. local function go_elevator()
  26.     do_forward()
  27.     turtle.turnRight()
  28.     for i = 1,3 do
  29.         do_forward()
  30.     end
  31.     turtle.turnLeft()
  32. end
  33. local function go_home()
  34.     turtle.turnLeft()
  35.     turtle.turnLeft()
  36.     do_forward()
  37.     turtle.turnRight()
  38.     for i = 1,3 do
  39.         do_forward()
  40.     end
  41.     turtle.turnRight()
  42. end
  43.  
  44. local level = 0
  45. local function go_level(i)
  46.     if level == 0 and i > 0 then
  47.         for i = 1,(5+4*i) do
  48.             do_up()
  49.         end
  50.     elseif i == 0 and level > 0 then
  51.         for i = 1,(5+4*level) do
  52.             do_down()
  53.         end
  54.     elseif level > i then
  55.         for i = 1,(4*(level-i)) do
  56.             do_down()
  57.         end
  58.     else
  59.         for i = 1,(4*(i-level)) do
  60.             do_up()
  61.         end
  62.     end
  63.  
  64.     level = i
  65. end
  66.  
  67. local function do_cycle(i)
  68.     shell.run("trees.lua")
  69.     go_elevator()
  70.     go_level(4*i)
  71.     do_forward()
  72.     shell.run("champs.lua", 1, 24)
  73.     level = 4*i-3
  74.     turtle.back()
  75.     go_level(0)
  76.     go_home()
  77. end
  78.  
  79. do_cycle(1)
  80. do_cycle(2)
  81. do_cycle(3)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top