Necrotico

OC Melon Robot

Sep 17th, 2021 (edited)
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1.  
  2. -- This program harvests industrialcraft melon crops, will not work with normal ones.
  3.  
  4. local robot = require("robot")
  5. local os = require("os")
  6.  
  7. local argv = {...}
  8.  
  9. local melon_tower_levels = tonumber(argv[1])
  10.  
  11. local function collectMoveForward()
  12.     while true do
  13.         robot.useDown()
  14.         robot.suckDown()
  15.         if not robot.forward() then
  16.             break
  17.         end
  18.     end
  19. end
  20. local function clearLevel()
  21.     collectMoveForward()
  22.     robot.turnRight()
  23.     robot.forward()
  24.     robot.turnRight()
  25.     collectMoveForward()
  26.     robot.turnLeft()
  27.     robot.forward()
  28.     robot.turnLeft()
  29.     collectMoveForward()
  30.     robot.turnRight()
  31.     robot.forward()
  32.     robot.turnRight()
  33.     collectMoveForward()
  34.     robot.turnRight()
  35.     robot.forward()
  36.     robot.forward()
  37.     robot.forward()
  38.     robot.turnRight()
  39. end
  40.  
  41. while true do
  42.     for l=1, melon_tower_levels do
  43.         for i=1, l - 1 do
  44.             robot.up()
  45.             robot.up()
  46.             robot.up()
  47.         end
  48.         clearLevel()
  49.         for i=1, l - 1 do
  50.             robot.down()
  51.             robot.down()
  52.             robot.down()
  53.         end
  54.         robot.turnAround()
  55.         for s=1, 16 do
  56.             if robot.count(s) > 0 then
  57.                 robot.select(s)
  58.                 robot.drop()
  59.             end
  60.         end
  61.         robot.turnAround()
  62.     end
  63.     os.sleep(30)
  64. end
  65.  
Add Comment
Please, Sign In to add comment