Module ROT.Map.Corridor
Corridor object.
Used by ROT.Map.Uniform and ROT.Map.Digger to create maps
Functions
init (startX, startY, endX, endY) | Constructor. |
createRandomAt (x, y, dx, dy, options, rng) | Create random with position. |
debug () | Write various information about this corridor to the console. |
isValid (isWallCallback, canBeDugCallback) | Use two callbacks to confirm corridor validity. |
create (digCallback) | Create. |
createPriorityWalls (gen, priorityWallCallback) | Mark walls as priority for a future feature. |
Functions
- init (startX, startY, endX, endY)
-
Constructor.
Called with ROT.Map.Corridor:new()
Parameters:
- startX int x-position of first floospace in corridor
- startY int y-position of first floospace in corridor
- endX int x-position of last floospace in corridor
- endY int y-position of last floospace in corridor
- createRandomAt (x, y, dx, dy, options, rng)
-
Create random with position.
Parameters:
- x int x-position of first floospace in corridor
- y int y-position of first floospace in corridor
- dx int x-direction of corridor (-1, 0, 1) for (left, none, right)
- dy int y-direction of corridor (-1, 0, 1) for (up, none, down)
- options Options
- corridorLength table a table for the min and max corridor lengths {min, max}
- rng userData A user defined object with a .random(min, max) method (optional)
- debug ()
- Write various information about this corridor to the console.
- isValid (isWallCallback, canBeDugCallback)
-
Use two callbacks to confirm corridor 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 corridor is valid.
- create (digCallback)
-
Create.
Function runs a callback to dig the corridor into a map
Parameters:
- digCallback function The function responsible for digging the corridor into a map.
- createPriorityWalls (gen, priorityWallCallback)
-
Mark walls as priority for a future feature.
Use this for storing the three points at the end of the corridor that you probably want to make sure gets a room attached.
Parameters:
- gen userdata The map generator calling this function. Passed as self to the digCallback
- priorityWallCallback function The function responsible for receiving and processing the priority walls