static bool Prefix(ref float __result, int tile, bool perceivedStatic, int?ticksAbs = null, StringBuilder explanation = null) { Tile tile2 = Find.WorldGrid[tile]; if (tile2.biome.impassable || tile2.hilliness == Hilliness.Impassable) { if (explanation != null && explanation.Length > 0) { explanation.AppendLine(); } float num = tile2.biome.movementDifficulty; if (explanation != null) { explanation.Append(tile2.biome.LabelCap + ": " + tile2.biome.movementDifficulty.ToStringWithSign("0.#")); } float num2 = Settings.MovementDifficulty; num += num2; if (explanation != null) { explanation.AppendLine(); explanation.Append(tile2.hilliness.GetLabelCap() + ": " + num2.ToStringWithSign("0.#")); } num += WorldPathGrid.GetCurrentWinterMovementDifficultyOffset(tile, new int?((!ticksAbs.HasValue) ? GenTicks.TicksAbs : ticksAbs.Value), explanation); __result = num; return(false); } return(true); }
public static int CostToMoveIntoTile(Caravan caravan, int tile, float yearPercent = -1f) { int normalTicks = 2500; double num = (normalTicks + WorldPathGrid.CalculatedCostAt(tile, false, yearPercent)) * ((double)caravan.TicksPerMove / (double)normalTicks); return(Mathf.Clamp((int)num, 1, 120000)); }
public static void Postifx(ref float __result, WorldGrid __instance, ref int fromTile, ref int toTile, ref StringBuilder explanation) { List <Tile.RoadLink> roads = __instance.tiles[fromTile].Roads; if (roads == null) { return; } if (toTile == -1) { toTile = __instance.FindMostReasonableAdjacentTileForDisplayedPathCost(fromTile); } float BiomeModifier = 0; float HillModifier = 0; float WinterModifier = 0; for (int i = 0; i < roads.Count; i++) { if (roads[i].neighbor == toTile) { Tile ToTileAsTile = Find.WorldGrid[toTile]; float HillinessOffset = (float)HillinessMovementDifficultyOffset.Invoke(null, new object[] { ToTileAsTile.hilliness }); if (HillinessOffset > 12f) { HillinessOffset = 12f; } // If the tile has an impassable biome, set the biomemovement difficulty to 12, as per the patch for CalculatedMovementDifficultyAt float biomeMovementDifficulty = (ToTileAsTile.biome.impassable ? 12f : ToTileAsTile.biome.movementDifficulty); // Calculate biome, Hillines & winter modifiers, update explanation & multiply result by biome modifier float RoadModifier = RoadsOfTheRim.calculateRoadModifier( roads[i].road, biomeMovementDifficulty, HillinessOffset, WorldPathGrid.GetCurrentWinterMovementDifficultyOffset(toTile), out BiomeModifier, out HillModifier, out WinterModifier ); float resultBefore = __result; __result *= RoadModifier; if (explanation != null) { explanation.AppendLine(); explanation.Append(String.Format( "The road cancels {0:P0} of the biome ({3:##.###}), {1:P0} of the hills ({4:##.###}) & {2:P0} of winter movement costs. Total modifier={5} applied to {6}", BiomeModifier, HillModifier, WinterModifier, biomeMovementDifficulty, HillinessOffset, RoadModifier, resultBefore )); } return; } } }
static bool Prefix(ref int __result, Caravan caravan, int start, int end, int?ticksAbs = null) { if (!VesselManager.WorldObjectIsNavigator(caravan)) { return(true); } int caravanTicksPerMove = caravan.TicksPerMove; bool perceivedStatic = false; StringBuilder explanation = null; string caravanTicksPerMoveExplanation = null; if (start == end) { __result = 0; } if (explanation != null) { explanation.Append(caravanTicksPerMoveExplanation); explanation.AppendLine(); } StringBuilder explanation1 = explanation == null ? (StringBuilder)null : new StringBuilder(); float num1 = !perceivedStatic || explanation != null?WorldPathGrid.CalculatedMovementDifficultyAt(end, perceivedStatic, ticksAbs, explanation1) : Find.WorldPathGrid.PerceivedMovementDifficultyAt(end); //float difficultyMultiplier = Find.WorldGrid.GetRoadMovementDifficultyMultiplier(start, end, explanation1); float difficultyMultiplier = 0; if (explanation != null) { explanation.AppendLine(); explanation.Append("TileMovementDifficulty".Translate() + ":"); explanation.AppendLine(); explanation.Append(explanation1.ToString().Indented(" ")); explanation.AppendLine(); explanation.Append(" = " + (num1 * difficultyMultiplier).ToString("0.#")); } int num2 = Mathf.Clamp((int)((double)caravanTicksPerMove * (double)num1 * (double)difficultyMultiplier), 1, 30000); if (explanation != null) { explanation.AppendLine(); explanation.AppendLine(); explanation.Append("FinalCaravanMovementSpeed".Translate() + ":"); int num3 = Mathf.CeilToInt((float)num2 / 1f); explanation.AppendLine(); explanation.Append(" " + (60000f / (float)caravanTicksPerMove).ToString("0.#") + " / " + (num1 * difficultyMultiplier).ToString("0.#") + " = " + (60000f / (float)num3).ToString("0.#") + " " + "TilesPerDay".Translate()); } __result = num2; return(false); }
public static int CostToMove(List <Pawn> pawns, int start, int end, float yearPercent) { //This part makes sure the static tile costs are also decreased by mount usage int tileCost = WorldPathGrid.CalculatedCostAt(end, false, yearPercent); tileCost = Mathf.RoundToInt((float)tileCost); int adjustedTicksPerMove = CaravanTicksPerMoveUtility.GetTicksPerMove(pawns); int result = adjustedTicksPerMove + Utilities.CaravanUtility.applySpeedBonus(tileCost, pawns); result = Mathf.RoundToInt((float)result * Find.WorldGrid.GetRoadMovementMultiplierFast(start, end)); return(result); }
protected static void FilterMovementTime(int tileId, float yearPct, UsableMinMaxNumericItem <float> item, List <int> resultList) { var ticks = Mathf.Min(GenDate.TicksPerHour + WorldPathGrid.CalculatedCostAt(tileId, false, yearPct), Caravan_PathFollower.MaxMoveTicks); ticks.TicksToPeriod(out var years, out var quadrums, out var days, out var hours); // combine everything into hours; note that we shouldn't get anything other than 'hours' and 'days'. Technically, a tile is should be passable in less than 48 hours. var totalHours = hours + days * GenDate.HoursPerDay + quadrums * GenDate.DaysPerQuadrum * GenDate.HoursPerDay + years * GenDate.DaysPerTwelfth * GenDate.TwelfthsPerYear * GenDate.HoursPerDay; //TODO: see how RimWorld rounds movement time numbers; e.g 4.06 is 4.1, does that mean that 4.02 is 4? if (item.InRange(totalHours)) { resultList.Add(tileId); } }
public override void Filter(List <int> inputList) { base.Filter(inputList); if (!IsFilterActive) { return; } foreach (var tileId in inputList) { var difficulty = WorldPathGrid.CalculatedMovementDifficultyAt(tileId, false) * Find.WorldGrid.GetRoadMovementDifficultyMultiplier(tileId, -1); if (UserData.MovementDifficulty.InRange(difficulty)) { FilteredTiles.Add(tileId); } } }
private string GetTileTip(int tile, int pathIndex) { int num = paths[pathIndex].NodesReversed.IndexOf(tile); int num2; if (num > 0) { num2 = paths[pathIndex].NodesReversed[num - 1]; } else if (pathIndex < paths.Count - 1 && paths[pathIndex + 1].NodesReversed.Count >= 2) { num2 = paths[pathIndex + 1].NodesReversed[paths[pathIndex + 1].NodesReversed.Count - 2]; } else { num2 = -1; } int num3 = cachedTicksToWaypoint[pathIndex] + CaravanArrivalTimeEstimator.EstimatedTicksToArrive(paths[pathIndex].FirstNode, tile, paths[pathIndex], 0f, CaravanTicksPerMove, GenTicks.TicksAbs + cachedTicksToWaypoint[pathIndex]); int num4 = GenTicks.TicksAbs + num3; StringBuilder stringBuilder = new StringBuilder(); if (num3 != 0) { stringBuilder.AppendLine("EstimatedTimeToTile".Translate(num3.ToStringTicksToDays("0.##"))); } stringBuilder.AppendLine("ForagedFoodAmount".Translate() + ": " + Find.WorldGrid[tile].biome.forageability.ToStringPercent()); stringBuilder.Append(VirtualPlantsUtility.GetVirtualPlantsStatusExplanationAt(tile, num4)); if (num2 != -1) { stringBuilder.AppendLine(); stringBuilder.AppendLine(); StringBuilder stringBuilder2 = new StringBuilder(); float num5 = WorldPathGrid.CalculatedMovementDifficultyAt(num2, false, new int?(num4), stringBuilder2); float roadMovementDifficultyMultiplier = Find.WorldGrid.GetRoadMovementDifficultyMultiplier(tile, num2, stringBuilder2); stringBuilder.Append("TileMovementDifficulty".Translate() + ":\n" + stringBuilder2.ToString().Indented(" ")); stringBuilder.AppendLine(); stringBuilder.Append(" = "); stringBuilder.Append((num5 * roadMovementDifficultyMultiplier).ToString("0.#")); } return(stringBuilder.ToString()); }
protected override bool TryExecuteWorker(IncidentParms parms) { if (!TryGetRandomAvailableTargetMap(out map)) { return(false); } SettlementBase settlementBase = RandomNearbyTradeableSettlement(map.Tile); if (settlementBase == null) { return(false); } int destination = Rand.Chance(directConnectionChance) ? map.Tile : AllyOfNearbySettlement(settlementBase)?.Tile ?? map.Tile; int maxPriority = settlementBase.Faction.def.techLevel >= TechLevel.Medieval ? 30 : 20; RoadDef roadToBuild = DefDatabase <RoadDef> .AllDefsListForReading.Where(x => x.priority <= maxPriority).RandomElement(); WorldPath path = WorldPath.NotFound; //StringBuilder stringBuilder = new StringBuilder(); int cost2 = 12000; int timeToBuild = 0; string letterTitle = "MFI_RoadWorks".Translate(); List <WorldObject_RoadConstruction> list = new List <WorldObject_RoadConstruction>(); using (path = Find.WorldPathFinder.FindPath(destination, settlementBase.Tile, null)) { if (path != null && path != WorldPath.NotFound) { float roadCount = path.NodesReversed.Count(x => !Find.WorldGrid[x].Roads.NullOrEmpty() && Find.WorldGrid[x].Roads.Any(roadLink => roadLink.road.priority >= roadToBuild.priority) || Find.WorldObjects.AnyWorldObjectOfDefAt(MFI_DefOf.MFI_RoadUnderConstruction, x)); if (roadCount / path.NodesReversed.Count >= maxRoadCoverage) { Log.Message($"MFI :: too many roads leading from {(Find.WorldObjects.AnyWorldObjectAt(destination) ? Find.WorldObjects.ObjectsAt(destination).FirstOrDefault()?.Label : destination.ToString())} to {settlementBase} for road project"); return(false); } //stringBuilder.Append($"Path found from {settlementBase.Label} to {map.info.parent.Label}. Length = {path.NodesReversed.Count} "); //not 0 and - 1 for (int i = 1; i < path.NodesReversed.Count - 1; i++) { cost2 += Caravan_PathFollower.CostToMove(CaravanTicksPerMoveUtility.DefaultTicksPerMove, path.NodesReversed[i], path.NodesReversed[i + 1]); timeToBuild += (int)(2 * GenDate.TicksPerHour * WorldPathGrid.CalculatedMovementDifficultyAt(path.NodesReversed[i], true) * Find.WorldGrid.GetRoadMovementDifficultyMultiplier(i, i + 1)); if (!Find.WorldGrid[path.NodesReversed[i]].Roads.NullOrEmpty() && Find.WorldGrid[path.NodesReversed[i]].Roads.Any(roadLink => roadLink.road.priority >= roadToBuild.priority)) { timeToBuild = timeToBuild / 2; } WorldObject_RoadConstruction roadConstruction = (WorldObject_RoadConstruction)WorldObjectMaker.MakeWorldObject(MFI_DefOf.MFI_RoadUnderConstruction); roadConstruction.Tile = path.NodesReversed[i]; roadConstruction.nextTile = path.NodesReversed[i + 1]; roadConstruction.road = roadToBuild; roadConstruction.SetFaction(settlementBase.Faction); roadConstruction.projectedTimeOfCompletion = Find.TickManager.TicksGame + timeToBuild; list.Add(roadConstruction); } cost2 = cost2 / 10; DiaNode node = new DiaNode("MFI_RoadWorksDialogue".Translate(settlementBase, path.NodesReversed.Count, cost2)); // {settlementBase} wants {cost2 / 10} to build a road of {path.NodesReversed.Count}"); DiaOption accept = new DiaOption("OK".Translate()) { resolveTree = true, action = () => { TradeUtility.LaunchSilver(TradeUtility.PlayerHomeMapWithMostLaunchableSilver(), cost2); foreach (WorldObject_RoadConstruction worldObjectRoadConstruction in list) { Find.WorldObjects.Add(worldObjectRoadConstruction); } list.Clear(); } }; if (!TradeUtility.ColonyHasEnoughSilver(TradeUtility.PlayerHomeMapWithMostLaunchableSilver(), cost2)) { accept.Disable("NeedSilverLaunchable".Translate(cost2)); } DiaOption reject = new DiaOption("RejectLetter".Translate()) { resolveTree = true, action = () => { for (int i = list.Count - 1; i >= 0; i--) { list[i] = null; } list.Clear(); } }; node.options.Add(accept); node.options.Add(reject); //Log.Message(stringBuilder.ToString()); Find.WindowStack.Add(new Dialog_NodeTreeWithFactionInfo(node, settlementBase.Faction)); Find.Archive.Add(new ArchivedDialog(node.text, letterTitle, settlementBase.Faction)); } } return(true); }
public static int CostToMove(int warObjectTicksPerMove, int start, int end, int?ticksAbs = default(int?), bool perceivedStatic = false, StringBuilder explanation = null, string warObjectTicksPerMoveExplanation = null) { if (start == end) { return(0); } if (explanation != null) { explanation.Append(warObjectTicksPerMoveExplanation); explanation.AppendLine(); } StringBuilder stringBuilder = (explanation == null) ? null : new StringBuilder(); float num = (!perceivedStatic || explanation != null) ? WorldPathGrid.CalculatedMovementDifficultyAt(end, perceivedStatic, ticksAbs, stringBuilder) : Verse.Find.WorldPathGrid.PerceivedMovementDifficultyAt(end); float roadMovementDifficultyMultiplier = Verse.Find.WorldGrid.GetRoadMovementDifficultyMultiplier(start, end, stringBuilder); if (explanation != null) { explanation.AppendLine(); explanation.Append("TileMovementDifficulty".Translate() + ":"); explanation.AppendLine(); explanation.Append(stringBuilder.ToString().Indented(" ")); explanation.AppendLine(); explanation.Append(" = " + (num * roadMovementDifficultyMultiplier).ToString("0.#")); } int value = (int)((float)warObjectTicksPerMove * num * roadMovementDifficultyMultiplier); value = Mathf.Clamp(value, 1, 60000); if (explanation != null) { explanation.AppendLine(); explanation.AppendLine(); explanation.Append("FinalCaravanMovementSpeed".Translate() + ":"); int num2 = Mathf.CeilToInt((float)value / 1f); explanation.AppendLine(); explanation.Append(" " + (60000f / (float)warObjectTicksPerMove).ToString("0.#") + " / " + (num * roadMovementDifficultyMultiplier).ToString("0.#") + " = " + (60000f / (float)num2).ToString("0.#") + " " + "TilesPerDay".Translate()); } return(value); }
public override string GetInspectString() { StringBuilder stringBuilder = new StringBuilder(); if (this.Resting) { stringBuilder.Append("CaravanResting".Translate()); } else if (this.AnyPawnHasExtremeMentalBreak) { stringBuilder.Append("CaravanMemberMentalBreak".Translate(new object[] { this.FirstPawnWithExtremeMentalBreak.LabelShort })); } else if (this.AllOwnersDowned) { stringBuilder.Append("AllCaravanMembersDowned".Translate()); } else if (this.pather.Moving) { if (this.pather.arrivalAction != null) { stringBuilder.Append(this.pather.arrivalAction.ReportString); } else { stringBuilder.Append("CaravanTraveling".Translate()); } } else { FactionBase factionBase = CaravanVisitUtility.FactionBaseVisitedNow(this); if (factionBase != null) { stringBuilder.Append("CaravanVisiting".Translate(new object[] { factionBase.Label })); } else { stringBuilder.Append("CaravanWaiting".Translate()); } } if (this.pather.Moving) { stringBuilder.AppendLine(); stringBuilder.Append("CaravanEstimatedTimeToDestination".Translate(new object[] { CaravanArrivalTimeEstimator.EstimatedTicksToArrive(this, true).ToStringTicksToPeriod(true) })); } if (this.ImmobilizedByMass) { stringBuilder.AppendLine(); stringBuilder.Append("CaravanImmobilizedByMass".Translate()); } string text; if (CaravanPawnsNeedsUtility.AnyPawnOutOfFood(this, out text)) { stringBuilder.AppendLine(); stringBuilder.Append("CaravanOutOfFood".Translate()); if (!text.NullOrEmpty()) { stringBuilder.Append(" "); stringBuilder.Append(text); stringBuilder.Append("."); } } else { stringBuilder.AppendLine(); stringBuilder.Append("CaravanDaysOfFood".Translate(new object[] { this.DaysWorthOfFood.ToString("0.#") })); } stringBuilder.AppendLine(); stringBuilder.AppendLine(string.Concat(new string[] { "CaravanBaseMovementTime".Translate(), ": ", ((float)this.TicksPerMove / 2500f).ToString("0.##"), " ", "CaravanHoursPerTile".Translate() })); double actualTicksPerMove = ((double)this.TicksPerMove / 2500f) * (2500f + WorldPathGrid.CalculatedCostAt(base.Tile, false, -1f)); stringBuilder.Append("CurrentTileMovementTime".Translate() + ": " + ((int)actualTicksPerMove).ToStringTicksToPeriod(true)); return(stringBuilder.ToString()); }
private void DrawSelectedTileInfo() { DrawEntryHeader("PLMWFTIL_SelectedTileInfo".Translate(), backgroundColor: Color.yellow); var matchingTiles = PrepareLanding.Instance.TileFilter.AllMatchingTiles; if (_selectedTileIndex < 0 || _selectedTileIndex >= matchingTiles.Count) { return; } ListingStandard.verticalSpacing = 0f; var selTileId = matchingTiles[_selectedTileIndex]; var selTile = Find.World.grid[selTileId]; ListingStandard.Label(selTile.biome.description); ListingStandard.Gap(8f); ListingStandard.GapLine(); if (!selTile.biome.implemented) { ListingStandard.Label(selTile.biome.LabelCap + " " + "BiomeNotImplemented".Translate()); } ListingStandard.LabelDouble("Terrain".Translate(), selTile.hilliness.GetLabelCap()); if (selTile.Roads != null) { ListingStandard.LabelDouble("Road".Translate(), (from roadlink in selTile.Roads select roadlink.road.label).Distinct().ToCommaList(true).CapitalizeFirst()); } if (selTile.Rivers != null) { ListingStandard.LabelDouble("River".Translate(), selTile.Rivers.MaxBy(riverlink => riverlink.river.degradeThreshold).river.LabelCap); } if (!Find.World.Impassable(selTileId)) { var stringBuilder = new StringBuilder(); var tile = selTileId; const bool perceivedStatic = false; var explanation = stringBuilder; var rightLabel = (WorldPathGrid.CalculatedMovementDifficultyAt(tile, perceivedStatic, null, explanation) * Find.WorldGrid.GetRoadMovementDifficultyMultiplier(selTileId, -1, stringBuilder)).ToString("0.#"); if (WorldPathGrid.WillWinterEverAffectMovementDifficulty(selTileId) && WorldPathGrid.GetCurrentWinterMovementDifficultyOffset(selTileId, null) < 2f) { stringBuilder.AppendLine(); stringBuilder.AppendLine(); stringBuilder.Append(" ("); stringBuilder.Append("MovementDifficultyOffsetInWinter".Translate("+" + 2f.ToString("0.#"))); stringBuilder.Append(")"); } ListingStandard.LabelDouble("MovementDifficulty".Translate(), rightLabel, stringBuilder.ToString()); } if (selTile.biome.canBuildBase) { ListingStandard.LabelDouble("StoneTypesHere".Translate(), (from rt in Find.World.NaturalRockTypesIn(selTileId) select rt.label).ToCommaList(true).CapitalizeFirst()); } ListingStandard.LabelDouble("Elevation".Translate(), selTile.elevation.ToString("F0") + "m"); ListingStandard.GapLine(); ListingStandard.LabelDouble("AvgTemp".Translate(), GenTemperature.GetAverageTemperatureLabel(selTileId)); ListingStandard.LabelDouble("OutdoorGrowingPeriod".Translate(), Zone_Growing.GrowingQuadrumsDescription(selTileId)); ListingStandard.LabelDouble("Rainfall".Translate(), selTile.rainfall.ToString("F0") + "mm"); if (selTile.biome.foragedFood != null && selTile.biome.forageability > 0f) { ListingStandard.LabelDouble("Forageability".Translate(), selTile.biome.forageability.ToStringPercent() + " (" + selTile.biome.foragedFood.label + ")"); } else { ListingStandard.LabelDouble("Forageability".Translate(), "0%"); } ListingStandard.LabelDouble("AnimalsCanGrazeNow".Translate(), (!VirtualPlantsUtility.EnvironmentAllowsEatingVirtualPlantsNowAt(selTileId)) ? "No".Translate() : "Yes".Translate()); ListingStandard.GapLine(); ListingStandard.LabelDouble("AverageDiseaseFrequency".Translate(), $"{(60f / selTile.biome.diseaseMtbDays):F1} {"PerYear".Translate()}"); ListingStandard.LabelDouble("TimeZone".Translate(), GenDate.TimeZoneAt(Find.WorldGrid.LongLatOf(selTileId).x).ToStringWithSign()); var stringBuilder2 = new StringBuilder(); var rot = Find.World.CoastDirectionAt(selTileId); if (rot.IsValid) { stringBuilder2.AppendWithComma(("HasCoast" + rot).Translate()); } if (Find.World.HasCaves(selTileId)) { stringBuilder2.AppendWithComma("HasCaves".Translate()); } if (stringBuilder2.Length > 0) { ListingStandard.LabelDouble("SpecialFeatures".Translate(), stringBuilder2.ToString().CapitalizeFirst()); } if (Prefs.DevMode) { ListingStandard.LabelDouble("Debug world tile ID", selTileId.ToString()); } }
public static float CalculatedMovementDifficultyAt(int tile, VehicleDef vehicleDef, int?ticksAbs = null, StringBuilder explanation = null) { Tile worldTile = Find.WorldGrid[tile]; if (explanation != null && explanation.Length > 0) { explanation.AppendLine(); } if (vehicleDef.CoastalTravel(tile)) { return(vehicleDef.properties.customBiomeCosts[BiomeDefOf.Ocean] / vehicleDef.properties.worldSpeedMultiplier); } else if (vehicleDef.vehicleType == VehicleType.Sea) { return(WorldHelper.WaterCovered(tile) ? vehicleDef.properties.customBiomeCosts[worldTile.biome] / vehicleDef.properties.worldSpeedMultiplier : ImpassableMovementDifficulty); } float biomeCost = vehicleDef.properties.customBiomeCosts.TryGetValue(worldTile.biome, WorldPathGrid.CalculatedMovementDifficultyAt(tile, false, ticksAbs, explanation)); float hillinessCost = vehicleDef.properties.customHillinessCosts.TryGetValue(worldTile.hilliness, HillinessMovementDifficultyOffset(worldTile.hilliness)); if (ImpassableCost(biomeCost) || ImpassableCost(hillinessCost)) { if (explanation != null) { explanation.Append("Impassable".Translate()); } return(ImpassableMovementDifficulty); } float finalBiomeCost = biomeCost / vehicleDef.properties.worldSpeedMultiplier; if (explanation != null) { explanation.Append(worldTile.biome.LabelCap + ": " + biomeCost.ToStringWithSign("0.#")); } float num3 = finalBiomeCost + hillinessCost; if (explanation != null && hillinessCost != 0f) { explanation.AppendLine(); explanation.Append(worldTile.hilliness.GetLabelCap() + ": " + hillinessCost.ToStringWithSign("0.#")); } return(num3 + GetCurrentWinterMovementDifficultyOffset(tile, vehicleDef, new int?(ticksAbs ?? GenTicks.TicksAbs), explanation)); }
protected void DrawSelectedTileInfo() { DrawEntryHeader("Selected Tile Info", backgroundColor: Color.yellow); var matchingTiles = PrepareLanding.Instance.TileFilter.AllMatchingTiles; if (_selectedTileIndex < 0 || _selectedTileIndex >= matchingTiles.Count) { return; } ListingStandard.verticalSpacing = 0f; var selTileId = matchingTiles[_selectedTileIndex]; var selTile = Find.World.grid[selTileId]; ListingStandard.Label(selTile.biome.LabelCap); var y = Find.WorldGrid.LongLatOf(selTileId).y; ListingStandard.Label(selTile.biome.description); ListingStandard.Gap(8f); ListingStandard.GapLine(); if (!selTile.biome.implemented) { ListingStandard.Label(selTile.biome.LabelCap + " " + "BiomeNotImplemented".Translate()); } ListingStandard.LabelDouble("Terrain".Translate(), selTile.hilliness.GetLabelCap()); if (selTile.VisibleRoads != null) { ListingStandard.LabelDouble("Road".Translate(), GenText.ToCommaList((from roadlink in selTile.VisibleRoads select roadlink.road.label).Distinct()).CapitalizeFirst()); } if (selTile.VisibleRivers != null) { ListingStandard.LabelDouble("River".Translate(), selTile.VisibleRivers.MaxBy((riverlink) => riverlink.river.degradeThreshold).river.LabelCap); } if (!Find.World.Impassable(selTileId)) { const int num = 2500; var numTicks = Mathf.Min(num + WorldPathGrid.CalculatedCostAt(selTileId, false), 120000); ListingStandard.LabelDouble("MovementTimeNow".Translate(), numTicks.ToStringTicksToPeriod()); var numTicks2 = Mathf.Min(num + WorldPathGrid.CalculatedCostAt(selTileId, false, Season.Summer.GetMiddleYearPct(y)), 120000); ListingStandard.LabelDouble("MovementTimeSummer".Translate(), numTicks2.ToStringTicksToPeriod()); var numTicks3 = Mathf.Min(num + WorldPathGrid.CalculatedCostAt(selTileId, false, Season.Winter.GetMiddleYearPct(y)), 120000); ListingStandard.LabelDouble("MovementTimeWinter".Translate(), numTicks3.ToStringTicksToPeriod()); } if (selTile.biome.canBuildBase) { ListingStandard.LabelDouble("StoneTypesHere".Translate(), GenText.ToCommaList(from rt in Find.World.NaturalRockTypesIn(selTileId) select rt.label).CapitalizeFirst()); } ListingStandard.LabelDouble("Elevation".Translate(), selTile.elevation.ToString("F0") + "m"); ListingStandard.GapLine(); ListingStandard.LabelDouble("AvgTemp".Translate(), selTile.temperature.ToStringTemperature()); var celsiusTemp = GenTemperature.AverageTemperatureAtTileForTwelfth(selTileId, Season.Winter.GetMiddleTwelfth(y)); ListingStandard.LabelDouble("AvgWinterTemp".Translate(), celsiusTemp.ToStringTemperature()); var celsiusTemp2 = GenTemperature.AverageTemperatureAtTileForTwelfth(selTileId, Season.Summer.GetMiddleTwelfth(y)); ListingStandard.LabelDouble("AvgSummerTemp".Translate(), celsiusTemp2.ToStringTemperature()); ListingStandard.LabelDouble("OutdoorGrowingPeriod".Translate(), Zone_Growing.GrowingQuadrumsDescription(selTileId)); ListingStandard.LabelDouble("Rainfall".Translate(), selTile.rainfall.ToString("F0") + "mm"); ListingStandard.LabelDouble("AnimalsCanGrazeNow".Translate(), (!VirtualPlantsUtility.EnvironmentAllowsEatingVirtualPlantsNowAt(selTileId)) ? "No".Translate() : "Yes".Translate()); ListingStandard.GapLine(); ListingStandard.LabelDouble("TimeZone".Translate(), GenDate.TimeZoneAt(Find.WorldGrid.LongLatOf(selTileId).x).ToStringWithSign()); var rot = Find.World.CoastDirectionAt(selTileId); if (rot.IsValid) { ListingStandard.LabelDouble(string.Empty, ("HasCoast" + rot).Translate()); } if (Prefs.DevMode) { ListingStandard.LabelDouble("Debug world tile ID", selTileId.ToString()); } }