public override void OnStart(PartModule.StartState state)
        {
            if (UseStagingIcon)
            {
                //this.part.stackIcon.CreateIcon();
                //this.part.stackIcon.SetIcon(DefaultIcons.FUEL_TANK);
            }
            else
            {
                Utils.LogWarn("Fission Reactor: Staging Icon Disabled!");
            }

            if (state != StartState.Editor)
            {
                core = this.GetComponent <ModuleCoreHeat>();
                if (core == null)
                {
                    Utils.LogError("Fission Reactor: Could not find core heat module!");
                }

                SetupResourceRatios();
                // Set up staging icon heat bar

                if (UseStagingIcon)
                {
                    infoBox = this.part.stackIcon.DisplayInfo();

                    //infoBox.SetMsgBgColor(XKCDColors.RedOrange);
                    //infoBox.SetMsgTextColor(XKCDColors.Orange);
                    //infoBox.SetLength(1.0f);
                    //infoBox.SetValue(0.0f);
                    //infoBox.SetMessage("Meltdwn");
                    //infoBox.SetProgressBarBgColor(XKCDColors.RedOrange);
                    //infoBox.SetProgressBarColor(XKCDColors.Orange);
                }

                if (OverheatAnimation != "")
                {
                    overheatStates = Utils.SetUpAnimation(OverheatAnimation, this.part);
                }

                if (UseForcedActivation)
                {
                    this.part.force_activate();
                }
            }
            else
            {
                this.CurrentSafetyOverride = this.NominalTemperature;
            }


            base.OnStart(state);
        }
Exemple #2
0
        public override void OnStart(PartModule.StartState state)
        {
            UnityEngine.Debug.Log("[KSPI] - Start Initializing ElectricEngineControllerFX");
            try
            {
                // initialise resources
                this.resources_to_supply = new string[] { FNResourceManager.FNRESOURCE_WASTEHEAT };
                base.OnStart(state);
                AttachToEngine();

                _g0 = PluginHelper.GravityConstant;
                _hasGearTechnology     = String.IsNullOrEmpty(gearsTechReq) || PluginHelper.upgradeAvailable(gearsTechReq);
                _modifiedEngineBaseISP = baseISP * PluginHelper.ElectricEngineIspMult;
                _hasrequiredupgrade    = this.HasTechsRequiredToUpgrade();

                if (_hasrequiredupgrade && (isupgraded || state == StartState.Editor))
                {
                    upgradePartModule();
                }
                UpdateEngineTypeString();

                // calculate WasteHeat Capacity
                var wasteheatPowerResource = part.Resources.list.FirstOrDefault(r => r.resourceName == FNResourceManager.FNRESOURCE_WASTEHEAT);
                if (wasteheatPowerResource != null)
                {
                    var ratio = wasteheatPowerResource.amount / wasteheatPowerResource.maxAmount;
                    wasteheatPowerResource.maxAmount = part.mass * 1.0e+5 * wasteHeatMultiplier;
                    wasteheatPowerResource.amount    = wasteheatPowerResource.maxAmount * ratio;
                }

                if (HighLogic.LoadedSceneIsFlight)
                {
                    fuel_gauge = part.stackIcon.DisplayInfo();
                }

                // initialize propellant
                _propellants = ElectricEnginePropellant.GetPropellantsEngineForType(type);
                SetupPropellants(true);
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogError("[KSPI] - Error OnStart ElectricEngineControllerFX " + e.Message);
            }
            UnityEngine.Debug.Log("[KSPI] - End Initializing ElectricEngineControllerFX");
        }
        public override void OnStart(PartModule.StartState state)
        {
            throttleCurve = new FloatCurve();
            throttleCurve.Add(0, 0, 0, 0);
            throttleCurve.Add(70, 10, 0, 0);
            throttleCurve.Add(100, 100, 0, 0);

            if (UseStagingIcon)
            {
                //this.part.stackIcon.CreateIcon();
                //this.part.stackIcon.SetIcon(DefaultIcons.FUEL_TANK);
            }
            else
                Utils.LogWarn("Fission Reactor: Staging Icon Disabled!");

            if (state != StartState.Editor)
            {
                core = this.GetComponent<ModuleCoreHeat>();
                if (core == null)
                    Utils.LogError("Fission Reactor: Could not find core heat module!");

                SetupResourceRatios();
                // Set up staging icon heat bar

                if (UseStagingIcon)
                {
                    infoBox = this.part.stackIcon.DisplayInfo();

                    //infoBox.SetMsgBgColor(XKCDColors.RedOrange);
                    //infoBox.SetMsgTextColor(XKCDColors.Orange);
                    //infoBox.SetLength(1.0f);
                    //infoBox.SetValue(0.0f);
                    //infoBox.SetMessage("Meltdwn");
                    //infoBox.SetProgressBarBgColor(XKCDColors.RedOrange);
                    //infoBox.SetProgressBarColor(XKCDColors.Orange);
                }

                if (OverheatAnimation != "")
                    overheatStates = Utils.SetUpAnimation(OverheatAnimation, this.part);

                if (UseForcedActivation)
                    this.part.force_activate();

            } else
            {
                this.CurrentSafetyOverride = this.NominalTemperature;
            }

            base.OnStart(state);
        }
Exemple #4
0
        public override void OnStart(PartModule.StartState state)
        {
            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;

            throttleCurve = new FloatCurve();
            throttleCurve.Add(0, 0, 0, 0);
            throttleCurve.Add(50, 20, 0, 0);
            throttleCurve.Add(100, 100, 0, 0);

            if (UseStagingIcon)
            {
                //this.part.stackIcon.CreateIcon();
                //this.part.stackIcon.SetIcon(DefaultIcons.FUEL_TANK);
            }
            else
            {
                Utils.LogWarn("Fission Reactor: Staging Icon Disabled!");
            }

            if (FirstLoad)
            {
                this.CurrentSafetyOverride = this.CriticalTemperature;
                FirstLoad = false;
            }

            if (state != StartState.Editor)
            {
                core = this.GetComponent <ModuleCoreHeat>();
                if (core == null)
                {
                    Utils.LogError("Fission Reactor: Could not find core heat module!");
                }

                SetupResourceRatios();
                // Set up staging icon heat bar

                if (UseStagingIcon)
                {
                    infoBox = this.part.stackIcon.DisplayInfo();
                }

                if (OverheatAnimation != "")
                {
                    overheatStates = Utils.SetUpAnimation(OverheatAnimation, this.part);
                }

                if (FollowThrottle)
                {
                    reactorEngine = this.GetComponent <FissionEngine>();
                }

                if (UseForcedActivation)
                {
                    this.part.force_activate();
                }
            }
            else
            {
                //this.CurrentSafetyOverride = this.NominalTemperature;
            }


            base.OnStart(state);
        }
        public override void OnStart(PartModule.StartState state)
        {
            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;

            throttleCurve = new FloatCurve();
            throttleCurve.Add(0, 0, 0, 0);
            throttleCurve.Add(50, 20, 0, 0);
            throttleCurve.Add(100, 100, 0, 0);

            if (UseStagingIcon)
            {
                //this.part.stackIcon.CreateIcon();
                //this.part.stackIcon.SetIcon(DefaultIcons.FUEL_TANK);
            }
            else
                Utils.LogWarn("Fission Reactor: Staging Icon Disabled!");

            if (FirstLoad)
            {
              this.CurrentSafetyOverride = this.CriticalTemperature;
              FirstLoad = false;
            }

            if (state != StartState.Editor)
            {
                core = this.GetComponent<ModuleCoreHeat>();
                if (core == null)
                    Utils.LogError("Fission Reactor: Could not find core heat module!");

                SetupResourceRatios();
                // Set up staging icon heat bar

                if (UseStagingIcon)
                {
                    infoBox = this.part.stackIcon.DisplayInfo();
                }

                if (OverheatAnimation != "")
                    overheatStates = Utils.SetUpAnimation(OverheatAnimation, this.part);

                if (FollowThrottle)
                    reactorEngine = this.GetComponent<FissionEngine>();

                if (UseForcedActivation)
                    this.part.force_activate();

            } else
            {
                //this.CurrentSafetyOverride = this.NominalTemperature;
            }

            base.OnStart(state);
        }