Пример #1
0
        public static IntVec3 FindRadialCardinalPlacementFor(ThingDef def, Rot4 rot, IntVec3 centre, int radius)
        {
            byte rotb = (byte)Rand.Range(0, 4);

            for (int i = 0; i < 4; i++)
            {
                rotb++;
                var endpoint = centre + (rotb.ToIntVec3() * radius);

                if (!endpoint.InBounds(info.map))
                {
                    continue;
                }

                foreach (var cell in centre.CellsInLineTo(endpoint))
                {
                    // Try directly on line
                    if (info.map.reachability.CanReach(cell, info.carnivalArea.CenterCell, Verse.AI.PathEndMode.OnCell, TraverseMode.NoPassClosedDoors, Danger.Deadly))
                    {
                        if (CanPlaceBlueprintAt(cell, def, rot))
                        {
                            return(cell);
                        }
                    }
                }
            }

            return(IntVec3.Invalid);
        }