Advertisement
Forza11

NuclearST

Jul 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.78 KB | None | 0 0
  1. local component = require('component')
  2. local reactor
  3. local rs = component.redstone
  4. local note = require('note')
  5. local heat
  6. local try
  7. local aftr
  8. local term = require('term')
  9. n = 0
  10. if component.isAvailable('reactor') then
  11.   reactor = component.reactor
  12. elseif component.isAvailable('reactor_chamber') then
  13.   reactor = component.reactor_chamber
  14. else
  15.   print("Реактор не подключен")
  16.   os.exit()
  17. end
  18.  
  19. rs.setOutput(2, 0)
  20. function start()
  21.   while n == 0 do
  22.   temp = tostring(reactor.getHeat())
  23.   heatfloor = tostring(math.floor(reactor.getHeat()/reactor.getMaxHeat()*100+0.5))
  24.   message = "Нагрев реактора: " .. temp .. " (" .. heatfloor .. "%)"
  25.   term.clear()
  26.   print(message)
  27.   heat = reactor.getHeat()/reactor.getMaxHeat()*100
  28.   end
  29. end
  30. function password()
  31.   while true do
  32.   if n == 1 then
  33.     while true do
  34.       io.write("Введите код безопасности: ")
  35.       err, aftr = pcall(io.read)
  36.       if aftr == "124" then
  37.         n = 0
  38.         term.clear()
  39.         print("Code true")
  40.         while true do
  41.           io.write("Введите пароль: ")
  42.           err, try = pcall(io.read)
  43.           if try == "123" then
  44.             rs.setOutput(2, 15)
  45.             start()
  46.           else
  47.             rs.setOutput(2, 0)
  48.             print("Пароль неверный!")
  49.           end
  50.         end
  51.       else
  52.         print("Код безопасности неверный. Запуск невозможен!")
  53.       end
  54.     end
  55.   else
  56.       io.write("Введите пароль: ")
  57.       err, try = pcall(io.read)
  58.       if try == "123" then
  59.         rs.setOutput(2, 15)
  60.         start()
  61.       else
  62.         rs.setOutput(2, 0)
  63.         print("Пароль неверный!")
  64.       end
  65.   end
  66.   end
  67. end
  68. password()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement