Binding of Isaac - Afterbirth+ Lua Reference/Guide
Level Class Reference

Public Member Functions

 Update ()
 
 SetStage (LevelStage Stage, StageType StageType)
 for SetStage/SetNextStage to have effect, call Init afterward More...
 
 SetNextStage ()
 
string GetName (LevelStage Stage, StageType Type, integer Curses, int InfiniteLevel, boolean Dyslexia)
 Deletes everything without creating a new room (Added for WiiU Shutdown) More...
 
boolean CanStageHaveCurseOfLabyrinth (LevelStage Stage)
 
string GetCurseName ()
 
 ShowName (boolean Sticky)
 
boolean GetStateFlag (Level::StateFlag StateFlag)
 Store private data in the SaveData so it can be written to file. More...
 
 SetStateFlag (Level::StateFlag StateFlag, boolean Val)
 
RoomGetCurrentRoom ()
 
integer GetPreviousRoomIndex ()
 
integer GetCurrentRoomIndex ()
 
integer GetRoomCount ()
 
integer GetRandomRoomIndex (boolean IAmErrorRoom, integer Seed)
 
integer GetNonCompleteRoomIndex ()
 
const RoomDescriptorGetRoomByIdx (integer RoomIdx)
 
const RoomDescriptorGetCurrentRoomDesc ()
 
const RoomDescriptorGetLastRoomDesc ()
 
LuaArrayProxy< RoomDescriptor, true > GetRooms ()
 
integer GetStartingRoomIndex ()
 
integer QueryRoomTypeIndex (RoomType RoomType, boolean Visited, RNG rng)
 
integer GetLastBossRoomListIndex ()
 
boolean CanOpenChallengeRoom (integer RoomIndex)
 
Vector GetEnterPosition ()
 
 ChangeRoom (integer RoomIndex)
 
boolean ForceHorsemanBoss (integer Seed)
 return true on success More...
 
LevelStage GetStage ()
 
integer GetCurses ()
 
boolean IsAltStage ()
 
StageType GetStageType ()
 
boolean HasBossChallenge ()
 
boolean IsDevilRoomDisabled ()
 
 DisableDevilRoom ()
 
 UpdateVisibility ()
 
 ApplyMapEffect ()
 
 ApplyBlueMapEffect ()
 
 ApplyCompassEffect (boolean Persistent)
 
 RemoveCompassEffect ()
 
 ShowMap ()
 Show's all map (world/sun card effect) except the top secret room. More...
 
 SetHeartPicked ()
 
boolean GetHeartPicked ()
 
boolean GetCanSeeEverything ()
 
 SetCanSeeEverything (boolean Value)
 
 AddCurse (LevelCurse Curse, boolean ShowName)
 
 RemoveCurses ()
 
 RemoveCurse (LevelCurse Curse)
 
integer GetDungeonPlacementSeed ()
 
RNGGetDevilAngelRoomRNG ()
 
boolean CanSpawnDevilRoom ()
 
 InitializeDevilAngelRoom (boolean ForceAngel, boolean ForceDevil)
 
 UncoverHiddenDoor (integer CurrentRoomIdx, DoorSlot Slot)
 Uncovers the door on both sides by modifying the saved grid entities for neighboring room. More...
 
 SetRedHeartDamage ()
 
boolean IsNextStageAvailable ()
 
LevelStage GetAbsoluteStage ()
 Returns the absolute stage, if its greed mode its converted to equivalent one. More...
 
 AddAngelRoomChance (float Chance)
 
float GetAngelRoomChance ()
 

Public Attributes

integer EnterDoor
 
integer LeaveDoor
 
Vector DungeonReturnPosition
 
integer DungeonReturnRoomIndex
 
integer GreedModeWave
 

Member Function Documentation

◆ AddAngelRoomChance()

Level::AddAngelRoomChance ( float  Chance)

◆ AddCurse()

Level::AddCurse ( LevelCurse  Curse,
boolean  ShowName 
)

◆ ApplyBlueMapEffect()

Level::ApplyBlueMapEffect ( )

◆ ApplyCompassEffect()

Level::ApplyCompassEffect ( boolean  Persistent)

◆ ApplyMapEffect()

Level::ApplyMapEffect ( )

◆ CanOpenChallengeRoom()

boolean Level::CanOpenChallengeRoom ( integer  RoomIndex)

◆ CanSpawnDevilRoom()

boolean Level::CanSpawnDevilRoom ( )

◆ CanStageHaveCurseOfLabyrinth()

boolean Level::CanStageHaveCurseOfLabyrinth ( LevelStage  Stage)

◆ ChangeRoom()

Level::ChangeRoom ( integer  RoomIndex)

◆ DisableDevilRoom()

Level::DisableDevilRoom ( )

◆ ForceHorsemanBoss()

boolean Level::ForceHorsemanBoss ( integer  Seed)

return true on success

◆ GetAbsoluteStage()

LevelStage Level::GetAbsoluteStage ( )

Returns the absolute stage, if its greed mode its converted to equivalent one.

◆ GetAngelRoomChance()

float Level::GetAngelRoomChance ( )

◆ GetCanSeeEverything()

boolean Level::GetCanSeeEverything ( )

◆ GetCurrentRoom()

Room& Level::GetCurrentRoom ( )

◆ GetCurrentRoomDesc()

const RoomDescriptor& Level::GetCurrentRoomDesc ( )

◆ GetCurrentRoomIndex()

integer Level::GetCurrentRoomIndex ( )

This will always return the roomindex on the levelgrid, on which you entered the current room from. (see black entries in graphic below)

◆ GetCurseName()

string Level::GetCurseName ( )

◆ GetCurses()

integer Level::GetCurses ( )

◆ GetDevilAngelRoomRNG()

RNG& Level::GetDevilAngelRoomRNG ( )

◆ GetDungeonPlacementSeed()

integer Level::GetDungeonPlacementSeed ( )

◆ GetEnterPosition()

Vector Level::GetEnterPosition ( )

◆ GetHeartPicked()

boolean Level::GetHeartPicked ( )

◆ GetLastBossRoomListIndex()

integer Level::GetLastBossRoomListIndex ( )

◆ GetLastRoomDesc()

const RoomDescriptor& Level::GetLastRoomDesc ( )

◆ GetName()

string Level::GetName ( LevelStage  Stage,
StageType  Type,
integer  Curses,
int  InfiniteLevel,
boolean  Dyslexia 
)

◆ GetNonCompleteRoomIndex()

integer Level::GetNonCompleteRoomIndex ( )

◆ GetPreviousRoomIndex()

integer Level::GetPreviousRoomIndex ( )

◆ GetRandomRoomIndex()

integer Level::GetRandomRoomIndex ( boolean  IAmErrorRoom,
integer  Seed 
)

◆ GetRoomByIdx()

const RoomDescriptor& Level::GetRoomByIdx ( integer  RoomIdx)

◆ GetRoomCount()

integer Level::GetRoomCount ( )

◆ GetRooms()

LuaArrayProxy<RoomDescriptor, true> Level::GetRooms ( )

◆ GetStage()

LevelStage Level::GetStage ( )

◆ GetStageType()

StageType Level::GetStageType ( )

◆ GetStartingRoomIndex()

integer Level::GetStartingRoomIndex ( )

◆ GetStateFlag()

boolean Level::GetStateFlag ( Level::StateFlag  StateFlag)

◆ HasBossChallenge()

boolean Level::HasBossChallenge ( )

◆ InitializeDevilAngelRoom()

Level::InitializeDevilAngelRoom ( boolean  ForceAngel,
boolean  ForceDevil 
)

◆ IsAltStage()

boolean Level::IsAltStage ( )

◆ IsDevilRoomDisabled()

boolean Level::IsDevilRoomDisabled ( )

◆ IsNextStageAvailable()

boolean Level::IsNextStageAvailable ( )

◆ QueryRoomTypeIndex()

integer Level::QueryRoomTypeIndex ( RoomType  RoomType,
boolean  Visited,
RNG  rng 
)

◆ RemoveCompassEffect()

Level::RemoveCompassEffect ( )

◆ RemoveCurse()

Level::RemoveCurse ( LevelCurse  Curse)

◆ RemoveCurses()

Level::RemoveCurses ( )

◆ SetCanSeeEverything()

Level::SetCanSeeEverything ( boolean  Value)

◆ SetHeartPicked()

Level::SetHeartPicked ( )

◆ SetNextStage()

Level::SetNextStage ( )

This function teleports you directly to the next stage without playing the leveltransition or updating the floors backdrop. Use other functions to fix those issues.

◆ SetRedHeartDamage()

Level::SetRedHeartDamage ( )

◆ SetStage()

Level::SetStage ( LevelStage  Stage,
StageType  StageType 
)

for SetStage/SetNextStage to have effect, call Init afterward

◆ SetStateFlag()

Level::SetStateFlag ( Level::StateFlag  StateFlag,
boolean  Val 
)

◆ ShowMap()

Level::ShowMap ( )

Show's all map (world/sun card effect) except the top secret room.

◆ ShowName()

Level::ShowName ( boolean  Sticky)

◆ UncoverHiddenDoor()

Level::UncoverHiddenDoor ( integer  CurrentRoomIdx,
DoorSlot  Slot 
)

Uncovers the door on both sides by modifying the saved grid entities for neighboring room.

◆ Update()

Level::Update ( )

◆ UpdateVisibility()

Level::UpdateVisibility ( )
Whenever you update the visibility of a room on the minimap, it won't update the map automatically, since it is cached. You have to explicitly call UpdateVisibility() afterwards to apply any changes.
This code
-- Local variables
local game = Game()
local level = game:GetLevel()

-- Give the player the Compass effect, which will display all of the floor's special rooms on the mini-map
level:ApplyCompassEffect()

-- Remove the icon for the Treasure Room specifically
local treasureIndex = level:QueryRoomTypeIndex(RoomType.ROOM_TREASURE, false, RNG())
local treasureRoom = level:GetRoomByIdx(treasureIndex)
treasureRoom.DisplayFlags = 0

-- Since the mini-map is cached, changing display flags won't update it unless we explicitly call this function
level:UpdateVisibility()

Member Data Documentation

◆ DungeonReturnPosition

Vector Level::DungeonReturnPosition

◆ DungeonReturnRoomIndex

integer Level::DungeonReturnRoomIndex

◆ EnterDoor

integer Level::EnterDoor
This value defines on which doorslot you entered the room.
Changing this value has no impact on anything. the EnterDoor value is always determined by the LeaveDoor Value and the game itself.

◆ GreedModeWave

integer Level::GreedModeWave

◆ LeaveDoor

integer Level::LeaveDoor
This value defines on which doorslot you are positioned after the transition. You will always end up at the oposite side of the door specified. Example: LeaveDoor=1 (Up0) will position you at Doorslot Down0 (Logic: Doorslot+2)
if level.LeaveDoor is set to anything other than -1, the function will transition based on the room you are currently in.