Example #1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

                biomeName = biome.name;
                harvestID = (HarvestTypes)harvestType;
                planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
            }

            converters = this.part.FindModulesImplementing <ModuleResourceConverter>();

            originalEfficiencyType = efficiencyType;
            originalHarvestType    = harvestType;

            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += new ModuleRedecoratedEvent(switcher_onModuleRedecorated);
            }
        }
Example #2
0
        private bool VerifyBiomeResult(double lat, double lon, CBAttributeMapSO.MapAttribute target)
        {
            if (projectedMap == null)
            {
                return(true);                      // we'll have to assume it's accurate since we can't prove otherwise
            }
            if (target == null || target.mapColor == null)
            {
                return(true);                                           // this shouldn't happen
            }
            lon -= Mathf.PI * 0.5f;
            if (lon < 0d)
            {
                lon += Mathf.PI * 2d;
            }
            lon %= Mathf.PI * 2d;

            int x_center = (int)Math.Round(projectedMap.width * (float)(lon / (Mathf.PI * 2)), 0);
            int y_center = (int)Math.Round(projectedMap.height * ((float)(lat / Mathf.PI) + 0.5f), 0);

            for (int y = y_center - HALF_SEARCH_DIMENSIONS; y < y_center + HALF_SEARCH_DIMENSIONS; ++y)
            {
                for (int x = x_center - HALF_SEARCH_DIMENSIONS; x < x_center + HALF_SEARCH_DIMENSIONS; ++x)
                {
                    Color c = projectedMap.GetPixel(x, y);
                    if (Similar(c, target.mapColor))
                    {
                        return(true); // we have a match, no need to look further
                    }
                }
            }
            return(false);
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }
            infoView = new InfoView();
            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);
            biomeName = biome.name;

            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                harvestID = (HarvestTypes)harvestType;
                planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
            }

            moduleSwitcher = this.part.FindModuleImplementing <WBIModuleSwitcher>();

            GameEvents.onCrewOnEva.Add(this.onCrewEVA);
            GameEvents.onCrewTransferred.Add(this.onCrewTransfer);
            GameEvents.onCrewBoardVessel.Add(this.onCrewBoardVessel);

            originalCriticalSuccess = criticalSuccess;
            setupModuleInfo();
        }
Example #4
0
        public static bool IsBiomeUnlocked(Vessel vessel)
        {
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return(false);
            }
            if (vessel == null)
            {
                return(false);
            }
            if (!vessel.Landed && !vessel.Splashed)
            {
                return(true);
            }

            //ResourceMap.Instance.IsBiomeUnlocked is borked. Need to use an alternate method...
            CBAttributeMapSO.MapAttribute biome         = Utils.GetCurrentBiome(vessel);
            List <BiomeLockData>          biomeLockData = ResourceScenario.Instance.gameSettings.GetBiomeLockInfo();

            if (biome == null)
            {
                return(false);
            }

            foreach (BiomeLockData data in biomeLockData)
            {
                if (data.BiomeName == biome.name)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            Events["CheckGoldStrike"].guiActive          = showGUI;
            Events["CheckGoldStrike"].guiActiveUncommand = showGUI;

            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            //See if we have an asteroid.
            asteroid = this.part.vessel.FindPartModuleImplementing <ModuleAsteroid>();

            //Minimum travel distance
            minTravelDistance = GoldStrikeSettings.DistanceBetweenProspects;
            GameEvents.OnGameSettingsApplied.Add(onGameSettingsApplied);

            //Get the last prospect location for the local planet and biome
            if (this.part.vessel.situation == Vessel.Situations.PRELAUNCH || this.part.vessel.situation == Vessel.Situations.LANDED)
            {
                CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);
                lastProspectLocation = WBIPathfinderScenario.Instance.GetLastProspectLocation(this.part.vessel.mainBody.flightGlobalsIndex, biome.name);
            }
        }
Example #6
0
        protected void setLastLocation()
        {
            CBAttributeMapSO.MapAttribute biome = null;
            string biomeName = string.Empty;
            int    planetID  = int.MaxValue;
            double longitude = 0f;
            double latitude  = 0f;
            double altitude  = 0f;

            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                biome     = Utils.GetCurrentBiome(this.part.vessel);
                biomeName = biome.name;

                planetID = this.part.vessel.mainBody.flightGlobalsIndex;

                longitude = this.part.vessel.longitude;
                latitude  = this.part.vessel.latitude;
                altitude  = this.part.vessel.altitude;
            }

            else if ((this.part.vessel.situation == Vessel.Situations.ORBITING || this.part.vessel.situation == Vessel.Situations.DOCKED) && asteroid != null)
            {
                biomeName = asteroid.AsteroidName;
            }

            //Keep a copy of the location for our purposes
            lastProspectLocation.x = longitude;
            lastProspectLocation.y = latitude;

            debugLog("Last lode location: " + planetID + " " + biomeName + " lon: " + longitude + " lat: " + latitude + " altitude: " + altitude);
            WBIPathfinderScenario.Instance.SetLastProspectLocation(planetID, biomeName, longitude, latitude, altitude);
        }
Example #7
0
        public static string GetCurrentBiomeName(Vessel vessel)
        {
            CBAttributeMapSO biomeMap = FlightGlobals.currentMainBody.BiomeMap;

            CBAttributeMapSO.MapAttribute mapAttribute = biomeMap.GetAtt(vessel.latitude * Mathf.Deg2Rad, vessel.longitude * Mathf.Deg2Rad);
            return(mapAttribute.name);
        }
Example #8
0
        protected string getCurrentBiomeName(Vessel vessel)
        {
            CBAttributeMapSO.MapAttribute biome = getCurrentBiome(vessel);

            if (biome != null)
            {
                return(biome.name);
            }

            switch (vessel.situation)
            {
            case Vessel.Situations.FLYING:
                return("FLYING");

            case Vessel.Situations.ORBITING:
            case Vessel.Situations.ESCAPING:
            case Vessel.Situations.SUB_ORBITAL:
                return("ORBITING");

            case Vessel.Situations.SPLASHED:
                return("SPLASHED");

            default:
                return("LANDED");
            }
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            if (originalCriticalFail == -1)
            {
                originalCriticalFail = criticalFail;
                currentCriticalFail  = criticalFail;
            }

            criticalFail = currentCriticalFail;

            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

            biomeName = biome.name;

            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                harvestID = (HarvestTypes)harvestType;
                planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
            }

            float efficiencyModifier = WBIPathfinderScenario.Instance.GetEfficiencyModifier(planetID, biomeName, harvestID, efficiencyType);

            if (this.EfficiencyBonus != efficiencyModifier)
            {
                this.EfficiencyBonus = efficiencyModifier;
            }

            SetupGUI();
        }
Example #10
0
        protected int getSamplesLeft()
        {
            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);
            HarvestTypes harvestType            = (HarvestTypes)resourceType;
            int          samplesLeft            = WBIPathfinderScenario.Instance.GetCoreSamplesRemaining(this.part.vessel.mainBody.flightGlobalsIndex, biome.name, harvestType);

            return(samplesLeft);
        }
Example #11
0
        /// <summary>Gets the biome of the current colliding part.</summary>
        /// <param name="lat">Latitude of the vessel.</param>
        /// <param name="lon">Longitude of the vessel.</param>
        /// <returns>The name of the biome it finds.</returns>
        static string GetCurrentBiomeName(double lat, double lon)
        {
            CBAttributeMapSO biomeMap = FlightGlobals.currentMainBody.BiomeMap;

            CBAttributeMapSO.MapAttribute mapAttribute = biomeMap.GetAtt(lat * Mathf.Deg2Rad, lon * Mathf.Deg2Rad);
            string result = mapAttribute.name.Replace(' ', '_');

            return(result);
        }
Example #12
0
        public static float GetScienceCap(Part part)
        {
            CBAttributeMapSO.MapAttribute biome      = Utils.GetCurrentBiome(part.vessel);
            ScienceExperiment             experiment = ResearchAndDevelopment.GetExperiment(kBiomeAnalysisID);
            ScienceSubject subject = ResearchAndDevelopment.GetExperimentSubject(experiment, ScienceUtil.GetExperimentSituation(part.vessel),
                                                                                 part.vessel.mainBody, biome.name, biome.displayname);

            return(subject.scienceCap);
        }
 internal string getBiomeName(CelestialBody body, double lon, double lat)
 {
     CBAttributeMapSO.MapAttribute a = getBiome(body, lon, lat);
     if (a == null)
     {
         return("unknown");
     }
     return(a.name);
 }
Example #14
0
        public static CBAttributeMapSO.MapAttribute GetCurrentBiome(Vessel vessel)
        {
            CelestialBody celestialBody = vessel.mainBody;
            double        lattitude     = ResourceUtilities.Deg2Rad(vessel.latitude);
            double        longitude     = ResourceUtilities.Deg2Rad(vessel.longitude);

            CBAttributeMapSO.MapAttribute biome = ResourceUtilities.GetBiome(lattitude, longitude, FlightGlobals.currentMainBody);

            return(biome);
        }
Example #15
0
 //Adapted from SCANSAT
 private static int getBiomeIndex(CelestialBody body, double lon, double lat)
 {
     CBAttributeMapSO.MapAttribute att = body.BiomeMap.GetAtt(Mathf.Deg2Rad * lat, Mathf.Deg2Rad * lon);
     for (int i = 0; i < body.BiomeMap.Attributes.Length; ++i)
     {
         if (body.BiomeMap.Attributes[i] == att)
         {
             return(i);
         }
     }
     return(-1);
 }
        protected void getResultsText()
        {
            List <string>     results    = new List <string>();
            string            situation  = ScienceUtil.GetExperimentSituation(part.vessel).ToString();
            ScienceExperiment experiment = ResearchAndDevelopment.GetExperiment(scienceLab.experimentID);

            if (experiment == null)
            {
                resultsText = "You've done some basic research.";
                return;
            }
            string resultKey;

            string biomeName = "";

            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);
            if (biome != null)
            {
                biomeName = "'s " + biomeName;
            }
            this.WindowTitle = experiment.experimentTitle + " from " + this.part.vessel.mainBody.name + biomeName;

            foreach (string key in experiment.Results.Keys)
            {
                resultKey = key.Replace("*", "");

                if (resultKey.Contains(situation))
                {
                    results.Add(experiment.Results[key]);
                }
            }

            if (results.Count == 0)
            {
                if (experiment.Results.ContainsKey("default"))
                {
                    resultsText = experiment.Results["default"];
                }
                else
                {
                    resultsText = "You've done some basic research.";
                }
                return;
            }

            int resultIndex = UnityEngine.Random.Range(0, results.Count);

            if (resultIndex >= results.Count)
            {
                resultIndex = results.Count - 1;
            }
            resultsText = results[resultIndex];
        }
Example #17
0
        public void InvalidateResults()
        {
            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

            if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER | HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX)
            {
                if (invalidateConfirm == false)
                {
                    ScreenMessages.PostScreenMessage(kConfirmInvalidate, kWarningMsgDuration, ScreenMessageStyle.UPPER_CENTER);
                    invalidateConfirm = true;
                    return;
                }

                if (Reputation.CurrentRep > 0)
                {
                    float fibbo1 = WBIPathfinderScenario.Instance.reputationIndex - 1.0f;
                    float fibbo2 = WBIPathfinderScenario.Instance.reputationIndex - 2.0f;

                    if (fibbo2 < 0.001f)
                    {
                        fibbo2 = 0.0f;
                    }

                    float reputationHit = kBaseReputationLoss + (fibbo1 + fibbo2);

                    //Take the reputation hit
                    Reputation.Instance.AddReputation(-reputationHit, TransactionReasons.Any);

                    //Increase the reputation hit by increasing the index.
                    WBIPathfinderScenario.Instance.reputationIndex += 1;

                    //Reset efficiency data for the biome
                    WBIPathfinderScenario.Instance.ResetEfficiencyData(this.part.vessel.mainBody.flightGlobalsIndex, biome.name, (HarvestTypes)resourceType);
                    coreSampleStatus = getSamplesLeft().ToString();

                    //Hide the button
                    Events["InvalidateResults"].guiActive          = false;
                    Events["InvalidateResults"].guiActiveUnfocused = false;
                }
            }

            //Just rest the efficiency data.
            else
            {
                //Reset efficiency data for the biome
                WBIPathfinderScenario.Instance.ResetEfficiencyData(this.part.vessel.mainBody.flightGlobalsIndex, biome.name, (HarvestTypes)resourceType);
                coreSampleStatus = getSamplesLeft().ToString();

                //Hide the button
                Events["InvalidateResults"].guiActive          = false;
                Events["InvalidateResults"].guiActiveUnfocused = false;
            }
        }
Example #18
0
        /// <summary>
        /// Get the current biome of the ship. Returns null if none.
        /// </summary>
        /// <param name="vessel"></param>
        /// <returns></returns>
        public static string GetCurrentBiome(this Vessel vessel)
        {
            if (vessel == null)
            {
                return(null);
            }
            double lat = ResourceUtilities.Deg2Rad((vessel.latitude + 180.0 + 90.0) % 180.0 - 90.0);
            double lon = ResourceUtilities.Deg2Rad((vessel.longitude + 360.0 + 180.0) % 360.0 - 180.0);

            CBAttributeMapSO.MapAttribute biome = ResourceUtilities.GetBiome(lat, lon, vessel.mainBody);
            return((biome == null) ? null : biome.name);
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

            biomeName = biome.name;

            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                harvestType = HarvestTypes.Planetary;
                planetID    = this.part.vessel.mainBody.flightGlobalsIndex;
            }
        }
Example #20
0
 /// <summary> Require EnvLanded, EnvInnerBelt and EnvOuterBelt to evaluated first </summary>
 public void Update()
 {
     body = vd.Vessel.mainBody;
     GetSituationsAndVirtualBiomes();
     biomeIndex = GetBiomeIndex(vd.Vessel);
     if (biomeIndex >= 0)
     {
         biome = body.BiomeMap.Attributes[biomeIndex];
     }
     else
     {
         biome = null;
     }
 }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

            biomeName = biome.name;

            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                harvestID = (HarvestTypes)harvestType;
                planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
            }

            converters = this.part.FindModulesImplementing <ModuleResourceConverter>();
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            Fields["efficiencyDisplayString"].guiName = efficiencyGUIName;

            //Get our biome, planet, and harvest ID.
            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

                if (biome != null)
                {
                    biomeName = biome.name;
                    harvestID = (HarvestTypes)harvestType;
                    planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
                }
            }

            //Get our converters
            converters = this.part.FindModulesImplementing <BaseConverter>();

            //Make sure we know the original efficiency and harvest type since these can change.
            originalEfficiencyType = efficiencyType;
            originalHarvestType    = harvestType;

            //Hook into the switcher's events
            switcher = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            if (switcher != null)
            {
                switcher.onModuleRedecorated += switcher_onModuleRedecorated;
            }

            //Hook into the scenario's events
            WBIPathfinderScenario.Instance.onEfficiencyUpdate += onEfficiencyUpdate;

            //Make sure that we set up efficiency
            if (!string.IsNullOrEmpty(biomeName))
            {
                onEfficiencyUpdate(planetID, biomeName, harvestID, efficiencyType,
                                   WBIPathfinderScenario.Instance.GetEfficiencyModifier(planetID, biomeName, harvestID, efficiencyType));
            }
        }
Example #23
0
        public static bool IsBiomeUnlocked(Vessel vessel)
        {
            //ResourceMap.Instance.IsBiomeUnlocked is borked. Need to use an alternate method...
            CBAttributeMapSO.MapAttribute biome         = Utils.GetCurrentBiome(vessel);
            List <BiomeLockData>          biomeLockData = ResourceScenario.Instance.gameSettings.GetBiomeLockInfo();

            foreach (BiomeLockData data in biomeLockData)
            {
                if (data.BiomeName == biome.name)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #24
0
 protected override void Inspect(Vessel vessel)
 {
     if (vessel != null)
     {
         double        lat  = vessel.latitude * Math.PI / 180d;
         double        lon  = vessel.longitude * Math.PI / 180d;
         CelestialBody body = vessel.mainBody;
         if (body != null)
         {
             CBAttributeMapSO biomeMap = body.BiomeMap;
             if (biomeMap != null)
             {
                 mapAttribute = biomeMap.GetAtt(lat, lon);
             }
         }
     }
 }
Example #25
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (!HighLogic.LoadedSceneIsFlight)
            {
                return;
            }
            bonusValue = Bonus;

            //Get our biome, planet, and harvest ID.
            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

                biomeName = biome.name;
                planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
            }
        }
Example #26
0
        public void ShowResults(string experimentID, float amount, ModuleScienceLab lab = null)
        {
            CBAttributeMapSO.MapAttribute biome      = Utils.GetCurrentBiome(part.vessel);
            ScienceExperiment             experiment = ResearchAndDevelopment.GetExperiment(experimentID);
            ScienceSubject subject = ResearchAndDevelopment.GetExperimentSubject(experiment, ScienceUtil.GetExperimentSituation(part.vessel),
                                                                                 part.vessel.mainBody, biome.name, biome.displayname);

            //Kerbin low orbit has a science multiplier of 1.
            ScienceSubject subjectLEO = ResearchAndDevelopment.GetExperimentSubject(experiment, ExperimentSituations.InSpaceLow,
                                                                                    FlightGlobals.GetHomeBody(), "", "");

            //This ensures you can re-run the experiment.
            subjectLEO.science         = 0f;
            subjectLEO.scientificValue = 1f;

            //Create science data
            ScienceData data = new ScienceData(amount, 1f, 0f, subjectLEO.id, subject.title);

            ShowResults(data, lab);
        }
Example #27
0
        public static ScienceData CreateData(Part part, float amount)
        {
            CBAttributeMapSO.MapAttribute biome      = Utils.GetCurrentBiome(part.vessel);
            ScienceExperiment             experiment = ResearchAndDevelopment.GetExperiment(kBiomeAnalysisID);
            ScienceSubject subject = ResearchAndDevelopment.GetExperimentSubject(experiment, ScienceUtil.GetExperimentSituation(part.vessel),
                                                                                 part.vessel.mainBody, biome.name, biome.displayname);

            //Kerbin low orbit has a science multiplier of 1.
            ScienceSubject subjectLEO = ResearchAndDevelopment.GetExperimentSubject(experiment, ExperimentSituations.InSpaceLow,
                                                                                    FlightGlobals.GetHomeBody(), "", "");

            //This ensures you can re-run the experiment.
            subjectLEO.science         = 0f;
            subjectLEO.scientificValue = 1f;

            //Create science data
            ScienceData data = new ScienceData(amount, 1f, 0f, subjectLEO.id, subject.title);

            return(data);
        }
Example #28
0
        private void prepareBiome()
        {
            CBAttributeMapSO.MapAttribute mapAttribute;

            try
            {
                Vessel           vessel   = FlightGlobals.ActiveVessel;
                CBAttributeMapSO BiomeMap = vessel.mainBody.BiomeMap;
                double           lat      = vessel.latitude * Math.PI / 180d;
                double           lon      = vessel.longitude * Math.PI / 180d;
                mapAttribute = BiomeMap.GetAtt(lat, lon);
            }
            catch (NullReferenceException)
            {
                mapAttribute      = new CBAttributeMapSO.MapAttribute();
                mapAttribute.name = "N/A";
            }

            this.biome.value = mapAttribute.name;
        }
Example #29
0
        protected void applyResults(float efficiencyModifier, string resultsPreamble)
        {
            int          planetID    = this.part.vessel.mainBody.flightGlobalsIndex;
            HarvestTypes harvestType = HarvestTypes.Planetary;

            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);
            string biomeName      = biome.name;
            string modifierName   = "";
            string processChanged = "";

            switch (currentExperiment)
            {
            case GeologyLabExperiments.SoilAnalysis:
                modifierName   = EfficiencyData.kHabitationMod;
                processChanged = kLifeSupport;
                break;

            case GeologyLabExperiments.MetallurgyAnalysis:
                modifierName   = EfficiencyData.kIndustryMod;
                processChanged = kManufacturing;
                break;

            default:
            case GeologyLabExperiments.ChemicalAnalysis:
                modifierName   = EfficiencyData.kScienceMod;
                processChanged = kChemicalProducts;
                break;
            }

            //Get existing modifier
            float currentModifer = WBIPathfinderScenario.Instance.GetEfficiencyModifier(planetID, biome.name, harvestType, modifierName);

            //Add improvement
            currentModifer += efficiencyModifier;
            WBIPathfinderScenario.Instance.SetEfficiencyData(planetID, biome.name, harvestType, modifierName, currentModifer);

            //Inform user
            string message = string.Format(resultsPreamble, efficiencyModifier * 100f) + processChanged + "</color>";

            ScreenMessages.PostScreenMessage(message, 8.0f, ScreenMessageStyle.UPPER_CENTER);
        }
Example #30
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            ResourceRatio[] outputs = outputList.ToArray();
            ResourceRatio   output;

            for (int index = 0; index < outputs.Length; index++)
            {
                output = outputs[index];
                if (output.ResourceName == "ElectricCharge")
                {
                    ecBaseOutput = output.Ratio;
                    break;
                }
            }

            CBAttributeMapSO.MapAttribute biome = Utils.GetCurrentBiome(this.part.vessel);

            biomeName = biome.name;

            if (this.part.vessel.situation == Vessel.Situations.LANDED || this.part.vessel.situation == Vessel.Situations.SPLASHED || this.part.vessel.situation == Vessel.Situations.PRELAUNCH)
            {
                harvestID = (HarvestTypes)harvestType;
                planetID  = this.part.vessel.mainBody.flightGlobalsIndex;
            }

            float efficiencyModifier = WBIPathfinderScenario.Instance.GetEfficiencyModifier(planetID, biomeName, harvestID, efficiencyType);

            if (this.EfficiencyBonus != efficiencyModifier)
            {
                this.EfficiencyBonus = efficiencyModifier;
            }
        }
Example #31
0
 // Allocate the biome descriptor
 public Biome()
 {
     attribute = new CBAttributeMapSO.MapAttribute();
 }