Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reactor = peripheral.wrap('back')
- mon = peripheral.wrap('right')
- monX, monY = mon.getSize()
- progColors = {
- background = colors.black,
- text = colors.white,
- value = colors.purple,
- energy = colors.green,
- fuel = colors.blue
- }
- function monClear()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setCursorPos(1,1)
- end
- function percent(minVal, maxVal)
- return math.floor((minVal/maxVal)*100)
- end
- function monWrite(x, y, text, textColor, backgroundColor)
- textColor = textColor
- backgroundColor = backgroundColor
- mon.setCursorPos(x,y)
- mon.setBackgroundColor(backgroundColor)
- mon.setTextColor(textColor)
- mon.write(text)
- end
- function monCenter(y, text, textColor, backgroundColor)
- monWrite((monX/2)-(#text/2),y,text,textColor,backgroundColor)
- end
- function monProgress(x,y,percent,name,barColor,backgroundColor, length,size)
- length = length or (monX/2)+(monX/3)
- size = size or 2
- for i = 0,size-1 do
- monWrite(x,y+i, string.rep(" ", length), backgroundColor,backgroundColor)
- monWrite(x,y+i, string.rep(" ", ((percent/100)*length)), barColor, barColor)
- end
- barText = name.." "..math.floor(percent).."%"
- if ((percent/100)*length) > #barText + 1 then
- monWrite(x+(((percent/100)*length)-#barText),y+(size/2), barText, progColors.text,barColor)
- else
- monWrite(x+((length/2)-(#barText/2)),y+(size/2), barText, progColors.text,backgroundColor)
- end
- end
- function energyStored()
- return(reactor.getEnergyStored())
- end
- function maxFuel()
- return(reactor.getFuelAmountMax())
- end
- function fuelLevel()
- return(reactor.getFuelAmount())
- end
- function currTemp()
- return(reactor.getTemperature())
- end
- function RFOutput()
- return(reactor.getEnergyProducedLastTick())
- end
- function reactorStatus()
- status = reactor.getActive()
- if status == true then
- return("Active")
- end
- if status == false then
- return("Shutdown")
- end
- end
- function mainScreen(energyPercent,fuelPercent,tempPercent)
- energyPercent = energyPercent or 0
- fuelPercent = fuelPercent or 0
- tempPercent = tempPercent or 0
- monProgress(15,8, energyPercent, "Energy", progColors.energy, colors.gray, 35,3)
- monProgress(15,12, fuelPercent, "Fuel", progColors.fuel, colors.gray, 35, 3)
- monProgress(15,16, tempPercent, "Temperature", colors.red, colors.gray, 35,3)
- end
- while true do
- monClear()
- energy = percent(energyStored(),10000000)
- fuel = percent(fuelLevel(), maxFuel())
- temp = percent(currTemp(), 2000)
- monCenter(4, "Daelie's Reactor 1", colors.yellow, colors.black)
- monWrite(1,9, "Redstone Flux", colors.purple, colors.black)
- monWrite(1,13, "Yellorium", colors.purple,colors.black)
- monWrite(1,17, "Temp: "..currTemp(), colors.purple, colors.black)
- mainScreen(energy, fuel, temp)
- monWrite(1,21, "Control Rods: 9", colors.purple,colors.black)
- monWrite(1,22, "Output: ".. math.floor(RFOutput()).." RF/t", colors.purple, colors.black)
- monWrite(1,23, "Reactor Status: " ..tostring(reactorStatus()), colors.purple, colors.black)
- sleep(0.8)
- end
Advertisement
Add Comment
Please, Sign In to add comment