Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- sen = sensor.wrap("bottom")
- mon = peripheral.wrap("back")
- mon.setTextScale(1)
- xMax, yMax = mon.getSize()
- tps=30
- x=1
- y=-2
- z=0
- function JoJa()
- mon.setBackgroundColor(colors.gray)
- for xP = 1,xMax do
- mon.setCursorPos(xP,1)
- mon.write(" ")
- end
- mon.setCursorPos(1,1)
- mon.setTextColor(colors.cyan)
- mon.write("Jo")
- mon.setTextColor(colors.orange)
- mon.write("Ja ")
- mon.setTextColor(colors.lightGray)
- mon.write("Productions")
- end
- function bg(col)
- mon.setBackgroundColor(col)
- for xP = 1,xMax do
- for yP = 1,yMax do
- mon.setCursorPos(xP,yP)
- mon.write(" ")
- end
- end
- end
- energy=0
- energynew=0
- energytick=0
- energytotal=0
- tickstotal=0
- while true do
- targets = sen.getTargets()
- for k,v in pairs(targets) do
- if v.Position.X==x and v.Position.Y==y
- and v.Position.Z==z then
- for w,x in pairs(sen.getTargetDetails(k)) do
- if w == "EnergySunken" then
- energynew = x
- end
- end
- end
- end
- bg(colors.lightGray)
- JoJa()
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.lightGray)
- if energy == 0 then
- energy = energynew
- mon.setCursorPos(1,3)
- mon.write("EU/t 0EU/t")
- mon.setCursorPos(1,4)
- mon.write("Mittelwert 0EU/t")
- elseif energynew >= energy then
- energytick = (energynew - energy) / tps
- energytotal = energytotal + energytick
- energy = energynew
- tickstotal = tickstotal + 1
- mon.setCursorPos(1,3)
- mon.write("EU/t " .. math.floor(energytick) .. "EU/t")
- mon.setCursorPos(1,4)
- mon.write("Mittelwert " .. math.floor(energytotal / tickstotal) .. "EU/t")
- else
- energytick = 0
- energy = 0
- energynew = 0
- tickstotal = 0
- mon.setCursorPos(1,3)
- mon.write("Neuberechnung...")
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement