Advertisement
TIIITAN

Robot

Jul 29th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.20 KB | None | 0 0
  1. local component = require("component")
  2. local robot = require("robot")
  3. local sides = require("sides")
  4.  
  5. local ic = component.inventory_controller
  6.  
  7. local function initialisation()
  8.    
  9.     -- Items picking
  10.    
  11.     robot.select(1)
  12.     robot.suckUp(1)
  13.     ic.equip()
  14.     robot.forward()
  15.     robot.suckUp(4)
  16.     robot.turnRight()
  17.     robot.select(2)
  18.     robot.suck(12)
  19.     robot.turnLeft()
  20.     robot.forward()
  21.    
  22.     -- Place sapplings
  23.    
  24.     robot.select(1)
  25.     robot.forward()
  26.     robot.place()
  27.     robot.turnLeft()
  28.     robot.forward()
  29.     robot.turnRight()
  30.     robot.place()
  31.     robot.back()
  32.     robot.place()
  33.     robot.turnRight()
  34.     robot.forward()
  35.     robot.turnLeft()
  36.     robot.place()
  37.    
  38.     -- Bone meal
  39.    
  40.     robot.select(2)
  41.     robot.place()
  42.     robot.place()
  43.     robot.place()
  44.     robot.place()
  45.     robot.place()
  46.     robot.place()
  47.     robot.place()
  48.     robot.place()
  49.     robot.place()
  50.     robot.place()
  51.     robot.place()
  52.     robot.place()
  53.    
  54.     -- First layer
  55.    
  56.     robot.swing()
  57.     robot.forward()
  58.     robot.swing()
  59.     robot.forward()
  60.     robot.turnLeft()
  61.     robot.swing()
  62.     robot.forward()
  63.     robot.turnLeft()
  64.     robot.swing()
  65.     robot.forward()
  66.     robot.turnLeft()
  67.     robot.forward()
  68.     robot.turnLeft()
  69.    
  70. end
  71.  
  72. local function execution()
  73.    
  74.     while robot.detectUp() == true do
  75.         robot.swingUp()
  76.         robot.forward()
  77.         robot.swingUp()
  78.         robot.turnLeft()
  79.         robot.forward()
  80.         robot.swingUp()
  81.         robot.turnLeft()
  82.         robot.forward()
  83.         robot.swingUp()
  84.         robot.turnLeft()
  85.         robot.forward()
  86.         robot.turnLeft()
  87.        
  88.         robot.up()
  89.        
  90.     end
  91.    
  92. end
  93.  
  94. local function terminaison()
  95.    
  96.     -- Redescente
  97.    
  98.     while robot.detectDown() == false do
  99.         robot.down()
  100.     end
  101.    
  102.     robot.back()
  103.     robot.back()
  104.     robot.back()
  105.    
  106.     for k = 1, 16 do
  107.         robot.select(k)
  108.         robot.dropDown()
  109.     end
  110.    
  111.     robot.select(1)
  112.     ic.equip()
  113.     robot.dropDown()
  114.    
  115. end
  116.  
  117. while true do
  118.    
  119.     initialisation()
  120.     execution()
  121.     terminaison()
  122.    
  123.     os.sleep(15)
  124.    
  125. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement