void ActivateEngine(string reason) { Log.Info("ActivateEngine"); if (HighLogic.LoadedSceneIsFlight && !activated) { Log.Info("ActivateEngine, part: " + part.partInfo.title + ", reason: " + reason + ", activated: " + activated); double availAmt = 0; int cnt = 0; // Get total of all fuel in part availAmt = GetAllAvailableFuel(false); Log.Info("ActivateEngine: " + cnt++ + ", Part: " + part.partInfo.title + ", availAmt: " + availAmt + ", maxThrust: " + totalMaxThrust); part.Resources[ModSegSRBs.Propellant].amount = part.Resources[ModSegSRBs.BurnablePropellant].amount = 0; maxThrust = totalMaxThrust / 2; bool vesselContainsBaseEngine = baseEngine != null && this.vessel.Parts.Contains(baseEngine.part); if (vesselContainsBaseEngine) { baseEngine.SetBrokenSRB(totalMaxThrust, 0.5f, availAmt / 2); baseEngine.part.Resources[ModSegSRBs.BurnablePropellant].amount = part.Resources[ModSegSRBs.AbortedPropellant].maxAmount = part.Resources[ModSegSRBs.AbortedPropellant].amount = availAmt / 2; } else { part.Resources[ModSegSRBs.AbortedPropellant].maxAmount = part.Resources[ModSegSRBs.AbortedPropellant].amount = availAmt; } Log.Info("ActivateEngine, availAmt: " + availAmt); enabled = true; activated = true; MSSRB_Engine.ChangeUsage(0.5f, ref this.maxThrust, ref this.atmosphereCurve); Log.Info("ActivateEngine, before baseEngine"); if (vesselContainsBaseEngine) { baseEngine.maxThrust = this.maxThrust / 2; baseEngine.atmosphereCurve = this.atmosphereCurve; this.maxFuelFlow = baseEngine.maxFuelFlow; Log.Info("ActivateEngine, baseEngine.isActiveAndEnabled: " + baseEngine.isActiveAndEnabled); Log.Info("ActivateEngine, baseEngine.part.Resources[ModSegSRBs.BurnablePropellant].amount: " + baseEngine.part.Resources[ModSegSRBs.BurnablePropellant].amount); Log.Info("ActivateEngine, part.Resources[ModSegSRBs.AbortedPropellant].amount: " + part.Resources[ModSegSRBs.AbortedPropellant].amount); } Log.Info("maxThrust: " + maxThrust + ", maxFuelFlow: " + maxFuelFlow); base.Activate(); } }
void Start() { nonThrustMotor = true; attNode = this.part.FindAttachNode(attachNode); activated = false; #if true base.Events["Activate"].active = false; base.Events["Activate"].guiActive = false; base.Events["Shutdown"].active = false; base.Events["Shutdown"].guiActive = false; base.Fields["independentThrottle"].guiActive = false; base.Fields["independentThrottle"].guiActiveEditor = false; base.Fields["independentThrottlePercentage"].guiActive = false; base.Fields["independentThrottlePercentage"].guiActiveEditor = false; base.Fields["thrustPercentage"].guiActive = false; base.Fields["thrustPercentage"].guiActiveEditor = false; Actions["ToggleThrottle"].active = false; Actions["ToggleThrottle"].activeEditor = false; foreach (var e in Events) { Log.Info("Event: " + e.name + ", guiName = " + e.GUIName); } foreach (var a in Actions) { Log.Info("Action: " + a.name + ", guiName: " + a.guiName); } #endif if (HighLogic.LoadedSceneIsFlight) { PartModuleList pml = part.Modules; if (pml.Contains <MSSRB_Fuel_Segment>()) { thisSegment = pml.GetModule <MSSRB_Fuel_Segment>(); } if (attNode != null && attNode.attachedPart != null) { pml = attNode.attachedPart.Modules; if (pml != null) { if (pml.Contains <MSSRB_Fuel_Segment>()) { attachedSegment = pml.GetModule <MSSRB_Fuel_Segment>(); } if (pml.Contains <MSSRB_Endcap>()) { attachedEndCap = pml.GetModule <MSSRB_Endcap>(); } if (pml.Contains <MSSRB_Engine>()) { attachedMotor = pml.GetModule <MSSRB_Engine>(); } } } } }