Example #1
0
        public static string GrowingQuadrumsDescription(int tile)
        {
            List <Twelfth> list = GenTemperature.TwelfthsInAverageTemperatureRange(tile, 10f, 42f);

            if (list.NullOrEmpty <Twelfth>())
            {
                return("NoGrowingPeriod".Translate());
            }
            if (list.Count == 12)
            {
                return("GrowYearRound".Translate());
            }
            return("PeriodDays".Translate(list.Count * 5 + "/" + 60) + " (" + QuadrumUtility.QuadrumsRangeLabel(list) + ")");
        }
        public static string GrowingQuadrumsDescription(int tile)
        {
            List <Twelfth> list = GenTemperature.TwelfthsInAverageTemperatureRange(tile, 10f, 42f);
            string         result;

            if (list.NullOrEmpty <Twelfth>())
            {
                result = "NoGrowingPeriod".Translate();
            }
            else if (list.Count == 12)
            {
                result = "GrowYearRound".Translate();
            }
            else
            {
                result = "PeriodDays".Translate(new object[]
                {
                    list.Count * 5 + "/" + 60
                }) + " (" + QuadrumUtility.QuadrumsRangeLabel(list) + ")";
            }
            return(result);
        }
Example #3
0
        public override void Filter(List <int> inputList)
        {
            base.Filter(inputList);

            if (!IsFilterActive)
            {
                return;
            }

            if (!UserData.GrowingPeriod.Max.IsEqualOrGreaterGrowingPeriod(UserData.GrowingPeriod.Min))
            {
                var minGrowingDays = UserData.GrowingPeriod.Min.ToGrowingDays();
                var maxGrowingDays = UserData.GrowingPeriod.Max.ToGrowingDays();
                var message        =
                    $"{SubjectThingDef}: {"PLFILT_VerifyMinIsLessOrEqualMax".Translate()}: {minGrowingDays} days <= {maxGrowingDays} days).";
                PrepareLanding.Instance.TileFilter.FilterInfoLogger.AppendErrorMessage(message);
                return;
            }

            foreach (var tileId in inputList)
            {
                // twelfthList is a list of Twelfth (where 1 twelfth is 5 days); the count of items indicates how much twelfths you can grow plants
                //   from 0 (no growing period) to 12 (60 days -> year round).
                var twelfthList = GenTemperature.TwelfthsInAverageTemperatureRange(tileId,
                                                                                   Plant.MinOptimalGrowthTemperature, Plant.MaxOptimalGrowthTemperature);
                var tileGrowingDays = twelfthList.Count * GenDate.DaysPerTwelfth;

                // GrowingPeriod.Min and GrowingPeriod.Max are only one twelfth,: it indicates *how many periods of 5 days* we must search for.
                // e.g Twelfth.Undefined is 0 days, Twelfth.First is 5 days, Twelfth.Second is 10 days, etc. up to Twelfth.Twelfth (12 * 5 = 60 days = 1 year [year-round])
                var minDays = UserData.GrowingPeriod.Min.ToGrowingDays();
                var maxDays = UserData.GrowingPeriod.Max.ToGrowingDays();

                if (tileGrowingDays >= minDays && tileGrowingDays <= maxDays)
                {
                    _filteredTiles.Add(tileId);
                }
            }
        }