Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function detectDevice(DeviceName)
- DeviceSide="nix"
- for a,b in pairs(redstone.getSides()) do
- if peripheral.getType(b)==DeviceName then
- DeviceSide = b
- break
- end
- end
- return(DeviceSide)
- end
- --BigReactors-Reactor
- function clearline(line)
- monitor.setCursorPos(1,line)
- monitor.clearLine()
- end
- function round(num)
- vor, nach = math.modf(num)
- if (nach >= 0.5) then
- vor = vor +1
- end
- return vor
- end
- reaktor = peripheral.wrap(detectDevice("BigReactors-Reactor"))
- monitor = peripheral.wrap(detectDevice("monitor"))
- while (true) do
- storedE = reaktor.getEnergyStored()
- monitor.setCursorPos(1,1)
- monitor.clearLine(1)
- monitor.write("Interner Speicher bei ")
- monitor.write(math.floor(reaktor.getEnergyStored()/100000))
- monitor.write(" %")
- -- monitor.write(storedE/1000)
- if (reaktor.getEnergyStored()>=9800000) then
- reaktor.setActive(false)
- monitor.setCursorPos(1,2)
- monitor.clearLine(2)
- monitor.setBackgroundColor(colors.red)
- monitor.setTextColor(colors.black)
- monitor.write("Reaktor offline")
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.white)
- end
- if (reaktor.getEnergyStored()<= 1000000) then
- reaktor.setActive(true)
- monitor.setCursorPos(1,2)
- monitor.clearLine(2)
- monitor.setBackgroundColor(colors.green)
- monitor.setTextColor(colors.black)
- monitor.write("Reaktor online")
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.white)
- end
- sleep(1)
- storedE2 = reaktor.getEnergyStored()
- usedEnergy = storedE - storedE2
- usedEnergy = usedEnergy /1000
- --monitor.clear(),monitor.setCursorPos(1,1)
- monitor.setCursorPos(1,5)
- monitor.clearLine(5)
- if (usedEnergy >=0) then
- monitor.write("aktueller Verbrauch bei: ")
- else
- monitor.write("aktuelle Aufladung mit")
- end
- monitor.setCursorPos(1,6)
- monitor.clearLine(6)
- monitor.write(round(usedEnergy))
- monitor.write(" kRF")
- sleep(1)
- --monitor.clear()
- --monitor.setCursorPos(1,1)
- end
Add Comment
Please, Sign In to add comment