Advertisement
Guest User

react

a guest
Apr 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. local com = require('component')
  2. local cb=com.chat_box
  3. local red = com.redstone
  4. local event=require("event")
  5. local str=require("string")
  6. local react=com.reactor_chamber
  7.  
  8. heat=0
  9. cb.setName("§6Реактор§8")
  10.  
  11. while true do
  12. heat=react.getHeat()
  13. print(heat)
  14. if heat>0 and react.isActive()=="true" then
  15. cb.say("test")
  16. end
  17. if heat>0 and react.isActive()=="true" then
  18. red.setOutput(4,0)
  19. cb.say("§4Реактор аварийно остановлен, проверьте схему")
  20. end
  21.  
  22.  evt,_,plr,msg=event.pull("chat_message")
  23.     if msg=="старт" and react.getHeat()==0  then
  24.     if plr=="AndreyVodogrey" or plr=="atomzerg" then
  25. red.setOutput(4,1)
  26. cb.say("§4Реактор запущен")
  27.     end
  28. end
  29.  
  30. if msg=="выход" then
  31. if plr=="AndreyVodogrey" or plr=="atomzerg" then
  32. cb.say("§aВыход энергии= "..5*react.getReactorEnergyOutput().." §aEu/T")
  33. heat=react.getHeat()
  34. heat=heat/100
  35. cb.say("§aТемпература реактора="..heat.."%")
  36. end
  37. end
  38.  
  39. if msg=="статус" then
  40. if plr=="atomzerg" or plr=="AndreyVodogrey" then
  41. if react.isActive()==true then
  42. cb.say("§aCейчас реактор работает")
  43. end
  44. if react.isActive()==false then
  45. cb.say("§aСейчас реактор не работает")
  46. cb.say("§aТемпература реактора="..heat.."%")
  47. end
  48. end
  49. end
  50.  
  51. if msg=="стоп" then
  52. if plr=="AndreyVodogrey" or plr=="atomzerg" then
  53. red.setOutput(4,0)
  54. cb.say("§aРеактор остановлен")
  55. end
  56. end
  57.  
  58.  
  59. if msg=="старт" and plr=="atomzerg" and react.getHeat()>0 and red.getOutput(4)==0 then
  60. cb.say("§5Температура не позволяет запустить реактор")
  61. red.setOutput(4,0)
  62. end
  63.  
  64. if msg=="старт" and plr=="AndreyVodogrey" and react.getHeat()>0 and red.getOutput(4)==0 then
  65. cb.say("§5Температура не позволяет запустить реактор")
  66. red.setOutput(4,0)
  67. end
  68.  
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement