Advertisement
Guest User

transport

a guest
Apr 1st, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. function up()
  2.  while not turtle.up() do
  3.   sleep(1)
  4.  end
  5. end
  6. function down()
  7.  while not turtle.down() do
  8.   sleep(1)
  9.  end
  10. end
  11. function drop()
  12.  for i=1,15 do
  13.   turtle.select(i)
  14.   if not turtle.dropUp() then
  15.    return
  16.   end
  17.  end
  18. end
  19. function suck()
  20.  for i=1,15 do
  21.   turtle.suck()
  22.  end
  23. end
  24. function check()
  25.  turtle.select(16)
  26.  if turtle.compare() then
  27.   if turtle.getItemCount(15) < 1 then
  28.    suck()
  29.   end
  30.  elseif turtle.detectUp() then
  31.   drop()
  32.  end
  33. end
  34. while true do
  35.  x=0
  36.  while not turtle.detectUp() do
  37.   check()
  38.   up()
  39.  end
  40.  while x < 1 do
  41.   check()
  42.   if turtle.getItemCount(15) > 0 then
  43.    x=1
  44.   else
  45.    down()
  46.   end
  47.   if turtle.detectDown() then
  48.    x=1
  49.   end
  50.  end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement