Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("api")
- os.loadAPI("touchpoint")
- while true do
- r = peripheral.wrap("back")
- mon = peripheral.wrap("left")
- mon.clear()
- mon.setTextScale(1)
- glass = peripheral.wrap("bottom")
- local t = touchpoint.new("left")
- t:add("Toggle", toggle, 1, 17, 29, 19, colors.red, colors.lime)
- t:draw()
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- state = "Null"
- stateColor = colors.white
- rods = r.getNumberOfControlRods()
- rfStored = r.getEnergyStored()
- rfCapacity = 10000000
- casingTemp = r.getCasingTemperature()
- fuelAmount = r.getFuelAmount()
- fuelCapacity = r.getFuelAmountMax()
- fuelPercent = api.getPercent(fuelAmount, fuelCapacity)
- rate = r.getEnergyProducedLastTick()
- if r.getActive() then state = "Active" else state = "Inactive" end
- if r.getActive() then stateColor = colors.green else stateColor = colors.red end
- function toggle()
- if r.getActive() then
- r.setActive(false)
- else
- r.setActive(true)
- end
- end
- if rate >= 1000 then
- rateConverted = rate / 1000
- else
- rateConverted = rate
- end
- api.drawStringWithColor(mon, "State: ", 1, 1, colors.white)
- api.drawStringWithColor(mon, state, 7, 1, stateColor)
- api.drawStringWithColor(mon, "Rods: ", 1, 2, colors.white)
- api.drawStringWithColor(mon, rods, 6, 2, colors.blue)
- api.drawStringWithColor(mon, "Stored: ", 1, 3, colors.white)
- api.drawStringWithColor(mon, rfStored .. " RF", 8, 3, colors.red)
- api.drawStringWithColor(mon, "Temperature: ", 1, 4, colors.white)
- api.drawStringWithColor(mon, casingTemp .. " C", 13, 4, colors.red)
- api.drawStringWithColor(mon, "Fuel: ", 1, 5, colors.white)
- api.drawStringWithColor(mon, fuelAmount .." mb", 6, 5, colors.blue)
- api.drawStringWithColor(mon, "Rate: ", 1, 6, colors.white)
- if rate >= 1000 then
- api.drawStringWithColor(mon, math.ceil(rate / 1000) .. " kRF/t", 6, 6, colors.red)
- else
- api.drawStringWithColor(mon, rate .. " RF/t", 6, 6, colors.red)
- end
- glass.clear()
- glass.addBox(1, 1, 140, 46, 0xFFFFFF, 0.2)
- if r.getActive() then
- glass.addText(5, 2, "State: " .. state, 0x66FF33)
- else
- glass.addText(5, 2, "State: " .. state, 0xFF0000)
- end
- glass.addText(5, 11, "Stored: " .. rfStored .. " RF", 0x66FF33)
- glass.addText(5, 20, "Temperature: " .. casingTemp .. " C", 0x66FF33)
- glass.addText(5, 29, "Fuel: " .. fuelAmount .." mb", 0x66FF33)
- if rate >= 1000 then
- glass.addText(5, 38, "Rate: " .. math.ceil(rate / 1000) .. " kRF/t", 0x66FF33)
- else
- glass.addText(5, 38, "Rate: " .. rate .. " RF/t", 0x66FF33)
- end
- glass.sync()
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- t.buttonList[p1].func()
- end
- sleep(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment