Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Whip's GPS Recorder v1 - 6/6/17
- //Made for Erebus Alpha :)
- string textPanelNameTag = "GPS";
- void Main(string arg)
- {
- var coordList = Me.CustomData.Split(new char[] { '\n', '\r' });
- int count = 1;
- foreach (var thisCoord in coordList)
- {
- var gpsSplit = thisCoord.Split(':');
- if (gpsSplit.Length != 6)
- {
- if (!string.IsNullOrWhiteSpace(thisCoord))
- Echo($"Error: '{thisCoord}' is not a GPS coordinate");
- continue;
- }
- var name = gpsSplit[1];
- if (name.Contains(arg))
- {
- count++;
- }
- }
- var currentPos = GetWorldPosition(Me);
- var gpsString = "GPS:" + arg + String.Format("{0:000}", count) + $":{Math.Round(currentPos.X)}:{Math.Round(currentPos.Y)}:{Math.Round(currentPos.Z)}:\n";
- Me.CustomData += gpsString;
- var screens = new List<IMyTextPanel>();
- GridTerminalSystem.GetBlocksOfType(screens, x => x.CustomName.ToLower().Contains(textPanelNameTag.ToLower()));
- if (screens.Count == 0)
- {
- Echo($"Warning: No text panels named '{textPanelNameTag} were found'");
- return;
- }
- foreach (var block in screens)
- {
- block.WritePublicText(Me.CustomData);
- block.ShowPublicTextOnScreen();
- }
- }
- Vector3D GetWorldPosition(IMyTerminalBlock block)
- {
- return block.CubeGrid.GridIntegerToWorld(block.Position);
- }
Advertisement
Add Comment
Please, Sign In to add comment