Advertisement
TwiXon4ik

Untitled

Oct 5th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. local c = require("component")
  2. local unicode = require("unicode")
  3. local holo = c.hologram
  4.  
  5. if not holo then error("This program reqiures holoram projector.") end
  6.  
  7.  
  8. local hologram = {}
  9.  
  10. ---------------------------------------
  11.  
  12. local symbols = {
  13. A = {
  14. {0, 0, 1, 0, 0},
  15.  
  16. },
  17. B = {
  18. {1, 1, 1, 1, 0},
  19. },
  20. C = {
  21. {0, 1, 1, 1, 0},
  22. },
  23. D = {
  24. {1, 1, 1, 1, 0},
  25. {0, 1, 0, 0, 1},
  26. {0, 1, 0, 0, 1},
  27. },
  28. E = {
  29. {1, 1, 1, 1, 1},
  30. {1, 0, 0, 0, 0},
  31. },
  32. F = {
  33. {1, 1, 1, 1, 1},
  34. {1, 0, 0, 0, 0},
  35. },
  36. G = {
  37. {0, 1, 1, 1, 1},
  38. },
  39. H = {
  40. {1, 0, 0, 0, 1},
  41. },
  42. I = {
  43.  
  44. },
  45. J = {
  46. {0, 0, 0, 0, 01},
  47. {0, 0, 0, 0, 1},
  48. {0, 0, 0, 0, 1},
  49. {0, 0, 0, 0, 1},
  50. {0, 0, 0, 0, 1},
  51. {0, 1, 0, 0, 1},
  52. {0, 0, 1, 1, 0},
  53. },
  54. K = {
  55. {1, 0, 0, 1, 1},
  56. {1, 0, 1, 0, 0},
  57. {1, 0, 1, 0, 0},
  58. {1, 1, 0, 0, 0},
  59. {1, 0, 1, 0, 0},
  60. {1, 0, 0, 1, 0},
  61. {1, 0, 0, 0, 1},
  62. },
  63. L = {
  64.  
  65. },
  66. M = {
  67. {1, 0, 0, 0, 1},
  68. {1, 1, 0, 1, 1},
  69. {1, 0, 1, 0, 1},
  70. {1, 0, 0, 0, 1},
  71. {1, 0, 0, 0, 1},
  72. {1, 0, 0, 0, 1},
  73. {1, 0, 0, 0, 1},
  74. },
  75. N = {
  76. {1, 0, 0, 0, 1},
  77. {1, 0, 0, 0, 1},
  78. {1, 1, 0, 0, 1},
  79. {1, 0, 1, 0, 1},
  80. {1, 0, 0, 1, 1},
  81. {1, 0, 0, 0, 1},
  82. {1, 0, 0, 0, 1},
  83. },
  84. O = {
  85. {0, 1, 1, 1, 0},
  86. {1, 0, 0, 0, 1},
  87. {1, 0, 0, 0, 1},
  88. {1, 0, 0, 0, 1},
  89. {1, 0, 0, 0, 1},
  90. {1, 0, 0, 0, 1},
  91. {0, 1, 1, 1, 0},
  92. },
  93. P = {
  94. {1, 1, 1, 1, 0},
  95. {1, 0, 0, 0, 1},
  96. {1, 0, 0, 0, 1},
  97. {1, 1, 1, 1, 0},
  98. {1, 0, 0, 0, 0},
  99. {1, 0, 0, 0, 0},
  100. {1, 0, 0, 0, 0},
  101. },
  102. Q = {
  103.  
  104. },
  105. R = {
  106.  
  107. },
  108. S = {
  109.  
  110. },
  111. T = {
  112.  
  113. },
  114. U = {
  115.  
  116. },
  117. V = {
  118.  
  119. },
  120. W = {
  121.  
  122. },
  123. X = {
  124.  
  125. },
  126. Y = {
  127.  
  128. },
  129. Z = {
  130.  
  131. },
  132. ["."] = {
  133.  
  134. },
  135. [","] = {
  136.  
  137. },
  138. ["!"] = {
  139.  
  140. },
  141. [":"] = {
  142.  
  143. },
  144. ["-"] = {
  145.  
  146. },
  147. ["_"] = {
  148.  
  149. },
  150. ["1"] = {
  151.  
  152. },
  153. ["2"] = {
  154.  
  155. },
  156. ["3"] = {
  157.  
  158. },
  159. ["4"] = {
  160.  
  161. },
  162. ["5"] = {
  163.  
  164. },
  165. ["6"] = {
  166.  
  167. },
  168. ["7"] = {
  169.  
  170. },
  171. ["8"] = {
  172.  
  173. },
  174. ["9"] = {
  175.  
  176. },
  177. ["0"] = {
  178.  
  179. },
  180. [" "] = {
  181.  
  182. },
  183. empty = {
  184.  
  185. },
  186. }
  187.  
  188. local function clear()
  189. holo.clear()
  190. end
  191.  
  192. function hologram.drawSymbol(x, y, z, symbol, color)
  193. for j = 1, #symbol do
  194. for i = 1, #symbol[j] do
  195. if symbol[j][i] == 1 then
  196. holo.set(x + i - 1, y - j + 1, z, color)
  197. end
  198. end
  199. end
  200. end
  201.  
  202. function hologram.text(x, y, z, text, color)
  203. local length = unicode.len(text)
  204. local smeshenie = 0
  205. for i = 1, length do
  206. local sym = unicode.sub(text, i, i)
  207. hologram.drawSymbol(x + smeshenie, y, z, symbols[sym], color)
  208. smeshenie = smeshenie + 6
  209. end
  210. end
  211.  
  212.  
  213. ---------------------------------------
  214.  
  215. local args = {...}
  216. local scale = tonumber(args[1]) or 1
  217. local height = tonumber(args[2]) or 10
  218.  
  219. local date
  220.  
  221. holo.setScale(scale)
  222.  
  223. while true do
  224. holo.clear()
  225. date = os.date("%T")
  226. hologram.text(1, height, 24, date, 2)
  227. os.sleep(1)
  228. end
  229.  
  230. ---------------------------------------
  231.  
  232. return hologram
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement