// This function works out if it is time to stage private bool AllowedToStage() { if (log != null) { log.AppendLine("AllowedToStage") .AppendLine("currentStage = ", currentStage); } if (activeEngines.Count > 0) { for (int i = 0; i < dontStageParts.Count; ++i) { PartSim partSim = dontStageParts[i]; if (log != null) { partSim.DumpPartToLog(log, "Testing: "); } //if (log != null) log.AppendLine("isSepratron = ", partSim.isSepratron ? "true" : "false"); if (!partSim.isSepratron && !partSim.EmptyOf(drainingResources)) { if (log != null) { partSim.DumpPartToLog(log, "Decoupled part not empty => false: "); } return(false); } if (partSim.isEngine) { for (int j = 0; j < activeEngines.Count; ++j) { EngineSim engine = activeEngines[j]; if (engine.dontDecoupleActive && engine.partSim == partSim) { if (log != null) { partSim.DumpPartToLog(log, "Decoupled part is active engine => false: "); } return(false); } } } } } if (currentStage == 0 && doingCurrent) { if (log != null) { log.AppendLine("Current stage == 0 && doingCurrent => false"); } return(false); } if (log != null) { log.AppendLine("Returning true"); } return(true); }
// This function works out if it is time to stage private bool AllowedToStage() { StringBuilder buffer = null; if (SimManager.logOutput) { buffer = new StringBuilder(1024); buffer.AppendLine("AllowedToStage"); buffer.AppendFormat("currentStage = {0:d}\n", this.currentStage); } if (this.activeEngines.Count > 0) { for (int i = 0; i < dontStageParts.Count; ++i) { PartSim partSim = dontStageParts[i]; if (SimManager.logOutput) { partSim.DumpPartToBuffer(buffer, "Testing: "); } //buffer.AppendFormat("isSepratron = {0}\n", partSim.isSepratron ? "true" : "false"); if (!partSim.isSepratron && !partSim.EmptyOf(this.drainingResources)) { if (SimManager.logOutput) { partSim.DumpPartToBuffer(buffer, "Decoupled part not empty => false: "); MonoBehaviour.print(buffer); } return(false); } if (partSim.isEngine) { for (int j = 0; j < activeEngines.Count; ++j) { EngineSim engine = activeEngines[j]; if (engine.partSim == partSim) { if (SimManager.logOutput) { partSim.DumpPartToBuffer(buffer, "Decoupled part is active engine => false: "); MonoBehaviour.print(buffer); } return(false); } } } } } if (this.currentStage == 0 && this.doingCurrent) { if (SimManager.logOutput) { buffer.AppendLine("Current stage == 0 && doingCurrent => false"); MonoBehaviour.print(buffer); } return(false); } if (SimManager.logOutput) { buffer.AppendLine("Returning true"); MonoBehaviour.print(buffer); } return(true); }