public TieredResource(
     string name,
     string capacityUnits,
     ResearchCategory researchCategory,
     bool canBeStored,
     bool unstoredExcessCanGoToResearch,
     bool isHarvestedLocally,
     TieredResource madeFrom,
     TechTier madeFromStartsAt,
     double effT0, double effT1, double effT2, double effT3, double effT4)
 {
     this.BaseName      = name;
     this.DisplayName   = name;
     this.CapacityUnits = capacityUnits;
     this.CanBeStored   = canBeStored;
     this.ExcessProductionCountsTowardsResearch = unstoredExcessCanGoToResearch;
     this.ResearchCategory        = researchCategory;
     this.IsHarvestedLocally      = isHarvestedLocally;
     this.madeFrom                = madeFrom;
     this.madeFromStartsAt        = madeFromStartsAt;
     this.effectivenessAtTier     = new double[5];
     this.effectivenessAtTier[0]  = effT0;
     this.effectivenessAtTier[1]  = effT1;
     this.effectivenessAtTier[2]  = effT2;
     this.effectivenessAtTier[3]  = effT3;
     this.effectivenessAtTier[4]  = effT4;
     this.reputationPerUnitAtTier = new float[5];
 }
 public ResearchData(ResearchCategory category, TechTier currentTier, double accumulatedKerbalDays, double kerbalDaysRequired)
 {
     this.Category = category;
     this.AccumulatedKerbalDays       = accumulatedKerbalDays;
     this.KerbalDaysRequired          = kerbalDaysRequired;
     this.KerbalDaysContributedPerDay = 0;
     this.currentTier = currentTier;
 }
        private TieredResource(ConfigNode c, ResearchCategory researchCategory, TieredResource madeFrom, TechTier madeFromStartsAt)
        {
            this.BaseName      = c.GetValue("name");
            this.DisplayName   = c.GetValue("display_name");
            this.CapacityUnits = c.GetValue("capacity_units");
            bool canBeStored = false;

            c.TryGetValue("can_be_stored", ref canBeStored);
            this.CanBeStored = canBeStored;

            bool unstoredExcessCanGoToResearch = false;

            c.TryGetValue("unstored_excess_can_go_to_research", ref unstoredExcessCanGoToResearch);
            this.ExcessProductionCountsTowardsResearch = unstoredExcessCanGoToResearch;

            bool isHarvestedLocally = false;

            c.TryGetValue("is_harvested_locally", ref isHarvestedLocally);
            this.IsHarvestedLocally = isHarvestedLocally;

            this.CrewSkill = c.GetValue("crew_skill");
            researchCategory.AddCrewSkill(this.CrewSkill);

            this.ResearchCategory = researchCategory;

            // If it's edible, it'll have these set
            bool allSet = true;

            double[] effectiveness = new double[1 + (int)TechTier.Tier4];
            for (TechTier tech = TechTier.Tier0; tech <= TechTier.Tier4; ++tech)
            {
                string name = $"effectiveness_at_tier{(int)tech}";
                if (!c.TryGetValue(name, ref effectiveness[(int)tech]) || effectiveness[(int)tech] > 1 || effectiveness[(int)tech] < 0)
                {
                    allSet = false;
                    break;
                }
            }

            this.effectivenessAtTier = allSet ? effectiveness : null;
            this.madeFrom            = madeFrom;
            this.madeFromStartsAt    = madeFromStartsAt;

            float[] repGains = new float[1 + (int)TechTier.Tier4];
            allSet = true;
            for (TechTier tech = TechTier.Tier0; tech <= TechTier.Tier4; ++tech)
            {
                string name = $"reputation_per_unit_at_tier{(int)tech}";
                if (!c.TryGetValue(name, ref repGains[(int)tech]))
                {
                    allSet = false;
                    break;
                }
            }
            this.reputationPerUnitAtTier = allSet ? repGains : new float[1 + (int)TechTier.Tier4];
        }
 public TieredResource(
     string name,
     string capacityUnits,
     ResearchCategory researchCategory,
     bool canBeStored,
     bool unstoredExcessCanGoToResearch,
     bool isHarvestedLocally,
     TieredResource madeFrom,
     TechTier madeFromStartsAt)
 {
     this.BaseName      = name;
     this.DisplayName   = name;
     this.CapacityUnits = capacityUnits;
     this.CanBeStored   = canBeStored;
     this.ExcessProductionCountsTowardsResearch = unstoredExcessCanGoToResearch;
     this.ResearchCategory        = researchCategory;
     this.IsHarvestedLocally      = isHarvestedLocally;
     this.madeFrom                = madeFrom;
     this.madeFromStartsAt        = madeFromStartsAt;
     this.reputationPerUnitAtTier = name == "Shinies" ? new float[] { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f } : new float[5];
 }
示例#5
0
 private bool EligibleToSkipTier1(ResearchCategory researchCategory)
 {
     // If we've researched Tier3 on 2 or more worlds, allow user to skip T1 for this category.
     return(this.categoryToBodyToProgressMap[researchCategory].Values.Count(v => v.Tier > TechTier.Tier3) >= 2);
 }