public static Twelfth PreviousTwelfth(this Twelfth twelfth) { Twelfth result; if (twelfth == Twelfth.Undefined) { result = Twelfth.Undefined; } else { int num = (int)(twelfth - Twelfth.Second); if (num == -1) { num = 11; } result = (Twelfth)num; } return(result); }
public static NeededWarmth CalculateNeededWarmth(Pawn pawn, int tile, Twelfth twelfth) { float num = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, twelfth); NeededWarmth result; if (num < pawn.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMin, null) - 4f) { result = NeededWarmth.Warm; } else if (num > pawn.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMin, null) + 4f) { result = NeededWarmth.Cool; } else { result = NeededWarmth.Any; } return(result); }
public static Twelfth GetRightMostTwelfth(List <Twelfth> twelfths, Twelfth rootTwelfth) { if (twelfths.Count >= 12) { return(Twelfth.Undefined); } Twelfth m; while (true) { m = rootTwelfth; rootTwelfth = TwelfthUtility.TwelfthAfter(rootTwelfth); if (!twelfths.Contains(rootTwelfth)) { break; } } return(TwelfthUtility.TwelfthAfter(m)); }
public static Twelfth GetRightMostTwelfth(List <Twelfth> twelfths, Twelfth rootTwelfth) { Twelfth result; if (twelfths.Count >= 12) { result = Twelfth.Undefined; } else { Twelfth m; do { m = rootTwelfth; rootTwelfth = TwelfthUtility.TwelfthAfter(rootTwelfth); }while (twelfths.Contains(rootTwelfth)); result = TwelfthUtility.TwelfthAfter(m); } return(result); }
private static string SeasonsContinuousRangeLabel(List <Twelfth> twelfths, Twelfth rootTwelfth, Vector2 longLat) { Twelfth leftMostTwelfth = TwelfthUtility.GetLeftMostTwelfth(twelfths, rootTwelfth); Twelfth rightMostTwelfth = TwelfthUtility.GetRightMostTwelfth(twelfths, rootTwelfth); Twelfth twelfth = leftMostTwelfth; while (twelfth != rightMostTwelfth) { if (twelfths.Contains(twelfth)) { twelfths.Remove(twelfth); twelfth = TwelfthUtility.TwelfthAfter(twelfth); continue; } Log.Error("Twelfths doesn't contain " + twelfth + " (" + leftMostTwelfth + ".." + rightMostTwelfth + ")"); break; } twelfths.Remove(rightMostTwelfth); return(GenDate.SeasonDateStringAt(leftMostTwelfth, longLat) + " - " + GenDate.SeasonDateStringAt(rightMostTwelfth, longLat)); }
public static Twelfth GetLeftMostTwelfth(List <Twelfth> twelfths, Twelfth rootTwelfth) { Twelfth result; if (twelfths.Count >= 12) { result = Twelfth.Undefined; } else { Twelfth twelfth; do { twelfth = rootTwelfth; rootTwelfth = TwelfthUtility.TwelfthBefore(rootTwelfth); }while (twelfths.Contains(rootTwelfth)); result = twelfth; } return(result); }
private static NeededWarmth ApparelWarmthNeededNow(Pawn pawn, PawnGenerationRequest request, out float mapTemperature) { int tile = request.Tile; if (tile == -1) { Map anyPlayerHomeMap = Find.AnyPlayerHomeMap; if (anyPlayerHomeMap != null) { tile = anyPlayerHomeMap.Tile; } } if (tile == -1) { mapTemperature = 21f; return(NeededWarmth.Any); } NeededWarmth neededWarmth = NeededWarmth.Any; Twelfth twelfth = GenLocalDate.Twelfth(tile); mapTemperature = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, twelfth); for (int i = 0; i < 2; i++) { NeededWarmth neededWarmth2 = CalculateNeededWarmth(pawn, tile, twelfth); if (neededWarmth2 != 0) { neededWarmth = neededWarmth2; break; } twelfth = twelfth.NextTwelfth(); } if (pawn.kindDef.apparelIgnoreSeasons) { if (request.ForceAddFreeWarmLayerIfNeeded && neededWarmth == NeededWarmth.Warm) { return(neededWarmth); } return(NeededWarmth.Any); } return(neededWarmth); }
public static List <Twelfth> TwelfthsInAverageTemperatureRange(int tile, float minTemp, float maxTemp) { List <Twelfth> twelfths = new List <Twelfth>(); for (int i = 0; i < 12; i++) { float num = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, (Twelfth)i); if (num >= minTemp && num <= maxTemp) { twelfths.Add((Twelfth)i); } } if (twelfths.Count <= 1 || twelfths.Count == 12) { return(twelfths); } if (twelfths.Contains(Twelfth.Twelfth) && twelfths.Contains(Twelfth.First)) { Twelfth twelfth = twelfths.First((Twelfth m) => !twelfths.Contains((Twelfth)(m - Twelfth.Second))); List <Twelfth> list = new List <Twelfth>(); for (int j = (int)twelfth; j < 12; j++) { if (!twelfths.Contains((Twelfth)j)) { break; } list.Add((Twelfth)j); } for (int k = 0; k < 12; k++) { if (!twelfths.Contains((Twelfth)k)) { break; } list.Add((Twelfth)k); } } return(twelfths); }
private float GetTemperature(Twelfth twelfth, [NotNull] Map map) { return(GenTemperature.AverageTemperatureAtTileForTwelfth(map.Tile, twelfth)); }
public float AverageTemperatureForTwelfth(int tile, Twelfth twelfth) { return(this.RetrieveCachedData(tile).AverageTemperatureForTwelfth(twelfth)); }
public float AverageTemperatureForTwelfth(Twelfth twelfth) { return(this.twelfthlyTempAverages[(int)twelfth]); }
public static string SeasonDateStringAt(Twelfth twelfth, Vector2 longLat) { return(SeasonDateStringAt((int)twelfth * 300000 + 1, longLat)); }
public static string QuadrumDateStringAt(Twelfth twelfth) { return(QuadrumDateStringAt((int)twelfth * 300000 + 1, 0f)); }
public static Quadrum Quadrum(long absTicks, float longitude) { Twelfth twelfth = GenDate.Twelfth(absTicks, longitude); return(twelfth.GetQuadrum()); }
public static string QuadrumDateStringAt(Twelfth twelfth) { return(GenDate.QuadrumDateStringAt((long)((int)twelfth * 300000 + 1), 0f)); }
static void Postfix(int tile, Twelfth twelfth, ref float __result) { if (averageTileTemps.TryGetValue(tile, out float[] arr) && !float.IsNaN(arr[(int)twelfth]))
static bool Prefix(int tile, Twelfth twelfth) { return(!averageTileTemps.TryGetValue(tile, out float[] arr) || float.IsNaN(arr[(int)twelfth])); }
internal bool <> m__0(Twelfth m) { return(!this.twelfths.Contains((Twelfth)(m - Twelfth.Second))); }
public static int ToGrowingDays(this Twelfth thisTwelfth) { return(((int)thisTwelfth + 1 % 13) * 5); }
public static float GetBeginningYearPct(this Twelfth twelfth) { return((float)(int)twelfth / 12f); }
public static float GetMiddleYearPct(this Twelfth twelfth) { return(((float)(int)twelfth + 0.5f) / 12f); }
public static bool AverageTemperatureForTwelfth(TileTemperaturesComp __instance, ref float __result, int tile, Twelfth twelfth) { __result = RetrieveCachedData2(__instance, tile).AverageTemperatureForTwelfth(twelfth); return(false); }