Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string receiveTag = "controlcoordinate";
- public IMyBroadcastListener coordinateListener;
- public List<Vector3D> receivedCoordinates = new List<Vector3D>();
- public Program()
- {
- Runtime.UpdateFrequency = UpdateFrequency.Update10;
- coordinateListener = IGC.RegisterBroadcastListener(receiveTag);
- Echo("Listening on tag: " + receiveTag);
- Save();
- }
- public void Save()
- {
- }
- public void Main(string argument, UpdateType updateSource)
- {
- if (coordinateListener.HasPendingMessage)
- {
- MyIGCMessage message = coordinateListener.AcceptMessage();
- Vector3D coordinate = (Vector3D)(message.Data);
- Echo("Coordinate received at: " + coordinate.ToString("N0"));
- if (!receivedCoordinates.Contains(coordinate)) receivedCoordinates.Add(coordinate);
- }
- Output();
- }
- public void Output()
- {
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < receivedCoordinates.Count; i++)
- {
- builder.AppendLine(receivedCoordinates[i].ToString("N0"));
- }
- List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
- GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(blocks, b => b.CustomName.ToLower().Contains("coordinate"));
- for (int i = 0; i < blocks.Count; i++)
- {
- IMyTextSurface surface = (IMyTextSurface)blocks[i];
- surface.ContentType = VRage.Game.GUI.TextPanel.ContentType.TEXT_AND_IMAGE;
- surface.WriteText(builder);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement