Created
September 11, 2017 14:13
-
-
Save krypt-lynx/c3da7737628f48e381051ffc28ee6280 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<IMyProgrammableBlock> pbs = new List<IMyProgrammableBlock>(); | |
IMyTextPanel status = null; | |
public Program() { | |
} | |
public void Main(string argument) { | |
this.GridTerminalSystem.GetBlocksOfType<IMyProgrammableBlock>(pbs); | |
status = this.GridTerminalSystem.GetBlockWithName("Watchdog Status LCD") as IMyTextPanel ; | |
status.WritePublicText(""); | |
status.WritePublicText(DateTime.Now.ToString() + "\n\n"); | |
//status.WritePublicText("Monitoring blocks: " + pbs.Count.ToString() + "\n\n", true); | |
foreach (var pb in pbs) | |
{ | |
if (Me.CubeGrid != pb.CubeGrid) | |
{ | |
continue; | |
} | |
status.WritePublicText(pb.CustomName + ": ", true); | |
status.WritePublicText(new string('.' , 30 - pb.CustomName.Length), true); | |
status.WritePublicText(" ", true); | |
if (!pb.IsFunctional) | |
{ | |
status.WritePublicText("\uE058 Damaged", true); | |
} | |
else if (!pb.Enabled) | |
{ | |
status.WritePublicText(" Disabled", true); | |
} | |
else if (pb.IsRunning) | |
{ | |
status.WritePublicText(" This is me", true); | |
} | |
else | |
{ | |
Me.CustomData = ""; | |
if (!pb.TryRun("ping " + Me.EntityId.ToString())) | |
{ | |
status.WritePublicText("\uE058 Failed", true); | |
} | |
else | |
{ | |
if (Me.CustomData.Length > 0) | |
{ | |
status.WritePublicText(" Ok", true); | |
} | |
else | |
{ | |
status.WritePublicText("\uE056 Not Responding", true); | |
} | |
} | |
} | |
status.WritePublicText("\n", true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment