Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensorSide = "back"
- inputRSSide = "top"
- outputRSSide = "left"
- flowRSInputSide = "right"
- monitorSide = "front"
- -- DO NOT EDIT
- os.loadAPI("ocs/apis/sensor")
- se = sensor.wrap("back")
- counter = 0
- -- 0 Loading
- -- 1 Start Unloading
- -- 2 Unloading
- -- 3 Finish Unloading
- status = 0
- rs.setOutput("top", false)
- rs.setOutput("left", true)
- local maxw, maxh = term.getSize()
- function printCentered(text)
- local maxw, maxh = term.getSize()
- local curx, cury = term.getCursorPos()
- term.setCursorPos((maxw - #text) / 2, cury)
- term.write(text)
- term.setCursorPos(curx, cury + 1)
- end
- while true do
- targets = se.getTargets()
- for name, data in pairs(targets) do
- details = se.getTargetDetails(name)
- if data["Name"] == "tile.tankBlock" and details ~= nil then
- if status == 0 then
- if details.Tanks[1].Amount >= 1000 then
- rs.setOutput("top", true)
- sleep(0.5)
- details = se.getTargetDetails(name)
- counter = counter + details.Tanks[1].Amount + 500
- rs.setOutput("left", false)
- status = 1
- end
- term.clear()
- term.setCursorPos(1, math.floor(maxh / 2))
- printCentered("Count: "..counter)
- elseif status == 1 then
- if details.Tanks[1].Amount == 0 then
- status = 2
- end
- elseif status == 2 then
- if rs.getInput("right") then
- status = 3
- end
- elseif status == 3 then
- if not rs.getInput("right") then
- rs.setOutput("top", false)
- rs.setOutput("left", true)
- status = 0
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment