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

Public Member Functions

Backdrop::Backdrop GetBackdropType ()
 
 Update ()
 
 Render ()
 
boolean IsInitialized ()
 
GridEntity::CollisionClass GetGridCollision (integer GridIndex)
 
GridEntity::CollisionClass GetGridCollisionAtPos (Vector Pos)
 
GridEntityDoorGetDoor (DoorSlot Slot)
 
Vector GetDoorSlotPosition (DoorSlot Slot)
 
boolean IsDoorSlotAllowed (DoorSlot Slot)
 Returns whether this room design may have a door at a given position, disregarding whether those doors exist. More...
 
 RemoveDoor (DoorSlot Slot)
 
 KeepDoorsClosed ()
 
RoomType GetType ()
 
integer GetDecorationSeed ()
 
integer GetSpawnSeed ()
 
integer GetAwardSeed ()
 
RoomShape GetRoomShape ()
 
RoomConfig::Stage GetRoomConfigStage ()
 returns the original stage the room was designed for (useful for The Void) More...
 
integer GetGridPath (integer Index)
 
integer GetGridPathFromPos (integer Index)
 
boolean SetGridPath (integer Index, integer Value)
 
boolean DamageGrid (integer Index, integer Damage)
 
boolean DestroyGrid (integer Index, boolean Immediate)
 
boolean CheckLine (Vector Pos1, Vector Pos2, LinecheckMode Mode, integer GridPathThreshold, boolean IgnoreWalls, boolean IgnoreCrushable)
 
Vector GetLaserTarget (Vector Pos, Vector Dir)
 
GridEntityGetGridEntity (integer Index)
 
GridEntityGetGridEntityFromPos (integer Index)
 
integer GetGridWidth ()
 
integer GetGridHeight ()
 
integer GetGridSize ()
 
boolean IsClear ()
 bool IsClear(void) const {return m_Desc->Clear;} More...
 
 SetClear (boolean Clear)
 
Vector FindFreePickupSpawnPosition (Vector Pos, float InitialStep, boolean AvoidActiveEntities)
 
Vector FindFreeTilePosition (Vector Pos, float DistanceThreshold)
 
integer GetGridIndex (Vector Position)
 
integer GetClampedGridIndex (Vector Position)
 
Vector GetGridPosition (integer GridIndex)
 
Vector GetClampedPosition (Vector Pos, float Margin)
 
boolean IsPositionInRoom (Vector Pos, float Margin)
 
Vector ScreenWrapPosition (Vector Pos, float Margin)
 
boolean IsLShapedRoom ()
 
LRoomAreaDesc GetLRoomAreaDesc ()
 
LRoomTileDesc GetLRoomTileDesc ()
 
Vector GetTopLeftPos ()
 
Vector GetBottomRightPos ()
 
Vector GetCenterPos ()
 
boolean SpawnGridEntity (integer GridIndex, GridEntityType Type, integer Variant, integer Seed, integer VarData)
 
 RemoveGridEntity (integer GridIndex, integer PathTrail, boolean KeepDecoration)
 
integer GetFrameCount ()
 
EntityList & GetEntities ()
 
integer GetAliveEnemiesCount ()
 
integer GetAliveBossesCount ()
 
BossId GetBossID ()
 
BossId GetSecondBossID ()
 
 TryPlaceLadder (Vector PlayerPos, Vector PlayerVelocity, Entity Ladder)
 
 SetSacrificeDone (boolean Done)
 
boolean IsSacrificeDone ()
 
boolean IsAmbushDone ()
 
 SetAmbushDone (boolean Value)
 
boolean IsAmbushActive ()
 
 ShopRestockPartial ()
 
 ShopRestockFull ()
 
 ShopReshuffle (boolean KeepCollectibleIdx, boolean ReselectSaleItem)
 
boolean TrySpawnDevilRoomDoor (boolean Animate)
 
float GetDevilRoomChance ()
 
boolean TrySpawnBossRushDoor (boolean IgnoreTime)
 
boolean TrySpawnMegaSatanRoomDoor ()
 
boolean TrySpawnBlueWombDoor (boolean FirstTime, boolean IgnoreTime)
 
boolean TrySpawnTheVoidDoor ()
 
 PlayMusic ()
 
 SetRedHeartDamage ()
 
boolean GetRedHeartDamage ()
 
integer GetBrokenWatchState ()
 
 SetBrokenWatchState (integer State)
 
boolean IsFirstVisit ()
 Broken Watch Room State - 0 = no watch effect, 1 = speed down, 2 = speed up. More...
 
const VectorGetRenderSurfaceTopLeft ()
 The position the floor and wall textures will be rendered at. More...
 
const VectorGetRenderScrollOffset ()
 The camera scroll offset and screen shake offsets are both represented here. More...
 
boolean HasWaterPits ()
 bool HasWaterPits(void) const { return m_Desc->HasWater; } More...
 
CollectibleType GetSeededCollectible (integer Seed)
 
integer GetShopLevel ()
 
 SetShockwaveParam (integer ShockwaveId, ShockwaveParams Params)
 
integer GetNextShockwaveId ()
 
 SetCardAgainstHumanity ()
 
 EmitBloodFromWalls (integer Duration, integer Count)
 
 SpawnClearAward ()
 
float GetLightingAlpha ()
 
boolean TryMakeBridge (GridEntity pit)
 
integer GetDungeonRockIdx ()
 
integer GetTintedRockIdx ()
 
boolean HasSlowDown ()
 
 SetSlowDown (integer Duration)
 
Vector GetRandomPosition (float Margin)
 returns random non tile aligned position More...
 
integer GetRandomTileIndex (integer Seed)
 
 RespawnEnemies ()
 for D7 collectible More...
 
boolean HasWater ()
 
boolean HasTriggerPressurePlates ()
 
boolean IsCurrentRoomLastBoss ()
 
boolean IsFirstEnemyDead ()
 
 SetFirstEnemyDead (boolean Value)
 
 MamaMegaExplossion ()
 
integer GetDeliriumDistance ()
 
 TurnGold ()
 
 SetFloorColor (KColor FloorColor)
 
 SetWallColor (KColor WallColor)
 
Vector WorldToScreenPosition (Vector WorldPos)
 Converts an entity position to one that can be used to render to the screen. More...
 

Member Function Documentation

◆ CheckLine()

boolean Room::CheckLine ( Vector  Pos1,
Vector  Pos2,
LinecheckMode  Mode,
integer  GridPathThreshold,
boolean  IgnoreWalls,
boolean  IgnoreCrushable 
)

returns true if there is a direct line of sight between Pos1 and Pos2 returns false if the line is obstructed

◆ DamageGrid()

boolean Room::DamageGrid ( integer  Index,
integer  Damage 
)

Damage Grid Entities currently this concerns GridEntityPoop and GridEntity_Fire returns true if damageable entity was found (and possibly damaged) return false if not used by tears, bombs, some NPCs, etc

◆ DestroyGrid()

boolean Room::DestroyGrid ( integer  Index,
boolean  Immediate 
)

calls DamageGrid internally to damage Poop/Fire removes rocks and opens secret doors returns true if something was destroyed returns false if not used for explosions mostly

◆ EmitBloodFromWalls()

Room::EmitBloodFromWalls ( integer  Duration,
integer  Count 
)

◆ FindFreePickupSpawnPosition()

Vector Room::FindFreePickupSpawnPosition ( Vector  Pos,
float  InitialStep,
boolean  AvoidActiveEntities 
)

Starting from Pos, will try to find a free spawn position where a newly spawned pickup item will not collide with already spawned pickup items, or solid grid elements such as rocks, or pits The returned position will be aligned to the grid. If no free position is found, the original position (aligned to the grid) is returned.

◆ FindFreeTilePosition()

Vector Room::FindFreeTilePosition ( Vector  Pos,
float  DistanceThreshold 
)

Finds the nearest free tile based on position Stops immediately if the tile sampled has a squared distance less than DistanceThresholdSQ

◆ GetAliveBossesCount()

integer Room::GetAliveBossesCount ( )

◆ GetAliveEnemiesCount()

integer Room::GetAliveEnemiesCount ( )

◆ GetAwardSeed()

integer Room::GetAwardSeed ( )

◆ GetBackdropType()

Backdrop::Backdrop Room::GetBackdropType ( )

◆ GetBossID()

BossId Room::GetBossID ( )

◆ GetBottomRightPos()

Vector Room::GetBottomRightPos ( )

returns bottom right position inside of walls

◆ GetBrokenWatchState()

integer Room::GetBrokenWatchState ( )

◆ GetCenterPos()

Vector Room::GetCenterPos ( )

returns the room center position

◆ GetClampedGridIndex()

integer Room::GetClampedGridIndex ( Vector  Position)

converts float position (x,y) to grid index (similar to ingrid) clamps the values if out of bounds

◆ GetClampedPosition()

Vector Room::GetClampedPosition ( Vector  Pos,
float  Margin 
)

returns Pos clamped to room borders inside of walls

◆ GetDecorationSeed()

integer Room::GetDecorationSeed ( )

◆ GetDeliriumDistance()

integer Room::GetDeliriumDistance ( )

◆ GetDevilRoomChance()

float Room::GetDevilRoomChance ( )

◆ GetDoor()

GridEntityDoor& Room::GetDoor ( DoorSlot  Slot)

◆ GetDoorSlotPosition()

Vector Room::GetDoorSlotPosition ( DoorSlot  Slot)

◆ GetDungeonRockIdx()

integer Room::GetDungeonRockIdx ( )

◆ GetEntities()

EntityList& Room::GetEntities ( )

◆ GetFrameCount()

integer Room::GetFrameCount ( )

◆ GetGridCollision()

GridEntity::CollisionClass Room::GetGridCollision ( integer  GridIndex)

◆ GetGridCollisionAtPos()

GridEntity::CollisionClass Room::GetGridCollisionAtPos ( Vector  Pos)

◆ GetGridEntity()

GridEntity& Room::GetGridEntity ( integer  Index)

◆ GetGridEntityFromPos()

GridEntity& Room::GetGridEntityFromPos ( integer  Index)

◆ GetGridHeight()

integer Room::GetGridHeight ( )

◆ GetGridIndex()

integer Room::GetGridIndex ( Vector  Position)

converts float position (x,y) to grid index returns -1 for invalid index

◆ GetGridPath()

integer Room::GetGridPath ( integer  Index)

◆ GetGridPathFromPos()

integer Room::GetGridPathFromPos ( integer  Index)

◆ GetGridPosition()

Vector Room::GetGridPosition ( integer  GridIndex)

converts grid index to float (x,y) position undefined behaviour for invalid index

◆ GetGridSize()

integer Room::GetGridSize ( )

◆ GetGridWidth()

integer Room::GetGridWidth ( )

◆ GetLaserTarget()

Vector Room::GetLaserTarget ( Vector  Pos,
Vector  Dir 
)

returns the hit position for a laser beam (Technology, Robo-Baby) usually, the first poop, fire, rock, TNT, or wall encountered on a straight line

◆ GetLightingAlpha()

float Room::GetLightingAlpha ( )

◆ GetLRoomAreaDesc()

LRoomAreaDesc Room::GetLRoomAreaDesc ( )

◆ GetLRoomTileDesc()

LRoomTileDesc Room::GetLRoomTileDesc ( )

◆ GetNextShockwaveId()

integer Room::GetNextShockwaveId ( )

◆ GetRandomPosition()

Vector Room::GetRandomPosition ( float  Margin)

returns random non tile aligned position

◆ GetRandomTileIndex()

integer Room::GetRandomTileIndex ( integer  Seed)

◆ GetRedHeartDamage()

boolean Room::GetRedHeartDamage ( )

◆ GetRenderScrollOffset()

const Vector& Room::GetRenderScrollOffset ( )

The camera scroll offset and screen shake offsets are both represented here.

◆ GetRenderSurfaceTopLeft()

const Vector& Room::GetRenderSurfaceTopLeft ( )

The position the floor and wall textures will be rendered at.

◆ GetRoomConfigStage()

RoomConfig::Stage Room::GetRoomConfigStage ( )

returns the original stage the room was designed for (useful for The Void)

◆ GetRoomShape()

RoomShape Room::GetRoomShape ( )

◆ GetSecondBossID()

BossId Room::GetSecondBossID ( )

◆ GetSeededCollectible()

CollectibleType Room::GetSeededCollectible ( integer  Seed)

◆ GetShopLevel()

integer Room::GetShopLevel ( )

◆ GetSpawnSeed()

integer Room::GetSpawnSeed ( )

◆ GetTintedRockIdx()

integer Room::GetTintedRockIdx ( )

◆ GetTopLeftPos()

Vector Room::GetTopLeftPos ( )

returns top left position inside of walls

◆ GetType()

RoomType Room::GetType ( )

◆ HasSlowDown()

boolean Room::HasSlowDown ( )

◆ HasTriggerPressurePlates()

boolean Room::HasTriggerPressurePlates ( )

◆ HasWater()

boolean Room::HasWater ( )

◆ HasWaterPits()

boolean Room::HasWaterPits ( )

bool HasWaterPits(void) const { return m_Desc->HasWater; }

◆ IsAmbushActive()

boolean Room::IsAmbushActive ( )

◆ IsAmbushDone()

boolean Room::IsAmbushDone ( )

◆ IsClear()

boolean Room::IsClear ( )

bool IsClear(void) const {return m_Desc->Clear;}

◆ IsCurrentRoomLastBoss()

boolean Room::IsCurrentRoomLastBoss ( )

◆ IsDoorSlotAllowed()

boolean Room::IsDoorSlotAllowed ( DoorSlot  Slot)

Returns whether this room design may have a door at a given position, disregarding whether those doors exist.

◆ IsFirstEnemyDead()

boolean Room::IsFirstEnemyDead ( )

◆ IsFirstVisit()

boolean Room::IsFirstVisit ( )

Broken Watch Room State - 0 = no watch effect, 1 = speed down, 2 = speed up.

◆ IsInitialized()

boolean Room::IsInitialized ( )

◆ IsLShapedRoom()

boolean Room::IsLShapedRoom ( )

◆ IsPositionInRoom()

boolean Room::IsPositionInRoom ( Vector  Pos,
float  Margin 
)

◆ IsSacrificeDone()

boolean Room::IsSacrificeDone ( )

◆ KeepDoorsClosed()

Room::KeepDoorsClosed ( )

◆ MamaMegaExplossion()

Room::MamaMegaExplossion ( )

◆ PlayMusic()

Room::PlayMusic ( )

◆ RemoveDoor()

Room::RemoveDoor ( DoorSlot  Slot)

◆ RemoveGridEntity()

Room::RemoveGridEntity ( integer  GridIndex,
integer  PathTrail,
boolean  KeepDecoration 
)

◆ Render()

Room::Render ( )

◆ RespawnEnemies()

Room::RespawnEnemies ( )

for D7 collectible

◆ ScreenWrapPosition()

Vector Room::ScreenWrapPosition ( Vector  Pos,
float  Margin 
)

Returns Pos, screen-wrapped (if it is just outside the room on the right it will be moved to the left side of the room, etc)

Note: This only wraps the point once, so if it has crossed multiple wrapping planes it will only wrap on the one it's closest to. For wrapping a position that has crossed two planes (outside a room in the top left for instance) call this function iteratively.

◆ SetAmbushDone()

Room::SetAmbushDone ( boolean  Value)

◆ SetBrokenWatchState()

Room::SetBrokenWatchState ( integer  State)

◆ SetCardAgainstHumanity()

Room::SetCardAgainstHumanity ( )

◆ SetClear()

Room::SetClear ( boolean  Clear)

Needed for angel room, so the clear flag can be set to false when the angel spawns void SetClear(bool Clear) {m_Desc->Clear = Clear;}

◆ SetFirstEnemyDead()

Room::SetFirstEnemyDead ( boolean  Value)

◆ SetFloorColor()

Room::SetFloorColor ( KColor  FloorColor)

◆ SetGridPath()

boolean Room::SetGridPath ( integer  Index,
integer  Value 
)

◆ SetRedHeartDamage()

Room::SetRedHeartDamage ( )

◆ SetSacrificeDone()

Room::SetSacrificeDone ( boolean  Done)

◆ SetShockwaveParam()

Room::SetShockwaveParam ( integer  ShockwaveId,
ShockwaveParams  Params 
)

◆ SetSlowDown()

Room::SetSlowDown ( integer  Duration)

◆ SetWallColor()

Room::SetWallColor ( KColor  WallColor)

◆ ShopReshuffle()

Room::ShopReshuffle ( boolean  KeepCollectibleIdx,
boolean  ReselectSaleItem 
)

◆ ShopRestockFull()

Room::ShopRestockFull ( )

◆ ShopRestockPartial()

Room::ShopRestockPartial ( )

◆ SpawnClearAward()

Room::SpawnClearAward ( )

◆ SpawnGridEntity()

boolean Room::SpawnGridEntity ( integer  GridIndex,
GridEntityType  Type,
integer  Variant,
integer  Seed,
integer  VarData 
)

◆ TryMakeBridge()

boolean Room::TryMakeBridge ( GridEntity  pit)

◆ TryPlaceLadder()

Room::TryPlaceLadder ( Vector  PlayerPos,
Vector  PlayerVelocity,
Entity  Ladder 
)

◆ TrySpawnBlueWombDoor()

boolean Room::TrySpawnBlueWombDoor ( boolean  FirstTime,
boolean  IgnoreTime 
)

◆ TrySpawnBossRushDoor()

boolean Room::TrySpawnBossRushDoor ( boolean  IgnoreTime)

◆ TrySpawnDevilRoomDoor()

boolean Room::TrySpawnDevilRoomDoor ( boolean  Animate)

◆ TrySpawnMegaSatanRoomDoor()

boolean Room::TrySpawnMegaSatanRoomDoor ( )

◆ TrySpawnTheVoidDoor()

boolean Room::TrySpawnTheVoidDoor ( )

◆ TurnGold()

Room::TurnGold ( )

◆ Update()

Room::Update ( )

◆ WorldToScreenPosition()

Vector Room::WorldToScreenPosition ( Vector  WorldPos)

Converts an entity position to one that can be used to render to the screen.