protected override void Complete(SignalArgs signalArgs) { Map map = (returnMap == null) ? Find.AnyPlayerHomeMap : returnMap.Map; if (map != null) { base.Complete(new SignalArgs(new LookTargets(lentColonists).Named("SUBJECT"), lentColonists.Select((Thing c) => c.LabelShort).ToCommaList(useAnd: true).Named("PAWNS"))); if (lendColonistsToFaction == Faction.Empire) { SkyfallerUtility.MakeDropoffShuttle(map, lentColonists, Faction.Empire); } else { DropPodUtility.DropThingsNear(DropCellFinder.TradeDropSpot(map), map, lentColonists, 110, canInstaDropDuringInit: false, leaveSlag: false, canRoofPunch: true, forbid: false); } } }
public static bool TryFindDropSpotNear(IntVec3 center, Map map, out IntVec3 result, bool allowFogged, bool canRoofPunch, bool willExplode) { if (DebugViewSettings.drawDestSearch) { map.debugDrawer.FlashCell(center, 1f, "center", 50); } Predicate <IntVec3> validator = (IntVec3 c) => DropCellFinder.IsGoodDropSpot(c, map, allowFogged, canRoofPunch) && map.reachability.CanReach(center, c, PathEndMode.OnCell, TraverseMode.PassDoors, Danger.Deadly) && (!willExplode || !SkyfallerUtility.CanPossiblyFallOnColonist(ThingDefOf.ExplosiveDropPodIncoming, c, map)); int num = 5; while (!CellFinder.TryFindRandomCellNear(center, map, num, validator, out result, -1)) { num += 3; if (num > 16) { result = center; return(false); } } return(true); }