Class DungeonTools

java.lang.Object
com.github.yellowstonegames.place.DungeonTools

public final class DungeonTools extends Object
A static class that can be used to modify the char[][] dungeons that other generators produce. Includes constants to describe environment types encountered in possible dungeons, which are used elsewhere. Here, 2D char arrays are always indexed with x, then y. Has methods to open and close doors represented by '+' and '/'. Can double the width of a 2D char array while respecting both ASCII and Unicode box drawing chars for walls, or undo that operation. Can simplify 2D char arrays to use '#' for any wall and '.' for any floor. Can add random paths to existing maps to guarantee they can be traversed from one point to another. Can wrap a 2D char array with '#' chars for walls.
The earlier DungeonUtility class in SquidLib had various methods that have since been moved to LineTools, such as the often-used LineTools.hashesToLines(char[][]). This class still has debugPrint(char[][]), but new code may want to prefer StringTools.printChar2D(char[][]), which calls the same code.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Bit flag used by other constants to indicate they are floors, or if absent, that they are walls.
    static final int
    A bit flag mask that can be used to isolate the bits that indicate whether an environment int value is a room, natural area, or corridor, regardless of floor/wall status.
    static final int
    A bit flag mask that can be used to isolate only the bits used in constants defined by DungeonTools.
    static final int
    Constant for environment tiles that are floors for a corridor.
    static final int
    Constant for environment tiles that are walls near a corridor.
    static final int
    A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can swim or otherwise move through deep water.
    static final int
    A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can move without risking death through intense heat and/or fire, such as a path blocked by lava.
    static final int
    A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can jump or fly some higher-than-normal amount vertically, such as to get up and out of a pit.
    static final int
    A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can jump or fly some longer-than-normal amount horizontally, such as to get over a low hazard.
    static final int
    A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can open doors with a free hand.
    static final int[]
    All bit-flag constants that represent locks.
    static final int
    Constant for environment tiles that are floors for a cave or other natural part of a map.
    static final int
    Constant for environment tiles that are walls near a cave or other natural part of a map.
    static final int
    Constant for environment tiles that are floors for a room.
    static final int
    Constant for environment tiles that are walls near a room.
    static final int
    Constant for environment tiles that are not near a cave, room, or corridor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>
    allMatching(char[][] map, char... matching)
     
    boolean
    checkLock(int environment, int lock)
    For the optional lock-and-key puzzle system, checks if an environment cell has access prohibited by a given lock.
    static List<com.github.yellowstonegames.grid.Coord>
    circle(int x, int y, int radius, List<com.github.yellowstonegames.grid.Coord> buf)
    Gets a List of Coord that are within radius distance of (x,y), and appends them to buf if it is non-null or makes a fresh List to append to otherwise.
    static char[][]
    closeDoors(char[][] map)
    When a map is generated by DungeonProcessor with addDoors enabled, different chars are used for vertical and horizontal doors ('+' for vertical and '/' for horizontal).
    static char[][]
    closeDoorsInPlace(char[][] map, int[][] environment)
    When a map is generated by DungeonProcessor with addDoors enabled, different chars are used for vertical and horizontal doors ('+' for vertical and '/' for horizontal).
    static int
    countCells(char[][] level, char match)
    Quickly counts the number of char elements in level that are equal to match.
    static void
    debugPrint(char[][] level)
    Prints a 2D char array without padding.
    static char[][]
    doubleWidth(char[][] map)
    Takes a dungeon map with either '#' as the only wall character or the Unicode box drawing characters used by LineTools.hashesToLines(char[][]).
    static com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>
    ensurePath(char[][] map, com.github.tommyettinger.random.EnhancedRandom rng, char replacement, char... blocking)
    Ensures a path exists in a rough ring around the map by first creating the path (using pointPath(int, int, EnhancedRandom) with the given EnhancedRandom), then finding chars in blocking that are on that path and replacing them with replacement.
    int
    getLevel(int environment)
    Gets the abstract "level" concept that can mean anything and is associated with a given environment cell.
    static boolean
    inLevel(char[][] level, int x, int y)
     
    static boolean
    inLevel(char[][] level, com.github.yellowstonegames.grid.Coord c)
     
    static boolean
    inLevel(float[][] level, int x, int y)
     
    static boolean
    inLevel(float[][] level, com.github.yellowstonegames.grid.Coord c)
     
    static <T> boolean
    inLevel(T[][] level, int x, int y)
     
    static <T> boolean
    inLevel(T[][] level, com.github.yellowstonegames.grid.Coord c)
     
    boolean
    isCorridor(int environment)
    Checks an environment int and returns true if it represents any type of corridor cell (floor or wall).
    boolean
    isFloor(int environment)
    Checks an environment int and returns true if it represents any type of floor (passable cell).
    boolean
    isNatural(int environment)
    Checks an environment int and returns true if it represents any type of natural cell (floor or wall).
    boolean
    isRoom(int environment)
    Checks an environment int and returns true if it represents any type of room cell (floor or wall).
    boolean
    isWall(int environment)
    Checks an environment int and returns true if it represents any type of wall (impassable cell).
    static char[][]
    openDoors(char[][] map)
    When a map is generated by DungeonProcessor with addDoors enabled, different chars are used for vertical and horizontal doors ('+' for vertical and '/' for horizontal).
    static char[][]
    openDoorsInPlace(char[][] map, int[][] environment)
    When a map is generated by DungeonProcessor with addDoors enabled, different chars are used for vertical and horizontal doors ('+' for vertical and '/' for horizontal).
    static com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>
    pointPath(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng)
     
    static char[][]
    simplifyDungeon(char[][] map)
    Takes a char[][] dungeon map and returns a copy with all box drawing chars, special placeholder chars, or '#' chars changed to '#' and everything else changed to '.' .
    static char[][]
    unDoubleWidth(char[][] map)
    Takes a dungeon map that uses two characters per cell, and condenses it to use only the left (lower index) character in each cell.
    static char[][]
    wallWrap(char[][] map)
    Changes the outer edge of a char[][] to the wall char, '#'.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • UNTOUCHED

      public static final int UNTOUCHED
      Constant for environment tiles that are not near a cave, room, or corridor. Value is 0. Used by several classes that distinguish types of dungeon environment.
      This isn't really a bit flag, but if used as one in conjunction with ANY_FLOOR, it is treated as a wall.
      See Also:
    • ANY_FLOOR

      public static final int ANY_FLOOR
      Bit flag used by other constants to indicate they are floors, or if absent, that they are walls. All floors are considered possible to pass through for pathfinding purposes, and all walls are considered impassable. This constant should not be used on its own in an environment 2D array. You can check if an environment value is any type of floor with (env & ANY_FLOOR) == ANY_FLOOR, or is any type of wall with (env & ANY_FLOOR) != ANY_FLOOR.
      See Also:
    • ROOM_WALL

      public static final int ROOM_WALL
      Constant for environment tiles that are walls near a room. Value is 2. Used by several classes that distinguish types of dungeon environment.
      This is a bit flag. It can be used with env == ROOM_WALL to check if an environment int value is a wall in a room (and nothing else). Use (env & ROOM_WALL) == ROOM_WALL to check if an environment int value is any kind of room value (room wall or room floor, even if other flags are set). Use (env & ROOM_FLOOR) == ROOM_WALL to check if env represents a wall in a room, potentially with other flags.
      See Also:
    • ROOM_FLOOR

      public static final int ROOM_FLOOR
      Constant for environment tiles that are floors for a room. Value is 3. Used by several classes that distinguish types of dungeon environment.
      This is a bit flag. It can be treated as ROOM_WALL | ANY_FLOOR. You can compare an environment int value to this with env == ROOM_FLOOR to check if it represents a floor in a room (and nothing else). Use (env & ROOM_FLOOR) == ROOM_FLOOR to check if env represents a floor in a room, potentially with other flags. Use (env & ROOM_FLOOR) == ROOM_WALL to check if env represents a wall in a room, potentially with other flags.
      See Also:
    • NATURAL_WALL

      public static final int NATURAL_WALL
      Constant for environment tiles that are walls near a cave or other natural part of a map. Value is 4. Used by several classes that distinguish types of dungeon environment. May be used by WildernessGenerator for ledges and other natural obstacles.
      This is a bit flag. It can be used with env == NATURAL_WALL to check if an environment int value is a wall in a natural area (and nothing else). Use (env & NATURAL_WALL) == NATURAL_WALL to check if an environment int value is any kind of natural area (wall or floor, even if other flags are set). Use (env & NATURAL_FLOOR) == NATURAL_WALL to check if env represents a wall in a natural area, potentially with other flags.
      See Also:
    • NATURAL_FLOOR

      public static final int NATURAL_FLOOR
      Constant for environment tiles that are floors for a cave or other natural part of a map. Value is 5. Used by several classes that distinguish types of dungeon environment. Also used by WildernessGenerator for almost everything it generates.
      This is a bit flag. It can be treated as NATURAL_WALL | ANY_FLOOR. You can compare an environment int value to this with env == NATURAL_FLOOR to check if it represents a floor in a natural area (and nothing else). Use (env & NATURAL_FLOOR) == NATURAL_FLOOR to check if env represents a floor in a natural area, potentially with other flags. Use (env & NATURAL_FLOOR) == NATURAL_WALL to check if env represents a wall in a natural area, potentially with other flags.
      See Also:
    • CORRIDOR_WALL

      public static final int CORRIDOR_WALL
      Constant for environment tiles that are walls near a corridor. Value is 8. Used by several classes that distinguish types of dungeon environment.
      This is a bit flag. It can be treated as CORRIDOR_WALL | ANY_FLOOR. You can compare an environment int value to this with env == CORRIDOR_FLOOR to check if it represents a floor in a corridor (and nothing else). Use (env & CORRIDOR_FLOOR) == CORRIDOR_FLOOR to check if env represents a floor in a corridor, potentially with other flags. Use (env & CORRIDOR_FLOOR) == CORRIDOR_WALL to check if env represents a wall in a corridor, potentially with other flags.
      See Also:
    • CORRIDOR_FLOOR

      public static final int CORRIDOR_FLOOR
      Constant for environment tiles that are floors for a corridor. Value is 9. Used by several classes that distinguish types of dungeon environment.
      This is a bit flag. It can be treated as CORRIDOR_WALL | ANY_FLOOR. You can compare an environment int value to this with env == CORRIDOR_FLOOR to check if it represents a floor in a corridor (and nothing else). Use (env & CORRIDOR_FLOOR) == CORRIDOR_FLOOR to check if env represents a floor in a corridor, potentially with other flags. Use (env & CORRIDOR_FLOOR) == CORRIDOR_WALL to check if env represents a wall in a corridor, potentially with other flags.
      See Also:
    • AREA_MASK

      public static final int AREA_MASK
      A bit flag mask that can be used to isolate the bits that indicate whether an environment int value is a room, natural area, or corridor, regardless of floor/wall status. Use (env & AREA_MASK) == wallConstant, where wallConstant is your choice of ROOM_WALL, NATURAL_WALL, or CORRIDOR_WALL, to identify if that int is your selected area.
      See Also:
    • CORE_ENVIRONMENT_MASK

      public static final int CORE_ENVIRONMENT_MASK
      A bit flag mask that can be used to isolate only the bits used in constants defined by DungeonTools. Use (env & CORE_ENVIRONMENT_MASK) == someConstant, wheresomeConstant is any constant from DungeonTools, to tell which one it is even if there are other flags present. Note that this will identify bit flags with no bits from DungeonTools constants as UNTOUCHED.
      See Also:
    • LOCK_NEEDS_HAND

      public static final int LOCK_NEEDS_HAND
      A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can open doors with a free hand. This should block animals from entering areas that require opening a door to access. It may also temporarily block people who are frozen numb, for instance, or creatures like vampires who aren't allowed to open a door themselves in some versions.
      This is lock 0.
      See Also:
    • LOCK_DEEP_WATER

      public static final int LOCK_DEEP_WATER
      A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can swim or otherwise move through deep water.
      This is lock 1.
      See Also:
    • LOCK_FIRE

      public static final int LOCK_FIRE
      A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can move without risking death through intense heat and/or fire, such as a path blocked by lava.
      This is lock 2.
      See Also:
    • LOCK_HIGH_JUMP

      public static final int LOCK_HIGH_JUMP
      A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can jump or fly some higher-than-normal amount vertically, such as to get up and out of a pit.
      This is lock 3.
      See Also:
    • LOCK_LONG_JUMP

      public static final int LOCK_LONG_JUMP
      A lock for the optional lock-and-key system that indicates an area can only be accessed by creatures who can jump or fly some longer-than-normal amount horizontally, such as to get over a low hazard.
      This is lock 4.
      See Also:
    • LOCKS

      public static final int[] LOCKS
      All bit-flag constants that represent locks. There are 20 constants here, and any one can be passed to checkLock(int, int) as its lock parameter.
  • Method Details

    • isFloor

      public boolean isFloor(int environment)
      Checks an environment int and returns true if it represents any type of floor (passable cell).
      Parameters:
      environment - an environment int, typically taken from PlaceGenerator.getEnvironment()
      Returns:
      true if the int represents any passable terrain cell
    • isWall

      public boolean isWall(int environment)
      Checks an environment int and returns true if it represents any type of wall (impassable cell).
      Parameters:
      environment - an environment int, typically taken from PlaceGenerator.getEnvironment()
      Returns:
      true if the int represents any impassable terrain cell
    • isRoom

      public boolean isRoom(int environment)
      Checks an environment int and returns true if it represents any type of room cell (floor or wall).
      Parameters:
      environment - an environment int, typically taken from PlaceGenerator.getEnvironment()
      Returns:
      true if the int represents any room cell
    • isCorridor

      public boolean isCorridor(int environment)
      Checks an environment int and returns true if it represents any type of corridor cell (floor or wall).
      Parameters:
      environment - an environment int, typically taken from PlaceGenerator.getEnvironment()
      Returns:
      true if the int represents any corridor cell
    • isNatural

      public boolean isNatural(int environment)
      Checks an environment int and returns true if it represents any type of natural cell (floor or wall).
      Parameters:
      environment - an environment int, typically taken from PlaceGenerator.getEnvironment()
      Returns:
      true if the int represents any natural cell (such as cave walls or floors)
    • checkLock

      public boolean checkLock(int environment, int lock)
      For the optional lock-and-key puzzle system, checks if an environment cell has access prohibited by a given lock. There are 20 locks, all stored in LOCKS and some additionally available as constants in this class, such as LOCK_NEEDS_HAND or LOCK_DEEP_WATER.
      Parameters:
      environment - an environment int, typically taken from PlaceGenerator.getEnvironment()
      lock - either from LOCKS or a constant from this class such as LOCK_NEEDS_HAND
      Returns:
      true if the environment cell has locked access by the given lock
    • getLevel

      public int getLevel(int environment)
      Gets the abstract "level" concept that can mean anything and is associated with a given environment cell. The "level" starts at 0 and can go up to 255, inclusive. It can be used to mean the approximate power of enemies in an area, as one meaning, or a linear score of some kind needed or preferred to enter the area. It is separate from the optional lock-and-key system, which allows any locks to be passed independently of any others.
      Parameters:
      environment - an environment int, typically taken from PlaceGenerator.getEnvironment()
      Returns:
      an int between 0 and 255, drawn from the given environment cell
    • closeDoors

      public static char[][] closeDoors(char[][] map)
      When a map is generated by DungeonProcessor with addDoors enabled, different chars are used for vertical and horizontal doors ('+' for vertical and '/' for horizontal). This makes all doors '+', which is useful if you want '/' to be used for a different purpose and/or to distinguish open and closed doors.
      Parameters:
      map - a char[][] that may have both '+' and '/' for doors
      Returns:
      a char[][] that only uses '+' for all doors
    • closeDoorsInPlace

      public static char[][] closeDoorsInPlace(char[][] map, int[][] environment)
      When a map is generated by DungeonProcessor with addDoors enabled, different chars are used for vertical and horizontal doors ('+' for vertical and '/' for horizontal). This makes all doors '+', which is useful if you want '/' to be used for a different purpose and/or to distinguish open and closed doors. This also takes and modifies an int 2D array, which is often generated by PlaceGenerator.getEnvironment(), and sets the optional lock value on all doors to enable LOCK_NEEDS_HAND. That lock is used to mean an area that can only be opened by someone with an available and working hand, but not an animal or mindless creature. This does not set the lock value on areas past closed doors, since that would need to know an entry point.
      Parameters:
      map - a char[][] that may have both '+' and '/' for doors, which will be modified in-place
      environment - an environment int[][], which will be modified in-place; must be at least as large as map
      Returns:
      map, after changes in-place
    • openDoors

      public static char[][] openDoors(char[][] map)
      When a map is generated by DungeonProcessor with addDoors enabled, different chars are used for vertical and horizontal doors ('+' for vertical and '/' for horizontal). This makes all doors '/', which is useful if you want '+' to be used for a different purpose and/or to distinguish open and closed doors.
      Parameters:
      map - a char[][] that may have both '+' and '/' for doors
      Returns:
      a char[][] that only uses '/' for all doors
    • openDoorsInPlace

      public static char[][] openDoorsInPlace(char[][] map, int[][] environment)
      When a map is generated by DungeonProcessor with addDoors enabled, different chars are used for vertical and horizontal doors ('+' for vertical and '/' for horizontal). This makes all doors '/', which is useful if you want '+' to be used for a different purpose and/or to distinguish open and closed doors. This also takes and modifies an int 2D array, which is often generated by PlaceGenerator.getEnvironment(), and sets the optional lock value on all doors to disable LOCK_NEEDS_HAND. That lock is used to mean an area that can only be opened by someone with an available and working hand, but not an animal or mindless creature. This does not change the lock value on areas past open doors, since that would need to know an entry point.
      Parameters:
      map - a char[][] that may have both '+' and '/' for doors, which will be modified in-place
      environment - an environment int[][], which will be modified in-place; must be at least as large as map
      Returns:
      map, after changes in-place
    • simplifyDungeon

      public static char[][] simplifyDungeon(char[][] map)
      Takes a char[][] dungeon map and returns a copy with all box drawing chars, special placeholder chars, or '#' chars changed to '#' and everything else changed to '.' .
      Parameters:
      map - a char[][] with different characters that can be simplified to "wall" or "floor"
      Returns:
      a copy of map with all box-drawing, placeholder, wall or space characters as '#' and everything else '.'
    • doubleWidth

      public static char[][] doubleWidth(char[][] map)
      Takes a dungeon map with either '#' as the only wall character or the Unicode box drawing characters used by LineTools.hashesToLines(char[][]). Returns a new char[][] dungeon map with two characters per cell, mostly filling the spaces next to non-walls with space characters. Only does anything different if a box-drawing character would continue into an adjacent cell, or if a '#' wall needs another '#' wall next to it. The recommended approach is to keep both the original non-double-width map and the newly-returned double-width map, since the single-width maps can be used more easily for pathfinding. If you need to undo this function, call unDoubleWidth().
      Parameters:
      map - a char[][] that uses either '#' or box-drawing characters for walls, but one per cell
      Returns:
      a widened copy of map that uses two characters for every cell, connecting box-drawing chars correctly
    • unDoubleWidth

      public static char[][] unDoubleWidth(char[][] map)
      Takes a dungeon map that uses two characters per cell, and condenses it to use only the left (lower index) character in each cell. This should (probably) only be called on the result of doubleWidth(), and will throw an exception if called on a map with an odd number of characters for width, such as "#...#" .
      Parameters:
      map - a char[][] that has been widened by doubleWidth()
      Returns:
      a copy of map that uses only one char per cell
    • inLevel

      public static boolean inLevel(char[][] level, com.github.yellowstonegames.grid.Coord c)
      Parameters:
      level - dungeon/map level as 2D char array. x,y indexed
      c - Coord to check
      Returns:
      true if c is valid in level, false otherwise.
    • inLevel

      public static boolean inLevel(char[][] level, int x, int y)
      Parameters:
      level - dungeon/map level as 2D char array. x,y indexed
      x - x coordinate to check
      y - y coordinate to check
      Returns:
      true if c is valid in level, false otherwise.
    • inLevel

      public static boolean inLevel(float[][] level, com.github.yellowstonegames.grid.Coord c)
      Parameters:
      level - dungeon/map level as 2D float array. x,y indexed
      c - Coord to check
      Returns:
      true if c is valid in level, false otherwise.
    • inLevel

      public static boolean inLevel(float[][] level, int x, int y)
      Parameters:
      level - dungeon/map level as 2D float array. x,y indexed
      x - x coordinate to check
      y - y coordinate to check
      Returns:
      true if c is valid in level, false otherwise.
    • inLevel

      public static <T> boolean inLevel(T[][] level, com.github.yellowstonegames.grid.Coord c)
      Parameters:
      level - a dungeon/map level as 2D array. x,y indexed
      c - Coord to check
      Returns:
      true if c is valid in level, false otherwise.
    • inLevel

      public static <T> boolean inLevel(T[][] level, int x, int y)
      Parameters:
      level - a dungeon/map level as 2D array. x,y indexed
      x - x coordinate to check
      y - y coordinate to check
      Returns:
      true if c is valid in level, false otherwise.
    • countCells

      public static int countCells(char[][] level, char match)
      Quickly counts the number of char elements in level that are equal to match.
      Parameters:
      level - the 2D char array to count cells in
      match - the char to search for
      Returns:
      the number of cells that matched
    • debugPrint

      public static void debugPrint(char[][] level)
      Prints a 2D char array without padding. Prints on multiple lines, with a trailing newline. To match how libGDX usually displays on the screen, this prints with the y-axis pointing up, that is, row 0 is at the bottom and the highest y-value is at the top.
      This delegates to StringTools.printChar2D(char[][]).
      Parameters:
      level - a 2D char array to print with a trailing newline
    • wallWrap

      public static char[][] wallWrap(char[][] map)
      Changes the outer edge of a char[][] to the wall char, '#'.
      Parameters:
      map - A char[][] that stores map data; will be modified in place
      Returns:
      the modified-in-place map with its edge replaced with '#'
    • pointPath

      public static com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord> pointPath(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng)
    • ensurePath

      public static com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord> ensurePath(char[][] map, com.github.tommyettinger.random.EnhancedRandom rng, char replacement, char... blocking)
      Ensures a path exists in a rough ring around the map by first creating the path (using pointPath(int, int, EnhancedRandom) with the given EnhancedRandom), then finding chars in blocking that are on that path and replacing them with replacement. Modifies map in-place and returns an ObjectList of Coord points that will always be on the path.
      Parameters:
      map - a 2D char array, x then y, etc. that will be modified directly; this is the "returned map"
      rng - used for random factors in the path choice
      replacement - the char that will fill be used where a path needs to be carved out; usually '.'
      blocking - an array or vararg of char that are considered blocking for the path and will be replaced if they are in the way
      Returns:
      the ObjectList of Coord points that are on the carved path, including existing non-blocking cells; will be empty if any parameters are invalid
    • allMatching

      public static com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord> allMatching(char[][] map, char... matching)
    • circle

      public static List<com.github.yellowstonegames.grid.Coord> circle(int x, int y, int radius, List<com.github.yellowstonegames.grid.Coord> buf)
      Gets a List of Coord that are within radius distance of (x,y), and appends them to buf if it is non-null or makes a fresh List to append to otherwise. Returns buf if non-null, else the fresh List of Coord. May produce Coord values that are not within the boundaries of a map, such as (-5,-4), if the center is too close to the edge or radius is too high. You can use Radius.inCircle(int, int, int, boolean, int, int, List) with surpassEdges as false if you want to limit Coords to within the map, or the more general Radius.pointsInside(int, int, int, boolean, int, int, List) on a Radius.SQUARE or Radius.DIAMOND enum value if you want a square or diamond shape.
      Parameters:
      x - center x of the circle
      y - center y of the circle
      radius - inclusive radius to extend from the center; radius 0 gives just the center
      buf - Where to add the coordinates, or null for this method to allocate a fresh list.
      Returns:
      The coordinates of a circle centered (x, y), whose diameter is (radius * 2) + 1.
      See Also:
      • if you want to keep the Coords within the bounds of the map