pepeknamornik

Dalkovy_prenos_sablona

Jun 12th, 2021 (edited)
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. HlasLinka = "back"
  2. Adresa = "Jaderna Elektrarna Bostrava"
  3. Udalost = "POZAR"
  4. upresneni = "Reaktor c. 4"
  5. local idPC = os.getComputerID()
  6. modem = peripheral.wrap("top")
  7. modem.open(idPC)
  8. IDserver = 120
  9. local historielinka = false
  10. local tedlinka
  11. local i = 0
  12. local testJednotky = true
  13. local test = math.random(10000, 22000)
  14. term.clear()
  15.  
  16. term.setCursorPos(1,1)
  17. print("ID ustredny: "..idPC)
  18. print("Adresa: "..Adresa)
  19. print("Cas spusteni: "..os.date())
  20. if (test < 11600 and testJednotky) then  
  21. hod = math.floor(test/3600)
  22. minu = math.floor ((test - hod*3600)/60)
  23. print("Test jednotky za: "..hod.." h, "..minu.." min")
  24. else print ("Test jednotky nebude proveden! ("..test..")") end
  25.  
  26. function linka()
  27.     tedlinka = redstone.getInput(HlasLinka)
  28.     if not (historielinka == tedlinka) then
  29.         if tedlinka then
  30.         poplach = true
  31.         end
  32.     end
  33.     if poplach then poslatStatus() print("status odeslan!") end
  34.    
  35.     historielinka = tedlinka
  36.     poplach = false
  37.     sleep(1)
  38.     i = i+1
  39.     if (test < 11600 and (test-i) >=0 and testJednotky) then term.setCursorPos(1,5) print("Test za "..(test-i).." s") end
  40.     if ((test-i) == 0) then upresneni = ("TC - "..upresneni) poslatStatus() print("Status odeslan!") end
  41.     if (i==11600) then os.reboot() end
  42.     linka()
  43. end
  44.  
  45. function poslatStatus()
  46.     modem.transmit(IDserver,990,idPC)
  47.     modem.transmit(IDserver,57600,Adresa)
  48.     modem.transmit(IDserver,57601,Udalost)
  49.     modem.transmit(IDserver,57602,upresneni)
  50. end
  51.  
  52.  
  53. linka()
Advertisement
Add Comment
Please, Sign In to add comment