private static IntVec3 FindCoverRoot(Map map, ThingDef coverDef, ThingDef coverStuff)
        {
            var      centre          = (IntVec3)NonPublicFields.SiegeBlueprintPlacer_center.GetValue(null);
            var      placedCoverLocs = (List <IntVec3>)NonPublicFields.SiegeBlueprintPlacer_placedCoverLocs.GetValue(null);
            CellRect cellRect        = CellRect.CenteredOn(centre, 13);

            cellRect.ClipInsideMap(map);
            CellRect cellRect2 = CellRect.CenteredOn(centre, 8);

            cellRect2.ClipInsideMap(map);
            int num = 0;

            for (; ;)
            {
                num++;
                if (num > 200)
                {
                    break;
                }
                IntVec3 randomCell = cellRect.RandomCell;
                if (!cellRect2.Contains(randomCell))
                {
                    if (map.reachability.CanReach(randomCell, centre, PathEndMode.OnCell, TraverseMode.NoPassClosedDoors, Danger.Deadly))
                    {
                        if (NonPublicMethods.SiegeBlueprintPlacer_CanPlaceBlueprintAt(randomCell, Rot4.North, coverDef, map, coverStuff))
                        {
                            bool flag = false;
                            for (int i = 0; i < placedCoverLocs.Count; i++)
                            {
                                float num2 = (float)(placedCoverLocs[i] - randomCell).LengthHorizontalSquared;
                                if (num2 < 36f)
                                {
                                    flag = true;
                                }
                            }
                            if (!flag)
                            {
                                return(randomCell);
                            }
                        }
                    }
                }
            }
            return(IntVec3.Invalid);
        }
        private static IEnumerable <Blueprint_Build> MakeCoverLine(IntVec3 root, Map map, Rot4 growDir, int maxLength, ThingDef coverThing, ThingDef coverStuff)
        {
            var     placedSandbagLocs = (List <IntVec3>)NonPublicFields.SiegeBlueprintPlacer_placedCoverLocs.GetValue(null);
            IntVec3 cur = root;

            for (int i = 0; i < maxLength; i++)
            {
                if (!NonPublicMethods.SiegeBlueprintPlacer_CanPlaceBlueprintAt(cur, Rot4.North, coverThing, map, coverStuff))
                {
                    break;
                }
                yield return(GenConstruct.PlaceBlueprintForBuild(coverThing, cur, map, Rot4.North, (Faction)NonPublicFields.SiegeBlueprintPlacer_faction.GetValue(null), coverStuff));

                placedSandbagLocs.Add(cur);
                cur += growDir.FacingCell;
            }
            yield break;
        }