Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = component.proxy(component.list("robot"){})
- local inv = component.proxy(component.list("inventory_controller"){})
- function wash()
- robot.turnLeft()
- robot.drop()
- robot.turnRight()
- end
- function heat()
- robot.turnRight()
- robot.drop()
- robot.turnLeft()
- end
- function macerate()
- robot.drop()
- end
- function intoAE()
- robot.up()
- robot.turnLeft()
- robot.drop()
- robot.turnRight()
- robot.down()
- end
- function getOre()
- robot.up()
- robot.turnLeft()
- robot.suck()
- robot.turnRight()
- robot.down()
- print("check3");
- if inv.getStackInInternalSlot().name == "Oilsands Ore" then
- OilSand()
- else
- macerate()
- end
- end
- function getProccesing()
- robot.suckDown()
- evaluateItem()
- end
- function OilSand()
- robot.up()
- robot.turnAround()
- robot.drop()
- robot.turnAround()
- robot.down()
- end
- function SecondMacerate()
- robot.turnAround()
- robot.drop()
- robot.turnAround()
- end
- function evaluateItem()
- local t = {}
- local s = inv.getStackInInternalSlot().name
- print("check1");
- for k, v in string.gmatch(s, "%s") do
- print("check2");
- t[k] = v
- end
- if t[0] == "Centrifuged" then
- SecondMacerate()
- elseif t[0] == "Purified" then
- heat()
- elseif t[0] == "Crushed" then
- wash()
- else
- intoAE()
- end
- end
- function check(side)
- local p = 1
- local SlotsOccupied = 0
- local InventorySize = 0
- local AreSlotsOccupied = false
- if side == 3 then
- InventorySize = macerate1Size
- elseif side == 5 then
- InventorySize = WashSize
- elseif side == 4 then
- InventorySize = HeatSize
- elseif side == 2 then
- InventorySize = macerate2Size
- elseif side == 0 then
- InventorySize = TempStorageSize
- end
- while InventorySize >= p do
- if inv.getStackInSlot(side, p) ~= nil then
- SlotsOccupied = SlotsOccupied + 1;
- end
- p = p + 1
- end
- if SlotsOccupied > 0 then
- AreSlotsOccupied = true
- elseif SlotsOccupied == 0 then
- AreSlotsOccupied = false
- end
- return AreSlotsOccupied
- end
- local macerate1Size = inv.getInventorySize(3)
- local WashSize = inv.getInventorySize(5)
- local HeatSize = inv.getInventorySize(4)
- local macerate2Size = inv.getInventorySize(2)
- local TempStorageSize = inv.getInventorySize(0)
- robot.up()
- local OreStorageSize = inv.getInventorySize(4)
- local OilSandSize = inv.getInventorySize(2)
- robot.down()
- while true do
- while check(0) == true do
- getProccesing()
- while check(5) == true or check(3) == true or check(4) == true or check(3) == true do
- os.sleep(2)
- end
- end
- getOre()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement