Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local reactor = peripheral.find("BigReactors-Reactor")
- local turnOnAt = 20
- local turnOffAt = 90
- local localEnergy = 0
- local status = false
- local energyLastTick = 0
- function main()
- drawScreen()
- end
- function getValues()
- status = reactor.getActive()
- localEnergy = reactor.getEnergyStored()
- energyLastTick = reactor.getEnergyProducedLastTick()
- end
- function drawScreen()
- monitor.clear()
- monitor.setTextScale(1)
- monitor.setBackgroundColor(colors.black)
- drawBox(1,39,1,3,colors.red,"Reactor Control",colors.white)
- drawBox(1,39,4,4,colors.black," ", colors.black)
- drawBox(1,19,5,5,colors.red,"Status",colors.white)
- drawBox(26,39,5,5,colors.black,tostring(status), colors.lime)
- drawBox(1,39,6,6,colors.black," ", colors.black)
- drawBox(1,19,7,7,colors.red,"EnergyStored",colors.white)
- drawBox(26,39,7,7,colors.black,tostring(localEnergy), colors.lime)
- drawBox(1,39,8,8,colors.black," ", colors.black)
- drawBox(1,19,9,9,colors.red,"Energy Production",colors.white)
- drawBox(26,39,9,9,colors.black,tostring(energyLastTick), colors.lime)
- end
- function drawBox(xa,xb,ya,yb, bgcolor,text,textcolor)
- monitor.setCursorPos(xa,ya)
- monitor.setTextColor(textcolor)
- for y = ya,yb,1 do
- for x = xa,xb,1 do
- monitor.setCursorPos(x,y)
- monitor.setBackgroundColor(bgcolor)
- monitor.write(" ")
- end
- xPos =1+ math.floor ((xa-1+xb) /2) - math.floor( string.len(text)/2 )
- monitor.setCursorPos(xPos,(ya+yb)/2)
- monitor.write(text)
- end
- monitor.setCursorPos(xa,yb+1)
- monitor.setBackgroundColor(colors.black)
- monitor.write(" ")
- end
- while true do
- main()
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement