Class "Level"⚓︎
Functions⚓︎
CanPlaceRoom ()⚓︎
boolean CanPlaceRoom ( RoomConfigRoom RoomConfigToPlace, int GridIndex, Dimension Dimension = -1, bool AllowMultipleDoors = true, bool AllowSpecialNeighbors = false, bool AllowNoNeighbors = false )⚓︎
Returns true if the provided room could be successfully placed at this location using TryPlaceRoom.
See documentation for TryPlaceRoom for more information.
CanPlaceRoomAtDoor ()⚓︎
boolean CanPlaceRoomAtDoor ( RoomConfigRoom RoomConfigToPlace, RoomDescriptor NeighborRoomDescriptor, DoorSlot DoorSlot, bool AllowMultipleDoors = true, bool AllowSpecialNeighbors = false )⚓︎
Returns true if the provided room (the RoomConfigRoom) could be successfully placed as a neighbor of an existing room (the RoomDescriptor) at the specified DoorSlot, using TryPlaceRoomAtDoor.
See documentation for TryPlaceRoomAtDoor and TryPlaceRoom for more information.
CanSpawnDoorOutline ()⚓︎
boolean CanSpawnDoorOutline ( int RoomIdx, DoorSlot DoorSlot )⚓︎
FindValidRoomPlacementLocations ()⚓︎
int[] FindValidRoomPlacementLocations ( RoomConfigRoom RoomConfig, Dimension Dimension = -1, bool AllowMultipleDoors = true, bool AllowSpecialNeighbors = false )⚓︎
Returns a table of room grid indices that would be valid locations to place the specified room using TryPlaceRoom.
Note that if you set AllowSpecialNeighbors
to true
, you can get weird placements next to the ultra secret room. You can use GetNeighboringRooms to confirm that potential neighbors are desired before placing your room.
See TryPlaceRoom for more information on room placement and example code.
GetDimension ()⚓︎
Dimension GetDimension ( )⚓︎
Get's the current Dimension the player is in.
GetForceSpecialQuest ()⚓︎
SpecialQuest GetForceSpecialQuest ( )⚓︎
If set, the level will automatically attempt to place the Knife Piece puzzle door for this LevelStage.
Info
This is set to SpecialQuest.DEFAULT
immediately before calling MC_PRE_LEVEL_INIT
.
GetGreedWavesClearedWithoutRedHeartDamage ()⚓︎
int GetGreedWavesClearedWithoutRedHeartDamage ( )⚓︎
GetMyosotisPickups ()⚓︎
EntitiesSaveStateVector GetMyosotisPickups ( )⚓︎
Returns the pickups that will be transferred to the next floor by the Myosotis trinket effect.
GetNeighboringRooms ()⚓︎
table GetNeighboringRooms ( int GridIndex, RoomShape, Dimension Dimension = -1 )⚓︎
Returns a table that maps DoorSlot to RoomDescriptor for all of the neighbors that a room of the specified shape would have if placed at this location.
Don't use ipairs
to iterate over this, use pairs
!
Note that this does not give you any information on if a room would actually fit here, or if the neighbors would even allow the connection.
If you want to get the neighbors of an existing room, you can simply use RoomDescriptor:GetNeighboringRooms() instead.
Example Code
1 2 3 4 5 6 7 8 9 10 |
|
HasAbandonedMineshaft ()⚓︎
boolean HasAbandonedMineshaft ( )⚓︎
Returns true
if the floor has the mineshaft room used for the second Knife Piece puzzle.
HasMirrorDimension ()⚓︎
boolean HasMirrorDimension ( )⚓︎
Returns true
if the floor has the mirror dimension used for the first Knife Piece puzzle.
HasPhotoDoor ()⚓︎
boolean HasPhotoDoor ( )⚓︎
Returns true
if the floor has the photo door used to enter Mausoleum/Gehenna leading to the Ascent sequence.
IsStageAvailable ()⚓︎
void IsStageAvailable ( LevelStage Level, StageType Stage )⚓︎
Returns true
if the provided Level
and Stage
combination is available to be generated in any given run. Returns false
if locked behind an achievement.
PlaceRoom ()⚓︎
boolean PlaceRoom ( LevelGeneratorEntry Room, RoomConfigRoom RoomConfig, int Seed )⚓︎
Places a room into the game. Returns true
if successful.
Note that this function does not really check if a room placement would be considered valid, nor does it create the doors necessary to connect the new room to its neighbors.
See TryPlaceRoom and related functions if you want to properly add new rooms to the floor after level generation, similarly to what Red Key does.
SetForceSpecialQuest ()⚓︎
void SetForceSpecialQuest ( SpecialQuest Quest )⚓︎
Sets whether the level should attempt to place the Knife Piece puzzle door for this LevelStage.
Info
This is set to SpecialQuest.DEFAULT
immediately before calling MC_PRE_LEVEL_INIT
.
SetGreedWavesClearedWithoutRedHeartDamage ()⚓︎
void SetGreedWavesClearedWithoutRedHeartDamage ( int WavesCleared )⚓︎
SetName ()⚓︎
void SetName ( string Name )⚓︎
TryPlaceRoom ()⚓︎
RoomDescriptor TryPlaceRoom ( RoomConfigRoom RoomConfigToPlace, int GridIndex, Dimension Dimension = -1, int Seed = 0, bool AllowMultipleDoors = true, bool AllowSpecialNeighbors = false, bool AllowNoNeighbors = false )⚓︎
Attempts to place the provided room at the specified location.
If successful, returns the newly initialized RoomDescriptor. Otherwise, returns nil.
This function will ONLY place the room if it fits (does not overlap any other existing rooms, and can mutually connect to all neighboring room with doors).
If a seed of 0 or nil is provided, a deterministic seed with be auto-generated based on the location, room shape, and level seed.
The boolean parameters enable or disable additional restrictions/safeties for room placement:
- AllowMultipleDoors: Set to
false
to only allow placement if the room would only have one door (useful for placing special rooms). Secret rooms don't count as a door. - AllowSpecialNeighbors: Set to
true
to allow connections to existing special rooms (note that secret rooms are always permitted, but boss rooms never are). - AllowNoNeighbors: Set to
true
to permit room placements out in the void with no neighbors at all.
Example Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
TryPlaceRoomAtDoor ()⚓︎
RoomDescriptor TryPlaceRoomAtDoor ( RoomConfigRoom RoomConfigToPlace, RoomDescriptor NeighborRoomDescriptor, DoorSlot DoorSlot, int Seed = 0, bool AllowMultipleDoors = true, bool AllowSpecialNeighbors = false )⚓︎
Similar to TryPlaceRoom, but attempts to place the provided room (the RoomConfigRoom) as a neighbor of an existing room (the RoomDescriptor) at the specified DoorSlot.
Otherwise, the details are the same as for TryPlaceRoom.
Example Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|