Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- robot = require("robot")
- component = require("component")
- sides = require("sides")
- inv = component.inventory_controller
- craft = component.crafting
- items = { "19021:0", "19025:0", "19028:0", "19031:0", "19035:0", "19039:0", "19042:0", "19046:0", "19050:0", "19054:0",
- "19108:2", "19110:2", "19112:2", "19114:2", "19117:2", "19120:2", "19123:2", "19124:2", "19125:2", "19126:2",
- "19127:2", "19132:2"}
- function checkForPul()
- local size = inv.getInventorySize(sides.front)
- for x=1,size do
- local info = inv.getStackInSlot(sides.front, x)
- if (type(info) ~= "nil") then
- for _,c in ipairs(items) do
- if (c == tostring(info.id) .. ":" .. tostring(info.damage)) then
- if (info.size > 4) then
- robot.select(1)
- local count = math.floor((info.size - 1) / 4) * 4
- if (inv.suckFromSlot(sides.front, x, count) == false) then
- return -2
- end
- if (robot.transferTo(2, count / 4) == false) then
- return -2
- end
- if (robot.transferTo(5, count / 4) == false) then
- return -2
- end
- if (robot.transferTo(6, count / 4) == false) then
- return -2
- end
- if (craft.craft() == false) then
- return -2
- end
- robot.select(1)
- if (robot.dropDown() == false) then
- return -2
- end
- return x
- end
- end
- end
- end
- end
- return -1
- end
- while (1 == 1) do
- local ans = checkForPul()
- if (ans == -1) then
- os.sleep(5)
- elseif (ans == -2) then
- print("Failed")
- os.exit()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement