Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Some functions
- -- Gets a peripheral by name, so that
- -- we can connect to the reactor via a
- -- modem much easier
- function getPeripheral(thing)
- local wrapped, i = nil, 0
- while wrapped == nil and i <= 100 do
- wrapped = peripheral.wrap(thing.."_"..i)
- i = i + 1
- end
- if wrapped == nil then
- side = getDeviceSide(thing)
- if side ~= nil then
- return peripheral.wrap(side)
- else
- return nil
- end
- else
- return wrapped
- end
- end
- -- Displays a data row in two columns
- function displayDataRow(monitor, lineNum, label, value)
- valueIndent = 20
- monitor.setCursorPos(1, lineNum)
- monitor.write(label)
- monitor.setCursorPos(valueIndent, lineNum)
- monitor.write(value)
- end
- -- Rounds a number
- function round(number)
- return math.floor(number + 0.5)
- end
- -- Start of actual program
- local reactor = getPeripheral("BigReactors-Reactor")
- local monitor = peripheral.wrap("left")
- if reactor == nil then
- print("Can't find reactor")
- else
- if monitor == nil then
- print("Can't find monitor")
- else
- monitor.clear()
- displayDataRow(monitor,1,"Big Reactor Monitor","")
- displayDataRow(monitor,2,"-------------------","")
- displayDataRow(monitor,4,"Reactor active:", reactor.getActive())
- displayDataRow(monitor,4,"Fuel temp:", round(reactor.getFuelTemperature()))
- displayDataRow(monitor,5,"Casing temp:", round(reactor.getCasingTemperature()))
- displayDataRow(monitor,6,"Fuel left:", reactor.getFuelAmount())
- displayDataRow(monitor,7,"Reserve RF:",round(reactor.getEnergyStored()))
- displayDataRow(monitor,8,"Fuel Reactivity:",reactor.getFuelReactivity().."%")
- displayDataRow(monitor,9,"Fuel per tick:", reactor.getFuelConsumedLastTick())
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement