Skip to content

Class "Room"⚓︎

Info

You can get this class by using the following functions:

Example Code
1
local room = Game():GetRoom()

Functions⚓︎

Check·Line ()⚓︎

boolean CheckLine ( Vector Pos1, Vector Pos2, LinecheckMode Mode, int GridPathThreshold = 0, boolean IgnoreWalls = false, boolean IgnoreCrushable = false )⚓︎

Returns 2 values: * boolean: true if there are no obstructions between Pos1 and Pos2, false otherwise * Vector: first hit position from Pos1 to Pos2 (returns Pos2 if the line didn't hit anything)

LinecheckMode notes

LinecheckMode pseudo-enumeration:

0 : makes the line check collide with anything that impedes ground movement

1 : is a cheaper version of 0, but is not as reliable (For example, can return true if line of sight can be gained between diagonally adjacent rocks)

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

GridPathThreshold notes

GridPath values pseudo-enumeration:

900 : Set by some enemies when they pass through a tile. De-prioritises the tile for pathfinders. Degrades over time in steps of 100.

950 : Set by fire places. De-prioritises the tile for pathfinders. Does not degrade.

1000 : Set by grid entities. Invalidates the tile for pathfinders. Impedes grounded player movement. Does not degrade.

3000 : Set by pits. Invalidates the tile for pathfinders. Impedes grounded player movement. Does not degrade.

3999 : Set by grimaces. Invalidates the tile for pathfinders. Impedes grounded player movement. Drops to 900 and then degrades over time in steps of 100 (Grimaces reset value every frame).


Damage·Grid ()⚓︎

boolean DamageGrid ( int Index, int 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


Destroy·Grid ()⚓︎

boolean DestroyGrid ( int Index, boolean Immediate )⚓︎

Calls DamageGrid internally to damage Poop/Fire removes rocks and opens secret doors. Returns true if something was destroyed.


Emit·Blood·From·Walls ()⚓︎

void EmitBloodFromWalls ( int Duration, int Count )⚓︎


Find·Free·Pickup·Spawn·Position ()⚓︎

Vector FindFreePickupSpawnPosition ( Vector Pos, float InitialStep = 0, boolean AvoidActiveEntities = false, boolean AllowPits = false )⚓︎

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.


Find·Free·Tile·Position ()⚓︎

Vector 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.


Get·Alive·Bosses·Count ()⚓︎

int GetAliveBossesCount ( )⚓︎


Get·Alive·Enemies·Count ()⚓︎

int GetAliveEnemiesCount ( )⚓︎


Get·Award·Seed ()⚓︎

int GetAwardSeed ( )⚓︎


Get·Backdrop·Type ()⚓︎

BackdropType GetBackdropType ( )⚓︎

Returns the BackdropType of the current room.


Get·Boss·ID ()⚓︎

int GetBossID ( )⚓︎

Returns the boss ID of the first boss in the room. Returns 0 otherwise.

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

A boss ID is not equal to the entity type of the boss; it is a separate value in the entities2.xml file inside the "bossID" attribute.


Get·Bottom·Right·Pos ()⚓︎

Vector GetBottomRightPos ( )⚓︎

Returns bottom right position of the room, inside of the wall border.


Get·Broken·Watch·State ()⚓︎

int GetBrokenWatchState ( )⚓︎

Returns whether the room is slowed down, sped up or neither.

Note

Return values:

0: Room is neither slowed down nor sped up

1: Room is slowed down, either because of the Broken Watch or because of the I'm Drowsy pill

2: Room is sped up, either because of the Broken Watch or because of the I'm Excited!!! pill


Get·Center·Pos ()⚓︎

Vector GetCenterPos ( )⚓︎

Returns the room center position.


Get·Clamped·Grid·Index ()⚓︎

int GetClampedGridIndex ( Vector Position )⚓︎

Returns the grid index located at Position. Clamps to the nearest grid index if Position is out of bounds.


Get·Clamped·Position ()⚓︎

Vector GetClampedPosition ( Vector Pos, float Margin )⚓︎

Returns Pos clamped to within the room's walls with a radius of Margin units away from out of bounds.


Get·Decoration·Seed ()⚓︎

int GetDecorationSeed ( )⚓︎


Get·Delirium·Distance ()⚓︎

int GetDeliriumDistance ( )⚓︎


Get·Devil·Room·Chance ()⚓︎

float GetDevilRoomChance ( )⚓︎

This gives the total devil deal percentage for the floor. It doesn't split it into devil and angel percentages as seen in the found hud. It's effectively the Duality percentage. This will return a value for illegal floors (e.g. Basement I) so be careful. The value can be greater than 100%.

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
-- this code shows how to convert room:GetDevilRoomChance into the separate devil and angel percentages shown in the found hud
-- this code is current for Repentance as of Jan 2024, other versions might have different values
local game = Game()

local function anyPlayerHasCollectible(collectible)
  for i = 0, game:GetNumPlayers() - 1 do
    local player = game:GetPlayer(i)

    if player:HasCollectible(collectible, false) then
      return true
    end
  end

  return false
end

local function anyPlayerHasTrinket(trinket)
  for i = 0, game:GetNumPlayers() - 1 do
    local player = game:GetPlayer(i)

    if player:HasTrinket(trinket, false) then
      return true
    end
  end

  return false
end

local function getDevilAngelRoomChance()
  local level = game:GetLevel()
  local room = level:GetCurrentRoom()
  local totalChance = math.min(room:GetDevilRoomChance(), 1.0)

  local angelRoomSpawned = game:GetStateFlag(GameStateFlag.STATE_FAMINE_SPAWNED) -- repurposed
  local devilRoomSpawned = game:GetStateFlag(GameStateFlag.STATE_DEVILROOM_SPAWNED)
  local devilRoomVisited = game:GetStateFlag(GameStateFlag.STATE_DEVILROOM_VISITED)

  local devilRoomChance = 1.0
  if anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_EUCHARIST) then
    devilRoomChance = 0.0
  elseif devilRoomSpawned and devilRoomVisited and game:GetDevilRoomDeals() > 0 then -- devil deals locked in
    if anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_BOOK_OF_VIRTUES) or
       anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_ACT_OF_CONTRITION) or
       level:GetAngelRoomChance() > 0.0 -- confessional, sac room
    then
      devilRoomChance = 0.5
    end
  elseif devilRoomSpawned or anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_BOOK_OF_VIRTUES) or level:GetAngelRoomChance() > 0.0 then
    if not (devilRoomVisited or angelRoomSpawned) then
      devilRoomChance = 0.0
    else
      devilRoomChance = 0.5
    end
  end

  -- https://bindingofisaacrebirth.fandom.com/wiki/Angel_Room#Angel_Room_Generation_Chance
  if devilRoomChance == 0.5 then
    if anyPlayerHasTrinket(TrinketType.TRINKET_ROSARY_BEAD) then
      devilRoomChance = devilRoomChance * (1.0 - 0.5)
    end
    if game:GetDonationModAngel() >= 10 then -- donate 10 coins
      devilRoomChance = devilRoomChance * (1.0 - 0.5)
    end
    if anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_KEY_PIECE_1) then
      devilRoomChance = devilRoomChance * (1.0 - 0.25)
    end
    if anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_KEY_PIECE_2) then
      devilRoomChance = devilRoomChance * (1.0 - 0.25)
    end
    if level:GetStateFlag(LevelStateFlag.STATE_EVIL_BUM_KILLED) then
      devilRoomChance = devilRoomChance * (1.0 - 0.25)
    end
    if level:GetStateFlag(LevelStateFlag.STATE_BUM_LEFT) and not level:GetStateFlag(LevelStateFlag.STATE_EVIL_BUM_LEFT) then
      devilRoomChance = devilRoomChance * (1.0 - 0.1)
    end
    if level:GetStateFlag(LevelStateFlag.STATE_EVIL_BUM_LEFT) and not level:GetStateFlag(LevelStateFlag.STATE_BUM_LEFT) then
      devilRoomChance = devilRoomChance * (1.0 + 0.1)
    end
    if level:GetAngelRoomChance() > 0.0 or
       (level:GetAngelRoomChance() < 0.0 and (anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_BOOK_OF_VIRTUES) or anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_ACT_OF_CONTRITION)))
    then
      devilRoomChance = devilRoomChance * (1.0 - level:GetAngelRoomChance())
    end
    if anyPlayerHasCollectible(CollectibleType.COLLECTIBLE_BOOK_OF_VIRTUES) then
      devilRoomChance = devilRoomChance * (1.0 - 0.25)
    end
    devilRoomChance = math.max(0.0, math.min(devilRoomChance, 1.0))
  end

  local angelRoomChance = 1.0 - devilRoomChance
  return totalChance * devilRoomChance, totalChance * angelRoomChance
end

Get·Door ()⚓︎

GridEntityDoor GetDoor ( DoorSlot Slot )⚓︎

Returns the GridEntityDoor at the given DoorSlot position. Returns nil if no Door is located there.


Get·Door·Slot·Position ()⚓︎

Vector GetDoorSlotPosition ( DoorSlot Slot )⚓︎


Get·Dungeon·Rock·Idx ()⚓︎

int GetDungeonRockIdx ( )⚓︎


Get·Enemy·Damage·Inflicted ()⚓︎

float GetEnemyDamageInflicted ( )⚓︎

Returns the total amount of HP lost by all enemies in the room within the current frame.

This is used by items that charge on damage inflicted, such as Berserk.


Get·Entities ()⚓︎

EntityList GetEntities ( )⚓︎

Returns a raw pointer to the array that stores all entities in the current room. Therefore, iterating over the return value will always iterate over the entities present in the room during the current logic frame, regardless of when GetEntities was initially called.

This behavior is different to Isaac.GetRoomEntities(), which returns an iterable table of the entities in the room at the time the function was called. For most usecases, its advised to use Isaac.GetRoomEntities()!

Example Code

This code prints the Type, Variant and SubType of each entity in the room.

1
2
3
4
5
6
local room = Game():GetRoom()
local roomEntities = room:GetEntities()
for i = 0, #roomEntities - 1 do
    local entity = roomEntities:Get(i)
    print(entity.Type, entity.Variant, entity.SubType)
end

Get·Frame·Count ()⚓︎

int GetFrameCount ( )⚓︎

Returns the amount of frames the room has been active for. Resets to 0 when the player leaves the room or the run is exited.


Get·Grid·Collision ()⚓︎

GridCollisionClass GetGridCollision ( int GridIndex )⚓︎

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


Get·Grid·Collision·At·Pos ()⚓︎

GridCollisionClass GetGridCollisionAtPos ( Vector Pos )⚓︎

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


Get·Grid·Entity ()⚓︎

GridEntity GetGridEntity ( int Index )⚓︎

Returns the GridEntity at this grid index. Returns nil when no GridEntity is found.


Get·Grid·Entity·From·Pos ()⚓︎

GridEntity GetGridEntityFromPos ( Vector Position )⚓︎

Returns the GridEntity at this position in the room. Returns nil when no GridEntity is found.


Get·Grid·Height ()⚓︎

int GetGridHeight ( )⚓︎


Get·Grid·Index ()⚓︎

int GetGridIndex ( Vector Position )⚓︎

Returns the grid index located at Position. Returns -1 for invalid index.


Get·Grid·Path ()⚓︎

int GetGridPath ( int Index )⚓︎

Grid path is a property of a grid square that represents the "cost" of traveling over this grid cell. Its used for the path finding algorithms which search the cheapest path to a given location. If a grid cell has a value higher than 0, it can prevent grid entities from being spawned on that square. Thus, you can get around it by resetting the grid path to 0, and then spawning the grid entity.

notes

GridPath values pseudo-enumeration:

900 : Set by some enemies when they pass through a tile. De-prioritises the tile for pathfinders. Degrades over time in steps of 100.

950 : Set by fire places. De-prioritises the tile for pathfinders. Does not degrade.

1000 : Set by grid entities. Invalidates the tile for pathfinders. Impedes grounded player movement. Does not degrade.

3000 : Set by pits. Invalidates the tile for pathfinders. Impedes grounded player movement. Does not degrade.

3999 : Set by grimaces. Invalidates the tile for pathfinders. Impedes grounded player movement. Drops to 900 and then degrades over time in steps of 100 (Grimaces reset value every frame).


Get·Grid·Path·From·Pos ()⚓︎

int GetGridPathFromPos ( Vector Position )⚓︎

notes

GridPath values pseudo-enumeration:

900 : Set by some enemies when they pass through a tile. De-prioritises the tile for pathfinders. Degrades over time in steps of 100.

950 : Set by fire places. De-prioritises the tile for pathfinders. Does not degrade.

1000 : Set by grid entities. Invalidates the tile for pathfinders. Impedes grounded player movement. Does not degrade.

3000 : Set by pits. Invalidates the tile for pathfinders. Impedes grounded player movement. Does not degrade.

3999 : Set by grimaces. Invalidates the tile for pathfinders. Impedes grounded player movement. Drops to 900 and then degrades over time in steps of 100 (Grimaces reset value every frame).


Get·Grid·Position ()⚓︎

Vector GetGridPosition ( int GridIndex )⚓︎

Returns the world position of GridIndex, even if GridIndex is invalid.


Get·Grid·Size ()⚓︎

int GetGridSize ( )⚓︎


Get·Grid·Width ()⚓︎

int GetGridWidth ( )⚓︎


Get·Laser·Target ()⚓︎

Vector GetLaserTarget ( Vector Pos, Vector Dir )⚓︎

Returns the hit position for a laser beam (Technology, Robo-Baby). Usually this is the first poop, fire, rock, TNT, or wall encountered in a straight line.


Get·Lava·Intensity ()⚓︎

float GetLavaIntensity ( )⚓︎

Usually returns 1, unless the lava is in the process of being cooled down by Flush! or other room flooding effects, in which case this will gradually decrease down to 0.


Get·Lighting·Alpha ()⚓︎

float GetLightingAlpha ( )⚓︎


Get·LRoom·Area·Desc ()⚓︎

LRoomAreaDesc GetLRoomAreaDesc ( )⚓︎

Bug

Since it returns UserData, this function is unusable and therefore broken.


Get·LRoom·Tile·Desc ()⚓︎

LRoomTileDesc GetLRoomTileDesc ( )⚓︎

Bug

Since it returns UserData, this function is unusable and therefore broken.


Get·Random·Position ()⚓︎

Vector GetRandomPosition ( float Margin )⚓︎

Returns a random position in the room with a radius of Margin units away from any obstacles. This position is not alligned with the grid.


Get·Random·Tile·Index ()⚓︎

int GetRandomTileIndex ( int Seed )⚓︎


Get·Red·Heart·Damage ()⚓︎

boolean GetRedHeartDamage ( )⚓︎

Returns true if the player took non-self inflicted damage to a red heart container while in the room. Resets to false if the player leaves the room or exits the run.


Get·Render·Mode ()⚓︎

RenderMode GetRenderMode ( )⚓︎

Returns a RenderMode enum which can be used to render entities differently depending on context (i.e. custom water reflections).


Get·Render·Scroll·Offset ()⚓︎

const Vector GetRenderScrollOffset ( )⚓︎

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


Get·Render·Surface·Top·Left ()⚓︎

const Vector GetRenderSurfaceTopLeft ( )⚓︎

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


Get·Room·Config·Stage ()⚓︎

int GetRoomConfigStage ( )⚓︎

Returns the ID of the stage the room was designed for.

Stage IDs (corresponds to IDs in stages.xml)
DLC ID Stage Comment
0 Special Rooms
1 Basement
2 Cellar
3 Burning Basement
4 Caves
5 Catacombs
6 Flooded Caves
7 Depths
8 Necropolis
9 Dank Depths
10 Womb
11 Utero
12 Scarred Womb
13 Blue Womb
14 Sheol
15 Cathedral
16 Dark Room
17 Chest
18 Greed Special Rooms
19 Greed Basement
20 Greed Caves
21 Greed Depths
22 Greed Womb
23 Greed Sheol
24 The Shop
25 Ultra Greed
26 The Void
27 Downpour
28 Dross
29 Mines
30 Ashpit
31 Mausoleum
32 Gehenna
33 Corpse
35 Home The Stage ID of 34 does not exist.
36 Backwards These rooms are used during the Ascent.

Get·Room·Shape ()⚓︎

RoomShape GetRoomShape ( )⚓︎


Get·Second·Boss·ID ()⚓︎

int GetSecondBossID ( )⚓︎

Returns the boss ID of the second boss in a double trouble room. Returns 0 otherwise.

A boss ID is not equal to the entity type of the boss; it is a separate value in the entities2.xml file inside the "bossID" attribute.

Checking for this value is not sufficient to detect a Double Trouble room because a Double Trouble room can contain two of the same boss. If this is the case, then the value of the second boss ID will be equal to 0.


Get·Seeded·Collectible ()⚓︎

CollectibleType GetSeededCollectible ( int Seed, bool NoDecrease = false )⚓︎

When NoDecrease is true, returned collectibles will not be removed from the pools they came from.


Get·Shop·Level ()⚓︎

int GetShopLevel ( )⚓︎


Get·Spawn·Seed ()⚓︎

int GetSpawnSeed ( )⚓︎


Get·Tinted·Rock·Idx ()⚓︎

int GetTintedRockIdx ( )⚓︎


Get·Top·Left·Pos ()⚓︎

Vector GetTopLeftPos ( )⚓︎

Returns the top-left position inside of the walls.


Get·Type ()⚓︎

RoomType GetType ( )⚓︎


Get·Water·Current ()⚓︎

Vector GetWaterCurrent ( )⚓︎

Returns a vector corresponding to any water current in the room.


Has·Curse·Mist ()⚓︎

boolean HasCurseMist ( )⚓︎

Returns true if the player is inside the abandoned mineshaft.


Has·Lava ()⚓︎

boolean HasLava ( )⚓︎

Returns true if the room contains lava.

Warning

This function will return true if the room contains lava even if there are no pits to make the lava visible.


Has·Slow·Down ()⚓︎

boolean HasSlowDown ( )⚓︎

Returns whether the room is currently under the effect of the I'm Drowsy pill or not. The function will also return true if a call to SetSlowDown was performed earlier and the specified Duration has not yet expired.

Note that this function will return false if the effect of the I'm Drowsy pill was triggered through the Broken Watch. To check for that scenario, use the GetBrokenWatchState function.

This function will also return false if the player is under the effect of the Stop Watch. To check for that scenario, check whether or not the player has the Stop Watch in their posession.


Has·Trigger·Pressure·Plates ()⚓︎

boolean HasTriggerPressurePlates ( )⚓︎

Returns true if there are one or more pressure plates in the room.

Warning

In order to see if the pressure plates are pressed or not, you will have to iterate over the grid entities in the room.


Has·Water ()⚓︎

boolean HasWater ( )⚓︎


Has·Water·Pits ()⚓︎

boolean HasWaterPits ( )⚓︎

Returns true if the room contains pits that have liquid in them (e.g. lava in Mines, tar in Dank Depths, etc.).


Invalidate·Pickup·Vision ()⚓︎

void InvalidatePickupVision ( )⚓︎

Causes chest previews from Guppy's Eye to be updated on the next frame.


Is·Ambush·Active ()⚓︎

boolean IsAmbushActive ( )⚓︎


Is·Ambush·Done ()⚓︎

boolean IsAmbushDone ( )⚓︎


Is·Clear ()⚓︎

boolean IsClear ( )⚓︎


Is·Current·Room·Last·Boss ()⚓︎

boolean IsCurrentRoomLastBoss ( )⚓︎

Returns true if the current room is the second boss room when on an XL floor. Returns false otherwise.


Is·Door·Slot·Allowed ()⚓︎

boolean IsDoorSlotAllowed ( DoorSlot Slot )⚓︎

Returns whether or not the supplied door slot is valid for the current room. This is contingent on the room definition in the STB/XML file. (Basement Renovator displays valid doors as brown and invalid doors as white.) The value returned by this method is independent of whether or not a door currently exists at the given slot.

For example, in the starting room of a floor, this method would return true for DoorSlot.LEFT0, DoorSlot.UP0, Doorslot.RIGHT0, and DoorSlot.DOWN0, and false for all other values (regardless of what doors happen to exist or not).

For example, there is a relatively common 1x1 room in the Caves with 4 Boom Flies and a narrow bridge from the top door to the bottom door. In this room, the doors on the left side and the right side are disabled. In this room, this method would return true for DoorSlot.UP0 and DoorSlot.DOWN0, and false for all other values (regardless of what doors happen to exist or not).


Is·First·Enemy·Dead ()⚓︎

boolean IsFirstEnemyDead ( )⚓︎


Is·First·Visit ()⚓︎

boolean IsFirstVisit ( )⚓︎


Is·Initialized ()⚓︎

boolean IsInitialized ( )⚓︎


Is·LShaped·Room ()⚓︎

boolean IsLShapedRoom ( )⚓︎


Is·Mirror·World ()⚓︎

boolean IsMirrorWorld ( )⚓︎

Returns true if the player is inside the mirror dimension.


Is·Position·In·Room ()⚓︎

boolean IsPositionInRoom ( Vector Pos, float Margin )⚓︎

Returns true if the given position is inside the room. Margin is used as a radius around the position that also needs to be inside the room boundaries. The Room boundary is the position between the walkable area and the walls. Therefore, positions inside walls and the black void do count as "outside" the room.


Is·Sacrifice·Done ()⚓︎

boolean IsSacrificeDone ( )⚓︎


Keep·Doors·Closed ()⚓︎

void KeepDoorsClosed ( )⚓︎


Mama·Mega·Explosion ()⚓︎

void MamaMegaExplosion ( Vector Position )⚓︎


Play·Music ()⚓︎

void PlayMusic ( )⚓︎

Plays the music track used by this room. Useful for resetting music after playing a different track.


Remove·Door ()⚓︎

void RemoveDoor ( DoorSlot Slot )⚓︎


Remove·Grid·Entity ()⚓︎

void RemoveGridEntity ( int GridIndex, int PathTrail, boolean KeepDecoration )⚓︎

  • GridIndex is the location of the grid as shown with the debug 11 console command.
  • PathTrail is the "cost" to leave behind on the square. In most cases, you would want to pass 0 for this argument.

Note that after removing a grid entity, you cannot spawn another grid entity on the same tile until a frame has passed. If doing this is absolutely required, you can get around the restriction in two different ways:

  1. By calling the Room:Update() method between removing the old grid entity and spawning the new one, you can simulate a frame passing. However, this can have other unwanted side effects, so it is only recommended to do this as a last resort. Specifically, Room:Update will update every entity in the room, including the player, causing them to continue to move in the direction that they are already moving. Furthermore, if Room:Update is called in the PostNewRoom callback, it will still cause the player to drift, even though they are standing still. (This is because their velocity has not been zeroed out at time that the callback fires.)
  2. By calling GridEntity:Update() on the removed grid entity after it is removed, you will be able to immediately spawn another grid entity on the same tile. However, the new grid entity will be automatically removed at the end of the frame, so you must spawn it again on the next frame. This method can also lead to unwanted side effects, such as an explosion not destroying a rock properly (because it would be erronenously respawned on the subsequent frame).

Render ()⚓︎

void Render ( )⚓︎


Respawn·Enemies ()⚓︎

void RespawnEnemies ( )⚓︎

Used by the D7 collectible.


Screen·Wrap·Position ()⚓︎

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

Notes

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.


Set·Ambush·Done ()⚓︎

void SetAmbushDone ( boolean Value )⚓︎


Set·Broken·Watch·State ()⚓︎

void SetBrokenWatchState ( int State )⚓︎

Speed up, slow down or remove either of these states from the current room. See the notes section in GetBrokenWatchState for the different values of State.


Set·Card·Against·Humanity ()⚓︎

void SetCardAgainstHumanity ( )⚓︎


Set·Clear ()⚓︎

void SetClear ( boolean Clear )⚓︎

Needed for Angel rooms so that the clear flag can be set to false when an Angel spawns.


Set·First·Enemy·Dead ()⚓︎

void SetFirstEnemyDead ( boolean Value )⚓︎


Set·Floor·Color ()⚓︎

void SetFloorColor ( Color FloorColor )⚓︎

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

Example Code

This code changes the floor color to red.

1
Game():GetRoom():SetFloorColor(Color(1,1,1,1,255,0,0))


Set·Grid·Path ()⚓︎

boolean SetGridPath ( int Index, int Value )⚓︎

Grid path is a property of a grid square that represents the "cost" of traveling over this grid cell. Its used for the path finding algorithms which search the cheapest path to a given location. If a grid cell has a value higher than 0, it can prevent grid entities from being spawned on that square. Thus, you can get around it by resetting the grid path to 0, and then spawning the grid entity.

notes

GridPath values pseudo-enumeration:

900 : Set by some enemies when they pass through a tile. De-prioritises the tile for pathfinders. Degrades over time in steps of 100.

950 : Set by fire places. De-prioritises the tile for pathfinders. Does not degrade.

1000 : Set by grid entities. Invalidates the tile for pathfinders. Impedes grounded player movement. Does not degrade.

3000 : Set by pits. Invalidates the tile for pathfinders. Impedes grounded player movement. Does not degrade.

3999 : Set by grimaces. Invalidates the tile for pathfinders. Impedes grounded player movement. Drops to 900 and then degrades over time in steps of 100 (Grimaces reset value every frame).


Set·Red·Heart·Damage ()⚓︎

void SetRedHeartDamage ( )⚓︎


Set·Sacrifice·Done ()⚓︎

void SetSacrificeDone ( boolean Done )⚓︎


Set·Slow·Down ()⚓︎

void SetSlowDown ( int Duration )⚓︎

Apply a slow down effect for Duration logic frames (there are 30 logic frames per second).

Using a negative Duration will not do anything at all, instead of making the slow down permanent as one might expect.

Bug

This function will only apply a slow down effect on the player and not on all entities of the room. If you want to apply a slow down effect on all entities in the room, consider using SetBrokenWatchState with a State of 1 and add a timer to your script in order to count the elapsed frames.


Set·Wall·Color ()⚓︎

void SetWallColor ( Color WallColor )⚓︎

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

Example Code

This code changes the wall color to red.

1
Game():GetRoom():SetWallColor(Color(1,1,1,1,255,0,0))


Shop·Reshuffle ()⚓︎

void ShopReshuffle ( boolean KeepCollectibleIdx, boolean ReselectSaleItem )⚓︎


Shop·Restock·Full ()⚓︎

void ShopRestockFull ( )⚓︎

Effectively acts like a use of a Reroll Machine, restocking shops and rerolling items.


Shop·Restock·Partial ()⚓︎

void ShopRestockPartial ( )⚓︎


Spawn·Clear·Award ()⚓︎

void SpawnClearAward ( )⚓︎


Spawn·Grid·Entity ()⚓︎

boolean SpawnGridEntity ( int GridIndex, GridEntityType Type, int Variant, int Seed, int VarData )⚓︎


Stop·Rain ()⚓︎

void StopRain ( )⚓︎

Stops any rain effects in the room.


Trigger·Clear ()⚓︎

void TriggerClear ( boolean Silent = false )⚓︎

Triggers all room clear effects (does not actually clear the room). Door opening sounds can be muted by setting Silent to true.


Try·Make·Bridge ()⚓︎

boolean TryMakeBridge ( GridEntity pit, GridEntity rock )⚓︎

Tries to create a bridge over a given pit. Returns true if the creation was successful. Returns false otherwise.


Try·Place·Ladder ()⚓︎

void TryPlaceLadder ( Vector PlayerPos, Vector PlayerVelocity, Entity Ladder )⚓︎

This function was removed with Repentance.


Try·Spawn·Blue·Womb·Door ()⚓︎

boolean TrySpawnBlueWombDoor ( boolean FirstTime = true, boolean IgnoreTime = false, boolean Force = false )⚓︎

Attempts to spawn a door to the Blue Womb. This usually does nothing outside of Mom's Heart's boss room unless Force is set to true.


Try·Spawn·Boss·Rush·Door ()⚓︎

boolean TrySpawnBossRushDoor ( boolean IgnoreTime = false, boolean Force = false )⚓︎

Attempts to spawn a door to the Boss Rush. This usually does nothing outside of Mom's boss room unless Force is set to true.


Try·Spawn·Devil·Room·Door ()⚓︎

boolean TrySpawnDevilRoomDoor ( boolean Animate = false, boolean Force = false )⚓︎

Attempts to spawn a door to the Devil or Angel room. This usually does nothing inside of non-boss rooms unless Force is set to true.


Try·Spawn·Mega·Satan·Room·Door ()⚓︎

boolean TrySpawnMegaSatanRoomDoor ( boolean Force = false )⚓︎

Attempts to spawn a door to Mega Satan. This usually does nothing outside of the starting room of the Chest/Dark Room unless Force is set to true


Try·Spawn·Secret·Exit ()⚓︎

boolean TrySpawnSecretExit ( boolean Animate = false, boolean Force = false )⚓︎

Attempts to spawn a door to the Downpour, Mines or Mausoleum depending on the current floor. This usually does nothing outside of boss rooms unless Force is set to true.


Try·Spawn·Secret·Shop ()⚓︎

boolean TrySpawnSecretShop ( boolean Force = false )⚓︎

Attempts to spawn a trapdoor to the Member Card shop within the current room. This usually does nothing outside of shops or if the player doesn't hold a Member Card unless Force is set to true.


Try·Spawn·Special·Quest·Door ()⚓︎

boolean TrySpawnSpecialQuestDoor ( )⚓︎

Attempts to spawn either a door to the Mirror Dimension in Downpour, or the abandoned mineshaft in the Mines.


Try·Spawn·The·Void·Door ()⚓︎

boolean TrySpawnTheVoidDoor ( boolean Force = false )⚓︎

Attempts to spawn a door to a room containing a Void portal This usually does nothing outside of Hush's boss room unless Force is set to true.


Turn·Gold ()⚓︎

void TurnGold ( )⚓︎

Applies a gold tint to all grid entities in the room. This is the same effect that the game does after defeating Ultra Greedier.


Update ()⚓︎

void Update ( )⚓︎

Updates the current room.

It is recommended to call this function after calling Room:RemoveGridEntity() in order to correctly apply the changes.

Notes

Calling this function is needed to apply some changes like spawning a trapdoor where a pit already exists.

To do this, remove the pit, call the Update() function and then spawn the trapdoor.

Bug

As mentioned in the Repentance API Issue Tracker, calling room:Update() as a part of card functionality forces an instant use of pocket active items.


World·To·Screen·Position ()⚓︎

Vector WorldToScreenPosition ( Vector WorldPos )⚓︎

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



Last update: April 3, 2024