Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- shell.run("monitor top clear")
- rs.setOutput("bottom",false)
- os.loadAPI("ocs/apis/sensor")
- sen = sensor.wrap("left")
- sen2 = sensor.wrap("right")
- mon = peripheral.wrap("top")
- mon.setTextScale(0.5)
- rb = 0
- while true do
- s = sen2.getTargets()
- n = 1
- n2 = 3
- n3 = 1
- for v, k in pairs(s) do
- if k.Name == "MFE" then
- if rb < 6 then
- I = sen2.getTargetDetails(v)
- pos = I.Position.X .. "," .. I.Position.Y .. "," .. I.Position.Z
- term.setCursorPos(1,n2)
- n2 = n2 + 1
- icname = "MFE " .. n3
- n3 = n3 + 1
- term.setCursorPos(1,n)
- term.clearLine(n)
- print(icname .. " " .. I.Stored .. " / " .. I.Capacity)
- mon.setCursorPos(1,n)
- mon.clearLine(n)
- mon.write(icname .. " MFE " .. I.Stored)
- mon.setCursorPos(20,n)
- mon.write(" / " .. I.Capacity)
- n = n + 1
- if maxCap == nil then
- maxCap = I.Capacity
- else
- maxCap = maxCap + I.Capacity
- end
- if isCap == nil then
- isCap = I.Stored
- else
- isCap = isCap + I.Stored
- end
- x, y = mon.getSize()
- mon.setCursorPos(1,y - 1)
- mon.clearLine(y-1)
- mon.write("Gesamtstrom: " .. isCap)
- mon.setCursorPos(20,y-1)
- mon.write(" / " .. maxCap)
- mon.setCursorPos(x-4,y-1)
- --mon.clearLine(y)
- mon.write(math.floor(100 / maxCap * isCap) .. "%")
- --end
- tanks = sen.getTargets()
- for vr, kr in pairs(tanks) do
- if kr.Name == "Ender Chest" then
- infos = sen.getTargetDetails(vr)
- mon.setCursorPos(1,y-3)
- mon.clearLine(y-3)
- for b1, k2 in pairs(infos.Tanks) do
- mon.clearLine(y-3)
- r2 = k2.Amount
- a2 = k2.Capacity
- mon.write("Tankinhalt: " ..k2.Amount )
- mon.setCursorPos(20,y-3)
- mon.write(" / " .. k2.Capacity)
- end
- end
- end
- print(isCap)
- print(maxCap)
- print(r2)
- print(a2)
- if isCap < (maxCap/2) and r2 > (a2/4) then
- rs.setOutput("bottom",true)
- else
- rs.setOutput("bottom",false)
- end
- rb = rb + 1
- else
- rb = 6
- end
- end
- end
- sleep(1)
- maxCap = 0
- isCap = 0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement