Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Finding the Reactor & Monitor--
- local reactor = peripheral.find("BigReactors-Reactor")
- local mon = peripheral.find("monitor")
- --Functions--
- local function percentMe(currentValue, maxValue)
- return math.floor((100 * currentValue) / maxValue)
- end
- --Main Code--
- while true do
- --Variables--
- local maxEnergy = 1000000
- local storedEnergy = math.floor(reactor.getEnergyStored())
- local percentageEnergy = percentMe(storedEnergy, maxEnergy)
- local storedTemperature = reactor.getFuelTemperature()
- local storedFuel = reactor.getFuelAmount()
- local storedWaste = reactor.getWasteAmount()
- local status
- local statusColor
- --if Statements--
- if percentageEnergy > 90 then
- reactor.setActive(false)
- else
- reactor.setActive(true)
- end
- --
- if reactor.getActive() then
- statusColor = colors.lime
- status = "Online"
- else
- statusColor = colors.red
- status = "Offline"
- end
- --
- --Monitor Drawing--
- mon.clear()
- mon.setBackgroundColor(colors.black)
- mon.setTextScale(5)
- mon.setTextScale(0.5)
- mon.setCursorPos(7,1)
- mon.setTextColor(colors.orange)
- mon.write("[SC] Reactor Controller")
- mon.setCursorPos(1,3)
- mon.setTextColor(colors.white)
- mon.write("Reactor Status : ")
- mon.setCursorPos(22,3)
- mon.setTextColor(statusColor)
- mon.write(status)
- mon.setCursorPos(1,4)
- mon.setTextColor(colors.white)
- mon.write("Stored Energy : ")
- mon.setCursorPos(22,4)
- mon.setTextColor(colors.white)
- mon.write(tostring(storedEnergy))
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.white)
- mon.write("Temperature : ")
- mon.setCursorPos(22,5)
- mon.setTextColor(colors.white)
- mon.write(storedTemperature)
- mon.setCursorPos(1,6)
- mon.setTextColor(colors.white)
- mon.write("Stored Fuel : ")
- mon.setCursorPos(22,6)
- mon.setTextColor(colors.yellow)
- mon.write(storedFuel)
- mon.setCursorPos(1,7)
- mon.setTextColor(colors.white)
- mon.write("Stored Waste : ")
- mon.setCursorPos(22,7)
- mon.setTextColor(colors.orange)
- mon.write(storedWaste)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement