public void StarNextConsumer() { //Find the highest priority list with blocks disabled List <IMyTerminalBlock> blocks = PowerPriorities.Find(blockList => BlockUtils.CountEnabled(List <IMyTerminalBlock> blockList) < blockList.Count); // Turn on the first disabled block blocks.Find(block => !block.Enabled).Enabled = true; }
public void StopNextConsumer() { // Find the lowest priority list with blocks enabled List <IMyTerminalBlock> blocks = PowerPriorities.Reverse.Find(blockList => BlockUtils.CountEnabled(List <IMyTerminalBlock> blockList) > 0); // Turn off the first enabled block blocks.Find(block => block.Enabled).Enabled = false; }