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

Public Member Functions

Backdrop::Backdrop  GetBackdropType ()
 
  Update ()
 
  Render ()
 
boolean  IsInitialized ()
 
GridCollisionClass  GetGridCollision (integer GridIndex)
 
GridCollisionClass  GetGridCollisionAtPos (Vector Pos)
 
GridEntityDoor GetDoor (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)
 
GridEntity GetGridEntity (integer Index)
 
GridEntity GetGridEntityFromPos (Vector Position)
 
integer  GetGridWidth ()
 
integer  GetGridHeight ()
 
integer  GetGridSize ()
 
boolean  IsClear ()
 
  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 Vector GetRenderSurfaceTopLeft ()
  The position the floor and wall textures will be rendered at. More...
 
const Vector GetRenderScrollOffset ()
  The camera scroll offset and screen shake offsets are both represented here. More...
 
boolean  HasWaterPits ()
 
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 (Color FloorColor)
 
  SetWallColor (Color 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

LinecheckModes:

0 : makes the line check collide with anything that impedes ground movement
1 : is a cheaper version of 0, but is not as reliable
2 : is used for explosions, it only collides with walls and indestructible blocks
3 : is a line check that only collides with obstacles that can block projectiles

◆ 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 ( )

Returns the BackdropType (Background) of the current room.

BackdropTypes

ID Backdrop ID Backdrop
1 Basement 15 Cathedral
2 Cellar 16 Dark Room
3 Burning Basement 17 Chest
4 Caves 18 Mega Satan
5 Catacombs 19 Library
6 Drowned Caves 20 Shop
7 Depths 21 Isaacs Room
8 Necropolis 22 Barren Room
9 Dank Depths 23 Secret Room
10 Womb 24 Dice Room
11 Utero 25 Arcade
12 Scarred Womb 26 Error Room
13 Blue Womb (Hush) 27 Blue Secret
14 Sheol 28 Ultra Greed Shop

◆ GetBossID()

BossId Room::GetBossID ( )

This will return the subtype of the current room, since this value is used to determine the boss-portrait to display when entering.

◆ 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()

GridCollisionClass Room::GetGridCollision ( integer  GridIndex )

Returns the GridCollisionClass of the grid entity at this grid index.

◆ GetGridCollisionAtPos()

GridCollisionClass Room::GetGridCollisionAtPos ( Vector  Pos )

Returns the GridCollisionClass of the grid entity at this position in the room.

◆ GetGridEntity()

GridEntity& Room::GetGridEntity ( integer  Index )

Returns the GridEntity at this grid index.

◆ GetGridEntityFromPos()

GridEntity& Room::GetGridEntityFromPos ( Vector  Position )

Returns the GridEntity at this position in the room.

◆ 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 ( )

◆ IsAmbushActive()

boolean Room::IsAmbushActive ( )

◆ IsAmbushDone()

boolean Room::IsAmbushDone ( )

◆ IsClear()

boolean Room::IsClear ( )

◆ 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)

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 ( Color  FloorColor )

Allows you to apply a color modifier to the floor texture of the current room.

This code changes the floorcolor to red.
Game():GetRoom():SetFloorColor(Color(1,1,1,1,255,0,0))

◆ 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 ( Color  WallColor )

Allows you to apply a color modifier to the wall texture of the current room.

This code changes the wallcolor to red.
Game():GetRoom():SetWallColor(Color(1,1,1,1,255,0,0))

◆ 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 ( )

Updates the current room.

Calling this function is NOT needed to apply changes!

This function is pretty useless

◆ WorldToScreenPosition()

Vector Room::WorldToScreenPosition ( Vector  WorldPos )

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