Exemplo n.º 1
0
        public override void OnFixedUpdate()
        {
            float global_rate_multipliers = 1;

            crew_capacity_ratio     = ((float)part.protoModuleCrew.Count) / ((float)part.CrewCapacity);
            global_rate_multipliers = global_rate_multipliers * crew_capacity_ratio;

            if (!IsEnabled)
            {
                return;
            }

            if (active_mode == 0)  // Research
            {
                double electrical_power_provided = consumeFNResource(powerReqMult * PluginHelper.BasePowerConsumption * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio  = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BasePowerConsumption / powerReqMult);
                global_rate_multipliers = global_rate_multipliers * electrical_power_ratio;

                float kerbalScienceSkillFactor = part.protoModuleCrew.Sum(proto_crew_member => GetKerbalScienceFactor(proto_crew_member) / 2f);
                float altitude_multiplier      = Math.Max((float)(vessel.altitude / (vessel.mainBody.Radius)), 1);

                science_rate_f = (float)(kerbalScienceSkillFactor * GameConstants.baseScienceRate * PluginHelper.getScienceMultiplier(vessel) //PluginHelper.getScienceMultiplier(vessel.mainBody.flightGlobalsIndex, vessel.LandedOrSplashed)
                                         / GameConstants.EARH_DAY_SECONDS * global_rate_multipliers
                                         / (Mathf.Sqrt(altitude_multiplier)));

                if (ResearchAndDevelopment.Instance != null && !double.IsNaN(science_rate_f) && !double.IsInfinity(science_rate_f))
                {
                    //ResearchAndDevelopment.Instance.Science = ResearchAndDevelopment.Instance.Science + science_rate_f * TimeWarp.fixedDeltaTime;
                    science_to_add += science_rate_f * TimeWarp.fixedDeltaTime;
                }
            }
            else if (active_mode == 1) // Fuel Reprocessing
            {
                double electrical_power_provided = consumeFNResource(powerReqMult * PluginHelper.BasePowerConsumption * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio  = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BasePowerConsumption / powerReqMult);
                global_rate_multipliers = global_rate_multipliers * electrical_power_ratio;
                reprocessor.UpdateFrame(global_rate_multipliers, true);

                if (reprocessor.getActinidesRemovedPerHour() > 0)
                {
                    reprocessing_rate_f = (float)(reprocessor.getRemainingAmountToReprocess() / reprocessor.getActinidesRemovedPerHour());
                }
                else
                {
                    IsEnabled = false;
                }
            }
            else if (active_mode == 2) //Antimatter
            {
                double electrical_power_provided = consumeFNResource(powerReqMult * PluginHelper.BaseAMFPowerConsumption * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio  = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseAMFPowerConsumption / powerReqMult);
                global_rate_multipliers = crew_capacity_ratio * electrical_power_ratio;
                anti_factory.produceAntimatterFrame(global_rate_multipliers);
                antimatter_rate_f = (float)anti_factory.getAntimatterProductionRate();
            }
            else if (active_mode == 3)
            {
                IsEnabled = false;
            }
            else if (active_mode == 4) // Centrifuge
            {
                if (vessel.Splashed)
                {
                    float electrical_power_provided = consumeFNResource(powerReqMult * PluginHelper.BaseCentriPowerConsumption * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                    electrical_power_ratio  = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseCentriPowerConsumption / powerReqMult);
                    global_rate_multipliers = global_rate_multipliers * electrical_power_ratio;
                    float deut_produced = (float)(global_rate_multipliers * GameConstants.deuterium_timescale * GameConstants.deuterium_abudance * 1000.0f);
                    deut_rate_f = -ORSHelper.fixedRequestResource(part, InterstellarResourcesConfiguration.Instance.Deuterium, -deut_produced * TimeWarp.fixedDeltaTime) / TimeWarp.fixedDeltaTime;
                }
                else
                {
                    ScreenMessages.PostScreenMessage("You must be splashed down to perform this activity.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                    IsEnabled = false;
                }
            }

            if (electrical_power_ratio <= 0)
            {
                deut_rate_f         = 0;
                electrolysis_rate_f = 0;
                science_rate_f      = 0;
                antimatter_rate_f   = 0;
                reprocessing_rate_f = 0;
            }

            last_active_time = (float)Planetarium.GetUniversalTime();
        }
        public override void OnFixedUpdate()
        {
            double global_rate_multipliers = 1;

            crew_capacity_ratio     = ((float)part.protoModuleCrew.Count) / ((float)part.CrewCapacity);
            global_rate_multipliers = global_rate_multipliers * crew_capacity_ratio;

            if (!IsEnabled)
            {
                return;
            }

            if (active_mode == 0)  // Research
            {
                var powerRequest = powerReqMult * PluginHelper.BasePowerConsumption * TimeWarp.fixedDeltaTime;

                double electrical_power_provided = CheatOptions.InfiniteElectricity
                    ? powerRequest
                    : consumeFNResource(powerRequest, ResourceManager.FNRESOURCE_MEGAJOULES);

                electrical_power_ratio  = electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BasePowerConsumption / powerReqMult;
                global_rate_multipliers = global_rate_multipliers * electrical_power_ratio;

                double kerbalScienceSkillFactor = part.protoModuleCrew.Sum(proto_crew_member => GetKerbalScienceFactor(proto_crew_member) / 2f);
                double altitude_multiplier      = Math.Max(vessel.altitude / (vessel.mainBody.Radius), 1);

                science_rate_f = (kerbalScienceSkillFactor * GameConstants.baseScienceRate * PluginHelper.getScienceMultiplier(vessel)
                                  / PluginHelper.SecondsInDay * global_rate_multipliers
                                  / (Math.Sqrt(altitude_multiplier)));

                if (ResearchAndDevelopment.Instance != null && !double.IsNaN(science_rate_f) && !double.IsInfinity(science_rate_f))
                {
                    science_to_add += science_rate_f * TimeWarp.fixedDeltaTime;
                }
            }
            else if (active_mode == 1) // Fuel Reprocessing
            {
                var powerRequest = powerReqMult * PluginHelper.BasePowerConsumption * TimeWarp.fixedDeltaTime;

                double electrical_power_provided = CheatOptions.InfiniteElectricity
                    ? powerRequest
                    : consumeFNResource(powerRequest, ResourceManager.FNRESOURCE_MEGAJOULES);

                electrical_power_ratio = electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BasePowerConsumption / powerReqMult;

                var productionModifier = global_rate_multipliers;
                global_rate_multipliers = global_rate_multipliers * electrical_power_ratio;
                reprocessor.UpdateFrame(global_rate_multipliers, electrical_power_ratio, productionModifier, true, TimeWarp.fixedDeltaTime);

                if (reprocessor.getActinidesRemovedPerHour() > 0)
                {
                    reprocessing_rate_f = reprocessor.getRemainingAmountToReprocess() / reprocessor.getActinidesRemovedPerHour();
                }
                else
                {
                    IsEnabled = false;
                }
            }
            else if (active_mode == 2) //Antimatter
            {
                var powerRequestInMegajoules = powerReqMult * PluginHelper.BaseAMFPowerConsumption * TimeWarp.fixedDeltaTime;

                var energy_provided_in_megajoules = CheatOptions.InfiniteElectricity
                    ? powerRequestInMegajoules
                    : consumeFNResource(powerRequestInMegajoules, ResourceManager.FNRESOURCE_MEGAJOULES);

                electrical_power_ratio = powerRequestInMegajoules > 0 ? energy_provided_in_megajoules / powerRequestInMegajoules : 0;
                antimatterGenerator.Produce(energy_provided_in_megajoules * global_rate_multipliers);
                antimatter_rate_f = antimatterGenerator.ProductionRate;
            }
            else if (active_mode == 3)
            {
                IsEnabled = false;
            }
            else if (active_mode == 4) // Centrifuge
            {
                if (vessel.Splashed)
                {
                    var powerRequest = powerReqMult * PluginHelper.BaseCentriPowerConsumption * TimeWarp.fixedDeltaTime;

                    double electrical_power_provided = CheatOptions.InfiniteElectricity
                        ? powerRequest
                        : consumeFNResource(powerRequest, ResourceManager.FNRESOURCE_MEGAJOULES);

                    electrical_power_ratio  = electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseCentriPowerConsumption / powerReqMult;
                    global_rate_multipliers = global_rate_multipliers * electrical_power_ratio;
                    double deut_produced = global_rate_multipliers * GameConstants.deuterium_timescale * GameConstants.deuterium_abudance * 1000.0f;
                    deut_rate_f = -part.RequestResource(InterstellarResourcesConfiguration.Instance.LqdDeuterium, -deut_produced * TimeWarp.fixedDeltaTime) / TimeWarp.fixedDeltaTime;
                }
                else
                {
                    ScreenMessages.PostScreenMessage("You must be splashed down to perform this activity.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                    IsEnabled = false;
                }
            }

            if (electrical_power_ratio <= 0)
            {
                deut_rate_f         = 0;
                electrolysis_rate_f = 0;
                science_rate_f      = 0;
                antimatter_rate_f   = 0;
                reprocessing_rate_f = 0;
            }

            last_active_time = Planetarium.GetUniversalTime();
        }
Exemplo n.º 3
0
        public override void OnFixedUpdate()
        {
            if (!IsEnabled)
            {
                return;
            }

            if (active_mode == 0) // Fuel Reprocessing
            {
                double electrical_power_provided = consumeFNResource(reprocessor.PowerRequirements, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio = (float)(electrical_power_provided / reprocessor.PowerRequirements);
                reprocessor.UpdateFrame(electrical_power_ratio);
                if (reprocessor.getActinidesRemovedPerHour() > 0)
                {
                    reprocessing_rate_d = reprocessor.getRemainingAmountToReprocess() / reprocessor.getActinidesRemovedPerHour();
                }
                else
                {
                    ScreenMessages.PostScreenMessage("Unable to Reprocess Nuclear Fuel", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                    IsEnabled = false;
                }
            }
            else if (active_mode == 1) // Aluminium Electrolysis
            {
                double electrical_power_provided = consumeFNResource((PluginHelper.BaseELCPowerConsumption) * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseELCPowerConsumption);
                electrolysis_rate_d    = electrical_power_provided / PluginHelper.AluminiumElectrolysisEnergyPerTon / TimeWarp.fixedDeltaTime;
                double alumina_consumption_rate = part.RequestResource(InterstellarResourcesConfiguration.Instance.Alumina, electrolysis_rate_d * TimeWarp.fixedDeltaTime / density_alumina) / TimeWarp.fixedDeltaTime * density_alumina;
                double mass_rate = alumina_consumption_rate;
                electrolysis_rate_d  = part.RequestResource(InterstellarResourcesConfiguration.Instance.Aluminium, -mass_rate * TimeWarp.fixedDeltaTime / density_aluminium) * density_aluminium;
                electrolysis_rate_d += part.RequestResource(InterstellarResourcesConfiguration.Instance.Oxygen, -GameConstants.aluminiumElectrolysisMassRatio * mass_rate * TimeWarp.fixedDeltaTime / density_o) * density_o;
                electrolysis_rate_d  = electrolysis_rate_d / TimeWarp.fixedDeltaTime;
            }
            else if (active_mode == 2) // Sabatier ISRU
            {
                if (FlightGlobals.getStaticPressure(vessel.transform.position) * ORSAtmosphericResourceHandler.getAtmosphericResourceContentByDisplayName(vessel.mainBody.flightGlobalsIndex, "Carbon Dioxide") >= 0.01)
                {
                    double electrical_power_provided = consumeFNResource((PluginHelper.BaseELCPowerConsumption) * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                    electrical_power_ratio = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseELCPowerConsumption);
                    electrolysis_rate_d    = electrical_power_provided / PluginHelper.ElectrolysisEnergyPerTon * vessel.atmDensity / TimeWarp.fixedDeltaTime;
                    double hydrogen_rate = electrolysis_rate_d / (1 + GameConstants.electrolysisMassRatio);
                    double oxygen_rate   = hydrogen_rate * (GameConstants.electrolysisMassRatio - 1);
                    double density_ch4   = PartResourceLibrary.Instance.GetDefinition(InterstellarResourcesConfiguration.Instance.Methane).density;
                    double h2_rate       = part.RequestResource(InterstellarResourcesConfiguration.Instance.Hydrogen, hydrogen_rate * TimeWarp.fixedDeltaTime / density_h / 2);
                    double c02_rate      = part.RequestResource(InterstellarResourcesConfiguration.Instance.CarbonDioxide, hydrogen_rate * TimeWarp.fixedDeltaTime / density_h / 2);
                    if (h2_rate > 0)
                    {
                        double o_rate       = part.RequestResource(InterstellarResourcesConfiguration.Instance.Oxygen, -oxygen_rate * TimeWarp.fixedDeltaTime / density_o);
                        double methane_rate = oxygen_rate * 2;
                        methane_rate_d = -part.RequestResource(InterstellarResourcesConfiguration.Instance.Methane, -methane_rate * TimeWarp.fixedDeltaTime / density_ch4) * density_ch4 / TimeWarp.fixedDeltaTime;
                    }
                }
                else
                {
                    ScreenMessages.PostScreenMessage("Ambient C02 insufficient.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                    IsEnabled = false;
                }
            }
            else if (active_mode == 3) // Water Electrolysis
            {
                double electrical_power_provided = consumeFNResource((PluginHelper.BaseELCPowerConsumption) * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseELCPowerConsumption);
                electrolysis_rate_d    = electrical_power_provided / PluginHelper.ElectrolysisEnergyPerTon / TimeWarp.fixedDeltaTime;
                double water_consumption_rate = part.RequestResource(InterstellarResourcesConfiguration.Instance.Water, electrolysis_rate_d * TimeWarp.fixedDeltaTime / density_h2o) / TimeWarp.fixedDeltaTime * density_h2o;
                double hydrogen_rate          = water_consumption_rate / (1 + GameConstants.electrolysisMassRatio);
                double oxygen_rate            = hydrogen_rate * GameConstants.electrolysisMassRatio;
                electrolysis_rate_d  = part.RequestResource(InterstellarResourcesConfiguration.Instance.Hydrogen, -hydrogen_rate * TimeWarp.fixedDeltaTime / density_h);
                electrolysis_rate_d += part.RequestResource(InterstellarResourcesConfiguration.Instance.Oxygen, -oxygen_rate * TimeWarp.fixedDeltaTime / density_o);
                electrolysis_rate_d  = electrolysis_rate_d / TimeWarp.fixedDeltaTime * density_h;
            }
            else if (active_mode == 4) // Anthraquinone Process
            {
                double electrical_power_provided = consumeFNResource((PluginHelper.BaseAnthraquiononePowerConsumption) * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseAnthraquiononePowerConsumption);
                anthra_rate_d          = electrical_power_provided / PluginHelper.AnthraquinoneEnergyPerTon / TimeWarp.fixedDeltaTime;
                double water_consumption_rate = part.RequestResource(InterstellarResourcesConfiguration.Instance.Water, anthra_rate_d * TimeWarp.fixedDeltaTime / density_h2o) / TimeWarp.fixedDeltaTime * density_h2o;
                anthra_rate_d = -part.RequestResource(InterstellarResourcesConfiguration.Instance.HydrogenPeroxide, -water_consumption_rate * TimeWarp.fixedDeltaTime / density_h2o2) * density_h2o2 / TimeWarp.fixedDeltaTime;
                if (water_consumption_rate <= 0 && electrical_power_ratio > 0)
                {
                    ScreenMessages.PostScreenMessage("Water is required to perform the Anthraquinone Process.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                    IsEnabled = false;
                }
            }
            else if (active_mode == 5) // Monoprop Production
            {
                double electrical_power_provided = consumeFNResource((PluginHelper.BasePechineyUgineKuhlmannPowerConsumption) * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BasePechineyUgineKuhlmannPowerConsumption);
                monoprop_rate_d        = electrical_power_provided / PluginHelper.PechineyUgineKuhlmannEnergyPerTon / TimeWarp.fixedDeltaTime;
                double ammonia_consumption_rate = part.RequestResource(InterstellarResourcesConfiguration.Instance.Ammonia, 0.5 * monoprop_rate_d * (1 - GameConstants.pechineyUgineKuhlmannMassRatio) * TimeWarp.fixedDeltaTime / density_ammonia) * density_ammonia / TimeWarp.fixedDeltaTime;
                double h202_consumption_rate    = part.RequestResource(InterstellarResourcesConfiguration.Instance.HydrogenPeroxide, 0.5 * monoprop_rate_d * GameConstants.pechineyUgineKuhlmannMassRatio * TimeWarp.fixedDeltaTime / density_h2o2) * density_h2o2 / TimeWarp.fixedDeltaTime;

                if (ammonia_consumption_rate > 0 && h202_consumption_rate > 0)
                {
                    double mono_prop_produciton_rate = ammonia_consumption_rate + h202_consumption_rate;
                    double density_monoprop          = PartResourceLibrary.Instance.GetDefinition("MonoPropellant").density;
                    monoprop_rate_d = -ORSHelper.fixedRequestResource(part, "MonoPropellant", -mono_prop_produciton_rate * TimeWarp.fixedDeltaTime / density_monoprop) * density_monoprop / TimeWarp.fixedDeltaTime;
                    ORSHelper.fixedRequestResource(part, InterstellarResourcesConfiguration.Instance.Water, -mono_prop_produciton_rate * TimeWarp.fixedDeltaTime * 1.12436683185 / density_h2o);
                }
                else if (electrical_power_ratio > 0)
                {
                    monoprop_rate_d = 0;
                    ScreenMessages.PostScreenMessage("Ammonia and Hydrogen Peroxide are required to produce Monopropellant.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                    IsEnabled = false;
                }
            }
            else if (active_mode == 6) // Uranium Ammonolysis
            {
                double electrical_power_provided = consumeFNResource((PluginHelper.BaseUraniumAmmonolysisPowerConsumption) * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                electrical_power_ratio = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseUraniumAmmonolysisPowerConsumption);
                double lpersec       = GameConstants.baseUraniumAmmonolysisRate * electrical_power_ratio;
                double uf4persec     = lpersec * 1.24597 / density_uf4;
                double unpersec      = lpersec / density_un;
                double ammoniapersec = lpersec * 0.901 / density_ammonia;
                double uf4_rate      = ORSHelper.fixedRequestResource(part, InterstellarResourcesConfiguration.Instance.UraniumTetraflouride, uf4persec * TimeWarp.fixedDeltaTime);
                double ammonia_rate  = ORSHelper.fixedRequestResource(part, InterstellarResourcesConfiguration.Instance.Ammonia, uf4persec * TimeWarp.fixedDeltaTime);

                if (uf4_rate > 0 && ammonia_rate > 0)
                {
                    uranium_nitride_rate_d = -ORSHelper.fixedRequestResource(part, InterstellarResourcesConfiguration.Instance.UraniumNitride, -uf4_rate * density_uf4 / 1.24597 / density_un) / TimeWarp.fixedDeltaTime * density_un;
                }
                else
                {
                    if (electrical_power_ratio > 0)
                    {
                        uranium_nitride_rate_d = 0;
                        ScreenMessages.PostScreenMessage("Uranium Tetraflouride and Ammonia are required to produce Uranium Nitride.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                        IsEnabled = false;
                    }
                }
            }
            else if (active_mode == 7)             // Haber Process
            {
                bool  atmosphereNitrogenIsAvailable = false;
                float nitrogen_available            = 0;

                if ((FlightGlobals.getStaticPressure(vessel.transform.position) * ORSAtmosphericResourceHandler.getAtmosphericResourceContentByDisplayName(vessel.mainBody.flightGlobalsIndex, "Nitrogen") >= 0.1))
                {
                    atmosphereNitrogenIsAvailable = true;
                }
                else
                {
                    List <PartResource> resourcesWithNitrogen = part.GetConnectedResources(InterstellarResourcesConfiguration.Instance.Nitrogen).ToList();
                    nitrogen_available = (float)resourcesWithNitrogen.Sum(res => res.amount);
                }

                if (atmosphereNitrogenIsAvailable || nitrogen_available > 0)
                {
                    double electrical_power_provided = consumeFNResource((PluginHelper.BaseHaberProcessPowerConsumption) * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                    electrical_power_ratio = (float)(electrical_power_provided / TimeWarp.fixedDeltaTime / PluginHelper.BaseHaberProcessPowerConsumption);
                    double hydrogen_rate_t       = electrical_power_provided / PluginHelper.HaberProcessEnergyPerTon * GameConstants.ammoniaHydrogenFractionByMass / TimeWarp.fixedDeltaTime;
                    double ammonia_rate_to_add_t = ORSHelper.fixedRequestResource(part, InterstellarResourcesConfiguration.Instance.Hydrogen, hydrogen_rate_t * TimeWarp.fixedDeltaTime / density_h) * density_h / GameConstants.ammoniaHydrogenFractionByMass / TimeWarp.fixedDeltaTime;

                    double nitrogen_rate_to_add_t = atmosphereNitrogenIsAvailable ? 1
                                                : ORSHelper.fixedRequestResource(part, InterstellarResourcesConfiguration.Instance.Nitrogen, hydrogen_rate_t * TimeWarp.fixedDeltaTime / density_nitrogen) * density_nitrogen / GameConstants.ammoniaHydrogenFractionByMass / TimeWarp.fixedDeltaTime;

                    if ((ammonia_rate_to_add_t > 0) && (nitrogen_rate_to_add_t > 0))
                    {
                        ammonia_rate_d = -ORSHelper.fixedRequestResource(part, InterstellarResourcesConfiguration.Instance.Ammonia, -ammonia_rate_to_add_t * TimeWarp.fixedDeltaTime / density_ammonia) * density_ammonia / TimeWarp.fixedDeltaTime;
                    }
                    else if (electrical_power_ratio > 0)
                    {
                        ScreenMessages.PostScreenMessage("Hydrogen is required to perform the Haber Process.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                        IsEnabled = false;
                    }
                }
                else
                {
                    ScreenMessages.PostScreenMessage("Ambient Nitrogen Insufficient.", 5.0f, ScreenMessageStyle.UPPER_CENTER);
                    IsEnabled = false;
                }
            }
        }