Advertisement
Guest User

cropper.lua

a guest
Aug 23rd, 2015
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. local component = require("component")
  2. local robot = require("robot")
  3. local geo = component.geolyzer
  4. local ic = component.inventory_controller
  5.  
  6. local step = 0
  7.  
  8. function placeCross()
  9.   ic.equip()
  10.   robot.useDown(0)
  11.   os.sleep(0.1)
  12.   robot.useDown(0)
  13.   ic.equip()
  14. end
  15.  
  16. while true do
  17.    os.sleep(0.4)
  18.    meta = geo.analyze(0).metadata
  19.    if meta == 7 then
  20.      if step == 0 then
  21.        step=1
  22.        robot.turnLeft()
  23.        robot.forward()
  24.        robot.turnLeft()
  25.        robot.forward()
  26.        robot.swingDown()
  27.        placeCross()
  28.      else
  29.        step=0
  30.        robot.turnLeft()
  31.        robot.forward()
  32.        robot.swingDown()
  33.        placeCross()
  34.      end
  35.    elseif meta  > 0 then
  36.      robot.useDown(0,false,0)
  37.      os.sleep(0.2)
  38.      robot.useDown(0,false,0)
  39.      if geo.analyze(0).metadata < meta then
  40.         ic.equip()
  41.         robot.useDown(0,false,0)
  42.         ic.equip()
  43.      end
  44.  
  45.    
  46.    end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement