Ejemplo n.º 1
0
 /// <summary>
 /// Remove a ModuleSystemHeat to this loop. Removing means removing Volume and recalculating the nominal temperature
 /// </summary>
 /// <param name="heatModule">the module to remove</param>
 public void RemoveHeatModule(ModuleSystemHeat heatModule)
 {
     Volume -= heatModule.volume;
     modules.Remove(heatModule);
     // Recalculate the nominal temperature
     NominalTemperature = CalculateNominalTemperature();
 }
        public override void OnStart(PartModule.StartState state)
        {
            heatModule = part.gameObject.GetComponent <ModuleSystemHeat>();

            if (heatModule == null)
            {
                Utils.LogError("No SystemHeat Module on part!");
                return;
            }

            // Set up animation
            if (HeatAnimation != "")
            {
                heatStates = Utils.SetUpAnimation(HeatAnimation, part);


                if (heatTransform != null)
                {
                    heatTransform = part.FindModelTransform(HeatTransformName);
                    foreach (AnimationState heatState in heatStates)
                    {
                        heatState.AddMixingTransform(heatTransform);
                        heatState.blendMode = AnimationBlendMode.Blend;
                        heatState.layer     = 15;
                        heatState.weight    = 1.0f;
                        heatState.enabled   = true;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void Start()
        {
            heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);

            Utils.Log("[ModuleSystemHeatSink] Setup completed", LogType.Modules);

            if (HeatLightTransformName != "")
            {
                rampLight = part.FindModelTransform(HeatLightTransformName).GetComponent <Renderer>();
                ramp      = new Gradient();
                GradientColorKey[] keys = new GradientColorKey[]
                {
                    new GradientColorKey(Color.black, 0f),
                    new GradientColorKey(Color.red, 0.33f),
                    new GradientColorKey(Color.yellow, 0.75f),
                    new GradientColorKey(Color.white, 1f)
                };
                GradientAlphaKey[] keysAlpha = new GradientAlphaKey[]
                {
                    new GradientAlphaKey(1f, 0f),
                    new GradientAlphaKey(1f, .33f),
                    new GradientAlphaKey(1f, .66f),
                    new GradientAlphaKey(1f, 1f)
                };
                ramp.SetKeys(keys, keysAlpha);
            }
            if (OnLightTransformName != "")
            {
                onLight = part.FindModelTransform(OnLightTransformName).GetComponent <Renderer>();
            }
            SetupUI();
        }
Ejemplo n.º 4
0
        public void Start()
        {
            heatModule = this.GetComponents <ModuleSystemHeat>().ToList().Find(x => x.moduleID == systemHeatModuleID);
            if (heatModule == null)
            {
                heatModule.GetComponent <ModuleSystemHeat>();
            }

            if (engineModuleID != "")
            {
                engineModule = this.GetComponents <ModuleEngines>().ToList().Find(x => x.engineID == engineModuleID);
            }

            if (engineModule == null)
            {
                engineModule = this.GetComponent <ModuleEngines>();
            }

            multiModule = this.GetComponent <MultiModeEngine>();

            if (SystemHeatSettings.DebugModules)
            {
                Utils.Log("[ModuleSystemHeatEngine] Setup completed");
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Add a ModuleSystemHeat to this loop. Adding means adding Volume and recalculating the nominal temperature
 /// </summary>
 /// <param name="heatModule">the module to add</param>
 public void AddHeatModule(ModuleSystemHeat heatModule)
 {
     Volume += heatModule.volume;
     modules.Add(heatModule);
     heatModule.coolantName = CoolantName;
     // Recalculate the nominal temperature
     NominalTemperature = CalculateNominalTemperature();
     Temperature        = heatModule.LoopTemperature;
 }
Ejemplo n.º 6
0
        public void Start()
        {
            heatModule = this.GetComponents <ModuleSystemHeat>().ToList().Find(x => x.moduleID == systemHeatModuleID);
            if (heatModule == null)
            {
                heatModule.GetComponent <ModuleSystemHeat>();
            }

            Utils.Log("[ModuleSystemHeatTemperatureAdjuster] Setup completed", LogType.Modules);
        }
        public override void OnStart(PartModule.StartState state)
        {
            heatModule = part.gameObject.GetComponent <ModuleSystemHeat>();

            if (heatModule == null)
            {
                Utils.LogError("No SystemHeat Module on part!");
                return;
            }
        }
        public void Start()
        {
            heatModule   = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);
            scalarModule = part.GetComponents <ModuleColorChanger>().ToList().Find(x => x.moduleID == scalarModuleID);
            if (maxTempAnimation == -1f)
            {
                maxTempAnimation = (float)part.maxTemp;
            }

            maxTempAnimation -= draperPoint;
        }
        public void Start()
        {
            heatModule = this.GetComponents <ModuleSystemHeat>().ToList().Find(x => x.moduleID == systemHeatModuleID);
            if (heatModule == null)
            {
                heatModule.GetComponent <ModuleSystemHeat>();
            }

            if (SystemHeatSettings.DebugModules)
            {
                Utils.Log("[ModuleSystemHeatSink] Setup completed");
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Remove a heat module from a specific HeatLoop
        /// </summary>
        /// <param name="loopID">the loop to remove from</param>
        /// <param name="module">the module to remove</param>
        public void RemoveHeatModuleFromLoop(int loopID, ModuleSystemHeat module)
        {
            HeatLoops[loopID].RemoveHeatModule(module);


            Utils.Log(String.Format("[SystemHeatSimulator]: Removed module {0} from Heat Loop {1}", module.moduleID, loopID), LogType.Simulator);

            if (Loop(loopID).LoopModules.Count == 0)
            {
                HeatLoops.Remove(Loop(loopID));

                Utils.Log(String.Format("[SystemHeatSimulator]: Heat Loop {0} has no more members, removing", loopID), LogType.Simulator);
            }
        }
Ejemplo n.º 11
0
        public override void Start()
        {
            base.Start();
            heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);

            if (scalarModuleID != "")
            {
                scalarModule = part.GetComponents <ModuleSystemHeatColorAnimator>().ToList().Find(x => x.moduleID == scalarModuleID);
            }

            if (maxTempAnimation == -1f)
            {
                maxTempAnimation = (float)part.maxTemp;
            }

            maxTempAnimation -= draperPoint;

            Utils.Log("[ModuleSystemHeatRadiator] Setup completed", LogType.Modules);

            if (this.GetComponent <ModuleDeployableRadiator>() != null)
            {
                if (HighLogic.LoadedSceneIsFlight)
                {
                    if (sunTracking)
                    {
                        base._depRad.trackingMode = ModuleDeployablePart.TrackingMode.SUN;
                        base._depRad.isTracking   = true;
                    }
                    else
                    {
                        base._depRad.trackingMode  = ModuleDeployablePart.TrackingMode.NONE;
                        base._depRad.trackingSpeed = 0f;
                        base._depRad.isTracking    = false;
                    }
                }
                else
                {
                    this.Events["ToggleEditorSunTracking"].guiActiveEditor = true;
                }
            }
            else
            {
                if (HighLogic.LoadedSceneIsEditor)
                {
                    this.Events["ToggleEditorSunTracking"].guiActiveEditor = false;
                }
            }
        }
Ejemplo n.º 12
0
        public void Start()
        {
            heatModule1 = this.GetComponents <ModuleSystemHeat>().ToList().Find(x => x.moduleID == systemHeatModuleID1);
            heatModule2 = this.GetComponents <ModuleSystemHeat>().ToList().Find(x => x.moduleID == systemHeatModuleID2);



            UI_Toggle toggle = (HighLogic.LoadedSceneIsEditor) ? (UI_Toggle)Fields[nameof(ToggleSource)].uiControlEditor: (UI_Toggle)Fields[nameof(ToggleSource)].uiControlFlight;

            if (ToggleSource)
            {
                sourceModule = heatModule1;
                destModule   = heatModule2;
            }
            else
            {
                sourceModule = heatModule2;
                destModule   = heatModule1;
            }

            toggle.onFieldChanged = ToggleDirection;
            toggle.disabledText   = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatExchanger_Field_Direction_String", sourceModule.LoopID, destModule.LoopID);
            toggle.enabledText    = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatExchanger_Field_Direction_String", sourceModule.LoopID, destModule.LoopID);

            if (DirectionLightTransformName != "")
            {
                dirLight = part.FindModelTransform(DirectionLightTransformName).GetComponent <Renderer>();
                if (ToggleSource)
                {
                    dirLight.material.SetColor("_TintColor", XKCDColors.BlueGrey);
                }
                else
                {
                    dirLight.material.SetColor("_TintColor", XKCDColors.Orange);
                }
            }
            if (OnLightTransformName != "")
            {
                onLight = part.FindModelTransform(OnLightTransformName).GetComponent <Renderer>();
            }

            if (SystemHeatSettings.DebugModules)
            {
                Utils.Log("[ModuleSystemHeatSink] Setup completed");
            }
        }
Ejemplo n.º 13
0
        public void Start()
        {
            heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);

            if (converterModuleIndex != -1)
            {
                base.part.partInfo.moduleInfos[converterModuleIndex].info = EditConverterModuleInfo(base.part.partInfo.moduleInfos[converterModuleIndex].info);

                converterModule = base.part.Modules[converterModuleIndex] as BaseConverter;
                if (converterModule == null)
                {
                    Debug.LogError("[ModuleSystemHeatBaseConverterAdapter]: Module at index " + converterModuleIndex +
                                   " is not a BaseConverter on part " + base.part.partName, base.gameObject);
                    return;
                }
            }
        }
Ejemplo n.º 14
0
        public static ModuleSystemHeat FindHeatModule(Part part, string moduleName)
        {
            ModuleSystemHeat heatModule = part.GetComponents <ModuleSystemHeat>().ToList().Find(x => x.moduleID == moduleName);

            if (heatModule == null)
            {
                Utils.LogError($"[{part}] No ModuleSystemHeat named {moduleName} was found, using first instance");
                return(part.GetComponents <ModuleSystemHeat>().ToList().First());
            }

            if (heatModule == null)
            {
                Utils.LogError($"[{part}] No ModuleSystemHeat was found.");
            }

            return(heatModule);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Add a heat module to a specific HeatLoop
        /// </summary>
        /// <param name="loopID">the loop to add to</param>
        /// <param name="module">the module to add</param>
        public void AddHeatModuleToLoop(int loopID, ModuleSystemHeat module)
        {
            // Build a new heat loop as needed
            if (!HeatLoops.ContainsKey(loopID))
            {
                HeatLoops.Add(loopID, new HeatLoop(loopID));
                if (SystemHeatSettings.DebugSimulation)
                {
                    Utils.Log(String.Format("[SystemHeatSimulator]: Created new Heat Loop {0}", loopID));
                }
            }
            HeatLoops[loopID].AddHeatModule(module);

            if (SystemHeatSettings.DebugSimulation)
            {
                Utils.Log(String.Format("[SystemHeatSimulator]: Added module {0} to Heat Loop {1}", module.moduleID, loopID));
            }
        }
Ejemplo n.º 16
0
        public void Start()
        {
            heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);

            if (engineModuleID != "")
            {
                engineModule = this.GetComponents <ModuleEngines>().ToList().Find(x => x.engineID == engineModuleID);
            }

            if (engineModule == null)
            {
                engineModule = this.GetComponent <ModuleEngines>();
            }

            multiModule = this.GetComponent <MultiModeEngine>();

            Utils.Log("[ModuleSystemHeatEngine] Setup completed", LogType.Modules);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Remove a heat module from a specific HeatLoop
        /// </summary>
        /// <param name="loopID">the loop to remove from</param>
        /// <param name="module">the module to remove</param>
        public void RemoveHeatModuleFromLoop(int loopID, ModuleSystemHeat module)
        {
            HeatLoops[loopID].RemoveHeatModule(module);

            if (SystemHeatSettings.DebugSimulation)
            {
                Utils.Log(String.Format("[SystemHeatSimulator]: Removed module {0} from Heat Loop {1}", module.moduleID, loopID));
            }

            if (HeatLoops[loopID].LoopModules.Count == 0)
            {
                HeatLoops.Remove(loopID);
                if (SystemHeatSettings.DebugSimulation)
                {
                    Utils.Log(String.Format("[SystemHeatSimulator]: Heat Loop {0} has no more members, removing", loopID));
                }
            }
        }
        public void Start()
        {
            heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);

            if (HighLogic.LoadedSceneIsFlight)
            {
                SetupResourceRatios();
            }
            else
            {
                SetupResourceRatios();

                //this.CurrentSafetyOverride = this.NominalTemperature;
            }

            Utils.Log("[ModuleSystemHeatAsteroidHarvester] Setup completed", LogType.Modules);

            Fields["HarvesterEfficiency"].guiName = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatHarvester_Field_Efficiency", base.ConverterName);
        }
Ejemplo n.º 19
0
        public void Start()
        {
            heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);
            if (HighLogic.LoadedSceneIsFlight)
            {
                SetupResourceRatios();
            }
            else
            {
                SetupResourceRatios();
            }
            if (SystemHeatSettings.DebugModules)
            {
                Utils.Log("[ModuleSystemHeatConverter] Setup completed");
            }

            Events["ToggleEditorThermalSim"].guiName = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatConverter_Field_SimulateEditor", base.ConverterName);
            Fields["ConverterEfficiency"].guiName    = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatConverter_Field_Efficiency", base.ConverterName);
        }
Ejemplo n.º 20
0
        public override void Start()
        {
            base.Start();
            heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);

            if (scalarModuleID != "")
            {
                scalarModule = part.GetComponents <ModuleSystemHeatColorAnimator>().ToList().Find(x => x.moduleID == scalarModuleID);
            }

            if (maxTempAnimation == -1f)
            {
                maxTempAnimation = (float)part.maxTemp;
            }

            maxTempAnimation -= draperPoint;

            Utils.Log("[ModuleSystemHeatRadiator] Setup completed", LogType.Modules);
        }
        public override void OnStart(PartModule.StartState state)
        {
            base.OnStart(state);

            heatModule = part.gameObject.GetComponent <ModuleSystemHeat>();
            // startDeployedLast = !StartDeployed;

            if (heatModule == null)
            {
                Utils.LogError("No SystemHeat Module on part!");
                return;
            }

            // get the animation state for panel deployment
            //deployStates = Utils.SetUpAnimation(base.animationName, part);

            // Set up heat animation
            if (heatTransform != null && HeatAnimation != "")
            {
                heatStates    = Utils.SetUpAnimation(HeatAnimation, part);
                heatTransform = part.FindModelTransform(HeatTransformName);

                foreach (AnimationState heatState in heatStates)
                {
                    heatState.AddMixingTransform(heatTransform);
                    heatState.blendMode = AnimationBlendMode.Blend;
                    heatState.layer     = 15;
                    heatState.weight    = 1.0f;
                    heatState.enabled   = true;
                }
            }

            if (!TrackSun)
            {
                base.trackingSpeed = 0f;
            }

            if (HighLogic.LoadedScene == GameScenes.FLIGHT)
            {
                part.force_activate();
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Add a heat module to a specific HeatLoop
        /// </summary>
        /// <param name="loopID">the loop to add to</param>
        /// <param name="module">the module to add</param>
        public void AddHeatModuleToLoop(int loopID, ModuleSystemHeat module)
        {
            // Build a new heat loop as needed
            if (!HasLoop(loopID))
            {
                HeatLoops.Add(new HeatLoop(this, loopID));

                Utils.Log(String.Format("[SystemHeatSimulator]: Created new Heat Loop {0}", loopID), LogType.Simulator);
            }
            foreach (HeatLoop loop in HeatLoops)
            {
                if (loop.ID == loopID)
                {
                    loop.AddHeatModule(module);
                }
            }


            Utils.Log(String.Format("[SystemHeatSimulator]: Added module {0} to Heat Loop {1}", module.moduleID, loopID), LogType.Simulator);
        }
Ejemplo n.º 23
0
        private void ToggleDirection(BaseField field, object oldFieldValueObj)
        {
            Utils.Log($"[ModuleSystemHeatExchanger] Toggled direction of flow");
            ModuleSystemHeat saved = sourceModule;

            sourceModule = destModule;
            destModule   = saved;

            UI_Toggle toggle = (HighLogic.LoadedSceneIsEditor) ? (UI_Toggle)Fields[nameof(ToggleSource)].uiControlEditor : (UI_Toggle)Fields[nameof(ToggleSource)].uiControlFlight;

            toggle.disabledText = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatExchanger_Field_Direction_String", sourceModule.LoopID, destModule.LoopID);
            toggle.enabledText  = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatExchanger_Field_Direction_String", sourceModule.LoopID, destModule.LoopID);
            if (ToggleSource)
            {
                dirLight.material.SetColor("_TintColor", XKCDColors.BlueGrey);
            }
            else
            {
                dirLight.material.SetColor("_TintColor", XKCDColors.Orange);
            }
        }
Ejemplo n.º 24
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);
            if (HighLogic.LoadedSceneIsFlight)
            {
                SetupResourceRatios();
            }
            else
            {
                SetupResourceRatios();

                //this.CurrentSafetyOverride = this.NominalTemperature;
            }
            if (SystemHeatSettings.DebugModules)
            {
                Utils.Log("[ModuleSystemHeatConverter] Setup completed");
            }

            Events["ToggleEditorThermalSim"].guiName = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatConverter_Field_SimulateEditor", base.ConverterName);
            Fields["ConverterEfficiency"].guiName    = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatConverter_Field_Efficiency", base.ConverterName);
        }
Ejemplo n.º 25
0
        public void Start()
        {
            heatModule = this.GetComponents <ModuleSystemHeat>().ToList().Find(x => x.moduleID == systemHeatModuleID);

            if (HighLogic.LoadedSceneIsFlight)
            {
                SetupResourceRatios();
            }
            else
            {
                SetupResourceRatios();

                //this.CurrentSafetyOverride = this.NominalTemperature;
            }
            if (SystemHeatSettings.DebugModules)
            {
                Utils.Log("[ModuleSystemHeatConverter] Setup completed");
            }

            Events["ToggleEditorThermalSim"].guiName = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatHarvester_Field_SimulateEditor", base.ConverterName);
            Fields["HarvesterEfficiency"].guiName    = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatHarvester_Field_Efficiency", base.ConverterName);
        }
Ejemplo n.º 26
0
    public void Start()
    {
      heatModule = this.GetComponents<ModuleSystemHeat>().ToList().Find(x => x.moduleID == systemHeatModuleID);
      if (heatModule == null)
        heatModule.GetComponent<ModuleSystemHeat>();

      if (SystemHeatSettings.DebugModules)
      {
        Utils.Log("[ModuleSystemHeatSink] Setup completed");
      }

      if (HeatLightTransformName != "")
      {
        rampLight = part.FindModelTransform(HeatLightTransformName).GetComponent<Renderer>();
        ramp = new Gradient();
        GradientColorKey[] keys = new GradientColorKey[]
        {
          new GradientColorKey(Color.black, 0f),
          new GradientColorKey(Color.red, 0.33f),
          new GradientColorKey(Color.yellow, 0.75f),
          new GradientColorKey(Color.white, 1f)
      };
        GradientAlphaKey[] keysAlpha = new GradientAlphaKey[]
        {
          new GradientAlphaKey(1f,0f),
          new GradientAlphaKey(1f,.33f),
          new GradientAlphaKey(1f,.66f),
          new GradientAlphaKey(1f,1f)
        };
        ramp.SetKeys(keys, keysAlpha);

      }
      if (OnLightTransformName != "")
      {
        onLight = part.FindModelTransform(OnLightTransformName).GetComponent<Renderer>();
      }
      SetupUI();
    }
Ejemplo n.º 27
0
        private void DoToggleDirection()
        {
            Utils.Log($"[ModuleSystemHeatExchanger] Toggled direction of flow", LogType.Modules);
            ModuleSystemHeat saved = sourceModule;

            sourceModule = destModule;
            destModule   = saved;

            sourceModule.ignoreTemperature = true;
            destModule.ignoreTemperature   = false;

            UI_Toggle toggle = (HighLogic.LoadedSceneIsEditor) ? (UI_Toggle)Fields[nameof(ToggleSource)].uiControlEditor : (UI_Toggle)Fields[nameof(ToggleSource)].uiControlFlight;

            toggle.disabledText = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatExchanger_Field_Direction_String", sourceModule.LoopID, destModule.LoopID);
            toggle.enabledText  = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatExchanger_Field_Direction_String", sourceModule.LoopID, destModule.LoopID);
            if (ToggleSource)
            {
                dirLight.material.SetColor("_TintColor", XKCDColors.BlueGrey);
            }
            else
            {
                dirLight.material.SetColor("_TintColor", XKCDColors.Orange);
            }
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Remove a heat module from the system
 /// </summary>
 /// <param name="module">the module to remove</param>
 public void RemoveHeatModule(ModuleSystemHeat module)
 {
     RemoveHeatModuleFromLoop(module.currentLoopID, module);
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Add a heat module to the simulation
 /// </summary>
 /// <param name="module">the module to add</param>
 public void AddHeatModule(ModuleSystemHeat module)
 {
     AddHeatModuleToLoop(module.currentLoopID, module);
 }
        public virtual void Start()
        {
            if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor)
            {
                if (inputs == null || inputs.Count == 0)
                {
                    ConfigNode node = ModuleUtils.GetModuleConfigNode(part, moduleName);
                    if (node != null)
                    {
                        OnLoad(node);
                    }
                }

                heatModule = ModuleUtils.FindHeatModule(this.part, systemHeatModuleID);

                var range = (UI_FloatRange)this.Fields["CurrentSafetyOverride"].uiControlEditor;
                range.minValue = 0f;
                range.maxValue = MaximumTemperature;

                range          = (UI_FloatRange)this.Fields["CurrentSafetyOverride"].uiControlFlight;
                range.minValue = 0f;
                range.maxValue = MaximumTemperature;

                range          = (UI_FloatRange)this.Fields["CurrentReactorThrottle"].uiControlEditor;
                range.minValue = MinimumThrottle;

                range          = (UI_FloatRange)this.Fields["CurrentReactorThrottle"].uiControlFlight;
                range.minValue = MinimumThrottle;


                foreach (BaseField field in this.Fields)
                {
                    if (!string.IsNullOrEmpty(field.group.name))
                    {
                        continue;
                    }

                    if (field.group.name == uiGroupName)
                    {
                        field.group.displayName = Localizer.Format(uiGroupDisplayName);
                    }
                }

                foreach (BaseEvent baseEvent in this.Events)
                {
                    if (!string.IsNullOrEmpty(baseEvent.group.name))
                    {
                        continue;
                    }

                    if (baseEvent.group.name == uiGroupName)
                    {
                        baseEvent.group.displayName = Localizer.Format(uiGroupDisplayName);
                    }
                }

                if (!GeneratesElectricity)
                {
                    if (Efficiency == -1f)
                    {
                        Efficiency = 0f;
                    }
                    Fields["GeneratorStatus"].guiActive = false;
                }
                else
                {
                    if (Efficiency == -1f)
                    {
                        Efficiency = ElectricalGeneration.Evaluate(100f) / HeatGeneration.Evaluate(100f);
                    }
                }

                if (FirstLoad)
                {
                    if (HighLogic.LoadedSceneIsFlight)
                    {
                        CurrentThrottle            = 0f;
                        CurrentReactorThrottle     = 0f;
                        InternalCoreTemperature    = 0f;
                        this.CurrentSafetyOverride = this.CriticalTemperature;
                        FirstLoad = false;
                    }
                }
            }
            if (HighLogic.LoadedSceneIsEditor)
            {
                Fields["CurrentSafetyOverride"].guiActiveEditor = allowManualShutdownTemperatureControl;
                Fields["CurrentReactorThrottle"].guiActive      = true;
                CurrentReactorThrottle = 100f;
            }

            if (HighLogic.LoadedSceneIsFlight)
            {
                DoCatchup();
                SetManualControl(ManualControl);
            }
        }