Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function math.round(num, idp)
- assert(type(num) == "number", "math.round: wrong argument types (<number> expected for num)")
- assert(type(idp) == "number" or idp == nil, "math.round: wrong argument types (<integer> expected for idp)")
- local mult = 10 ^ (idp or 0)
- if num >= 0 then return math.floor(num * mult + 0.5) / mult
- else return math.ceil(num * mult - 0.5) / mult
- end
- end
- local reaktor = peripheral.wrap("back")
- local chest = peripheral.wrap('chest_1')
- local cell = peripheral.wrap('tile_thermalexpansion_cell_resonant_name_0')
- local g = peripheral.wrap("right")
- function addBg()
- g.addBox(1,1,200,80,0xFFFFFF,0.2)
- end
- function write()
- local energyMax = cell.getMaxEnergyStored()
- local energyStored = cell.getEnergyStored()
- g.addText(3,2,"Generated Rf/t: "..tostring(reaktor.getEnergyProducedLastTick()),0x000000)
- g.addText(3,12,"Control Rod Level: "..tostring(reaktor.getControlRodLevel(1)),0x000000)
- g.addText(3,22,"Reactor Status: ", 0x000000)
- if reaktor.getActive() then
- g.addText(85,22,"Online",0x00FF00)
- else
- g.addText(85,22,"Offline",0xFF0000)
- end
- g.addText(3,32,"Energy Stored: "..((energyStored/energyMax)*100).."%",0x000000)
- g.addText(3,42,"Fuel left: "..tostring(reaktor.getFuelAmount()+GetItemsInChest()*1000).."mB",0x000000)
- g.addText(3,52,"mB/t: "..tostring(reaktor.getFuelConsumedLastTick()),0x000000)
- local fuelticksleft = ((reaktor.getFuelAmount()+GetItemsInChest()*100)/reaktor.getFuelConsumedLastTick())
- local secleft = fuelticksleft/20
- local minleft = secleft/60
- local hourleft = minleft/60
- local daysleft = hourleft/24
- if daysleft > 1 then
- g.addText(3,62,"Time left: "..tostring(math.round(daysleft,2)).." Days",0x000000)
- elseif hourleft > 1 then
- g.addText(3,62,"Time left: "..tostring(math.round(hourleft,2)).." Hours",0x000000)
- elseif minleft > 1 then
- g.addText(3,62,"Time left: "..tostring(math.round(minleft,2)).." Minutes",0xFF00FF)
- elseif secleft > 1 then
- g.addText(3,62,"Time left: "..tostring(math.round(secleft,2)).." Seconds",0xFF00FF)
- elseif fuelticksleft > 1 then
- g.addText(3,62,"Time left: "..tostring(fuelticksleft).." Ticks",0xFF00FF)
- else
- g.addText(3,62," -- FUEL DEPLETED -- ",0xFF0000)
- end
- end
- function GetItemsInChest()
- local yellorium = 0
- for i = 1, chest.getInventorySize() do
- local s = chest.getStackInSlot(i)
- if s then
- if s.display_name == "Yellorium Block" then
- yellorium = yellorium + s.qty*9
- elseif s.display_name == "Yellorium Ingot" or s.display_name == "Blutonium Ingot" then
- yellorium = yellorium + s.qty
- end
- end
- end
- return yellorium
- end
- function start()
- while true do
- g.clear()
- addBg()
- write()
- g.sync()
- sleep(1)
- end
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement