public static void Postfix(Pawn pawn, TargetInfo t, ref float __result, WorkGiver_Grower __instance) { IntVec3 cell = t.Cell; var zone = (Zone_Growing)pawn.Map.zoneManager.AllZones.FirstOrFallback(x => x is Zone_Growing growZone && growZone.cells.Contains(cell)); if (zone != null) { __result = zone != null && PriorityTracker.growingZonePriorities.TryGetValue(zone, out PriorityIntHolder intp) ? intp.Int : (int)Priority.Normal; } else { foreach (Building b in pawn.Map.listerBuildings.allBuildingsColonist) { if (b is Building_PlantGrower building) { CellRect.CellRectIterator cri = building.OccupiedRect().GetIterator(); while (!cri.Done()) { Priority priority = PriorityTracker.plantBuildingPriorities.TryGetValue(building, out PriorityIntHolder intp) ? (Priority)intp.Int : Priority.Normal; __result = (float)priority; cri.MoveNext(); } } } } }
private void CalculateRoofsAboutToCollapse(CellRect rect) { Map map = BaseGen.globalSettings.map; roofsAboutToCollapse.Clear(); visited.Clear(); CellRect.CellRectIterator iterator = rect.GetIterator(); while (!iterator.Done()) { IntVec3 current = iterator.Current; if (current.Roofed(map) && !RoofCollapseCellsFinder.ConnectsToRoofHolder(current, map, visited)) { map.floodFiller.FloodFill(current, (IntVec3 x) => x.Roofed(map), delegate(IntVec3 x) { roofsAboutToCollapse.Add(x); }); } iterator.MoveNext(); } CellRect.CellRectIterator iterator2 = rect.GetIterator(); while (!iterator2.Done()) { IntVec3 current2 = iterator2.Current; if (current2.Roofed(map) && !roofsAboutToCollapse.Contains(current2) && !RoofCollapseUtility.WithinRangeOfRoofHolder(current2, map)) { roofsAboutToCollapse.Add(current2); } iterator2.MoveNext(); } }
public override bool CanResolve(ResolveParams rp) { Map map = BaseGen.globalSettings.map; if (!base.CanResolve(rp)) { return(false); } int num = 0; CellRect.CellRectIterator iterator = rp.rect.GetIterator(); while (!iterator.Done()) { if (iterator.Current.Standable(map)) { num++; } iterator.MoveNext(); } if (num < 2) { return(false); } return(true); }
public override void Resolve(ResolveParams rp) { Map map = BaseGen.globalSettings.map; TerrainGrid terrainGrid = map.terrainGrid; TerrainDef terrainDef = rp.floorDef ?? BaseGenUtility.RandomBasicFloorDef(rp.faction, false); bool? floorOnlyIfTerrainSupports = rp.floorOnlyIfTerrainSupports; bool flag = floorOnlyIfTerrainSupports.HasValue && floorOnlyIfTerrainSupports.Value; CellRect.CellRectIterator iterator = rp.rect.GetIterator(); while (!iterator.Done()) { if (!rp.chanceToSkipFloor.HasValue || !Rand.Chance(rp.chanceToSkipFloor.Value)) { if (!flag || GenConstruct.CanBuildOnTerrain(terrainDef, iterator.Current, map, Rot4.North, null)) { terrainGrid.SetTerrain(iterator.Current, terrainDef); if (rp.filthDef != null) { FilthMaker.MakeFilth(iterator.Current, map, rp.filthDef, (!rp.filthDensity.HasValue) ? 1 : Mathf.RoundToInt(rp.filthDensity.Value.RandomInRange)); } } } iterator.MoveNext(); } }
private void CalculateAvailablePowerPlants(CellRect rect) { Map map = BaseGen.globalSettings.map; SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.Clear(); if (rect.Width >= ThingDefOf.SolarGenerator.size.x && rect.Height >= ThingDefOf.SolarGenerator.size.z) { int num = 0; CellRect.CellRectIterator iterator = rect.GetIterator(); while (!iterator.Done()) { if (!iterator.Current.Roofed(map)) { num++; } iterator.MoveNext(); } if ((float)num / (float)rect.Area >= 0.5) { SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.Add(ThingDefOf.SolarGenerator); } } if (rect.Width >= ThingDefOf.WoodFiredGenerator.size.x && rect.Height >= ThingDefOf.WoodFiredGenerator.size.z) { SymbolResolver_BasePart_Outdoors_Leaf_PowerPlant.availablePowerPlants.Add(ThingDefOf.WoodFiredGenerator); } }
public static Thing FirstBlockingThing(Thing constructible, Pawn pawnToIgnore) { Blueprint blueprint = constructible as Blueprint; Thing thing; if (blueprint != null) { thing = GenConstruct.MiniToInstallOrBuildingToReinstall(blueprint); } else { thing = null; } CellRect.CellRectIterator iterator = constructible.OccupiedRect().GetIterator(); while (!iterator.Done()) { List <Thing> thingList = iterator.Current.GetThingList(constructible.Map); for (int i = 0; i < thingList.Count; i++) { Thing thing2 = thingList[i]; if (GenConstruct.BlocksConstruction(constructible, thing2) && thing2 != pawnToIgnore && thing2 != thing) { return(thing2); } } iterator.MoveNext(); } return(null); }
public static CellRect FindUsableRect(int width, int height, Map map, float minFertility = 0f, bool noItems = false) { IntVec3 center = map.Center; float num = 1f; CellRect cellRect; for (;;) { IntVec3 center2 = center + new IntVec3((int)Rand.Range(-num, num), 0, (int)Rand.Range(-num, num)); cellRect = CellRect.CenteredOn(center2, width / 2); cellRect.Width = width; cellRect.Height = height; cellRect = cellRect.ExpandedBy(1); bool flag = true; CellRect.CellRectIterator iterator = cellRect.GetIterator(); while (!iterator.Done()) { IntVec3 intVec = iterator.Current; if (intVec.Fogged(map) || !intVec.Walkable(map) || !intVec.GetTerrain(map).affordances.Contains(TerrainAffordanceDefOf.Heavy) || intVec.GetTerrain(map).fertility < minFertility || intVec.GetZone(map) != null || TutorUtility.ContainsBlockingThing(intVec, map, noItems) || intVec.InNoBuildEdgeArea(map) || intVec.InNoZoneEdgeArea(map)) { flag = false; break; } iterator.MoveNext(); } if (flag) { break; } num += 0.25f; } return(cellRect.ContractedBy(1)); }
private void RegisterThingsInRegionListers() { CellRect cellRect = this.newReg.extentsClose; cellRect = cellRect.ExpandedBy(1); cellRect.ClipInsideMap(this.map); WaterRegionMaker.tmpProcessedThings.Clear(); CellRect.CellRectIterator iterator = cellRect.GetIterator(); while (!iterator.Done()) { IntVec3 intVec = iterator.Current; bool flag = false; for (int i = 0; i < 9; i++) { IntVec3 c = intVec + GenAdj.AdjacentCellsAndInside[i]; if (c.InBoundsShip(this.map)) { if (this.regionGrid.GetValidRegionAt(c) == this.newReg) { flag = true; break; } } } if (flag) { WaterRegionListersUpdater.RegisterAllAt(intVec, this.map, WaterRegionMaker.tmpProcessedThings); } iterator.MoveNext(); } WaterRegionMaker.tmpProcessedThings.Clear(); }
internal bool <> m__0(IntVec3 x) { bool result; if (!this.map.reachability.CanReachMapEdge(x, this.traverseParams)) { result = false; } else { CellRect cellRect = CellRect.CenteredOn(x, this.rectRadius); int num = 0; CellRect.CellRectIterator iterator = cellRect.GetIterator(); while (!iterator.Done()) { if (!iterator.Current.InBounds(this.map)) { return(false); } if (iterator.Current.Standable(this.map) || iterator.Current.GetPlant(this.map) != null) { num++; } iterator.MoveNext(); } result = ((float)num / (float)cellRect.Area >= 0.6f); } return(result); }
public static void GetTouchableRegions(Thing thing, Map map, List <Region> outRegions, bool allowAdjacentEvenIfCantTouch = false) { outRegions.Clear(); CellRect cellRect = thing.OccupiedRect(); CellRect cellRect2 = cellRect; if (newRegionListersUpdater.CanRegisterInAdjacentRegions(thing)) { cellRect2 = cellRect2.ExpandedBy(1); } CellRect.CellRectIterator iterator = cellRect2.GetIterator(); while (!iterator.Done()) { IntVec3 current = iterator.Current; if (current.InBounds(map)) { Region validRegionAt_NoRebuild = map.regionGrid.GetValidRegionAt_NoRebuild(current); if (validRegionAt_NoRebuild != null && validRegionAt_NoRebuild.type.Passable() && !outRegions.Contains(validRegionAt_NoRebuild)) { if (cellRect.Contains(current)) { outRegions.Add(validRegionAt_NoRebuild); } else if (allowAdjacentEvenIfCantTouch || ReachabilityImmediate.CanReachImmediate(current, thing, map, PathEndMode.Touch, null)) { outRegions.Add(validRegionAt_NoRebuild); } } } iterator.MoveNext(); } }
internal static bool SelectableByMapClick(Thing t) { if (!t.def.selectable) { return(false); } if (!t.Spawned) { return(false); } if (t is Pawn && ((Pawn)t).health.hediffSet.HasHediff(HediffDefOfPsychology.Thief)) { return(false); } if (t.def.size.x == 1 && t.def.size.z == 1) { return(!t.Position.Fogged(t.Map)); } CellRect.CellRectIterator iterator = t.OccupiedRect().GetIterator(); while (!iterator.Done()) { if (!iterator.Current.Fogged(t.Map)) { return(true); } iterator.MoveNext(); } return(false); }
public Thing BlockingHaulableOnTop() { Thing result; if (this.def.entityDefToBuild.passability == Traversability.Standable) { result = null; } else { CellRect.CellRectIterator iterator = this.OccupiedRect().GetIterator(); while (!iterator.Done()) { List <Thing> thingList = iterator.Current.GetThingList(base.Map); for (int i = 0; i < thingList.Count; i++) { Thing thing = thingList[i]; if (thing.def.EverHaulable) { return(thing); } } iterator.MoveNext(); } result = null; } return(result); }
private bool TrySpawnPowerTransmittingBuildingNear(IntVec3 position, Map map, Faction faction, ThingDef def, out Building newBuilding, Predicate <IntVec3> extraValidator = null) { TraverseParms traverseParams = TraverseParms.For(TraverseMode.PassAllDestroyableThings, Danger.Deadly, false); IntVec3 loc; if (RCellFinder.TryFindRandomCellNearWith(position, delegate(IntVec3 x) { if (!x.Standable(map) || x.Roofed(map) || !this.EverPossibleToTransmitPowerAt(x, map)) { return(false); } if (!map.reachability.CanReach(position, x, PathEndMode.OnCell, traverseParams)) { return(false); } CellRect.CellRectIterator iterator = GenAdj.OccupiedRect(x, Rot4.North, def.size).GetIterator(); while (!iterator.Done()) { IntVec3 c = iterator.Current; if (!c.InBounds(map) || c.Roofed(map) || c.GetEdifice(map) != null || c.GetFirstItem(map) != null || c.GetTransmitter(map) != null) { return(false); } iterator.MoveNext(); } return(extraValidator == null || extraValidator(x)); }, map, out loc, 8, 2147483647)) { newBuilding = (Building)GenSpawn.Spawn(ThingMaker.MakeThing(def, null), loc, map, Rot4.North, WipeMode.Vanish, false); newBuilding.SetFaction(faction, null); return(true); } newBuilding = null; return(false); }
public override void Resolve(ResolveParams rp) { Map map = BaseGen.globalSettings.map; ThingDef thingDef = rp.cultivatedPlantDef ?? SymbolResolver_CultivatedPlants.DeterminePlantDef(rp.rect); if (thingDef != null) { float growth = Rand.Range(0.2f, 1f); int age = thingDef.plant.LimitedLifespan ? Rand.Range(0, Mathf.Max(thingDef.plant.LifespanTicks - 2500, 0)) : 0; CellRect.CellRectIterator iterator = rp.rect.GetIterator(); while (!iterator.Done()) { float num = map.fertilityGrid.FertilityAt(iterator.Current); if (!(num < thingDef.plant.fertilityMin) && this.TryDestroyBlockingThingsAt(iterator.Current)) { Plant plant = (Plant)GenSpawn.Spawn(thingDef, iterator.Current, map); plant.Growth = growth; if (plant.def.plant.LimitedLifespan) { plant.Age = age; } } iterator.MoveNext(); } } }
public static ThingDef DeterminePlantDef(CellRect rect) { Map map = BaseGen.globalSettings.map; if (!(map.mapTemperature.OutdoorTemp < 0.0) && !(map.mapTemperature.OutdoorTemp > 58.0)) { float minFertility = 3.40282347E+38f; bool flag = false; CellRect.CellRectIterator iterator = rect.GetIterator(); while (!iterator.Done()) { float num = map.fertilityGrid.FertilityAt(iterator.Current); if (!(num <= 0.0)) { flag = true; minFertility = Mathf.Min(minFertility, num); } iterator.MoveNext(); } if (!flag) { return(null); } ThingDef result = default(ThingDef); if ((from x in DefDatabase <ThingDef> .AllDefsListForReading where x.category == ThingCategory.Plant && x.plant.Sowable && !x.plant.IsTree && !x.plant.cavePlant && x.plant.fertilityMin <= minFertility && x.plant.Harvestable select x).TryRandomElement <ThingDef>(out result)) { return(result); } return(null); } return(null); }
public static void GetTouchableRegions(Thing thing, Map map, List <WaterRegion> outRegions, bool allowAdjacenttEvenIfCantTouch = false) { outRegions.Clear(); CellRect cellRect = thing.OccupiedRect(); CellRect cellRect2 = cellRect; if (WaterRegionListersUpdater.CanRegisterInAdjacentRegions(thing)) { cellRect2 = cellRect2.ExpandedBy(1); } CellRect.CellRectIterator iterator = cellRect2.GetIterator(); while (!iterator.Done()) { IntVec3 intVec = iterator.Current; if (intVec.InBoundsShip(map)) { WaterRegion validRegionAt_NoRebuild = MapExtensionUtility.GetExtensionToMap(map).getWaterRegionGrid.GetValidRegionAt_NoRebuild(intVec); if (!(validRegionAt_NoRebuild is null) && validRegionAt_NoRebuild.type.Passable() && !outRegions.Contains(validRegionAt_NoRebuild)) { if (cellRect.Contains(intVec)) { outRegions.Add(validRegionAt_NoRebuild); } else if (allowAdjacenttEvenIfCantTouch || ShipReachabilityImmediate.CanReachImmediateShip(intVec, thing, map, PathEndMode.Touch, null)) { outRegions.Add(validRegionAt_NoRebuild); } } } iterator.MoveNext(); } }
private bool AnyNonStandableCellOrAnyBuildingInside(CellRect rect) { Map map = BaseGen.globalSettings.map; CellRect.CellRectIterator iterator = rect.GetIterator(); while (!iterator.Done()) { bool result; if (!iterator.Current.Standable(map)) { result = true; } else { if (iterator.Current.GetEdifice(map) == null) { iterator.MoveNext(); continue; } result = true; } return(result); } return(false); }
public static bool CanPossiblyFallOnColonist(ThingDef skyfaller, IntVec3 c, Map map) { CellRect cellRect = GenAdj.OccupiedRect(c, Rot4.North, skyfaller.size); int dist = Mathf.Max(Mathf.CeilToInt(skyfaller.skyfaller.explosionRadius) + 7, 14); CellRect.CellRectIterator iterator = cellRect.ExpandedBy(dist).GetIterator(); while (!iterator.Done()) { IntVec3 c2 = iterator.Current; if (c2.InBounds(map)) { List <Thing> thingList = c2.GetThingList(map); for (int i = 0; i < thingList.Count; i++) { Pawn pawn = thingList[i] as Pawn; if (pawn != null && pawn.IsColonist) { return(true); } } } iterator.MoveNext(); } return(false); }
protected override bool CanScatterAt(IntVec3 c, Map map) { if (!base.CanScatterAt(c, map)) { return(false); } if (!c.SupportsStructureType(map, TerrainAffordanceDefOf.Heavy)) { return(false); } if (!map.reachability.CanReachMapEdge(c, TraverseParms.For(TraverseMode.PassDoors))) { return(false); } CellRect.CellRectIterator iterator = CellRect.CenteredOn(c, 8, 8).GetIterator(); while (!iterator.Done()) { if (!iterator.Current.InBounds(map) || iterator.Current.GetEdifice(map) != null) { return(false); } iterator.MoveNext(); } return(true); }
public override void Resolve(ResolveParams rp) { Map map = BaseGen.globalSettings.map; batteries.Clear(); CellRect.CellRectIterator iterator = rp.rect.GetIterator(); while (!iterator.Done()) { List <Thing> thingList = iterator.Current.GetThingList(map); for (int i = 0; i < thingList.Count; i++) { CompPowerBattery compPowerBattery = thingList[i].TryGetComp <CompPowerBattery>(); if (compPowerBattery != null && !batteries.Contains(compPowerBattery)) { batteries.Add(compPowerBattery); } } iterator.MoveNext(); } for (int j = 0; j < batteries.Count; j++) { float num = Rand.Range(0.1f, 0.3f); batteries[j].SetStoredEnergyPct(Mathf.Min(batteries[j].StoredEnergyPct + num, 1f)); } batteries.Clear(); }
public static CellRect FindUsableRect(int width, int height, Map map, float minFertility = 0f, bool noItems = false) { IntVec3 center = map.Center; float num = 1f; CellRect cellRect; while (true) { IntVec3 center2 = center + new IntVec3((int)Rand.Range((float)(0.0 - num), num), 0, (int)Rand.Range((float)(0.0 - num), num)); cellRect = CellRect.CenteredOn(center2, width / 2); cellRect.Width = width; cellRect.Height = height; cellRect = cellRect.ExpandedBy(1); bool flag = true; CellRect.CellRectIterator iterator = cellRect.GetIterator(); while (!iterator.Done()) { IntVec3 current = iterator.Current; if (!current.Fogged(map) && current.Walkable(map) && current.GetTerrain(map).affordances.Contains(TerrainAffordance.Heavy) && !(current.GetTerrain(map).fertility < minFertility) && current.GetZone(map) == null && !TutorUtility.ContainsBlockingThing(current, map, noItems) && !current.InNoBuildEdgeArea(map) && !current.InNoZoneEdgeArea(map)) { iterator.MoveNext(); continue; } flag = false; break; } if (!flag) { num = (float)(num + 0.25); continue; } break; } return(cellRect.ContractedBy(1)); }
private void FindNearbyGlowers(CellRect rect) { Map map = BaseGen.globalSettings.map; SymbolResolver_OutdoorLighting.nearbyGlowers.Clear(); rect = rect.ExpandedBy(4); rect = rect.ClipInsideMap(map); CellRect.CellRectIterator iterator = rect.GetIterator(); while (!iterator.Done()) { Region region = iterator.Current.GetRegion(map, RegionType.Set_Passable); if (region != null && region.Room.PsychologicallyOutdoors) { List <Thing> thingList = iterator.Current.GetThingList(map); for (int i = 0; i < thingList.Count; i++) { CompGlower compGlower = thingList[i].TryGetComp <CompGlower>(); if (compGlower != null) { SymbolResolver_OutdoorLighting.nearbyGlowers.Add(compGlower); } } } iterator.MoveNext(); } }
public static bool CanBuildOnTerrain(BuildableDef entDef, IntVec3 c, Map map, Rot4 rot, Thing thingToIgnore = null) { TerrainDef terrainDef = entDef as TerrainDef; if (terrainDef != null && !c.GetTerrain(map).changeable) { return(false); } CellRect cellRect = GenAdj.OccupiedRect(c, rot, entDef.Size); cellRect.ClipInsideMap(map); CellRect.CellRectIterator iterator = cellRect.GetIterator(); while (!iterator.Done()) { TerrainDef terrainDef2 = map.terrainGrid.TerrainAt(iterator.Current); if (!terrainDef2.affordances.Contains(entDef.terrainAffordanceNeeded)) { return(false); } List <Thing> thingList = iterator.Current.GetThingList(map); for (int i = 0; i < thingList.Count; i++) { if (thingList[i] != thingToIgnore) { TerrainDef terrainDef3 = thingList[i].def.entityDefToBuild as TerrainDef; if (terrainDef3 != null && !terrainDef3.affordances.Contains(entDef.terrainAffordanceNeeded)) { return(false); } } } iterator.MoveNext(); } return(true); }
private bool TryFindRandomInnerRect(CellRect outerRect, int size, out CellRect rect, int minValidCells, out int maxValidCellsFound) { Map map = BaseGen.globalSettings.map; size = Mathf.Min(size, Mathf.Min(outerRect.Width, outerRect.Height)); int maxValidCellsFoundLocal = 0; bool result = outerRect.TryFindRandomInnerRect(new IntVec2(size, size), out rect, delegate(CellRect x) { int num = 0; CellRect.CellRectIterator iterator = x.GetIterator(); while (!iterator.Done()) { if (iterator.Current.Standable(map) && iterator.Current.GetFirstItem(map) == null && iterator.Current.GetFirstBuilding(map) == null) { num++; } iterator.MoveNext(); } maxValidCellsFoundLocal = Mathf.Max(maxValidCellsFoundLocal, num); return(num >= minValidCells); }); maxValidCellsFound = maxValidCellsFoundLocal; return(result); }
public static bool IsBurning(this Thing t) { if (!t.Destroyed && t.Spawned) { if (t.def.size == IntVec2.One) { if (t is Pawn) { return(t.HasAttachment(ThingDefOf.Fire)); } return(t.Position.ContainsStaticFire(t.Map)); } CellRect.CellRectIterator iterator = t.OccupiedRect().GetIterator(); while (!iterator.Done()) { if (iterator.Current.ContainsStaticFire(t.Map)) { return(true); } iterator.MoveNext(); } return(false); } return(false); }
public static bool SelectableByMapClick(Thing t) { if (!t.def.selectable) { return(false); } if (!t.Spawned) { return(false); } if (t.def.size.x == 1 && t.def.size.z == 1) { return(!t.Position.Fogged(t.Map)); } CellRect.CellRectIterator iterator = t.OccupiedRect().GetIterator(); while (!iterator.Done()) { if (!iterator.Current.Fogged(t.Map)) { return(true); } iterator.MoveNext(); } return(false); }
public override void Resolve(ResolveParams rp) { Map map = BaseGen.globalSettings.map; SymbolResolver_Refuel.refuelables.Clear(); CellRect.CellRectIterator iterator = rp.rect.GetIterator(); while (!iterator.Done()) { List <Thing> thingList = iterator.Current.GetThingList(map); for (int i = 0; i < thingList.Count; i++) { CompRefuelable compRefuelable = thingList[i].TryGetComp <CompRefuelable>(); if (compRefuelable != null && !SymbolResolver_Refuel.refuelables.Contains(compRefuelable)) { SymbolResolver_Refuel.refuelables.Add(compRefuelable); } } iterator.MoveNext(); } for (int j = 0; j < SymbolResolver_Refuel.refuelables.Count; j++) { float fuelCapacity = SymbolResolver_Refuel.refuelables[j].Props.fuelCapacity; float amount = Rand.Range(fuelCapacity / 2f, fuelCapacity); SymbolResolver_Refuel.refuelables[j].Refuel(amount); } SymbolResolver_Refuel.refuelables.Clear(); }
private bool TryFindTableCell(out IntVec3 cell) { JobDriver_HaulCorpseToPublicPlace.tmpCells.Clear(); List <Building> allBuildingsColonist = base.pawn.Map.listerBuildings.allBuildingsColonist; for (int i = 0; i < allBuildingsColonist.Count; i++) { Building building = allBuildingsColonist[i]; if (building.def.IsTable) { CellRect.CellRectIterator iterator = building.OccupiedRect().GetIterator(); while (!iterator.Done()) { IntVec3 current = iterator.Current; if (base.pawn.CanReserveAndReach(current, PathEndMode.OnCell, Danger.Deadly, 1, -1, null, false) && current.GetFirstItem(base.pawn.Map) == null) { JobDriver_HaulCorpseToPublicPlace.tmpCells.Add(current); } iterator.MoveNext(); } } } if (!JobDriver_HaulCorpseToPublicPlace.tmpCells.Any()) { cell = IntVec3.Invalid; return(false); } cell = JobDriver_HaulCorpseToPublicPlace.tmpCells.RandomElement(); return(true); }
private static string TemperatureString() { IntVec3 intVec = Gen.MouseCell(); IntVec3 intVec2 = IntVec3.Invalid; Room room = null; for (int i = 0; i < GlobalControls.TempSearchNumRadialCells; i++) { intVec2 = intVec + GenRadial.RadialPattern[i]; if (intVec2.InBounds()) { room = intVec2.GetRoom(); if (room != null) { break; } } } if (room == null && intVec.InBounds()) { Building edifice = intVec.GetEdifice(); if (edifice != null) { CellRect.CellRectIterator iterator = edifice.OccupiedRect().ExpandedBy(1).ClipInsideMap().GetIterator(); while (!iterator.Done()) { IntVec3 current = iterator.Current; room = current.GetRoom(); if (room != null && !room.PsychologicallyOutdoors) { intVec2 = current; break; } iterator.MoveNext(); } } } string str; if (intVec2.InBounds() && !intVec2.Fogged() && room != null && !room.PsychologicallyOutdoors) { if (!room.UsesOutdoorTemperature) { str = "Indoors".Translate(); } else { str = "IndoorsUnroofed".Translate(); } } else { str = "Outdoors".Translate(); } float celsiusTemp = (room == null || intVec2.Fogged()) ? GenTemperature.OutdoorTemp : room.Temperature; return(str + " " + celsiusTemp.ToStringTemperature("F0")); }
// Token: 0x060052A4 RID: 21156 RVA: 0x00129DE0 File Offset: 0x001281E0 protected bool CanHit(Thing thing) { if (!thing.Spawned) { return(false); } if (thing == this.launcher) { return(false); } bool flag = false; CellRect.CellRectIterator iterator = thing.OccupiedRect().GetIterator(); while (!iterator.Done()) { List <Thing> thingList = iterator.Current.GetThingList(base.Map); bool flag2 = false; for (int i = 0; i < thingList.Count; i++) { if (thingList[i] != thing && thingList[i].def.Fillage == FillCategory.Full && thingList[i].def.Altitude >= thing.def.Altitude) { flag2 = true; break; } } if (!flag2) { flag = true; break; } iterator.MoveNext(); } if (!flag) { return(false); } ProjectileHitFlags hitFlags = this.HitFlags; if (thing == this.intendedTarget && (hitFlags & ProjectileHitFlags.IntendedTarget) != ProjectileHitFlags.None) { return(true); } if (thing != this.intendedTarget) { if (thing is Pawn) { if ((hitFlags & ProjectileHitFlags.NonTargetPawns) != ProjectileHitFlags.None) { return(true); } } else if ((hitFlags & ProjectileHitFlags.NonTargetWorld) != ProjectileHitFlags.None) { return(true); } } return(thing == this.intendedTarget && thing.def.Fillage == FillCategory.Full); }