Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- robot = require("component").robot
- sides = require("sides")
- ic = require("component").inventory_controller
- crafting = require("component").crafting
- local selectedSlot = 13
- local usesRemaining = 72
- local howMany = ...
- howMany = tonumber(howMany)
- function turnAround()
- robot.turn(true)
- robot.turn(true)
- end
- function craftItem()
- robot.select(1)
- ic.equip()
- crafting.craft(1)
- ic.equip()
- robot.select(selectedSlot)
- usesRemaining = 72
- end
- function placeItem(dir)
- local success = true
- if robot.count(selectedSlot) == 0 then
- if (selectedSlot == 32) then
- return false, "Out of Items"
- end
- selectedSlot = selectedSlot + 1
- robot.select(selectedSlot)
- end
- success = robot.place(dir)
- robot.use(dir)
- usesRemaining = usesRemaining - 1
- craftItem()
- return success
- end
- function placeBatbox()
- robot.select(29)
- robot.place(sides.up)
- robot.select(selectedSlot)
- end
- function maint()
- local success = true;
- if (not placeItem(sides.down)) then
- return false
- end
- if (not robot.move(sides.back)) then return false, 1 end
- if (not placeItem(sides.forward)) then return false, 2 end
- if (not robot.move(sides.back)) then return false, 3 end
- if (not placeItem(sides.forward)) then return false, 4 end
- if (not robot.move(sides.back)) then return false, 5 end
- if (not placeItem(sides.forward)) then return false, 6 end
- robot.turn(true)
- if (not robot.move(sides.back)) then return false, 6 end
- if (not robot.move(sides.back)) then return false, 7 end
- if (not robot.move(sides.back)) then return false, 8 end
- if (not placeItem(sides.down)) then return false, 9 end
- turnAround()
- if (not robot.move(sides.back)) then return false, 10 end
- if (not placeItem(sides.forward)) then return false, 11 end
- if (not robot.move(sides.back)) then return false, 12 end
- if (not placeItem(sides.forward)) then return false, 13 end
- if (not robot.move(sides.back)) then return false, 14 end
- if (not placeItem(sides.forward)) then return false, 15 end
- if (not robot.move(sides.back)) then return false, 16 end
- if (not placeItem(sides.forward)) then return false, 17 end
- if (not robot.move(sides.back)) then return false, 18 end
- if (not placeItem(sides.forward)) then return false, 19 end
- if (not robot.move(sides.back)) then return false, 20 end
- if (not placeItem(sides.forward)) then return false, 21 end
- if (not placeItem(sides.down)) then return false, 22 end
- if (not robot.move(sides.back)) then return false, 23 end
- if (not placeItem(sides.forward)) then return false, 24 end
- robot.turn(true)
- if (not robot.move(sides.back)) then return false, 25 end
- robot.turn(true)
- if (not robot.move(sides.back)) then return false, 26 end
- if (not robot.move(sides.back)) then return false, 27 end
- if (not robot.move(sides.back)) then return false, 28 end
- if (not robot.move(sides.back)) then return false, 29 end
- robot.turn(false)
- return true
- end
- function connectt()
- if (not robot.move(sides.back)) then return false, 30 end
- if (not placeItem(sides.forward)) then return false, 31 end
- if (not robot.move(sides.back)) then return false, 32 end
- if (not placeItem(sides.forward)) then return false, 33 end
- placeBatbox()
- return true
- end
- function reset()
- if (not robot.move(sides.back)) then return false, 34 end
- if (not robot.move(sides.back)) then return false, 35 end
- return true
- end
- craftItem()
- robot.select(selectedSlot)
- local success = true
- local count = 1
- repeat
- if (not maint()) then break end
- if (not connectt()) then break end
- if (not maint()) then break end
- if (not reset()) then break end
- count = count + 1
- if count > howMany then success = false end
- until not success
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement