Advertisement
NickNDS

Attack Script

Aug 1st, 2019
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. public string receiveTag = "controlcoordinate";
  2.  
  3. public IMyBroadcastListener coordinateListener;
  4.  
  5. public List<Vector3D> receivedCoordinates = new List<Vector3D>();
  6.  
  7. public Program()
  8. {
  9.     Runtime.UpdateFrequency = UpdateFrequency.Update10;
  10.     coordinateListener = IGC.RegisterBroadcastListener(receiveTag);
  11.     Echo("Listening on tag: " + receiveTag);
  12.     Save();
  13. }
  14.  
  15. public void Save()
  16. {
  17.  
  18. }
  19.  
  20. public void Main(string argument, UpdateType updateSource)
  21. {
  22.     if (coordinateListener.HasPendingMessage)
  23.     {
  24.         MyIGCMessage message = coordinateListener.AcceptMessage();
  25.         Vector3D coordinate = (Vector3D)(message.Data);
  26.         Echo("Coordinate received at: " + coordinate.ToString("N0"));
  27.         if (!receivedCoordinates.Contains(coordinate)) receivedCoordinates.Add(coordinate);
  28.     }
  29.     Output();
  30. }
  31.  
  32. public void Output()
  33. {
  34.     StringBuilder builder = new StringBuilder();
  35.     for (int i = 0; i < receivedCoordinates.Count; i++)
  36.     {
  37.         builder.AppendLine(receivedCoordinates[i].ToString("N0"));
  38.     }
  39.     List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
  40.     GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(blocks, b => b.CustomName.ToLower().Contains("coordinate"));
  41.     for (int i = 0; i < blocks.Count; i++)
  42.     {
  43.         IMyTextSurface surface = (IMyTextSurface)blocks[i];
  44.         surface.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
  45.         surface.WriteText(builder);
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement