Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //The name of the remote control to trigger.
- const string remoteName = "Remote Control";
- List<IMyTerminalBlock> guns = new List<IMyTerminalBlock>();
- void Main()
- {
- var remote = GridTerminalSystem.GetBlockWithName(remoteName) as IMyRemoteControl;
- if (guns.Count == 0)
- {
- GridTerminalSystem.GetBlocksOfType<IMySmallGatlingGun>(guns, b => b.CubeGrid == Me.CubeGrid);
- }
- double maxVol = 0.0d;
- double curVol = 0.0d;
- double percentFull;
- for (int i = 0; i < guns.Count; i++)
- {
- var inventory = (guns[i]).GetInventory(0);
- curVol += (double)inventory.CurrentVolume;
- maxVol += (double)inventory.MaxVolume;
- }
- percentFull = Math.Round(100 * (curVol / maxVol),2);
- var log = "Capacity: " + (percentFull / 100).ToString("P2");
- Echo(log);
- if (percentFull == 0)
- {
- remote.ApplyAction("AutoPilot_On");
- }
- else
- {
- remote.ApplyAction("AutoPilot_Off");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment