Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --By Willa_/WillaRL_
- local statsDisp = require("statisticDisplayAPI")
- local buttonAPI = require("buttonAPI")
- local component = require("component")
- local event = require("event")
- local thread = require("thread")
- local gpuAPI = require("gpuAPI")
- local gpu = component.gpu
- local reac = component.reactor_logic_adapter
- local barDisplays = statsDisp()
- local buttons = buttonAPI()
- function energyOut()
- return (reac.getProducing()*0.4/1000000)
- end
- function injectRate()
- return reac.getInjectionRate()
- end
- function internalBuffer()
- return (reac.getEnergy()*0.4)/1000000
- end
- function minusInjRate()
- reac.setInjectionRate(reac.getInjectionRate() - 1)
- return true
- end
- function addInjRate()
- reac.setInjectionRate(reac.getInjectionRate() + 1)
- return true
- end
- function deutAmount()
- return reac.getDeuterium()
- end
- function tritAmount()
- return reac.getTritium()
- end
- function plasmaHeat()
- return reac.getPlasmaHeat()/1000000000
- end
- function caseHeat()
- return reac.getCaseHeat()/1000000000
- end
- function injectRateStr()
- local rate = tostring(reac.getInjectionRate())
- return rate
- end
- gpuAPI.clear(0x0F0F0F)
- gpuAPI.write(69, 5, 0x006D00, "Energy Production")
- gpuAPI.write(70, 15, 0x006D00, "Injection Rate")
- gpuAPI.fill(22,16,46,7, 0x878787)
- gpuAPI.write(16, 6, 0x990000, "Buffer")
- gpuAPI.write(41, 21, 0xFF2480, "Deuterium")
- gpuAPI.write(41,24, 0x00FF00, "Tritium")
- gpuAPI.write(54, 29, 0xFF6D00, "Plasma Heat")
- gpuAPI.write(90, 29, 0xFF6D00, "Case Heat")
- gpuAPI.fill(88,87,21,16, 0xFF0000)
- barDisplays:addGraph(0, 114, 41, 10, 7, 0x000000, 0x009900, energyOut, 0, 18)
- barDisplays:addGraph(0, 114, 41, 20, 17, 0x000000, 0x009900, injectRate, 0, 150)
- barDisplays:addGraph(1, 21, 17, 45, 8, 0x000000, 0x009900, internalBuffer, 0, 400)
- barDisplays:addGraph(0, 114, 41, 23, 22, 0x000000, 0xFF2480, deutAmount, 0, 1000)
- barDisplays:addGraph(0, 114, 41, 26, 25, 0x000000, 0x00FF00, tritAmount, 0, 1000)
- barDisplays:addGraph(1, 61, 59, 44, 31, 0x000000, 0xFF6D00, plasmaHeat, 0, 15)
- barDisplays:addGraph(1, 96, 94, 44, 31, 0x000000, 0xFF6D00, caseHeat, 0, 10)
- barDisplays:addText(75, 16, 0x006D00, injectRateStr)
- buttons:add("-", 0, 39, 34, 20, 17, 0x696969, 0xB4B4B4, 0.1, minusInjRate)
- buttons:add("+", 0, 121, 116, 20, 17, 0x696969, 0xB4B4B4, 0.1, addInjRate)
- --[[
- function temp()
- while true do
- local _, _, x, y = event.pull("touch")
- gpu.fill(x,y, 1, 1, "X")
- print(x,y)
- end
- end
- thread.create(temp)
- --]]
- function buttonListener()
- while true do
- local _, _, x, y = event.pull("touch")
- buttons:click(x,y)
- end
- end
- thread.create(buttonListener)
- barDisplays:start(1)
Advertisement
Add Comment
Please, Sign In to add comment