public override void OnStart(PartModule.StartState state) { if (maintainsPropellantBuffer) { propellantBufferResourceDefinition = PartResourceLibrary.Instance.GetDefinition(propellantBufferResourceName); } resourceBuffers = new ResourceBuffers(); resourceBuffers.AddConfiguration(new WasteHeatBufferConfig(wasteHeatMultiplier, 1.0e+6, true)); resourceBuffers.UpdateVariable(ResourceSettings.Config.WasteHeatInMegawatt, this.part.mass); resourceBuffers.Init(this.part); _attached_warpable_engine = this.part.FindModuleImplementing <ModuleEnginesWarp>(); _attached_engine = _attached_warpable_engine; if (_attached_engine != null) { _attached_engine.Fields["finalThrust"].guiFormat = "F5"; } ConnectToReactor(); UpdateEngineStats(true); max_power_multiplier = Math.Log10(maximum_isp / minimum_isp); throtleExponent = Math.Abs(Math.Log10(_attached_reactor.MinimumChargdIspMult / _attached_reactor.MaximumChargedIspMult)); simulatedThrottleFloatRange = Fields["simulatedThrottle"].uiControlEditor as UI_FloatRange; simulatedThrottleFloatRange.onFieldChanged += UpdateFromGUI; if (_attached_reactor == null) { Debug.LogWarning("[KSPI]: InterstellarMagneticNozzleControllerFX.OnStart no IChargedParticleSource found for MagneticNozzle!"); return; } exchanger_thrust_divisor = radius >= _attached_reactor.Radius ? 1 : radius * radius / _attached_reactor.Radius / _attached_reactor.Radius; InitializesPropellantBuffer(); if (_attached_engine != null && _attached_engine is ModuleEnginesFX) { if (!String.IsNullOrEmpty(runningEffectName)) { part.Effect(runningEffectName, 0, -1); } if (!String.IsNullOrEmpty(powerEffectName)) { part.Effect(powerEffectName, 0, -1); } } Fields["partMass"].guiActiveEditor = showPartMass; Fields["partMass"].guiActive = showPartMass; }
public override void OnStart(StartState state) { String[] resources_to_supply = { ResourceSettings.Config.ElectricPowerInMegawatt, ResourceSettings.Config.WasteHeatInMegawatt }; this.resources_to_supply = resources_to_supply; Debug.Log("[KSPI]: Start Current State: " + (int)state + " " + state.ToString()); Debug.Log("[KSPI]: OnStart Already Launched: " + Launched); curEngineT = this.part.FindModuleImplementing <ModuleEngines>(); curEngineWarp = this.part.FindModuleImplementing <ModuleEnginesWarp>(); if ((state & StartState.PreLaunch) == StartState.PreLaunch) { hideEmpty = true; } InitializeGUI(); _fuelConfigurationWithEffect = FuelConfigurations.Where(m => !string.IsNullOrEmpty(m.effectname)).ToList(); _fuelConfigurationWithEffect.ForEach(prop => part.Effect(prop.effectname, 0, -1)); if (state == StartState.Editor) { hideEmpty = false; selectedTank = selectedFuel; selectedTankName = FuelConfigurations[selectedFuel].ConfigName; } UpdateFuel(); Events["ShowFuels"].active = hideEmpty; Events["HideFuels"].active = !hideEmpty; translatedTechMk1 = PluginHelper.DisplayTech(upgradeTechReq1); translatedTechMk2 = PluginHelper.DisplayTech(upgradeTechReq2); translatedTechMk3 = PluginHelper.DisplayTech(upgradeTechReq3); translatedTechMk4 = PluginHelper.DisplayTech(upgradeTechReq4); base.OnStart(state); }