public static Thing FirstBlockingThing(Thing constructible, Pawn pawnToIgnore) { Blueprint blueprint = constructible as Blueprint; Thing thing; if (blueprint != null) { thing = GenConstruct.MiniToInstallOrBuildingToReinstall(blueprint); } else { thing = null; } CellRect.CellRectIterator iterator = constructible.OccupiedRect().GetIterator(); while (!iterator.Done()) { List <Thing> thingList = iterator.Current.GetThingList(constructible.Map); for (int i = 0; i < thingList.Count; i++) { Thing thing2 = thingList[i]; if (GenConstruct.BlocksConstruction(constructible, thing2) && thing2 != pawnToIgnore && thing2 != thing) { return(thing2); } } iterator.MoveNext(); } return(null); }
public static bool IsGoodStoreCell(IntVec3 c, Map map, Thing t, Pawn carrier, Faction faction) { bool result; if (carrier != null && c.IsForbidden(carrier)) { result = false; } else if (!StoreUtility.NoStorageBlockersIn(c, map, t)) { result = false; } else { if (carrier != null) { if (!carrier.CanReserveNew(c)) { return(false); } } else if (faction != null && map.reservationManager.IsReservedByAnyoneOf(c, faction)) { return(false); } if (c.ContainsStaticFire(map)) { result = false; } else { List <Thing> thingList = c.GetThingList(map); for (int i = 0; i < thingList.Count; i++) { if (thingList[i] is IConstructible && GenConstruct.BlocksConstruction(thingList[i], t)) { return(false); } } result = (carrier == null || carrier.Map.reachability.CanReach((!t.SpawnedOrAnyParentSpawned) ? carrier.PositionHeld : t.PositionHeld, c, PathEndMode.ClosestTouch, TraverseParms.For(carrier, Danger.Deadly, TraverseMode.ByPawn, false))); } } return(result); }