Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- # load the touchpoint API
- -- os.loadAPI("touchpoint")
- -- ## Fucntions ##
- -- check over mil
- function formatNum(num)
- if num >= 1000000 then
- num = math.floor((num / 1000000) * 10) / 10
- num = tostring(num) .. " M"
- end
- return num
- end
- -- next line
- function nextLine()
- y = y + 1
- screen.setCursorPos(x, y)
- end
- -- ## Pre setup ##
- -- setup connections
- screen = peripheral.find("monitor")
- cell = peripheral.find("tile_thermalexpansion_cell_resonant_name")
- reactor = peripheral.find("BigReactors-Reactor")
- -- check connections
- print(cell)
- if cell == nil then
- print("ERROR: please connect an energy cell")
- else
- print("found energy cell")
- end
- print()
- print(screen)
- if screen == nil then
- print("ERROR: please connect a monitor")
- else
- print("found monitor")
- -- t = touchpoint.new("monitor_0")
- end
- print()
- print(reactor)
- if reactor == nil then
- print("ERROR: please connect a reactor")
- else
- print("found reator")
- end
- print()
- -- ## Buttons ##
- -- t:add("big_button", nil, 2, 2, 3, 3, colors.red, colors.green)
- -- t:draw()
- while true do
- -- ## Code ##
- x, y = 1, 1
- -- setup monitor
- screen.clear()
- screen.setTextScale(1)
- screen.setCursorPos(x,y)
- -- get reactor status
- status = reactor.getActive()
- screen.setTextColor(colors.white)
- screen.write("Status: ")
- if status == true then
- screen.setTextColor(colors.green)
- screen.write("Active")
- else
- screen.setTextColor(colors.red)
- screen.write("Non active")
- end
- nextLine()
- -- get production
- production = math.floor(reactor.getEnergyProducedLastTick() * 10) / 10
- nextLine()
- screen.setTextColor(colors.white)
- screen.write("RF/tik: ")
- screen.setTextColor(colors.green)
- screen.write(production)
- -- get energy amounts
- curRfCell = cell.getEnergyStored()
- curRfReactor = reactor.getEnergyStored()
- maxRfCell = cell.getMaxEnergyStored()
- maxRfReactor = 10000000
- -- edit numbers
- cur = formatNum(curRfCell + curRfReactor)
- max = formatNum(maxRfCell + maxRfReactor)
- -- print out
- print("curent: " .. cur .. " RF")
- print("maximum: " .. max .. " RF")
- -- show on screen
- nextLine()
- screen.setTextColor(colors.white)
- screen.write("Curent: ")
- screen.setTextColor(colors.green)
- screen.write(cur .. " RF")
- nextLine()
- screen.setTextColor(colors.white)
- screen.write("Maximum: ")
- screen.setTextColor(colors.green)
- screen.write(max .. " RF")
- -- percent
- percent = math.floor((curRfCell / maxRfCell) * 100 * 100) / 100
- -- print out
- print(tostring(percent).."%")
- -- show on screen
- nextLine()
- screen.setTextColor(colors.white)
- screen.write("Percent: ")
- screen.setTextColor(colors.green)
- screen.write(percent .. " %")
- -- fuel
- curFuel = reactor.getFuelAmount()
- maxFuel = reactor.getFuelAmountMax()
- percentFuel = math.floor((curFuel / maxFuel) * 100) / 100
- nextLine()
- screen.setTextColor(colors.white)
- screen.write("Fuel: ")
- screen.setTextColor(colors.green)
- screen.write(percentFuel .. " %")
- -- check numbers
- if percent > 90 then
- reactor.setActive(false)
- end
- if percent < 10 then
- reactor.setActive(true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement