public static Blueprint_Build PlaceBlueprintForBuild(BuildableDef sourceDef, IntVec3 center, Map map, Rot4 rotation, Faction faction, ThingDef stuff)
        {
            Blueprint_Build blueprint_Build = (Blueprint_Build)ThingMaker.MakeThing(sourceDef.blueprintDef, null);

            blueprint_Build.SetFactionDirect(faction);
            blueprint_Build.stuffToUse = stuff;
            mineOut(map, center);
            GenSpawn.Spawn(blueprint_Build, center, map, rotation);
            return(blueprint_Build);
        }
        protected override int ProcessCell(IntVec3 c)
        {
            var hitCount   = 0;
            var cellThings = Find.VisibleMap.thingGrid.ThingsListAtFast(c);

            for (int i = 0; i < cellThings.Count; i++)
            {
                var thing = cellThings[i];
                if (thing.def.selectable && (thing.Faction == Faction.OfPlayer) && _newStuff != null)
                {
                    if (CanUseStuff(_newStuff, thing.def))
                    {
                        if (thing.def.IsBlueprint)
                        {
                            Blueprint_Build replaceBluePrint = (Blueprint_Build)ThingMaker.MakeThing(ThingDef.Named(thing.def.defName));
                            replaceBluePrint.SetFactionDirect(Faction.OfPlayer);
                            replaceBluePrint.stuffToUse = _newStuff;
                            GenSpawn.Spawn(replaceBluePrint, thing.Position, thing.Map, thing.Rotation);
                            thing.Destroy(DestroyMode.Cancel);
                        }
                        else if (thing.def.isFrame)
                        {
                            Frame replaceFrame = (Frame)ThingMaker.MakeThing(ThingDef.Named(thing.def.defName), _newStuff);
                            replaceFrame.SetFactionDirect(Faction.OfPlayer);
                            IntVec3 pos = thing.Position;
                            Map     map = thing.Map;
                            Rot4    rot = thing.Rotation;
                            //Destroys Frame's inner resourceContainer to reclaim resources
                            //Needs to be done before spawning new frame at loc (else resourceContainer goes MIA)
                            thing.Destroy(DestroyMode.Cancel);
                            GenSpawn.Spawn(replaceFrame, pos, map, rot);
                        }
                        hitCount++;
                    }
                }
            }
            return(hitCount);
        }