Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- os.loadAPI("ocs/apis/graph")
- local prox = sensor.wrap("left")
- local i = 0
- local targets = prox.getTargets()
- for name,basicDetails in pairs(targets) do
- print("Found Tank: "..name)
- tankDetails = prox.getTargetDetails(name)
- if (tankDetails ~= nil) then
- tank = name
- break
- end
- end
- if type == "item.fuel" then
- type = "Fuel"
- end
- function update()
- i = i + 1
- local amt = sensor.call("left", "getTargetDetails",tank)
- if amt ~= nil then
- amount = amt.Tanks[1].Amount
- capacity = amt.Tanks[1].Capacity
- if amount < (capacity / 2) then
- redstone.setOutput("right",false)
- end
- return amount
- else
- print("amt was null")
- end
- end
- function newLine()
- local_,cY= mon.getCursorPos()
- mon.setCursorPos(1,cY+1)
- end
- mon = peripheral.wrap("top")
- graphInstance = graph.new(mon, update, type, nil, 0 , capacity)
- mon.setTextScale(5)
- while true do
- graphInstance:draw()
- newLine()
- mon.write(" Consuming: ")
- mon.setTextColor(colors.lightBlue)
- mon.write(fuelcons)
- mon.setTextColor(colors.white)
- mon.write(" /h")
- newLine()
- mon.write(" Time Remaining: ")
- mon.setTextColor(colors.yellow)
- mon.write(timeleft)
- mon.setTextColor(colors.white)
- mon.write(" Hours")
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment