// Token: 0x06002764 RID: 10084 RVA: 0x0012C518 File Offset: 0x0012A918 public static void DropThingGroupsNear(IntVec3 dropCenter, Map map, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool canRoofPunch = true) { foreach (List <Thing> list in thingsGroups) { IntVec3 intVec; if (!DropThoughRoofCellFinder.TryFindDropSpotNear(dropCenter, map, out intVec, true, canRoofPunch)) { Log.Warning(string.Concat(new object[] { "DropThingsNear failed to find a place to drop ", list.FirstOrDefault <Thing>(), " near ", dropCenter, ". Dropping on random square instead." }), false); intVec = CellFinderLoose.RandomCellWith((IntVec3 c) => c.Walkable(map) && (c.Roofed(map) && c.GetRoof(map) != RoofDefOf.RoofRockThick), map, 1000); } for (int i = 0; i < list.Count; i++) { list[i].SetForbidden(true, false); } if (instaDrop) { foreach (Thing thing in list) { GenPlace.TryPlaceThing(thing, intVec, map, ThingPlaceMode.Near, null, null); } } else { ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); foreach (Thing item in list) { activeDropPodInfo.innerContainer.TryAddOrTransfer(item, true); } activeDropPodInfo.openDelay = openDelay; activeDropPodInfo.leaveSlag = leaveSlag; DropThroughRoofUtility.MakeTunnelAt(intVec, map, activeDropPodInfo); } } }
// Token: 0x06003688 RID: 13960 RVA: 0x001A0BAC File Offset: 0x0019EFAC public static bool TryFindRaidDropCenterClose(out IntVec3 spot, Map map) { Faction parentFaction = map.ParentFaction; if (parentFaction == null) { return(RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith((IntVec3 x) => DropThoughRoofCellFinder.CanPhysicallyDropInto(x, map, true) && !x.Fogged(map) && x.Standable(map), map, out spot)); } int num = 0; for (; ;) { IntVec3 root = IntVec3.Invalid; if (map.mapPawns.FreeHumanlikesSpawnedOfFaction(parentFaction).Count <Pawn>() > 0) { root = map.mapPawns.FreeHumanlikesSpawnedOfFaction(parentFaction).RandomElement <Pawn>().Position; } else { if (parentFaction == Faction.OfPlayer) { List <Building> allBuildingsColonist = map.listerBuildings.allBuildingsColonist; for (int i = 0; i < allBuildingsColonist.Count; i++) { if (DropThoughRoofCellFinder.TryFindDropSpotNear(allBuildingsColonist[i].Position, map, out root, true, true)) { break; } } } else { List <Thing> list = map.listerThings.ThingsInGroup(ThingRequestGroup.BuildingArtificial); for (int j = 0; j < list.Count; j++) { if (list[j].Faction == parentFaction && DropThoughRoofCellFinder.TryFindDropSpotNear(list[j].Position, map, out root, true, true)) { break; } } } if (!root.IsValid) { RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith((IntVec3 x) => DropThoughRoofCellFinder.CanPhysicallyDropInto(x, map, true) && !x.Fogged(map) && x.Standable(map), map, out root); } } spot = CellFinder.RandomClosewalkCellNear(root, map, 10, null); if (DropThoughRoofCellFinder.CanPhysicallyDropInto(spot, map, true) && !spot.Fogged(map)) { break; } num++; if (num > 300) { goto Block_10; } } return(true); Block_10: spot = CellFinderLoose.RandomCellWith((IntVec3 c) => DropThoughRoofCellFinder.CanPhysicallyDropInto(c, map, true), map, 1000); return(false); }