public static bool IsAdjacentOrInsideAndAllowedToTouch(IntVec3 root, LocalTargetInfo target, Map map)
        {
            IntVec3 bL;
            IntVec3 tL;
            IntVec3 tR;
            IntVec3 bR;

            GenAdj.GetAdjacentCorners(target, out bL, out tL, out tR, out bR);
            return(root.AdjacentTo8WayOrInside(target) && !TouchPathEndModeUtility.IsAdjacentCornerAndNotAllowed(root, bL, tL, tR, bR, map));
        }
        public static bool IsAdjacentOrInsideAndAllowedToTouch(IntVec3 root, LocalTargetInfo target, Map map)
        {
            IntVec3 bl;
            IntVec3 tl;
            IntVec3 tr;
            IntVec3 br;

            GenAdj.GetAdjacentCorners(target, out bl, out tl, out tr, out br);
            return(root.AdjacentTo8WayOrInside(target) && !TouchPathEndModeUtility.IsAdjacentCornerAndNotAllowed(root, bl, tl, tr, br, map));
        }
        public static bool IsCornerTouchAllowed(int cornerX, int cornerZ, int adjCardinal1X, int adjCardinal1Z, int adjCardinal2X, int adjCardinal2Z, Map map)
        {
            Building building = map.edificeGrid[new IntVec3(cornerX, 0, cornerZ)];

            if (building != null && TouchPathEndModeUtility.MakesOccupiedCellsAlwaysReachableDiagonally(building.def))
            {
                return(true);
            }
            IntVec3 intVec  = new IntVec3(adjCardinal1X, 0, adjCardinal1Z);
            IntVec3 intVec2 = new IntVec3(adjCardinal2X, 0, adjCardinal2Z);

            return((map.pathGrid.Walkable(intVec) && intVec.GetDoor(map) == null) || (map.pathGrid.Walkable(intVec2) && intVec2.GetDoor(map) == null));
        }
 public static bool IsAdjacentCornerAndNotAllowed(IntVec3 cell, IntVec3 BL, IntVec3 TL, IntVec3 TR, IntVec3 BR, Map map)
 {
     if (cell == BL && !TouchPathEndModeUtility.IsCornerTouchAllowed(BL.x + 1, BL.z + 1, BL.x + 1, BL.z, BL.x, BL.z + 1, map))
     {
         return(true);
     }
     if (cell == TL && !TouchPathEndModeUtility.IsCornerTouchAllowed(TL.x + 1, TL.z - 1, TL.x + 1, TL.z, TL.x, TL.z - 1, map))
     {
         return(true);
     }
     if (cell == TR && !TouchPathEndModeUtility.IsCornerTouchAllowed(TR.x - 1, TR.z - 1, TR.x - 1, TR.z, TR.x, TR.z - 1, map))
     {
         return(true);
     }
     if (cell == BR && !TouchPathEndModeUtility.IsCornerTouchAllowed(BR.x - 1, BR.z + 1, BR.x - 1, BR.z, BR.x, BR.z + 1, map))
     {
         return(true);
     }
     return(false);
 }
        public static void AddAllowedAdjacentRegions(LocalTargetInfo dest, TraverseParms traverseParams, Map map, List <Region> regions)
        {
            IntVec3 bL;
            IntVec3 tL;
            IntVec3 tR;
            IntVec3 bR;

            GenAdj.GetAdjacentCorners(dest, out bL, out tL, out tR, out bR);
            if (!dest.HasThing || (dest.Thing.def.size.x == 1 && dest.Thing.def.size.z == 1))
            {
                IntVec3 cell = dest.Cell;
                for (int i = 0; i < 8; i++)
                {
                    IntVec3 intVec = GenAdj.AdjacentCells[i] + cell;
                    if (intVec.InBounds(map) && !TouchPathEndModeUtility.IsAdjacentCornerAndNotAllowed(intVec, bL, tL, tR, bR, map))
                    {
                        Region region = intVec.GetRegion(map, RegionType.Set_Passable);
                        if (region != null && region.Allows(traverseParams, true))
                        {
                            regions.Add(region);
                        }
                    }
                }
            }
            else
            {
                List <IntVec3> list = GenAdjFast.AdjacentCells8Way(dest);
                for (int j = 0; j < list.Count; j++)
                {
                    if (list[j].InBounds(map) && !TouchPathEndModeUtility.IsAdjacentCornerAndNotAllowed(list[j], bL, tL, tR, bR, map))
                    {
                        Region region2 = list[j].GetRegion(map, RegionType.Set_Passable);
                        if (region2 != null && region2.Allows(traverseParams, true))
                        {
                            regions.Add(region2);
                        }
                    }
                }
            }
        }
예제 #6
0
 private bool IsCornerTouchAllowed(int cornerX, int cornerZ, int adjCardinal1X, int adjCardinal1Z, int adjCardinal2X, int adjCardinal2Z)
 {
     return(TouchPathEndModeUtility.IsCornerTouchAllowed(cornerX, cornerZ, adjCardinal1X, adjCardinal1Z, adjCardinal2X, adjCardinal2Z, this.map));
 }