Ejemplo n.º 1
0
        public void DebugLogTemps()
        {
            StringBuilder stringBuilder = new StringBuilder();
            float         num;

            if (Find.CurrentMap != null)
            {
                Vector2 vector = Find.WorldGrid.LongLatOf(Find.CurrentMap.Tile);
                num = vector.y;
            }
            else
            {
                num = 0f;
            }
            float num2 = num;

            stringBuilder.AppendLine("Latitude " + num2);
            stringBuilder.AppendLine("-----Temperature for each hour this day------");
            stringBuilder.AppendLine("Hour    Temp    SunEffect");
            int num3 = Find.TickManager.TicksAbs - Find.TickManager.TicksAbs % 60000;

            for (int i = 0; i < 24; i++)
            {
                int absTick = num3 + i * 2500;
                stringBuilder.Append(i.ToString().PadRight(5));
                stringBuilder.Append(Find.World.tileTemperatures.OutdoorTemperatureAt(map.Tile, absTick).ToString("F2").PadRight(8));
                stringBuilder.Append(GenTemperature.OffsetFromSunCycle(absTick, map.Tile).ToString("F2"));
                stringBuilder.AppendLine();
            }
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("-----Temperature for each twelfth this year------");
            for (int j = 0; j < 12; j++)
            {
                Twelfth twelfth = (Twelfth)j;
                float   num4    = Find.World.tileTemperatures.AverageTemperatureForTwelfth(map.Tile, twelfth);
                stringBuilder.AppendLine(twelfth.GetQuadrum() + "/" + SeasonUtility.GetReportedSeason(twelfth.GetMiddleYearPct(), num2) + " - " + twelfth.ToString() + " " + num4.ToString("F2"));
            }
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("-----Temperature for each day this year------");
            stringBuilder.AppendLine("Tile avg: " + map.TileInfo.temperature + "°C");
            stringBuilder.AppendLine("Seasonal shift: " + GenTemperature.SeasonalShiftAmplitudeAt(map.Tile));
            stringBuilder.AppendLine("Equatorial distance: " + Find.WorldGrid.DistanceFromEquatorNormalized(map.Tile));
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("Day  Lo   Hi   OffsetFromSeason RandomDailyVariation");
            for (int k = 0; k < 60; k++)
            {
                int absTick2 = (int)((float)(k * 60000) + 15000f);
                int absTick3 = (int)((float)(k * 60000) + 45000f);
                stringBuilder.Append(k.ToString().PadRight(8));
                stringBuilder.Append(Find.World.tileTemperatures.OutdoorTemperatureAt(map.Tile, absTick2).ToString("F2").PadRight(11));
                stringBuilder.Append(Find.World.tileTemperatures.OutdoorTemperatureAt(map.Tile, absTick3).ToString("F2").PadRight(11));
                stringBuilder.Append(GenTemperature.OffsetFromSeasonCycle(absTick3, map.Tile).ToString("F2").PadRight(11));
                stringBuilder.Append(Find.World.tileTemperatures.OffsetFromDailyRandomVariation(map.Tile, absTick3).ToString("F2"));
                stringBuilder.AppendLine();
            }
            Log.Message(stringBuilder.ToString());
        }
        public static float GetTemperatureFromSeasonAtTile(int absTick, int tile)
        {
            if (absTick == 0)
            {
                absTick = 1;
            }
            Tile tile2 = Find.WorldGrid[tile];

            return(tile2.temperature + GenTemperature.OffsetFromSeasonCycle(absTick, tile));
        }