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 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;
                }
            }
        }
        // Finds time remaining at specified fuel burn rates
        public string FindTimeRemaining(double amount, double rate)
        {
            if (rate < 0.0000001)
            {
                return(Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_FuelStatus_VeryLong"));
            }
            double remaining = amount / rate;

            if (remaining >= 0)
            {
                return(ModuleUtils.FormatTimeString(remaining));
            }
            {
                return(Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatFissionReactor_Field_FuelStatus_Exhausted"));
            }
        }
Exemple #4
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;
                }
            }
        }
        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);
        }
        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);
        }
        protected void UpdateSystemHeatFlight()
        {
            if (base.ModuleIsActive())
            {
                if (heatModule.currentLoopTemperature > shutdownTemperature)
                {
                    ScreenMessages.PostScreenMessage(
                        new ScreenMessage(
                            Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatHarvester_Message_Shutdown",
                                             part.partInfo.title),
                            3.0f,
                            ScreenMessageStyle.UPPER_CENTER));
                    ToggleResourceConverterAction(new KSPActionParam(0, KSPActionType.Activate));

                    Utils.Log("[ModuleSystemHeatConverter]: Overheated, shutdown fired", LogType.Modules);
                }
                base.recipe = ModuleUtils.RecalculateRatios(systemEfficiency.Evaluate(heatModule.currentLoopTemperature), inputs, outputs, inputList, outputList, base.recipe);
            }
        }
Exemple #8
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);
        }
        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);
        }
Exemple #10
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);
        }
        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 #12
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);
            }
        }