public bool CanReachUnfogged(IntVec3 c, TraverseParms traverseParms) { if (traverseParms.pawn != null) { if (!traverseParms.pawn.Spawned) { return(false); } if (traverseParms.pawn.Map != map) { Log.Error(string.Concat(new object[] { "Called CanReachUnfogged() with a pawn spawned not on this map. This means that we can't check his reachability here. Pawn's current map should have been used instead of this one. pawn=", traverseParms.pawn, " pawn.Map=", traverseParms.pawn.Map, " map=", map })); return(false); } } if (!c.InBoundsShip(map)) { return(false); } if (!c.Fogged(map)) { return(true); } VehicleRegion region = VehicleGridsUtility.GetRegion(c, map, RegionType.Set_Passable); if (region == null) { return(false); } bool entryCondition(VehicleRegion from, VehicleRegion r) => r.Allows(traverseParms, false); bool foundReg = false; bool regionProcessor(VehicleRegion r) { if (!r.AnyCell.Fogged(map)) { foundReg = true; return(true); } return(false); } WaterRegionTraverser.BreadthFirstTraverse(region, entryCondition, regionProcessor, 9999, RegionType.Set_Passable); return(foundReg); }
public bool CanReachMapEdge(IntVec3 c, TraverseParms traverseParms) { if (!(traverseParms.pawn is null)) { if (!traverseParms.pawn.Spawned) { return(false); } if (traverseParms.pawn.Map != this.map) { Log.Error(string.Concat(new object[] { "Called CanReachMapEdge() with a pawn spawned not on this map. This means that we can't check his reachability here. Pawn's current map should have been used instead of this one. pawn=", traverseParms.pawn, " pawn.Map=", traverseParms.pawn.Map, " map=", this.map }), false); return(false); } } WaterRegion region = WaterGridsUtility.GetRegion(c, this.map, RegionType.Set_Passable); if (region is null) { return(false); } if (region.Room.TouchesMapEdge) { return(true); } WaterRegionEntryPredicate entryCondition = (WaterRegion from, WaterRegion r) => r.Allows(traverseParms, false); bool foundReg = false; WaterRegionProcessor regionProcessor = delegate(WaterRegion r) { if (r.Room.TouchesMapEdge) { foundReg = true; return(true); } return(false); }; WaterRegionTraverser.BreadthFirstTraverse(region, entryCondition, regionProcessor, 9999, RegionType.Set_Passable); return(foundReg); }