public static float ControlTemperatureTempChange(IntVec3 cell, Map map, float energyLimit, float targetTemperature) { RoomGroup roomGroup = cell.GetRoomGroup(map); float result; if (roomGroup == null || roomGroup.UsesOutdoorTemperature) { result = 0f; } else { float b = energyLimit / (float)roomGroup.CellCount; float a = targetTemperature - roomGroup.Temperature; float num; if (energyLimit > 0f) { num = Mathf.Min(a, b); num = Mathf.Max(num, 0f); } else { num = Mathf.Max(a, b); num = Mathf.Min(num, 0f); } result = num; } return(result); }
public static bool TryGetDirectAirTemperatureForCell(IntVec3 c, Map map, out float temperature) { bool result; if (!c.InBounds(map)) { temperature = 21f; result = false; } else { RoomGroup roomGroup = c.GetRoomGroup(map); if (roomGroup == null) { temperature = 21f; result = false; } else { temperature = roomGroup.Temperature; result = true; } } return(result); }
public void DebugDraw() { if (this.map != Find.CurrentMap) { return; } if (DebugViewSettings.drawRegionTraversal) { CellRect currentViewRect = Find.CameraDriver.CurrentViewRect; currentViewRect.ClipInsideMap(this.map); foreach (IntVec3 c in currentViewRect) { Region validRegionAt = this.GetValidRegionAt(c); if (validRegionAt != null && !this.drawnRegions.Contains(validRegionAt)) { validRegionAt.DebugDraw(); this.drawnRegions.Add(validRegionAt); } } this.drawnRegions.Clear(); } IntVec3 intVec = UI.MouseCell(); if (intVec.InBounds(this.map)) { if (DebugViewSettings.drawRooms) { Room room = intVec.GetRoom(this.map, RegionType.Set_All); if (room != null) { room.DebugDraw(); } } if (DebugViewSettings.drawRoomGroups) { RoomGroup roomGroup = intVec.GetRoomGroup(this.map); if (roomGroup != null) { roomGroup.DebugDraw(); } } if (DebugViewSettings.drawRegions || DebugViewSettings.drawRegionLinks || DebugViewSettings.drawRegionThings) { Region regionAt_NoRebuild_InvalidAllowed = this.GetRegionAt_NoRebuild_InvalidAllowed(intVec); if (regionAt_NoRebuild_InvalidAllowed != null) { regionAt_NoRebuild_InvalidAllowed.DebugDrawMouseover(); } } } }
public static bool TryGetDirectAirTemperatureForCell(IntVec3 c, Map map, out float temperature) { if (!c.InBounds(map)) { temperature = 21f; return(false); } RoomGroup roomGroup = c.GetRoomGroup(map); if (roomGroup == null) { temperature = 21f; return(false); } temperature = roomGroup.Temperature; return(true); }
public static float ControlTemperatureTempChange(IntVec3 cell, Map map, float energyLimit, float targetTemperature) { RoomGroup roomGroup = cell.GetRoomGroup(map); if (roomGroup != null && !roomGroup.UsesOutdoorTemperature) { float b = energyLimit / (float)roomGroup.CellCount; float a = targetTemperature - roomGroup.Temperature; float num = 0f; if (energyLimit > 0.0) { num = Mathf.Min(a, b); return(Mathf.Max(num, 0f)); } num = Mathf.Max(a, b); return(Mathf.Min(num, 0f)); } return(0f); }
public static bool PushHeat(IntVec3 c, Map map, float energy) { bool result; if (map == null) { Log.Error("Added heat to null map.", false); result = false; } else { RoomGroup roomGroup = c.GetRoomGroup(map); if (roomGroup != null) { result = roomGroup.PushHeat(energy); } else { GenTemperature.neighRoomGroups.Clear(); for (int i = 0; i < 8; i++) { IntVec3 intVec = c + GenAdj.AdjacentCells[i]; if (intVec.InBounds(map)) { roomGroup = intVec.GetRoomGroup(map); if (roomGroup != null) { GenTemperature.neighRoomGroups.Add(roomGroup); } } } float energy2 = energy / (float)GenTemperature.neighRoomGroups.Count; for (int j = 0; j < GenTemperature.neighRoomGroups.Count; j++) { GenTemperature.neighRoomGroups[j].PushHeat(energy2); } bool flag = GenTemperature.neighRoomGroups.Count > 0; GenTemperature.neighRoomGroups.Clear(); result = flag; } } return(result); }
public void DebugDraw() { if (map != Find.CurrentMap) { return; } if (DebugViewSettings.drawRegionTraversal) { CellRect currentViewRect = Find.CameraDriver.CurrentViewRect; currentViewRect.ClipInsideMap(map); foreach (IntVec3 item in currentViewRect) { Region validRegionAt = GetValidRegionAt(item); if (validRegionAt != null && !drawnRegions.Contains(validRegionAt)) { validRegionAt.DebugDraw(); drawnRegions.Add(validRegionAt); } } drawnRegions.Clear(); } IntVec3 intVec = UI.MouseCell(); if (intVec.InBounds(map)) { if (DebugViewSettings.drawRooms) { intVec.GetRoom(map, RegionType.Set_All)?.DebugDraw(); } if (DebugViewSettings.drawRoomGroups) { intVec.GetRoomGroup(map)?.DebugDraw(); } if (DebugViewSettings.drawRegions || DebugViewSettings.drawRegionLinks || DebugViewSettings.drawRegionThings) { GetRegionAt_NoRebuild_InvalidAllowed(intVec)?.DebugDrawMouseover(); } } }
public static bool PushHeat(IntVec3 c, Map map, float energy) { if (map == null) { Log.Error("Added heat to null map."); return(false); } RoomGroup roomGroup = c.GetRoomGroup(map); if (roomGroup != null) { return(roomGroup.PushHeat(energy)); } neighRoomGroups.Clear(); for (int i = 0; i < 8; i++) { IntVec3 intVec = c + GenAdj.AdjacentCells[i]; if (intVec.InBounds(map)) { roomGroup = intVec.GetRoomGroup(map); if (roomGroup != null) { neighRoomGroups.Add(roomGroup); } } } float energy2 = energy / (float)neighRoomGroups.Count; for (int j = 0; j < neighRoomGroups.Count; j++) { neighRoomGroups[j].PushHeat(energy2); } bool result = neighRoomGroups.Count > 0; neighRoomGroups.Clear(); return(result); }
public void EqualizeTemperature() { if (this.roomGroup.UsesOutdoorTemperature) { Temperature = Map.mapTemperature.OutdoorTemp; } else if (this.roomGroup.RoomCount != 0 && this.roomGroup.Rooms[0].RegionType == RegionType.Portal) { bool flag = true; IntVec3 a = this.roomGroup.Rooms[0].Cells.First(); for (int i = 0; i < 4; i++) { IntVec3 intVec = a + GenAdj.CardinalDirections[i]; if (intVec.InBounds(Map)) { RoomGroup roomGroup = intVec.GetRoomGroup(Map); if (roomGroup != null && (roomGroup.RoomCount != 1 || roomGroup.Rooms[0].RegionType != RegionType.Portal)) { flag = false; break; } } } if (flag) { this.roomGroup.Temperature += WallEqualizationTempChangePerInterval(); } } else { float num = ThinRoofEqualizationTempChangePerInterval(); float num2 = NoRoofEqualizationTempChangePerInterval(); float num3 = WallEqualizationTempChangePerInterval(); float num4 = DeepEqualizationTempChangePerInterval(); Temperature += num + num2 + num3 + num4; } }
public static void EqualizeTemperaturesThroughBuilding(Building b, float rate, bool twoWay) { int num = 0; float num2 = 0f; if (twoWay) { for (int i = 0; i < 2; i++) { IntVec3 intVec = (i != 0) ? (b.Position - b.Rotation.FacingCell) : (b.Position + b.Rotation.FacingCell); if (intVec.InBounds(b.Map)) { RoomGroup roomGroup = intVec.GetRoomGroup(b.Map); if (roomGroup != null) { num2 += roomGroup.Temperature; GenTemperature.beqRoomGroups[num] = roomGroup; num++; } } } } else { for (int j = 0; j < 4; j++) { IntVec3 intVec2 = b.Position + GenAdj.CardinalDirections[j]; if (intVec2.InBounds(b.Map)) { RoomGroup roomGroup2 = intVec2.GetRoomGroup(b.Map); if (roomGroup2 != null) { num2 += roomGroup2.Temperature; GenTemperature.beqRoomGroups[num] = roomGroup2; num++; } } } } if (num != 0) { float num3 = num2 / (float)num; RoomGroup roomGroup3 = b.GetRoomGroup(); if (roomGroup3 != null) { roomGroup3.Temperature = num3; } if (num != 1) { float num4 = 1f; for (int k = 0; k < num; k++) { if (!GenTemperature.beqRoomGroups[k].UsesOutdoorTemperature) { float temperature = GenTemperature.beqRoomGroups[k].Temperature; float num5 = num3 - temperature; float num6 = num5 * rate; float num7 = num6 / (float)GenTemperature.beqRoomGroups[k].CellCount; float num8 = GenTemperature.beqRoomGroups[k].Temperature + num7; if (num6 > 0.0 && num8 > num3) { num8 = num3; } else if (num6 < 0.0 && num8 < num3) { num8 = num3; } float num9 = Mathf.Abs((num8 - temperature) * (float)GenTemperature.beqRoomGroups[k].CellCount / num6); if (num9 < num4) { num4 = num9; } } } for (int l = 0; l < num; l++) { if (!GenTemperature.beqRoomGroups[l].UsesOutdoorTemperature) { float temperature2 = GenTemperature.beqRoomGroups[l].Temperature; float num10 = num3 - temperature2; float num11 = num10 * rate * num4; float num12 = num11 / (float)GenTemperature.beqRoomGroups[l].CellCount; GenTemperature.beqRoomGroups[l].Temperature += num12; } } for (int m = 0; m < GenTemperature.beqRoomGroups.Length; m++) { GenTemperature.beqRoomGroups[m] = null; } } } }
private void RegenerateEqualizationData() { this.thickRoofCoverage = 0f; this.noRoofCoverage = 0f; this.equalizeCells.Clear(); if (this.roomGroup.RoomCount != 0) { Map map = this.Map; if (!this.roomGroup.UsesOutdoorTemperature) { int num = 0; foreach (IntVec3 cell in this.roomGroup.Cells) { RoofDef roof = cell.GetRoof(map); if (roof == null) { this.noRoofCoverage += 1f; } else if (roof.isThickRoof) { this.thickRoofCoverage += 1f; } num++; } this.thickRoofCoverage /= (float)num; this.noRoofCoverage /= (float)num; foreach (IntVec3 cell2 in this.roomGroup.Cells) { for (int i = 0; i < 4; i++) { IntVec3 intVec = cell2 + GenAdj.CardinalDirections[i]; IntVec3 intVec2 = cell2 + GenAdj.CardinalDirections[i] * 2; if (intVec.InBounds(map)) { Region region = intVec.GetRegion(map, RegionType.Set_Passable); if (region != null) { if (region.type == RegionType.Portal) { bool flag = false; for (int j = 0; j < region.links.Count; j++) { Region regionA = region.links[j].RegionA; Region regionB = region.links[j].RegionB; if (regionA.Room.Group != this.roomGroup && regionA.portal == null) { flag = true; break; } if (regionB.Room.Group != this.roomGroup && regionB.portal == null) { flag = true; break; } } if (!flag) { goto IL_0234; } } continue; } } goto IL_0234; IL_0234: if (intVec2.InBounds(map)) { RoomGroup roomGroup = intVec2.GetRoomGroup(map); if (roomGroup != this.roomGroup) { bool flag2 = false; for (int k = 0; k < 4; k++) { IntVec3 loc = intVec2 + GenAdj.CardinalDirections[k]; if (loc.GetRoomGroup(map) == this.roomGroup) { flag2 = true; break; } } if (!flag2) { this.equalizeCells.Add(intVec2); } } } } } this.equalizeCells.Shuffle(); } } }
public static void EqualizeTemperaturesThroughBuilding(Building b, float rate, bool twoWay) { int num = 0; float num2 = 0f; if (twoWay) { for (int i = 0; i < 2; i++) { IntVec3 intVec = (i == 0) ? (b.Position + b.Rotation.FacingCell) : (b.Position - b.Rotation.FacingCell); if (intVec.InBounds(b.Map)) { RoomGroup roomGroup = intVec.GetRoomGroup(b.Map); if (roomGroup != null) { num2 += roomGroup.Temperature; beqRoomGroups[num] = roomGroup; num++; } } } } else { for (int j = 0; j < 4; j++) { IntVec3 intVec2 = b.Position + GenAdj.CardinalDirections[j]; if (intVec2.InBounds(b.Map)) { RoomGroup roomGroup2 = intVec2.GetRoomGroup(b.Map); if (roomGroup2 != null) { num2 += roomGroup2.Temperature; beqRoomGroups[num] = roomGroup2; num++; } } } } if (num == 0) { return; } float num3 = num2 / (float)num; RoomGroup roomGroup3 = b.GetRoomGroup(); if (roomGroup3 != null) { roomGroup3.Temperature = num3; } if (num == 1) { return; } float num4 = 1f; for (int k = 0; k < num; k++) { if (!beqRoomGroups[k].UsesOutdoorTemperature) { float temperature = beqRoomGroups[k].Temperature; float num5 = (num3 - temperature) * rate; float num6 = num5 / (float)beqRoomGroups[k].CellCount; float num7 = beqRoomGroups[k].Temperature + num6; if (num5 > 0f && num7 > num3) { num7 = num3; } else if (num5 < 0f && num7 < num3) { num7 = num3; } float num8 = Mathf.Abs((num7 - temperature) * (float)beqRoomGroups[k].CellCount / num5); if (num8 < num4) { num4 = num8; } } } for (int l = 0; l < num; l++) { if (!beqRoomGroups[l].UsesOutdoorTemperature) { float temperature2 = beqRoomGroups[l].Temperature; float num9 = (num3 - temperature2) * rate * num4 / (float)beqRoomGroups[l].CellCount; beqRoomGroups[l].Temperature += num9; } } for (int m = 0; m < beqRoomGroups.Length; m++) { beqRoomGroups[m] = null; } }
private string CurrentDebugString() { StringBuilder stringBuilder = new StringBuilder(); if (DebugViewSettings.writeGame) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine((Current.Game != null) ? Current.Game.DebugString() : "Current.Game = null"); } if (DebugViewSettings.writeMusicManagerPlay) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.MusicManagerPlay.DebugString()); } if (DebugViewSettings.writePlayingSounds) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Sustainers:"); foreach (Sustainer sustainer in Find.SoundRoot.sustainerManager.AllSustainers) { stringBuilder.AppendLine(sustainer.DebugString()); } stringBuilder.AppendLine(); stringBuilder.AppendLine("OneShots:"); foreach (SampleOneShot sampleOneShot in Find.SoundRoot.oneShotManager.PlayingOneShots) { stringBuilder.AppendLine(sampleOneShot.ToString()); } } if (DebugViewSettings.writeSoundEventsRecord) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Recent sound events:\n ..."); stringBuilder.AppendLine(DebugSoundEventsLog.EventsListingDebugString); } if (DebugViewSettings.writeSteamItems) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(WorkshopItems.DebugOutput()); } if (DebugViewSettings.writeConcepts) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(LessonAutoActivator.DebugString()); } if (DebugViewSettings.writeMemoryUsage) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Total allocated: " + Profiler.GetTotalAllocatedMemoryLong().ToStringBytes("F2")); stringBuilder.AppendLine("Total reserved: " + Profiler.GetTotalReservedMemoryLong().ToStringBytes("F2")); stringBuilder.AppendLine("Total reserved unused: " + Profiler.GetTotalUnusedReservedMemoryLong().ToStringBytes("F2")); stringBuilder.AppendLine("Mono heap size: " + Profiler.GetMonoHeapSizeLong().ToStringBytes("F2")); stringBuilder.AppendLine("Mono used size: " + Profiler.GetMonoUsedSizeLong().ToStringBytes("F2")); } if (Current.ProgramState == ProgramState.Playing) { stringBuilder.AppendLine("Tick " + Find.TickManager.TicksGame); if (DebugViewSettings.writeStoryteller) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.Storyteller.DebugString()); } } if (Current.ProgramState == ProgramState.Playing && Find.CurrentMap != null) { if (DebugViewSettings.writeMapGameConditions) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.gameConditionManager.DebugString()); } if (DebugViewSettings.drawPawnDebug) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.reservationManager.DebugString()); } if (DebugViewSettings.writeMoteSaturation) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Mote count: " + Find.CurrentMap.moteCounter.MoteCount); stringBuilder.AppendLine("Mote saturation: " + Find.CurrentMap.moteCounter.Saturation); } if (DebugViewSettings.writeEcosystem) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.wildAnimalSpawner.DebugString()); } if (DebugViewSettings.writeTotalSnowDepth) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Total snow depth: " + Find.CurrentMap.snowGrid.TotalDepth); } if (DebugViewSettings.writeWind) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.windManager.DebugString()); } if (DebugViewSettings.writeRecentStrikes) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.mineStrikeManager.DebugStrikeRecords()); } if (DebugViewSettings.writeListRepairableBldgs) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.listerBuildingsRepairable.DebugString()); } if (DebugViewSettings.writeListFilthInHomeArea) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.listerFilthInHomeArea.DebugString()); } if (DebugViewSettings.writeListHaulables) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.listerHaulables.DebugString()); } if (DebugViewSettings.writeListMergeables) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.listerMergeables.DebugString()); } if (DebugViewSettings.drawLords) { foreach (Lord lord in Find.CurrentMap.lordManager.lords) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(lord.DebugString()); } } IntVec3 intVec = UI.MouseCell(); if (intVec.InBounds(Find.CurrentMap)) { stringBuilder.AppendLine("Inspecting " + intVec.ToString()); if (DebugViewSettings.writeTerrain) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.terrainGrid.DebugStringAt(intVec)); } if (DebugViewSettings.writeAttackTargets) { foreach (Pawn pawn in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).OfType <Pawn>()) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Potential attack targets for " + pawn.LabelShort + ":"); List <IAttackTarget> potentialTargetsFor = Find.CurrentMap.attackTargetsCache.GetPotentialTargetsFor(pawn); for (int i = 0; i < potentialTargetsFor.Count; i++) { Thing thing = (Thing)potentialTargetsFor[i]; stringBuilder.AppendLine(string.Concat(new object[] { thing.LabelShort, ", ", thing.Faction, (!potentialTargetsFor[i].ThreatDisabled(null)) ? "" : " (threat disabled)" })); } } } if (DebugViewSettings.writeSnowDepth) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Snow depth: " + Find.CurrentMap.snowGrid.GetDepth(intVec)); } if (DebugViewSettings.drawDeepResources) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Deep resource def: " + Find.CurrentMap.deepResourceGrid.ThingDefAt(intVec)); stringBuilder.AppendLine("Deep resource count: " + Find.CurrentMap.deepResourceGrid.CountAt(intVec)); } if (DebugViewSettings.writeCanReachColony) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("CanReachColony: " + Find.CurrentMap.reachability.CanReachColony(UI.MouseCell())); } if (DebugViewSettings.writeMentalStateCalcs) { stringBuilder.AppendLine("---"); foreach (Pawn pawn2 in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()) where t is Pawn select t).Cast <Pawn>()) { stringBuilder.AppendLine(pawn2.mindState.mentalBreaker.DebugString()); } } if (DebugViewSettings.writeWorkSettings) { foreach (Pawn pawn3 in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()) where t is Pawn select t).Cast <Pawn>()) { if (pawn3.workSettings != null) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(pawn3.workSettings.DebugString()); } } } if (DebugViewSettings.writeApparelScore) { stringBuilder.AppendLine("---"); if (intVec.InBounds(Find.CurrentMap)) { foreach (Thing thing2 in intVec.GetThingList(Find.CurrentMap)) { Apparel apparel = thing2 as Apparel; if (apparel != null) { stringBuilder.AppendLine(apparel.Label + ": " + JobGiver_OptimizeApparel.ApparelScoreRaw(null, apparel).ToString("F2")); } } } } if (DebugViewSettings.writeCellContents || this.fullMode) { stringBuilder.AppendLine("---"); if (intVec.InBounds(Find.CurrentMap)) { foreach (Designation designation in Find.CurrentMap.designationManager.AllDesignationsAt(intVec)) { stringBuilder.AppendLine(designation.ToString()); } foreach (Thing thing3 in Find.CurrentMap.thingGrid.ThingsAt(intVec)) { if (!this.fullMode) { stringBuilder.AppendLine(thing3.LabelCap + " - " + thing3.ToString()); } else { stringBuilder.AppendLine(Scribe.saver.DebugOutputFor(thing3)); stringBuilder.AppendLine(); } } } } if (DebugViewSettings.debugApparelOptimize) { stringBuilder.AppendLine("---"); foreach (Thing thing4 in Find.CurrentMap.thingGrid.ThingsAt(intVec)) { Apparel apparel2 = thing4 as Apparel; if (apparel2 != null) { stringBuilder.AppendLine(apparel2.LabelCap); stringBuilder.AppendLine(" raw: " + JobGiver_OptimizeApparel.ApparelScoreRaw(null, apparel2).ToString("F2")); Pawn pawn4 = Find.Selector.SingleSelectedThing as Pawn; if (pawn4 != null) { stringBuilder.AppendLine(" Pawn: " + pawn4); stringBuilder.AppendLine(" gain: " + JobGiver_OptimizeApparel.ApparelScoreGain(pawn4, apparel2).ToString("F2")); } } } } if (DebugViewSettings.drawRegions) { stringBuilder.AppendLine("---"); Region regionAt_NoRebuild_InvalidAllowed = Find.CurrentMap.regionGrid.GetRegionAt_NoRebuild_InvalidAllowed(intVec); stringBuilder.AppendLine("Region:\n" + ((regionAt_NoRebuild_InvalidAllowed == null) ? "null" : regionAt_NoRebuild_InvalidAllowed.DebugString)); } if (DebugViewSettings.drawRooms) { stringBuilder.AppendLine("---"); Room room = intVec.GetRoom(Find.CurrentMap, RegionType.Set_All); if (room != null) { stringBuilder.AppendLine(room.DebugString()); } else { stringBuilder.AppendLine("(no room)"); } } if (DebugViewSettings.drawRoomGroups) { stringBuilder.AppendLine("---"); RoomGroup roomGroup = intVec.GetRoomGroup(Find.CurrentMap); if (roomGroup != null) { stringBuilder.AppendLine(roomGroup.DebugString()); } else { stringBuilder.AppendLine("(no room group)"); } } if (DebugViewSettings.drawGlow) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Game glow: " + Find.CurrentMap.glowGrid.GameGlowAt(intVec, false)); stringBuilder.AppendLine("Psych glow: " + Find.CurrentMap.glowGrid.PsychGlowAt(intVec)); stringBuilder.AppendLine("Visual Glow: " + Find.CurrentMap.glowGrid.VisualGlowAt(intVec)); stringBuilder.AppendLine("GlowReport:\n" + ((SectionLayer_LightingOverlay)Find.CurrentMap.mapDrawer.SectionAt(intVec).GetLayer(typeof(SectionLayer_LightingOverlay))).GlowReportAt(intVec)); stringBuilder.AppendLine("SkyManager.CurSkyGlow: " + Find.CurrentMap.skyManager.CurSkyGlow); } if (DebugViewSettings.writePathCosts) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Perceived path cost: " + Find.CurrentMap.pathGrid.PerceivedPathCostAt(intVec)); stringBuilder.AppendLine("Real path cost: " + Find.CurrentMap.pathGrid.CalculatedCostAt(intVec, false, IntVec3.Invalid)); } if (DebugViewSettings.writeFertility) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("\nFertility: " + Find.CurrentMap.fertilityGrid.FertilityAt(intVec).ToString("##0.00")); } if (DebugViewSettings.writeLinkFlags) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("\nLinkFlags: "); IEnumerator enumerator11 = Enum.GetValues(typeof(LinkFlags)).GetEnumerator(); try { while (enumerator11.MoveNext()) { object obj = enumerator11.Current; if ((Find.CurrentMap.linkGrid.LinkFlagsAt(intVec) & (LinkFlags)obj) != LinkFlags.None) { stringBuilder.Append(" " + obj); } } } finally { IDisposable disposable; if ((disposable = (enumerator11 as IDisposable)) != null) { disposable.Dispose(); } } } if (DebugViewSettings.writeSkyManager) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.skyManager.DebugString()); } if (DebugViewSettings.writeCover) { stringBuilder.AppendLine("---"); stringBuilder.Append("Cover: "); Thing thing5 = Find.CurrentMap.coverGrid[intVec]; if (thing5 == null) { stringBuilder.AppendLine("null"); } else { stringBuilder.AppendLine(thing5.ToString()); } } if (DebugViewSettings.drawPower) { stringBuilder.AppendLine("---"); foreach (Thing thing6 in Find.CurrentMap.thingGrid.ThingsAt(intVec)) { ThingWithComps thingWithComps = thing6 as ThingWithComps; if (thingWithComps != null && thingWithComps.GetComp <CompPowerTrader>() != null) { stringBuilder.AppendLine(" " + thingWithComps.GetComp <CompPowerTrader>().DebugString); } } PowerNet powerNet = Find.CurrentMap.powerNetGrid.TransmittedPowerNetAt(intVec); if (powerNet != null) { stringBuilder.AppendLine("" + powerNet.DebugString()); } else { stringBuilder.AppendLine("(no PowerNet here)"); } } if (DebugViewSettings.drawPreyInfo) { Pawn pawn5 = Find.Selector.SingleSelectedThing as Pawn; if (pawn5 != null) { List <Thing> thingList = intVec.GetThingList(Find.CurrentMap); for (int j = 0; j < thingList.Count; j++) { Pawn pawn6 = thingList[j] as Pawn; if (pawn6 != null) { stringBuilder.AppendLine("---"); if (FoodUtility.IsAcceptablePreyFor(pawn5, pawn6)) { stringBuilder.AppendLine("Prey score: " + FoodUtility.GetPreyScoreFor(pawn5, pawn6)); } else { stringBuilder.AppendLine("Prey score: None"); } break; } } } } } } return(stringBuilder.ToString()); }
private void RegenerateEqualizationData() { thickRoofCoverage = 0f; noRoofCoverage = 0f; equalizeCells.Clear(); if (roomGroup.RoomCount != 0) { Map map = Map; if (!roomGroup.UsesOutdoorTemperature) { int num = 0; foreach (IntVec3 cell in roomGroup.Cells) { RoofDef roof = cell.GetRoof(map); if (roof == null) { noRoofCoverage += 1f; } else if (roof.isThickRoof) { thickRoofCoverage += 1f; } num++; } thickRoofCoverage /= num; noRoofCoverage /= num; foreach (IntVec3 cell2 in roomGroup.Cells) { for (int i = 0; i < 4; i++) { IntVec3 intVec = cell2 + GenAdj.CardinalDirections[i]; IntVec3 intVec2 = cell2 + GenAdj.CardinalDirections[i] * 2; if (intVec.InBounds(map)) { Region region = intVec.GetRegion(map); if (region != null) { if (region.type != RegionType.Portal) { continue; } bool flag = false; for (int j = 0; j < region.links.Count; j++) { Region regionA = region.links[j].RegionA; Region regionB = region.links[j].RegionB; if (regionA.Room.Group != roomGroup && !regionA.IsDoorway) { flag = true; break; } if (regionB.Room.Group != roomGroup && !regionB.IsDoorway) { flag = true; break; } } if (flag) { continue; } } } if (intVec2.InBounds(map) && intVec2.GetRoomGroup(map) != roomGroup) { bool flag2 = false; for (int k = 0; k < 4; k++) { if ((intVec2 + GenAdj.CardinalDirections[k]).GetRoomGroup(map) == roomGroup) { flag2 = true; break; } } if (!flag2) { equalizeCells.Add(intVec2); } } } } equalizeCells.Shuffle(); } } }