Module ROT.Map.BrogueRoom

BrogueRoom object.

Used by ROT.Map.Brogue to create maps with 'cross rooms'

Functions

init (dims[, doorX[, doorY]]) Constructor.
createEntranceRoom (availWidth, availHeight[, rng]) Create room at bottom center with dims 9x10 and 20x4
createRandomAt (x, y, dx, dy, options, rng) Create Random with position.
createRandomCenter (cx, cy, options, rng) Create Random with center position.
createRandom (availWidth, availHeight, options, rng) Create random with no position.
isValid (isWallCallback, canBeDugCallback) Use two callbacks to confirm room validity.
create (digCallback) Create.
addDoors (isWallCallback) Add all doors based on available walls.

Fields

min Generate Rectangle Two dimensions
min Generate Rectangle Two dimensions


Functions

init (dims[, doorX[, doorY]])
Constructor. creates a new BrogueRoom object with the assigned values

Parameters:

  • dims table Represents dimensions and positions of the rooms two rectangles
  • doorX int x-position of door (optional)
  • doorY int y-position of door (optional)
createEntranceRoom (availWidth, availHeight[, rng])
Create room at bottom center with dims 9x10 and 20x4

Parameters:

  • availWidth int Typically the width of the map.
  • availHeight int Typically the height of the map
  • rng userData A user defined object with a .random(self, min, max) method (optional)
createRandomAt (x, y, dx, dy, options, rng)
Create Random with position.

Parameters:

  • x int x-position of room
  • y int y-position of room
  • dx int x-direction in which to build room 1==right -1==left
  • dy int y-direction in which to build room 1==down -1==up
  • options Options
    • roomWidth table minimum/maximum width for room {min,max}
    • roomHeight table minimum/maximum height for room {min,max}
  • rng userData A user defined object with a .random(self, min, max) method (optional)
createRandomCenter (cx, cy, options, rng)
Create Random with center position.

Parameters:

  • cx int x-position of room's center
  • cy int y-position of room's center
  • options Options
    • roomWidth table minimum/maximum width for room {min,max}
    • roomHeight table minimum/maximum height for room {min,max}
    • crossWidth table minimum/maximum width for rectangleTwo {min,max}
    • crossHeight table minimum/maximum height for rectangleTwo {min,max}
  • rng userData A user defined object with a .random(min, max) method (optional)
createRandom (availWidth, availHeight, options, rng)
Create random with no position.

Parameters:

  • availWidth int Typically the width of the map.
  • availHeight int Typically the height of the map
  • options Options
    • roomWidth table minimum/maximum width for rectangleOne {min,max}
    • roomHeight table minimum/maximum height for rectangleOne {min,max}
    • crossWidth table minimum/maximum width for rectangleTwo {min,max}
    • crossHeight table minimum/maximum height for rectangleTwo {min,max}
  • rng userData A user defined object with a .random(min, max) method (optional)
isValid (isWallCallback, canBeDugCallback)
Use two callbacks to confirm room validity.

Parameters:

  • isWallCallback function A function with two parameters (x, y) that will return true if x, y represents a wall space in a map.
  • canBeDugCallback function A function with two parameters (x, y) that will return true if x, y represents a map cell that can be made into floorspace.

Returns:

    boolean true if room is valid.
create (digCallback)
Create. Function runs a callback to dig the room into a map

Parameters:

  • digCallback function The function responsible for digging the room into a map.
addDoors (isWallCallback)
Add all doors based on available walls.

Parameters:

  • isWallCallback function

Returns:

    ROT.Map.Room self

Fields

min
Generate Rectangle Two dimensions
min
Generate Rectangle Two dimensions
generated by LDoc 1.4.6 Last updated 2017-07-19 18:43:03