public static bool CanReach(this Reachability reachability, IntVec3 start, LocalTargetInfo dest, PathEndMode peMode, TraverseParms traverseParams) { // NOTE: not checking reachability.working if (traverseParams.thing != null) { if (!traverseParams.thing.Spawned) { return(false); } // ERROR: thing.map != this.map } if (ReachabilityImmediate.CanReachImmediate(start, dest, reachability.GetMap(), peMode, traverseParams.thing)) { return(true); } if (!dest.IsValid) { return(false); } if (dest.HasThing && dest.Thing.Map != reachability.GetMap()) { return(false); } if (!start.InBounds(reachability.GetMap()) || !dest.Cell.InBounds(reachability.GetMap())) { return(false); } if (peMode == PathEndMode.OnCell || peMode == PathEndMode.Touch || peMode == PathEndMode.ClosestTouch) { Room room = RegionAndRoomQuery.RoomAtFast(start, reachability.GetMap(), RegionType.Set_Passable); if (room != null && room == RegionAndRoomQuery.RoomAtFast(dest.Cell, reachability.GetMap(), RegionType.Set_Passable)) { return(true); } } return(true); // TEMP }
public static bool CanReachImmediate(this Thing thing, LocalTargetInfo target, PathEndMode peMode) { return(thing.Spawned && ReachabilityImmediate.CanReachImmediate(thing.Position, target, thing.Map, peMode, thing)); }