public override bool Allows(IntVec3 c, Map map) { CellRect cellRect = CellRect.CenteredOn(c, this.radius); for (int i = cellRect.minZ; i <= cellRect.maxZ; i++) { for (int j = cellRect.minX; j <= cellRect.maxX; j++) { IntVec3 c2 = new IntVec3(j, 0, i); if (!c2.InBounds(map)) { return(false); } if (c2.InNoBuildEdgeArea(map)) { return(false); } if (this.affordance != null && !c2.GetTerrain(map).affordances.Contains(this.affordance)) { return(false); } } } return(true); }
internal bool <> m__0(IntVec3 c) { int num = this.cellIndices.CellToIndex(c); if (this.traverseParams.mode == TraverseMode.PassAllDestroyableThingsNotWater || this.traverseParams.mode == TraverseMode.NoPassClosedDoorsOrWater) { if (c.GetTerrain(this.$this.map).IsWater) { return(false); } } if (this.traverseParams.mode == TraverseMode.PassAllDestroyableThings || this.traverseParams.mode == TraverseMode.PassAllDestroyableThingsNotWater) { if (!this.pathGrid.WalkableFast(num)) { Building edifice = c.GetEdifice(this.$this.map); if (edifice == null || !PathFinder.IsDestroyable(edifice)) { return(false); } } } else if (this.traverseParams.mode != TraverseMode.NoPassClosedDoorsOrWater) { Log.ErrorOnce("Do not use this method for non-cell based modes!", 938476762, false); if (!this.pathGrid.WalkableFast(num)) { return(false); } } Region region = this.directRegionGrid[num]; return(region == null || region.Allows(this.traverseParams, false)); }
public void Notify_TerrainBurned(IntVec3 c) { TerrainDef terrain = c.GetTerrain(this.map); this.Notify_TerrainDestroyed(c); if (terrain.burnedDef != null) { this.SetTerrain(c, terrain.burnedDef); } }
public string DebugStringAt(IntVec3 c) { if (c.InBounds(map)) { TerrainDef terrain = c.GetTerrain(map); TerrainDef terrainDef = underGrid[map.cellIndices.CellToIndex(c)]; return("top: " + ((terrain != null) ? terrain.defName : "null") + ", under=" + ((terrainDef != null) ? terrainDef.defName : "null")); } return("out of bounds"); }
public string DebugStringAt(IntVec3 c) { if (c.InBounds(this.map)) { TerrainDef terrain = c.GetTerrain(this.map); TerrainDef terrainDef = this.underGrid[this.map.cellIndices.CellToIndex(c)]; return("top: " + ((terrain == null) ? "null" : terrain.defName) + ", under=" + ((terrainDef == null) ? "null" : terrainDef.defName)); } return("out of bounds"); }
protected virtual void ExplosionDamageTerrain(Explosion explosion, IntVec3 c) { if (def == DamageDefOf.Bomb && explosion.Map.terrainGrid.CanRemoveTopLayerAt(c)) { TerrainDef terrain = c.GetTerrain(explosion.Map); if (!(terrain.destroyOnBombDamageThreshold < 0f) && (float)explosion.GetDamageAmountAt(c) >= terrain.destroyOnBombDamageThreshold) { explosion.Map.terrainGrid.Notify_TerrainDestroyed(c); } } }
protected virtual void defaultDamageTerrain(Explosion explosion, IntVec3 c) { if (this.def == DamageDefOf.Bomb) { if (explosion.Map.terrainGrid.CanRemoveTopLayerAt(c)) { TerrainDef terrain = c.GetTerrain(explosion.Map); if (terrain.destroyOnBombDamageThreshold >= 0f) { float num = (float)explosion.GetDamageAmountAt(c); if (num >= terrain.destroyOnBombDamageThreshold) { explosion.Map.terrainGrid.Notify_TerrainDestroyed(c); } } } } }
public void MouseoverReadoutOnGUI() { if (Event.current.type != EventType.Repaint || Find.MainTabsRoot.OpenTab != null) { return; } GenUI.DrawTextWinterShadow(new Rect(256f, UI.screenHeight - 256, -256f, 256f)); Text.Font = GameFont.Small; GUI.color = new Color(1f, 1f, 1f, 0.8f); IntVec3 c = UI.MouseCell(); if (!c.InBounds(Find.CurrentMap)) { return; } float num = 0f; if (c.Fogged(Find.CurrentMap)) { Widgets.Label(new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f), "Undiscovered".Translate()); GUI.color = Color.white; return; } Rect rect = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f); int num2 = Mathf.RoundToInt(Find.CurrentMap.glowGrid.GameGlowAt(c) * 100f); Widgets.Label(rect, glowStrings[num2]); num += 19f; Rect rect2 = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f); TerrainDef terrain = c.GetTerrain(Find.CurrentMap); if (terrain != cachedTerrain) { string t = ((double)terrain.fertility > 0.0001) ? (" " + "FertShort".TranslateSimple() + " " + terrain.fertility.ToStringPercent()) : ""; cachedTerrainString = terrain.LabelCap + ((terrain.passability != Traversability.Impassable) ? (" (" + "WalkSpeed".Translate(SpeedPercentString(terrain.pathCost)) + t + ")") : ((TaggedString)null)); cachedTerrain = terrain; } Widgets.Label(rect2, cachedTerrainString); num += 19f; Zone zone = c.GetZone(Find.CurrentMap); if (zone != null) { Rect rect3 = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f); string label = zone.label; Widgets.Label(rect3, label); num += 19f; } float depth = Find.CurrentMap.snowGrid.GetDepth(c); if (depth > 0.03f) { Rect rect4 = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f); SnowCategory snowCategory = SnowUtility.GetSnowCategory(depth); string label2 = SnowUtility.GetDescription(snowCategory) + " (" + "WalkSpeed".Translate(SpeedPercentString(SnowUtility.MovementTicksAddOn(snowCategory))) + ")"; Widgets.Label(rect4, label2); num += 19f; } List <Thing> thingList = c.GetThingList(Find.CurrentMap); for (int i = 0; i < thingList.Count; i++) { Thing thing = thingList[i]; if (thing.def.category != ThingCategory.Mote) { Rect rect5 = new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f); string labelMouseover = thing.LabelMouseover; Widgets.Label(rect5, labelMouseover); num += 19f; } } RoofDef roof = c.GetRoof(Find.CurrentMap); if (roof != null) { Widgets.Label(new Rect(BotLeft.x, (float)UI.screenHeight - BotLeft.y - num, 999f, 999f), roof.LabelCap); num += 19f; } GUI.color = Color.white; }
public static bool SupportsStructureType(this IntVec3 c, Map map, TerrainAffordanceDef surfaceType) { return(c.GetTerrain(map).affordances.Contains(surfaceType)); }
public void MouseoverReadoutOnGUI() { if (Event.current.type == EventType.Repaint) { if (Find.MainTabsRoot.OpenTab == null) { GenUI.DrawTextWinterShadow(new Rect(256f, (float)(UI.screenHeight - 256), -256f, 256f)); Text.Font = GameFont.Small; GUI.color = new Color(1f, 1f, 1f, 0.8f); IntVec3 c = UI.MouseCell(); if (c.InBounds(Find.CurrentMap)) { float num = 0f; Profiler.BeginSample("fog"); if (c.Fogged(Find.CurrentMap)) { Rect rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f); Widgets.Label(rect, "Undiscovered".Translate()); GUI.color = Color.white; Profiler.EndSample(); } else { Profiler.EndSample(); Profiler.BeginSample("light"); Rect rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f); int num2 = Mathf.RoundToInt(Find.CurrentMap.glowGrid.GameGlowAt(c, false) * 100f); Widgets.Label(rect, this.glowStrings[num2]); num += 19f; Profiler.EndSample(); Profiler.BeginSample("terrain"); rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f); TerrainDef terrain = c.GetTerrain(Find.CurrentMap); if (terrain != this.cachedTerrain) { string str = ((double)terrain.fertility <= 0.0001) ? "" : (" " + "FertShort".Translate() + " " + terrain.fertility.ToStringPercent()); this.cachedTerrainString = terrain.LabelCap + ((terrain.passability == Traversability.Impassable) ? null : (" (" + "WalkSpeed".Translate(new object[] { this.SpeedPercentString((float)terrain.pathCost) }) + str + ")")); this.cachedTerrain = terrain; } Widgets.Label(rect, this.cachedTerrainString); num += 19f; Profiler.EndSample(); Profiler.BeginSample("zone"); Zone zone = c.GetZone(Find.CurrentMap); if (zone != null) { rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f); string label = zone.label; Widgets.Label(rect, label); num += 19f; } Profiler.EndSample(); float depth = Find.CurrentMap.snowGrid.GetDepth(c); if (depth > 0.03f) { rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f); SnowCategory snowCategory = SnowUtility.GetSnowCategory(depth); string label2 = SnowUtility.GetDescription(snowCategory) + " (" + "WalkSpeed".Translate(new object[] { this.SpeedPercentString((float)SnowUtility.MovementTicksAddOn(snowCategory)) }) + ")"; Widgets.Label(rect, label2); num += 19f; } Profiler.BeginSample("things"); List <Thing> thingList = c.GetThingList(Find.CurrentMap); for (int i = 0; i < thingList.Count; i++) { Thing thing = thingList[i]; if (thing.def.category != ThingCategory.Mote) { rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f); string labelMouseover = thing.LabelMouseover; Widgets.Label(rect, labelMouseover); num += 19f; } } Profiler.EndSample(); Profiler.BeginSample("roof"); RoofDef roof = c.GetRoof(Find.CurrentMap); if (roof != null) { rect = new Rect(MouseoverReadout.BotLeft.x, (float)UI.screenHeight - MouseoverReadout.BotLeft.y - num, 999f, 999f); Widgets.Label(rect, roof.LabelCap); num += 19f; } Profiler.EndSample(); GUI.color = Color.white; } } } } }
public void MouseoverReadoutOnGUI() { if (Event.current.type == EventType.Repaint && Find.MainTabsRoot.OpenTab == null) { GenUI.DrawTextWinterShadow(new Rect(256f, (float)(UI.screenHeight - 256), -256f, 256f)); Text.Font = GameFont.Small; GUI.color = new Color(1f, 1f, 1f, 0.8f); IntVec3 c = UI.MouseCell(); if (c.InBounds(Find.CurrentMap)) { float num = 0f; Rect rect = default(Rect); if (c.Fogged(Find.CurrentMap)) { Vector2 botLeft = BotLeft; float x = botLeft.x; float num2 = (float)UI.screenHeight; Vector2 botLeft2 = BotLeft; rect = new Rect(x, num2 - botLeft2.y - num, 999f, 999f); Widgets.Label(rect, "Undiscovered".Translate()); GUI.color = Color.white; } else { Vector2 botLeft3 = BotLeft; float x2 = botLeft3.x; float num3 = (float)UI.screenHeight; Vector2 botLeft4 = BotLeft; rect = new Rect(x2, num3 - botLeft4.y - num, 999f, 999f); int num4 = Mathf.RoundToInt(Find.CurrentMap.glowGrid.GameGlowAt(c) * 100f); Widgets.Label(rect, glowStrings[num4]); num += 19f; Vector2 botLeft5 = BotLeft; float x3 = botLeft5.x; float num5 = (float)UI.screenHeight; Vector2 botLeft6 = BotLeft; rect = new Rect(x3, num5 - botLeft6.y - num, 999f, 999f); TerrainDef terrain = c.GetTerrain(Find.CurrentMap); if (terrain != cachedTerrain) { string str = (!((double)terrain.fertility > 0.0001)) ? string.Empty : (" " + "FertShort".Translate() + " " + terrain.fertility.ToStringPercent()); cachedTerrainString = terrain.LabelCap + ((terrain.passability == Traversability.Impassable) ? null : (" (" + "WalkSpeed".Translate(SpeedPercentString((float)terrain.pathCost)) + str + ")")); cachedTerrain = terrain; } Widgets.Label(rect, cachedTerrainString); num += 19f; Zone zone = c.GetZone(Find.CurrentMap); if (zone != null) { Vector2 botLeft7 = BotLeft; float x4 = botLeft7.x; float num6 = (float)UI.screenHeight; Vector2 botLeft8 = BotLeft; rect = new Rect(x4, num6 - botLeft8.y - num, 999f, 999f); string label = zone.label; Widgets.Label(rect, label); num += 19f; } float depth = Find.CurrentMap.snowGrid.GetDepth(c); if (depth > 0.03f) { Vector2 botLeft9 = BotLeft; float x5 = botLeft9.x; float num7 = (float)UI.screenHeight; Vector2 botLeft10 = BotLeft; rect = new Rect(x5, num7 - botLeft10.y - num, 999f, 999f); SnowCategory snowCategory = SnowUtility.GetSnowCategory(depth); string label2 = SnowUtility.GetDescription(snowCategory) + " (" + "WalkSpeed".Translate(SpeedPercentString((float)SnowUtility.MovementTicksAddOn(snowCategory))) + ")"; Widgets.Label(rect, label2); num += 19f; } List <Thing> thingList = c.GetThingList(Find.CurrentMap); for (int i = 0; i < thingList.Count; i++) { Thing thing = thingList[i]; if (thing.def.category != ThingCategory.Mote) { Vector2 botLeft11 = BotLeft; float x6 = botLeft11.x; float num8 = (float)UI.screenHeight; Vector2 botLeft12 = BotLeft; rect = new Rect(x6, num8 - botLeft12.y - num, 999f, 999f); string labelMouseover = thing.LabelMouseover; Widgets.Label(rect, labelMouseover); num += 19f; } } RoofDef roof = c.GetRoof(Find.CurrentMap); if (roof != null) { Vector2 botLeft13 = BotLeft; float x7 = botLeft13.x; float num9 = (float)UI.screenHeight; Vector2 botLeft14 = BotLeft; rect = new Rect(x7, num9 - botLeft14.y - num, 999f, 999f); Widgets.Label(rect, roof.LabelCap); num += 19f; } GUI.color = Color.white; } } } }