Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<IMyJumpDrive> jumpDrives = new List<IMyJumpDrive>();
- public Program()
- {
- Runtime.UpdateFrequency = UpdateFrequency.Update100;
- jumpDrives.Clear();
- GridTerminalSystem.GetBlocksOfType<IMyJumpDrive>(jumpDrives, b => b.CubeGrid == Me.CubeGrid);
- }
- public void Save()
- {
- }
- int freq = 3;
- int c = 0;
- bool sequentialJumpDriveCharging = false;
- public void Main(string argument, UpdateType updateSource)
- {
- c++;
- if(c % freq == 0)
- {
- IMyJumpDrive lastCharged = null;
- IMyJumpDrive lastCharging = null;
- foreach (IMyJumpDrive jj in jumpDrives)
- {
- if (jj.CurrentStoredPower < jj.MaxStoredPower) lastCharging = jj;
- else lastCharged = jj;
- }
- if(lastCharging != null)
- {
- foreach (IMyJumpDrive jj in jumpDrives)
- {
- if (jj != lastCharging) jj.Enabled = false;
- }
- lastCharging.Enabled = true;
- }else if(lastCharged != null)
- {
- foreach (IMyJumpDrive jj in jumpDrives)
- {
- if (jj != lastCharged) jj.Enabled = false;
- }
- lastCharged.Enabled = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement