public override AcceptanceReport AllowsPlacing(BuildableDef checkingDef, IntVec3 loc, Rot4 rot)
        {
            IEnumerable <IntVec3> cells = GenAdj.CellsOccupiedBy(loc, rot, checkingDef.Size);

            foreach (IntVec3 cell in cells)
            {
                Zone_Stockpile zoneStockpile = cell.GetZone() as Zone_Stockpile;
                if (zoneStockpile != null && zoneStockpile.FindWarehouse() != null)
                {
                    return("PlaceWorker_RTOnlyOneQWPerZone".Translate());
                }
            }
            return(true);
        }
Пример #2
0
 public static CompRTQuantumWarehouse FindWarehouse(this Thing thing)
 {
     if (thing != null)
     {
         Zone_Stockpile zoneStockpile = null;
         foreach (IntVec3 cell in thing.OccupiedRect().Cells)
         {
             Zone zone = cell.GetZone();
             if (zone != null && zone.GetType().ToString().Equals("RimWorld.Zone_Stockpile"))
             {
                 zoneStockpile = zone as Zone_Stockpile;
                 break;
             }
         }
         if (zoneStockpile != null)
         {
             return(zoneStockpile.FindWarehouse());
         }
     }
     return(null);
 }