Advertisement
Guest User

lol

a guest
Dec 11th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.97 KB | None | 0 0
  1. initScreen = function(width,height,side)
  2.         local screen = {}
  3.         setmetatable(screen,{__index=Screen})
  4.         screen.width = width
  5.         screen.height = height
  6.         local modem = peripheral.wrap(side)
  7.         local periplist = modem.getNamesRemote()
  8.  
  9.         local min_id = 1000000000000
  10.  
  11.         for _,name in pairs(periplist) do
  12.           if name:find("thermalexpansion_light") then
  13.             local id = tonumber(name:sub(24,#name))
  14.             if id < min_id then
  15.               min_id = id
  16.             end
  17.           end
  18.         end
  19.  
  20.         local illuminators = {}
  21.         for i = min_id,min_id+height*width-1 do
  22.           local l = peripheral.wrap("thermalexpansion_light_"..tostring(i))
  23.           table.insert(illuminators,l)
  24.         end
  25.         screen.illuminators = illuminators
  26.         return screen
  27. end
  28.  
  29. local creen = initScreen(9, 7, "back")
  30.  
  31. local pic = {{12,13,14,16,23,25,30,31,32,33,34,39,41,48,50,51,52}}
  32.  
  33. local picnum = {}
  34. picnum[1] = {14,23,24,32,41,50,51,49}
  35. picnum[2] = {15,14,13,22,31,32,33,42,51,50,49}
  36. picnum[3] = {15,14,13,22,31,32,33,40,49,50,51}
  37. picnum[4] = {15,13,24,22,33,32,31,40,49}
  38. picnum[5] = {13,14,15,24,33,32,31,40,49,50,51}
  39. picnum[6] = {13,14,15,24,33,32,31,40,42,49,50,51}
  40. picnum[7] = {15,14,13,22,31,40,49}
  41. picnum[8] = {13,14,15,22,24,31,32,33,40,42,49,50,51}
  42. picnum[9] = {13,14,15,22,24,31,32,33,40,49,50,51}
  43. picnum[10] = {16,26,25,34,43,52,53,51,13,12,11,22,20,31,29,40,38,49,48,47}
  44. picnum[11] = {16,25,26,34,43,51,52,53,22,12,21,30,39,48,49,47}
  45. picnum[12] = {26,16,25,34,43,52,51,53,13,12,11,20,29,30,31,40,49,48,47}
  46. picnum[13] = {16,25,26,34,43,51,52,53,13,12,11,20,29,30,31,38,47,48,49}
  47. picnum[14] = {16,25,26,34,43,51,52,53,13,11,20,22,29,30,31,38,47}
  48. picnum[15] = {16,25,26,34,43,51,52,53,11,12,13,22,31,30,29,38,47,48,49}
  49. picnum[16] = {16,25,26,34,43,51,52,53,11,12,13,22,31,30,29,38,40,49,48,47}
  50. picnum[17] = {16,25,26,34,43,51,52,53,13,12,11,20,29,38,47}
  51. picnum[18] = {16,25,26,34,43,51,52,53,13,12,11,22,20,31,30,29,40,38,49,48,47}
  52. picnum[19] = {16,25,26,34,43,51,52,53,13,12,11,22,20,31,30,29,38,47,48,49}
  53. picnum[20] = {15,16,17,24,33,34,35,44,53,52,51,13,12,11,22,20,31,29,40,38,49,48,47}
  54. picnum[21] = {15,16,17,24,33,34,35,44,53,52,51,22,12,21,30,39,48,49,47}
  55. picnum[22] = {15,16,17,24,33,34,35,44,53,52,51,13,12,11,20,29,30,31,40,49,48,47}
  56. picnum[23] = {15,16,17,24,33,34,35,44,53,52,51,13,12,11,20,31,30,29,38,49,48,47}
  57. picnum[0] = {17,16,15,26,24,35,33,44,42,53,52,51,13,12,11,22,20,31,29,40,38,49,48,47}
  58.  
  59. fill = function(screen, color)
  60.   for i,v in pairs(creen.illuminators) do
  61.     v.setColor(color)
  62.   end
  63. end
  64.  
  65. printimg = function(screen, pic)
  66.    local color = 0xFF0000
  67.   for i,v in ipairs(pic) do
  68.     screen.illuminators[v].setColor(color)
  69.      color = color + 0x000900
  70.     end
  71. end
  72.    
  73.  
  74.  
  75.  
  76. local time = -1
  77.  
  78. while true do
  79.   sleep(0)
  80.   local oldtime = time
  81.   time = math.floor(os.time())
  82.   if oldtime ~= time then
  83.     fill(creen, 0x000000)
  84.     printimg(creen, picnum[time])
  85.   end
  86. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement