Advertisement
Myros27

Livingrockgen

Aug 11th, 2022 (edited)
951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. local robot = require("robot")
  2. local term = require("term")
  3. local computer = require("computer")
  4. local component = require("component")
  5. local sides = require("sides")
  6. local keyboard = require("keyboard")
  7.  
  8. local function safeForward(x)
  9.   if (x ~= 0) then
  10.     for i = 1, x do
  11.       local canmoveF = nil
  12.       while (canmoveF == nil) do
  13.         canmoveF = robot.forward()
  14.       end
  15.     end
  16.   end
  17. end
  18.  
  19. local function doStuff()
  20.   robot.select(1)
  21.   local compared = robot.compareDown()
  22.   if compared == true then
  23.     robot.swingDown()
  24.     for i = 1, robot.inventorySize() do
  25.       local itemInSlot = component.inventory_controller.getStackInInternalSlot(i)
  26.       if itemInSlot ~= nil then
  27.         if itemInSlot.label == "Stone" then
  28.           robot.select(i)
  29.         end
  30.       end
  31.     end
  32.     robot.placeDown()
  33.   end
  34. end
  35.  
  36. while true do
  37.   safeForward(1)
  38.   robot.turnRight()
  39.   safeForward(1)
  40.   robot.select(2)
  41.   robot.swingDown()
  42.   robot.placeDown()
  43.   robot.turnRight()
  44.   safeForward(1)
  45.   robot.turnRight()
  46.   safeForward(1)
  47.   robot.turnRight()
  48.   for x = 1, 7 do
  49.     robot.swingDown()
  50.     for i = 1, robot.inventorySize() do
  51.     local itemInSlot = component.inventory_controller.getStackInInternalSlot(i)
  52.     if itemInSlot ~= nil then
  53.       if itemInSlot.label == "Stone" then
  54.         robot.select(i)
  55.       end
  56.     end
  57.   end
  58.   robot.placeDown()
  59.   for z = 1, 17 do
  60.     os.sleep(10)
  61.     doStuff()
  62.     safeForward(1)
  63.     os.sleep(10)
  64.     doStuff()
  65.     safeForward(1)
  66.     robot.turnRight()
  67.     end
  68.   end
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement