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
- craftItem()
- robot.select(selectedSlot)
- local success = true
- local count = 1
- repeat
- placeItem(sides.forward)
- robot.move(sides.back)
- count = count + 1
- if count > howMany then success = false end
- until not success
Add Comment
Please, Sign In to add comment