public PlacementReport CanPlace(IntVec3 origin)
        {
            // get rotated cell position
            var cell = origin + Position;

            // if the designator's check passes, we can safely assume it's OK to build here
            if (Designator.CanDesignateCell(cell).Accepted)
            {
                return(PlacementReport.CanPlace);
            }

            // otherwise, check if the same thing (or it's blueprint/frame stages) already exists here
            // terrain and thing both have bluePrint and frame in thinglist, as are things. Terrains are not a thing, and retrieved with GetTerrain().
            var cellDefs = cell.GetThingList(Find.VisibleMap).Select(thing => thing.def).ToList();

            if (cellDefs.Contains(BuildableDef as ThingDef) ||
                cell.GetTerrain(Find.VisibleMap) == BuildableDef as TerrainDef ||
                cellDefs.Contains(BuildableDef.blueprintDef) ||
                cellDefs.Contains(BuildableDef.frameDef))
            {
                return(PlacementReport.Alreadyplaced);
            }

            // finally, default to returning false.
            return(PlacementReport.CanNotPlace);
        }
 private void MakeMatchingGrowZone()
 {
     Designator designator = DesignatorUtility.FindAllowedDesignator<Designator_ZoneAdd_Growing>();
     designator.DesignateMultiCell(from tempCell in GrowableCells
                                   where designator.CanDesignateCell(tempCell).Accepted
                                   select tempCell);
 }
Example #3
0
        private void MakeMatchingStockpile()
        {
            Designator des = DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>();

            des.DesignateMultiCell(from c in this.PortableCells
                                   where des.CanDesignateCell(c).Accepted
                                   select c);
        }
Example #4
0
 public override AcceptanceReport CanDesignateCell(IntVec3 loc)
 {
     return(activeDesignator.CanDesignateCell(loc));
 }
        private void MakeMatchingGrowZone()
        {
            Designator designator = DesignatorUtility.FindAllowedDesignator <Designator_ZoneAdd_Growing>();

            designator.DesignateMultiCell(GrowableCells.Where((IntVec3 tempCell) => designator.CanDesignateCell(tempCell).Accepted));
        }
        private void MakeMatchingStockpile()
        {
            Designator des = DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>();

            des.DesignateMultiCell(TradeableCells.Where((IntVec3 c) => des.CanDesignateCell(c).Accepted));
        }