Advertisement
E-Kemp

Valley Display

Feb 5th, 2023 (edited)
2,090
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. function renderMasterTerm(stats)
  2.   local weather = stats.weather or 0
  3.   local power = stats.power or 0
  4.   local players = stats.players or {}
  5.   term.clear()
  6.   term.setCursorPos(1, 1)
  7.   print("Welcome to >>")
  8.   write("              Elli")
  9.   term.setTextColor(colors.purple)
  10.   print("OS")
  11.   term.setTextColor(colors.white)
  12.   print("\n--------------\n")
  13.   print("Stats:")
  14.   print("  Rain prevention: " .. stats.weather)
  15.   print("  Power level: " .. stats.power .. "%")
  16.   print("  Players present:")
  17.   if next(stats.players) ~= nil then
  18.     local day = os.day()
  19.     for k, v in pairs(players) do
  20.       if v >= day then
  21.         print("   > "..k)
  22.       end
  23.     end
  24.   else
  25.     print("    None")
  26.   end
  27.   print("\n--------------\n")
  28.   print("Listening for events . . .")
  29. end
  30.  
  31. function renderToDo(direction, list)
  32.   local monitor = peripheral.wrap(direction)
  33.   local x, y = monitor.getSize()
  34.  
  35.   monitor.clear()
  36.   monitor.setTextScale(0.5)
  37.   monitor.setCursorPos(1, 1)
  38.   monitor.write(">> Elli")
  39.   monitor.setTextColor(colors.purple)
  40.   monitor.write("OS")
  41.   monitor.setTextColor(colors.white)
  42.   for i = 1, x do
  43.     monitor.setCursorPos(i, 2)
  44.     monitor.write("-")
  45.   end
  46.   monitor.setCursorPos(1, 4)
  47.   monitor.write("To-do list:")
  48.   for i, v in ipairs(list) do
  49.     monitor.setCursorPos(1, i+4)
  50.     monitor.write(v)
  51.   end
  52. end
  53.  
  54. function renderWide(direction, statistic, number)
  55.   local monitor = peripheral.wrap(direction)
  56.   local x, y = monitor.getSize()
  57.  
  58.   monitor.clear()
  59.   monitor.setCursorPos(1, 1)
  60.   monitor.write(">> Elli")
  61.   monitor.setTextColor(colors.purple)
  62.   monitor.write("OS")
  63.   monitor.setTextColor(colors.white)
  64.   for i = 1, x do
  65.     monitor.setCursorPos(i, 2)
  66.     monitor.write("-")
  67.   end
  68.   monitor.setCursorPos(1, 4)
  69.   monitor.write(statistic .. ": " .. number)
  70. end
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement