Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------Jackson_Pike's Turbine Program---
- local function peripherals()
- mon = peripheral.wrap("right")
- turb = peripheral.wrap("BigReactors-Turbine_0")
- monX, monY = mon.getSize()
- name = turb
- end
- ------------------------------------------------
- local function drawMenus(color)
- mon.setCursorPos(1, 1)
- mon.setBackgroundColor(color)
- mon.write(string.rep(" ", monX))
- mon.setCursorPos(1, monY)
- mon.setBackgroundColor(color)
- mon.write(string.rep(" ", monX))
- end
- local function writeText(xPos, yPos, bgcolor, txcolor, text)
- mon.setCursorPos(xPos, yPos)
- mon.setBackgroundColor(bgcolor)
- mon.setTextColor(txcolor)
- mon.write(text)
- end
- local function clear()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- end
- local function getData()
- RFStored = math.floor(turb.getEnergyStored())
- RF = math.floor(turb.getEnergyProducedLastTick())
- Rotor = math.floor(turb.getRotorSpeed())
- poll = turb.getActive()
- Steam = turb.getInputAmount()
- sleep(0.1)
- end
- local function displayData()
- writeText(1, 3, colors.black, colors.yellow, "RF/Tick: ")
- writeText(10, 3, colors.black, colors.white, RF.." RF/T")
- writeText(1, 4, colors.black, colors.yellow, "Rotor Speed: ")
- writeText(14, 4, colors.black, colors.white, Rotor.." RPM")
- writeText(1, 5, colors.black, colors.yellow, "Energy Stored: ")
- writeText(16, 5, colors.black, colors.white, RFStored.." RF")
- writeText(1, 6, colors.black, colors.yellow, "Steam Stored: ")
- writeText(15, 6, colors.black, colors.white, Steam.."mB/2000mB")
- end
- local function homepage()
- if poll == true then
- clear()
- drawMenus(colors.blue)
- writeText(monX/2-4.5, 1, colors.blue, colors.white, "Turbine 1")
- writeText(1, 2, colors.black, colors.yellow, "Status: ")
- writeText(8, 2, colors.black, colors.green, "ONLINE")
- writeText(monX-3, 1, colors.blue, colors.white, "OFF")
- displayData()
- else
- clear()
- drawMenus(colors.gray)
- writeText(monX/2-4.5, 1, colors.gray, colors.white, "Turbine 1")
- writeText(1, 2, colors.black, colors.yellow, "Status: ")
- writeText(8, 2, colors.black, colors.red, "OFFLINE")
- writeText(monX-3, 1, colors.gray, colors.white, "ON")
- displayData()
- end
- end
- while true do
- peripherals()
- mon.setTextScale(1)
- getData()
- homepage()
- sleep(1)
- mon.clear()
- homepage()
- end
Advertisement
Add Comment
Please, Sign In to add comment