private bool TryRecoverFromUnwalkablePosition() { if (GenWorldClosest.TryFindClosestTile(caravan.Tile, (int t) => IsPassable(t), out var foundTile)) { Log.Warning(string.Concat(caravan, " on unwalkable tile ", caravan.Tile, ". Teleporting to ", foundTile)); caravan.Tile = foundTile; caravan.Notify_Teleported(); return(true); } Log.Error(string.Concat(caravan, " on unwalkable tile ", caravan.Tile, ". Could not find walkable position nearby. Removed.")); caravan.Destroy(); return(false); }
private bool TryRecoverFromUnwalkablePosition() { if (GenWorldClosest.TryFindClosestTile(caravan.Tile, (int t) => IsPassable(t), out int foundTile)) { Log.Warning(caravan + " on unwalkable tile " + caravan.Tile + ". Teleporting to " + foundTile); caravan.Tile = foundTile; caravan.Notify_Teleported(); return(true); } Find.WorldObjects.Remove(caravan); Log.Error(caravan + " on unwalkable tile " + caravan.Tile + ". Could not find walkable position nearby. Removed."); return(false); }