Advertisement
Guest User

Client

a guest
May 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. shell.run("clear")
  2. shell.run("id")
  3. missilesilo = peripheral.wrap("back")
  4. rednet.open("top")
  5. local armed = true
  6. local masterID
  7. local pack = textutils.serialise(siloData)
  8. local icbm = peripheral.wrap("back")
  9.  
  10.  
  11.  
  12. if missilesilo.getMissile() ~= "{}" then currentmissile = "None"
  13.  
  14. else
  15.  
  16. local currentmissile = tostring(missilesilo.getMissile())
  17. end
  18.  
  19. local armed = tostring(missilesilo.canLaunch())
  20.  
  21. local targets = tostring(missilesilo.getTarget())
  22.  
  23. print(currentmissile)
  24.  
  25. local siloData = {
  26. ["Msg"] = "ABM",
  27. ["ID"] = os.getComputerID(),
  28. ["Missile"] = currentmissile,
  29. ["Target"] = targets,
  30. ["Armed"] = armed
  31. }
  32.  
  33.  
  34. while true do
  35. print("Waiting for Threat Message From Defense Server...")
  36. local id, msg = rednet.receive(masterID)
  37.  
  38. if (msg == "ABM1") then
  39. print(" master=", id)
  40. masterID = id;
  41. print(siloData[1])
  42. rednet.send(masterID, siloData)
  43.  
  44.  
  45. elseif type(msg) == "table" and id == masterID then
  46. if type(msg.x) == "number" and type(msg.y) == "number" and type(msg.z) == "number" then
  47. print(" launching CounterMeasures At x=" .. msg.x .. ", y=" .. msg.y .. ", z=" .. msg.z)
  48. icbm.setTarget(msg.x, msg.y, msg.z)
  49. if (armed) then
  50. peripheral.call("back","launch")
  51. end
  52. else
  53. print(" Invalid Table Command")
  54. end
  55. else
  56. print(" Invalid Message:",msg," from: ",id)
  57.  
  58. end
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement