Advertisement
pepeknamornik

EPS

Dec 12th, 2020
1,022
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.88 KB | None | 0 0
  1. verze = "v0.1"
  2. objekt = "objekt"
  3. cmdPC = true
  4. obrazovka = true
  5. MonitorPos = "monitor_5"
  6. linky = 0
  7.  
  8.  
  9. Red_Line = true
  10. cervena = "PU c.1"
  11.  
  12. Orange_Line = true
  13. oranzova = "PU c.2"
  14.  
  15. Magenta_Line = true
  16. magentaT = "PU c.3"
  17.  
  18. lightBlue_Line = true
  19. lightBlueT = "PU c.4"
  20.  
  21. yellow_Line = true
  22. yellowT = "PU c.5"
  23.  
  24. pink_Line = true
  25. pinkT = "PU c.6"
  26.  
  27.  
  28.  
  29. if Red_Line then
  30. linky = linky + colors.red
  31. end
  32.  
  33. if Orange_Line then
  34. linky = linky + colors.orange
  35. end
  36.  
  37. if Magenta_Line then
  38. linky = linky + colors.magenta
  39. end
  40.  
  41. if lightBlue_Line then
  42. linky = linky + colors.lightBlue
  43. end
  44.  
  45. if yellow_Line then
  46. linky = linky + colors.yellow
  47. end
  48.  
  49. if pink_Line then
  50. linky = linky + colors.pink
  51. end
  52.  
  53.  
  54. function klid_tik()
  55.         redstone.setBundledOutput("back", linky)
  56.         sleep(2)
  57.         redstone.setBundledOutput("back", 0)
  58.         sleep(1)
  59.         vyhodnoceni()
  60. end
  61.  
  62. function vyhodnoceni()
  63.     if Red_Line then
  64.         if (colors.test (redstone.getBundledInput("back"), colors.red)) then
  65.         Line = cervena
  66.         poplach()
  67.         end
  68.     end
  69.    
  70.     if Orange_Line then
  71.         if (colors.test (redstone.getBundledInput("back"), colors.orange)) then
  72.         Line = oranzova
  73.         poplach()
  74.         end
  75.     end
  76.    
  77.     if Magenta_Line then
  78.         if (colors.test (redstone.getBundledInput("back"), colors.magenta)) then
  79.         Line = magentaT
  80.         poplach()
  81.         end
  82.     end
  83.    
  84.     if lightBlue_Line then
  85.         if (colors.test (redstone.getBundledInput("back"), colors.lightBlue)) then
  86.         Line = lightBlueT
  87.         poplach()
  88.         end
  89.     end
  90.    
  91.     if yellow_Line then
  92.         if (colors.test (redstone.getBundledInput("back"), colors.yellow)) then
  93.         Line = yellowT
  94.         poplach()
  95.         end
  96.     end
  97.    
  98.     if pink_Line then
  99.         if (colors.test (redstone.getBundledInput("back"), colors.pink)) then
  100.         Line = pinkT
  101.         poplach()
  102.         end
  103.     end
  104.    
  105.  
  106.     klid_tik()
  107. end
  108.  
  109. function poplach()
  110.  
  111.     if obrazovka then
  112.         monitor("poplach")
  113.     end
  114.    
  115.     if cmdPC then
  116.         for i=1,5 do
  117.         commands.exec("say POZAR! Objekt: "..objekt.." cidlo v PU: "..Line)
  118.         sleep(1)
  119.         end
  120.     end
  121.  
  122.     os.shutdown()
  123. end
  124.  
  125. function monitor(udalost)
  126. local monitor = peripheral.wrap(MonitorPos)
  127. monitor.setTextScale(1)
  128.    
  129.     if (udalost == "start") then
  130.         monitor.setBackgroundColor(colors.black)
  131.         monitor.setTextColor(colors.white)
  132.         monitor.clear()
  133.         monitor.setCursorPos(1,1)
  134.         monitor.write( "EPS by Pepek@Soft" )
  135.         monitor.setCursorPos(1,3)
  136.         monitor.write( "Stav: " )
  137.         monitor.setCursorPos(15,5)
  138.         monitor.write(verze)
  139.         monitor.setCursorPos(7,3)
  140.         monitor.setTextColor(colors.lime)
  141.         monitor.write( "v klidu" )
  142.     elseif (udalost == "poplach") then
  143.         monitor.setBackgroundColor(colors.red)
  144.         monitor.setTextColor(colors.white)
  145.         monitor.clear()
  146.         monitor.setCursorPos(1,1)
  147.         monitor.write( "POPLACH! POPLACH!" )
  148.         monitor.setCursorPos(1,3)
  149.         monitor.write( "Nahlasil:" )
  150.         monitor.setTextColor(colors.black)
  151.         monitor.setCursorPos(1,4)
  152.         monitor.write(Line)
  153.     end
  154.  
  155. end
  156.  
  157. if obrazovka then
  158. monitor("start")
  159. end
  160.  
  161.  
  162. klid_tik()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement