Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bridge = peripheral.wrap("bottom")
- local m = peripheral.wrap("right")
- m.setTextScale(.5)
- m.clear()
- local nCol = {}
- nCol.red = 0xff0000
- nCol.blue = 0x7dd2e4
- nCol.yellow = 0xffff4d
- nCol.green = 0x4dff4d
- nCol.gray = 0xe0e0e0
- nCol.grey = 0x909090
- nCol.night = 0x2020e0
- nCol.lime = 0x55ff55
- nCol.black = 0x000000
- nCol.white = 0xffffff
- nCol.dusk = 0x902090
- local power = 0
- local light = 0
- local line = 1
- local comMessage = "No news to report."
- rednet.open("top")
- m.setCursorPos(1,5)
- m.setTextColor(colors.purple)
- m.write("----------------------------------------------------")
- print("Ecliptica OS Loaded...")
- while true do
- -- clear the display
- bridge.clear()
- -- display welcome message
- welcome = "Ecliptica OS Loaded"
- text = bridge.addText(5, 5, welcome, nCol.white)
- m.setCursorPos(5,7)
- m.setTextColor(colors.yellow)
- m.write(welcome)
- -- display current time
- time = "IGT: " .. textutils.formatTime(os.time(), true)
- bridge.addText(5, 15, time, nCol.lime)
- m.setCursorPos(5,9)
- m.setTextColor(colors.lime)
- m.write(" ")
- m.setCursorPos(5,9)
- m.write(time)
- -- display current day
- day = "Day: " .. os.day()
- bridge.addText(55, 15, day, nCol.blue)
- m.setCursorPos(5,11)
- m.setTextColor(colors.cyan)
- m.write(" ")
- m.setCursorPos(5,11)
- m.write(day)
- -- display power information
- local powerLabel = "Power "
- bridge.addText(5, 25, powerLabel, nCol.red)
- barLength = 58 * power
- bridge.addBox(42, 26, barLength, 5, nCol.white, .5)
- bridge.addBox(42 + barLength, 26, 58 - barLength, 5, nCol.red, .5)
- m.setCursorPos(5,13)
- m.setTextColor(colors.red)
- m.write(" ")
- m.setCursorPos(5,13)
- m.write("Power: " .. math.floor(power * 600000) .. "/600,000")
- -- display light information
- barLength = 58 * light
- bridge.addBox(42, 36, barLength, 5, nCol.yellow, .5)
- bridge.addBox(42 + barLength, 36, 58 - barLength, 5, nCol.black, .5)
- m.setCursorPos(5,15)
- m.setTextColor(colors.yellow)
- m.write(" ")
- m.setCursorPos(5,15)
- m.write("Light: " .. light * 15 .. "/15")
- -- calculate weather from time and light levels
- if os.time() < 6 or os.time() > 20 then
- bridge.addText(5, 35, "Night", nCol.night)
- elseif os.time() > 17 then
- bridge.addText(5, 35, "Dusk", nCol.dusk)
- elseif light * 15 <= 9 then
- bridge.addText(5, 35, "Stormy", nCol.gray)
- elseif light * 15 <= 11 then
- bridge.addText(5, 35, "Dreary", nCol.blue)
- else
- bridge.addText(5, 35, "Clear", nCol.yellow)
- end
- -- clear connected users
- m.setCursorPos(5,18)
- m.write(" ")
- m.setCursorPos(5,19)
- m.write(" ")
- m.setCursorPos(5,20)
- m.write(" ")
- m.setCursorPos(5,21)
- m.write(" ")
- m.setCursorPos(5,22)
- m.write(" ")
- m.setCursorPos(5,23)
- m.write(" ")
- m.setCursorPos(5,24)
- m.write(" ")
- -- display connected users
- bridge.addText(5, 45, "Connections:", nCol.white)
- local users = bridge.getUsers()
- yLoc = 55
- m.setTextColor(colors.white)
- m.setCursorPos(5,17)
- m.write("Connections:")
- monitorLine = 18
- for key, value in pairs(users) do
- bridge.addText(5, yLoc, "- " .. value, nCol.blue)
- m.setCursorPos(5,monitorLine)
- m.write("- " .. value)
- monitorLine = monitorLine + 1
- yLoc = yLoc + 10
- end
- -- display com message
- --bridge.addText(350, 230, comMessage, nCol.gray)
- -- check rednet for notifications
- local sender, message, distance = rednet.receive()
- line = line + 1
- if line == 5 then
- line = 1
- end
- m.setCursorPos(1,line)
- m.write(" ")
- m.setCursorPos(1, line)
- m.setTextColor(colors.cyan)
- m.write("[" .. textutils.formatTime(os.time(), true) .. "]")
- m.setTextColor(colors.white)
- m.setCursorPos(8,line)
- m.write(" (" .. math.floor(distance) .. "m) " .. message .. " from " .. sender)
- if sender == 507 then
- power = tonumber(message) / 600000
- elseif sender == 508 then
- light = tonumber(message) / 15
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment