Beispiel #1
0
        private static IntVec3 FindArtySpot(ThingDef artyDef, Rot4 rot, Map map)
        {
            CellRect cellRect = CellRect.CenteredOn(SiegeBlueprintPlacer.center, 8);

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

            while (true)
            {
                num++;
                if (num > 200)
                {
                    break;
                }
                IntVec3 randomCell = cellRect.RandomCell;
                if (map.reachability.CanReach(randomCell, SiegeBlueprintPlacer.center, PathEndMode.OnCell, TraverseMode.NoPassClosedDoors, Danger.Deadly))
                {
                    if (!randomCell.Roofed(map))
                    {
                        if (SiegeBlueprintPlacer.CanPlaceBlueprintAt(randomCell, rot, artyDef, map))
                        {
                            return(randomCell);
                        }
                    }
                }
            }
            return(IntVec3.Invalid);
        }
Beispiel #2
0
        private static IEnumerable <Blueprint_Build> MakeSandbagLine(IntVec3 root, Map map, Rot4 growDir, int maxLength)
        {
            int i = 0;

            if (i < maxLength && SiegeBlueprintPlacer.CanPlaceBlueprintAt(root, Rot4.North, ThingDefOf.Sandbags, map))
            {
                yield return(GenConstruct.PlaceBlueprintForBuild(ThingDefOf.Sandbags, root, map, Rot4.North, SiegeBlueprintPlacer.faction, null));

                /*Error: Unable to find new state assignment for yield return*/;
            }
        }
Beispiel #3
0
        private static IEnumerable <Blueprint_Build> MakeSandbagLine(IntVec3 root, Map map, Rot4 growDir, int maxLength)
        {
            IntVec3 cur = root;

            for (int i = 0; i < maxLength; i++)
            {
                if (!SiegeBlueprintPlacer.CanPlaceBlueprintAt(cur, Rot4.North, ThingDefOf.Sandbags, map))
                {
                    break;
                }
                yield return(GenConstruct.PlaceBlueprintForBuild(ThingDefOf.Sandbags, cur, map, Rot4.North, SiegeBlueprintPlacer.faction, null));

                SiegeBlueprintPlacer.placedSandbagLocs.Add(cur);
                cur += growDir.FacingCell;
            }
        }
Beispiel #4
0
        private static IntVec3 FindSandbagRoot(Map map)
        {
            CellRect cellRect = CellRect.CenteredOn(SiegeBlueprintPlacer.center, 13);

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

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

            for (;;)
            {
                num++;
                if (num > 200)
                {
                    break;
                }
                randomCell = cellRect.RandomCell;
                if (!cellRect2.Contains(randomCell))
                {
                    if (map.reachability.CanReach(randomCell, SiegeBlueprintPlacer.center, PathEndMode.OnCell, TraverseMode.NoPassClosedDoors, Danger.Deadly))
                    {
                        if (SiegeBlueprintPlacer.CanPlaceBlueprintAt(randomCell, Rot4.North, ThingDefOf.Sandbags, map))
                        {
                            bool flag = false;
                            for (int i = 0; i < SiegeBlueprintPlacer.placedSandbagLocs.Count; i++)
                            {
                                float num2 = (float)(SiegeBlueprintPlacer.placedSandbagLocs[i] - randomCell).LengthHorizontalSquared;
                                if (num2 < 36f)
                                {
                                    flag = true;
                                }
                            }
                            if (!flag)
                            {
                                goto IL_104;
                            }
                        }
                    }
                }
            }
            return(IntVec3.Invalid);

IL_104:
            return(randomCell);
        }