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);
            }
        }
Exemple #2
0
        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;

                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)
                {
                    Fields["GeneratorStatus"].guiActive = false;
                }
                //Actions["TogglePanelAction"].guiName = Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Action_TogglePanelAction");
                if (FirstLoad)
                {
                    this.CurrentSafetyOverride = this.CriticalTemperature;
                    FirstLoad = false;
                }
            }


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