### MC_PRE_SFX_PLAY Example: Force Looping Sounds
Source: https://repentogon.com/enums/ModCallbacks.html
This example demonstrates how to modify sound effect parameters before they play. It forces all sounds to loop by returning a modified table.
```lua
function mod:myFunction(ID, Volume, FrameDelay, Loop, Pitch, Pan)
return {ID, Volume, FrameDelay, true, Pitch, Pan}
end
mod:AddCallback(ModCallbacks.MC_PRE_SFX_PLAY, mod.myFunction)
```
--------------------------------
### Render to Image Example
Source: https://repentogon.com/renderer/Renderer.html
This example demonstrates how to create an image and then use RenderToImage to draw content onto it. The render function clears the target and renders sprites based on provided data.
```lua
local exampleSurface = Renderer.CreateImage(128, 128, "Example Surface")
local function UpdateSurfaceContents(renders)
Renderer.RenderToImage(exampleSurface, function(controller)
controller:Clear()
for _, render in ipairs(renders) do
local sprite = render[1]
local position = render[2]
sprite:Render(position)
end
end)
end
```
--------------------------------
### Check if Starting From State
Source: https://repentogon.com/Game.html
Returns true if the game started from a continued state. Always false after MC_POST_GAME_STARTED.
```lua
boolean IsStartingFromState ( )
```
--------------------------------
### Get Transition Mode Example
Source: https://repentogon.com/RoomTransition.html
Retrieves the current transition mode. This function is part of the RoomTransition global table and requires a period (.) for invocation.
```lua
local tmode = RoomTransition.GetTransitionMode()
```
--------------------------------
### Start New Game
Source: https://repentogon.com/Isaac.html
Starts a new game with specified parameters including character, challenge, difficulty, and seed. Setting IsCustomRun to true disables achievements. An overload allows using a Seeds object for current seed modifiers.
```lua
void StartNewGame ( PlayerType Character, Challenge Challenge = ChallengeType.CHALLENGE_NULL, Difficulty Mode = Difficulty.DIFFICULTY_NORMAL, int Seed = Random, boolean IsCustomRun = false )
```
```lua
void StartNewGame ( PlayerType Character, Challenge Challenge, Difficulty Mode, Seeds Seeds )
```
--------------------------------
### Get RoomConfigSet Instance
Source: https://repentogon.com/CcpContainer_RoomConfigSet.html
Obtain an instance of the RoomConfigSet class. This is typically done by first getting the stage and then the room set from that stage.
```lua
local roomConfigSet = RoomConfig.GetStage(StbType.BASEMENT):GetRoomSet(0)
```
--------------------------------
### CanStartTrueCoop
Source: https://repentogon.com/Isaac.html
Determines if true co-op can be started.
```APIDOC
## CanStartTrueCoop
### Description
Checks if the conditions are met to start a true co-op game.
### Signature
`boolean CanStartTrueCoop()`
### Parameters
None.
```
--------------------------------
### Get ()
Source: https://repentogon.com/CcpContainer_RoomConfigSet.html
Retrieves a RoomConfigRoom from the set at a specified index.
```APIDOC
## Get ()
### Description
Returns a RoomConfigRoom at the index of the list provided.
### Parameters
#### Path Parameters
- **idx** (int) - Required - The index of the room to retrieve.
### Function Signature
`RoomConfigRoom Get ( int idx )`
```
--------------------------------
### Initialize
Source: https://repentogon.com/GenericPrompt.html
Initializes the GenericPrompt, optionally setting it to a smaller size.
```APIDOC
## Initialize()
### Description
Initializes the GenericPrompt. Can be configured to be a smaller prompt.
### Parameters
- **SmallPrompt** (boolean) - Optional - If true, initializes a smaller version of the prompt.
```
--------------------------------
### Get Sprite Example
Source: https://repentogon.com/menus/SpecialSeedsMenu.html
Retrieves the sprite associated with the SpecialSeedsMenu. This function is called using dot notation.
```lua
local sprite = SpecialSeedsMenu.GetSprite()
```
--------------------------------
### GetState
Source: https://repentogon.com/menus/DailyChallengeMenu.html
Gets the current state of the daily challenge menu.
```APIDOC
## GetState
### Description
Retrieves the current state of the daily challenge menu.
### Function Signature
int GetState ( )
### Return Value
- int: The current state of the menu.
```
--------------------------------
### Show
Source: https://repentogon.com/ImGui.html
Makes the ImGui interface visible.
```APIDOC
## Show
### Description
Renders and displays the ImGui interface to the screen.
### Signature
`void Show()`
```
--------------------------------
### Get Bubble Sprite Example
Source: https://repentogon.com/NightmareScene.html
Retrieves the sprite used for bubbles in the nightmare scene. Ensure this is called after game initialization.
```lua
local sprite = NightmareScene.GetBubbleSprite()
```
--------------------------------
### MC_POST_START_AMBUSH_WAVE
Source: https://repentogon.com/enums/ModCallbacks.html
Callback triggered after an ambush wave starts.
```APIDOC
## MC_POST_START_AMBUSH_WAVE
### Description
Callback triggered after an ambush wave starts.
### Method
Callback
### Parameters
#### Path Parameters
- **BossAmbush** (boolean) - Description
### Response
#### Success Response (200)
- **return value** (void) - Description
```
--------------------------------
### Get Selected Element Example
Source: https://repentogon.com/menus/SpecialSeedsMenu.html
Retrieves the index of the currently selected element in the SpecialSeedsMenu. This function is called using dot notation.
```lua
local selectedElement = SpecialSeedsMenu.GetSelectedElement()
```
--------------------------------
### InitTwin
Source: https://repentogon.com/EntityPlayer.html
Initializes a twin player.
```APIDOC
## InitTwin
### Description
Initializes a twin player.
### Method
POST (assumed)
### Endpoint
/EntityPlayer/InitTwin
### Parameters
#### Request Body
- **PlayerType** (PlayerType) - Required - The type of player to initialize as a twin.
```
--------------------------------
### StartNewGame
Source: https://repentogon.com/Isaac.html
Starts a new game with specified player character, challenge, difficulty, and seed options. Overloaded to accept either a single seed or a Seeds object.
```APIDOC
## StartNewGame (PlayerType Character, Challenge Challenge = ChallengeType.CHALLENGE_NULL, Difficulty Mode = Difficulty.DIFFICULTY_NORMAL, int Seed = Random, boolean IsCustomRun = false)
### Description
Starts a new game with specified player character, challenge, difficulty, and seed options. This overload allows for a single seed value and custom run flag.
### Method
void
### Parameters
- **Character** (PlayerType) - Required - The player character type.
- **Challenge** (Challenge) - Optional - The challenge type, defaults to ChallengeType.CHALLENGE_NULL.
- **Mode** (Difficulty) - Optional - The difficulty mode, defaults to Difficulty.DIFFICULTY_NORMAL.
- **Seed** (int) - Optional - The seed for the game, defaults to Random.
- **IsCustomRun** (boolean) - Optional - Flag to indicate if it's a custom run, defaults to false.
```
```APIDOC
## StartNewGame (PlayerType Character, Challenge Challenge, Difficulty Mode, Seeds Seeds)
### Description
Starts a new game with specified player character, challenge, difficulty, and a Seeds object. This overload is used when multiple seed values are managed via a Seeds object.
### Method
void
### Parameters
- **Character** (PlayerType) - Required - The player character type.
- **Challenge** (Challenge) - Required - The challenge type.
- **Mode** (Difficulty) - Required - The difficulty mode.
- **Seeds** (Seeds) - Required - An object containing multiple seed values.
```
--------------------------------
### Initialize and Render a Beam
Source: https://repentogon.com/renderer/Beam.html
This example demonstrates how to initialize a Beam object with a sprite and layer, then add points to it and render it during player pre-render. The sprite is copied internally, and changes should be made via GetSprite.
```lua
local spritesheetHeight = 64
local sprite = Sprite()
sprite:Load("gfx/1000.193_anima chain.anm2", true)
sprite:Play("Idle", false)
local layer = sprite:GetLayer("chain")
local chain = Beam(sprite, "chain", false, false)
mod:AddCallback(ModCallbacks.MC_PRE_PLAYER_RENDER, function(_, player)
local origin = Isaac.WorldToScreen(Game():GetRoom():GetCenterPos())
local target = Isaac.WorldToScreen(player.Position)
local coord = target:Distance(origin)
chain:Add(origin,0)
chain:Add(target,coord)
chain:Render()
end)
```
--------------------------------
### Get Number of Active Eyes
Source: https://repentogon.com/MultiShotParams.html
Returns the count of eyes that are simultaneously firing. Examples include 2 for 'The Wiz' and 1 for 'Mutant Spider'.
```lua
local numEyes = player:GetMultiShotParams(WeaponType.WEAPON_TEARS):GetNumEyesActive()
```
--------------------------------
### Get Current Wave Example
Source: https://repentogon.com/Ambush.html
Retrieves the current wave number of the active challenge or boss rush room. This is useful for tracking progress within a timed or wave-based event.
```lua
local currwave = Ambush.GetCurrentWave()
```
--------------------------------
### TryInitOptionCycle
Source: https://repentogon.com/EntityPickup.html
Attempts to initialize an option cycle with a specified number of cycles. Returns a boolean indicating success.
```APIDOC
## TryInitOptionCycle(NumCycle)
### Description
Attempts to initialize an option cycle with a specified number of cycles.
### Method
boolean
### Parameters
#### Path Parameters
- **NumCycle** (int) - Required - The number of cycles to initialize.
```
--------------------------------
### Get Collectibles List
Source: https://repentogon.com/EntityPlayer.html
Returns a table mapping each collectible type to the player's count of that item, excluding innate items. This example shows how to print the count of Sad Onions.
```lua
local collectiblesList = player:GetCollectiblesList()
print(collectiblesList[CollectibleType.COLLECTIBLE_SAD_ONION])
```
--------------------------------
### MC_POST_START_AMBUSH_WAVE
Source: https://repentogon.com/enums/ModCallbacks.html
Fires at the start of a challenge/boss rush room wave.
```APIDOC
## MC_POST_START_AMBUSH_WAVE
### Description
Fires at the start of a challenge/boss rush room wave.
### Function Args
- **BossAmbush** (boolean) - Whether this is a boss ambush wave.
### Return Type
- void
```
--------------------------------
### Get CollectibleType of Pocket Active Item
Source: https://repentogon.com/PocketItem.html
Obtains the CollectibleType of an active item stored in a pocket slot. This example demonstrates checking the item type and then retrieving the active slot index.
```lua
local pocketItem = player:GetPocketItem(PillCardSlot.PRIMARY)
if pocketItem:GetType() == PocketItemType.ACTIVE_ITEM then
local activeSlot = pocketItem:GetSlot() - 1
local activeItemID = player:GetActiveItem(activeSlot)
end
```
--------------------------------
### Instantiate LevelGeneratorEntry
Source: https://repentogon.com/LevelGeneratorEntry.html
Demonstrates how to create a new instance of the LevelGeneratorEntry class.
```lua
local newLevelGeneratorEntry = Isaac.LevelGeneratorEntry()
```
--------------------------------
### MC_PRE_RENDER
Source: https://repentogon.com/enums/ModCallbacks.html
Gets called right before the Manager::Render() function gets called.
```APIDOC
## MC_PRE_RENDER
### Description
Gets called right before the Manager::Render() function gets called.
### Method
(Implicitly called by the game)
### Parameters
None
### Return Type
void
```
--------------------------------
### MC_PLAYER_INIT_PRE_LEVEL_INIT_STATS
Source: https://repentogon.com/enums/ModCallbacks.html
This callback runs earlier than `MC_POST_PLAYER_INIT`, right before the game initializes the starting health/coins/costume/etc of a player. It still runs on run continues.
```APIDOC
## MC_PLAYER_INIT_PRE_LEVEL_INIT_STATS
### Description
This callback runs earlier than `MC_POST_PLAYER_INIT`, right before the game initializes the starting health/coins/costume/etc of a player. Note that this callback still runs on run continues, in which case some of the aforementioned initializations will later be overridden by the player's saved state (such as health).
### ID
1127
### Function Args
- **Player** (EntityPlayer)
### Optional Args
- **PlayerType**
### Return Type
void
```
--------------------------------
### SetSuplexState
Source: https://repentogon.com/EntityPlayer.html
No description available.
```APIDOC
## SetSuplexState
### Method
void
### Parameters
#### Path Parameters
- **State** (SuplexState) - Description not available
```
--------------------------------
### Get Bag of Crafting Slot Content
Source: https://repentogon.com/EntityPlayer.html
Gets the content of a specific slot within the Bag of Crafting.
```csharp
BagOfCraftingPickup GetBagOfCraftingSlot ( int SlotID )
```
--------------------------------
### MC_PLAYER_INIT_POST_LEVEL_INIT_STATS
Source: https://repentogon.com/enums/ModCallbacks.html
This callback runs after a player's starting items/pills/cards/etc are added, usually following their first initialization in the run, or after certain "resets" such as Genesis. It does not run again on run continues.
```APIDOC
## MC_PLAYER_INIT_POST_LEVEL_INIT_STATS
### Description
This callback runs after a player's starting items/pills/cards/etc are added, usually following their first initialization in the run, or after certain "resets" such as Genesis. This callback does not run again on run continues, so it is a good place to initialize similar sorts of "starting items".
### ID
1042
### Function Args
- **Player** (EntityPlayer)
### Optional Args
- **PlayerType**
### Return Type
void
```
--------------------------------
### Create and Display a Generic Prompt
Source: https://repentogon.com/GenericPrompt.html
This snippet demonstrates how to create a GenericPrompt, set its text, and display it when a specific key (Minus) is pressed. It also shows how to process user input and print the selected option to the console after the prompt is closed.
```lua
local myPrompt = GenericPrompt()
myPrompt:Initialize()
myPrompt:SetText("Some test text")
local wasPromptDisplayed = false
function mod:myRenderFunction(_)
myPrompt:Render()
end
mod:AddCallback(ModCallbacks.MC_POST_RENDER, mod.myRenderFunction)
function mod:myUpdateFunction(_)
myPrompt:Update(true) -- true = Process user inputs
if wasPromptDisplayed and not myPrompt:IsActive() then -- prompt was closed by user
print("User selected option: "..myPrompt:GetSubmittedSelection())
wasPromptDisplayed = false
end
if Input.IsButtonTriggered(Keyboard.KEY_MINUS, 0) then -- on Pressing minus button will open prompt
myPrompt:Show()
wasPromptDisplayed = true
end
end
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, mod.myUpdateFunction)
```
--------------------------------
### GetPill
Source: https://repentogon.com/EntityConfigPlayer.html
Returns the character's starting pill color. Does not include starting pills obtained via unlocks.
```APIDOC
## GetPill
### Description
Returns the character's starting pill color. Does not include starting pills obtained via unlocks.
### Method
N/A (Function Call)
### Endpoint
N/A
### Parameters
None
### Response
#### Success Response
- **PillColor** (PillColor) - The character's starting pill color.
```
--------------------------------
### Get Rain Intensity
Source: https://repentogon.com/Room.html
Gets the intensity of the positional rain effect in Downpour. Values above 1.0 have no additional visual effect.
```lua
float GetRainIntensity ( )
```
--------------------------------
### Create New 1x1 Room at Every Door Slot
Source: https://repentogon.com/Level.html
This example demonstrates how to use TryPlaceRoomAtDoor to create a new 1x1 room at every available door slot in the current room. It checks if a door slot is allowed and if the new room configuration meets the required door slot availability.
```lua
-- Example code for an active item that creates a new 1x1 room at every doorslot available in the current room.
mod:AddCallback(ModCallbacks.MC_USE_ITEM, function(_, id, rng, player, flags, slot)
local level = game:GetLevel()
local room = game:GetRoom()
local roomDesc = level:GetCurrentRoomDesc()
local success = false
for doorSlot=0, 7 do
-- Bitmask check to identify if the current room would even allow a door to be placed here.
local doorSlotAllowed = roomDesc.Data.Doors & (1 << doorSlot) ~= 0
if doorSlotAllowed and not room:GetDoor(doorSlot) then
local seed = rng:Next()
local requiredDoors = 15 -- Bitmask value that requires the new 1x1 room to have all 4 doorslots available, just so we're sure it fits.
local roomConfig = RoomConfig.GetRandomRoom(seed, true, Isaac.GetCurrentStageConfigId(), RoomType.ROOM_DEFAULT, RoomShape.ROOMSHAPE_1x1, nil, nil, nil, nil, requiredDoors)
if roomConfig then
local newRoom = level:TryPlaceRoomAtDoor(roomConfig, roomDesc, doorSlot, seed, true, false)
if newRoom then
success = true
end
end
end
end
if success then
return {ShowAnim=true}
else
return {Discharge=false}
end
end, MY_ACTIVE_ITEM_ID)
```
--------------------------------
### Get Lightning Intensity
Source: https://repentogon.com/Room.html
Gets the intensity of the Downpour lightning effect, which affects Wraith visibility. The value decays over time.
```lua
float GetLightningIntensity ( )
```
--------------------------------
### StartBossIntro
Source: https://repentogon.com/RoomTransition.html
Initiates the boss intro sequence with specified boss types.
```APIDOC
## StartBossIntro ( BossType BossID1, BossType BossID2 = 0 )
### Description
Initiates the boss intro sequence with specified boss types. The second boss ID is optional.
### Method
`RoomTransition.StartBossIntro(BossID1, BossID2)`
### Parameters
#### Path Parameters
- **BossID1** (BossType) - Required - The ID of the first boss.
- **BossID2** (BossType) - Optional - The ID of the second boss. Defaults to 0.
```
--------------------------------
### Get Completion Mark Value
Source: https://repentogon.com/Isaac.html
Gets a specific completion mark value for a character, ranging from 0 (not accomplished) to 2 (hard).
```C++
int GetCompletionMark ( PlayerType Character, CompletionType Mark)
```
--------------------------------
### Get Baby Entity Configuration
Source: https://repentogon.com/EntityConfigBaby.html
Obtain the configuration for a baby entity of a specific subtype. This is the primary method to get an instance of EntityConfigBaby.
```lua
local bloatBabyConfig = EntityConfig.GetBaby(BabySubType.BABY_BLOAT)
```
--------------------------------
### Instantiate WeightedOutcomePicker
Source: https://repentogon.com/WeightedOutcomePicker.html
Demonstrates how to create a new instance of the WeightedOutcomePicker class.
```lua
local wop = WeightedOutcomePicker()
```
--------------------------------
### Instantiate Color Object
Source: https://repentogon.com/Color.html
Demonstrates how to create a new Color object with RGBA values. All arguments are optional, and Colorize can be set directly in the constructor.
```lua
local redColor = Color(1,0,0,1)
```
--------------------------------
### SetSuplexAimCountdown
Source: https://repentogon.com/EntityPlayer.html
No description available.
```APIDOC
## SetSuplexAimCountdown
### Method
void
### Parameters
#### Path Parameters
- **Countdown** (int) - Description not available
```
--------------------------------
### Get RailManager Instance
Source: https://repentogon.com/RailManager.html
Obtain an instance of the RailManager class. This is typically done by first getting the game instance, then the room, and finally the RailManager.
```lua
local railManager = Game():GetRoom():GetRailManager()
```
--------------------------------
### TryInitOptionCycle
Source: https://repentogon.com/EntityPickup.html
Initiates a cycle of collectibles for the pedestal.
```APIDOC
## TryInitOptionCycle
### Description
Causes the collectible pedestal to start cycling through the specified amount of collectibles, including its own collectible type.
### Method
N/A (Method signature provided)
### Endpoint
N/A
### Parameters
- **NumCycle** (int) - The number of collectibles to cycle through.
### Response
#### Success Response
- **return value** (boolean) - `true` if the option cycle was successfully initialized, `false` otherwise.
### Response Example
```
true
```
```
--------------------------------
### GetTrinket
Source: https://repentogon.com/EntityConfigPlayer.html
Returns the character's starting trinket type. Does not include starting trinkets obtained via unlocks or trinkets added by mods.
```APIDOC
## GetTrinket
### Description
Returns the character's starting trinket type. Does not include starting trinkets obtained via unlocks or trinkets added by mods.
### Method
N/A (Function Call)
### Endpoint
N/A
### Parameters
None
### Response
#### Success Response
- **TrinketType** (TrinketType) - The character's starting trinket type.
```
--------------------------------
### Example Custom Tags in XML
Source: https://repentogon.com/xml/items.html
Demonstrates how to assign custom tags to an item in XML. Capitalization is ignored.
```xml
customtags="yourcustomtag nometronome"
```
--------------------------------
### Get PlayerHUDHeart Instance
Source: https://repentogon.com/PlayerHUDHeart.html
Obtain a PlayerHUDHeart instance by first getting the PlayerHUD and then specifying the heart's index. This is useful for interacting with individual hearts on the HUD.
```lua
local playerHud = HUD.GetPlayerHUD(0):GetHeartByIndex(0)
```
--------------------------------
### Create and Link ImGui Menu and Window
Source: https://repentogon.com/examples/ImGuiMenu.html
This snippet shows how to create a main menu entry and a corresponding window, linking them together. Use unique IDs for menu and window elements. The menu icon uses a FontAwesome unicode character.
```lua
local mod = RegisterMod("Repentogon ImGui", 1)
local sfx = SFXManager()
local game = Game()
-- We'll use this later.
local notificationText = "What do you want to shout..."
-- This example mod demonstrates many general applications for ImGui.
-- For a very thorough and generic usage example, please see the ImGui Lua Test Menu:
-- https://github.com/TeamREPENTON/REPENTOGON/blob/main/repentogon/resources/scripts/repentogon_tests/test_imgui.lua
-- Create a menu, which is a tab that appears in the top bar after pressing the debug console button.
-- The element id should be something unique. There can only be one element per ID.
-- This "\u{f0c3}" represents a unicode character. The font used for ImGui is powered by fontawesome.com, so it has many emojis you can use.
-- Find an emoji, then click on it and find the Unicode representation at the top right.
-- https://fontawesome.com/search?m=free&o=r
ImGui.CreateMenu("ExampleMenu", "\u{f0c3} ImGui Example")
-- To add a button under the dropdown for the menu, we need to use the generic AddElement function.
-- This can be used to add any element, or you can use the dedicated function for the type of element if there is one.
ImGui.AddElement("ExampleMenu", "ExampleMenuMainWindowButton", ImGuiElement.MenuItem, "\u{f005} Fun Menu")
-- Create Fun Menu. This will hold some buttons and sliders that we will make do fun things.
ImGui.CreateWindow("ExampleMenuFunMenu", "\u{f005} Fun Menu")
-- Link it to ExampleMenuMainWindowButton, the button we made earlier.
-- It'll now open or close when that button is pressed.
ImGui.LinkWindowToElement("ExampleMenuFunMenu", "ExampleMenuMainWindowButton")
```
--------------------------------
### Instantiate ColorParams
Source: https://repentogon.com/ColorParams.html
Example of creating a new ColorParams object with specific color, priority, duration, fadeout, and shared settings.
```lua
local fiveSecondRedColor = ColorParams(Color(1,0,0,1),255,150,false,false)
```
--------------------------------
### Get Boss Color Index by Name
Source: https://repentogon.com/Isaac.html
Gets the boss color index by name, which is typically the subtype needed for the desired color. The color entry must be named in XML.
```C++
int GetBossColorIdxByName ( string Name )
```
--------------------------------
### Get Player HUD Instance
Source: https://repentogon.com/PlayerHUD.html
Obtain an instance of the PlayerHUD class. This is typically done by first getting the game's HUD object and then accessing the player's HUD from it.
```lua
local playerHud = Game():GetHUD():GetPlayerHUD(0)
```
--------------------------------
### StartChallenge
Source: https://repentogon.com/Ambush.html
Initiates a challenge room or boss rush.
```APIDOC
## StartChallenge
### Description
Triggers the challenge room or boss rush. Calling this function outside of the appropriate room can lead to a softlock.
### Method
POST (conceptual)
### Endpoint
Ambush.StartChallenge()
### Parameters
None
### Response
#### Success Response (void)
- This function does not return a value.
### Bug
Calling this function outside of the boss rush room or a challenge room will do nothing except permanently close the doors, resulting in a softlock.
```
--------------------------------
### Sample Revive Item XML Configurations
Source: https://repentogon.com/xml/items.html
Provides XML examples for defining items with revive-related custom tags. Includes passive items, trinkets with persistent effects, and null items.
```xml
```
--------------------------------
### Accessing HistoryItem
Source: https://repentogon.com/HistoryItem.html
Demonstrates how to get the first HistoryItem from the player's collectible history.
```lua
local history = Isaac.GetPlayer(0):GetHistory():GetCollectiblesHistory()[1]
```
--------------------------------
### Handle New Room Initialization
Source: https://repentogon.com/enums/ModCallbacks.html
Fires before a new room is fully initialized. Use with caution as some room functions may be unstable.
```lua
function mod:my_callback(room, descriptor)
-- Perform actions after a new room is generated but before it's fully ready
log('New room generated: ' .. room.roomID)
-- Avoid using room functions that require full initialization here
end
mod:AddCallback(ModCallbacks.MC_PRE_NEW_ROOM, mod.my_callback)
```
--------------------------------
### Get Entity Configuration
Source: https://repentogon.com/EntityConfig.html
Retrieves the configuration for a specific entity type. Optional Variant and SubType parameters can be provided to get specific versions of an entity. Returns nil if the entity type does not exist.
```lua
local gaperConfig = EntityConfig.GetEntity(EntityType.ENTITY_GAPER)
```
--------------------------------
### Show
Source: https://repentogon.com/GenericPrompt.html
Makes the GenericPrompt visible on the screen.
```APIDOC
## Show()
### Description
Initiates the display of the prompt on the user's screen.
```
--------------------------------
### SetSuplexLandPosition
Source: https://repentogon.com/EntityPlayer.html
No description available.
```APIDOC
## SetSuplexLandPosition
### Method
void
### Parameters
#### Path Parameters
- **Position** (Vector) - Description not available
```
--------------------------------
### MC_GET_STATUS_EFFECT_TARGET
Source: https://repentogon.com/enums/ModCallbacks.html
Callback to get the target of a status effect.
```APIDOC
## MC_GET_STATUS_EFFECT_TARGET
### Description
Callback to get the target of a status effect.
### Method
Callback
### Parameters
#### Path Parameters
- **Entity** (Entity) - Description
### Response
#### Success Response (200)
- **return value** (Entity) - Description
- **return value** (EntityType) - Description
```
--------------------------------
### Load Custom Shader with Vertex Descriptor
Source: https://repentogon.com/renderer/Renderer.html
Loads a custom shader from files and defines its vertex attributes. This example shows how to set up a vertex descriptor for a shader that uses color offset and pixelation.
```lua
local fmt = Renderer.VertexAttributeFormat
local vertexDesc = {
{"Position", fmt.POSITION},
{"Color", fmt.COLOR},
{"TexCoord", fmt.TEX_COORD},
{"ColorizeIn", fmt.VEC4},
{"ColorOffsetIn", fmt.VEC3},
{"TextureSize", fmt.VEC2},
{"PixelationAmount", fmt.FLOAT},
{"ClipPlane", fmt.VEC3},
}
local goldShader = Renderer.LoadShader("shaders/coloroffset_gold", vertexDesc)
```
--------------------------------
### Accessing MainMenu Functions
Source: https://repentogon.com/menus/MainMenu.html
Demonstrates how to call functions from the MainMenu global table using dot notation. Ensure you use '.' instead of ':' for these calls.
```lua
local sprite = MainMenu.GetGameMenuSprite()
```
--------------------------------
### BabySkin
Source: https://repentogon.com/EntityPlayer.html
Gets the current baby skin of the player.
```APIDOC
## BabySkin
### Description
Gets the current baby skin of the player.
### Method
BabySubType
```
--------------------------------
### Get Next Waves Configuration
Source: https://repentogon.com/Ambush.html
Retrieves a table of RoomConfigRoom objects for all upcoming waves in a challenge.
```lua
local nextWavesConfig = Ambush.GetNextWaves()
```
--------------------------------
### GetVisible
Source: https://repentogon.com/ImGui.html
Gets the visibility status of a window element.
```APIDOC
## boolean GetVisible ( string ElementId )
Get if a window element is visible or not.
```
--------------------------------
### InitTwin
Source: https://repentogon.com/EntityPlayer.html
Initializes a secondary player controlled by the same input, similar to the mechanics in Jacob & Esau.
```APIDOC
## InitTwin
### Description
Initializes a "twin" player that is controlled by the player's same controller, similarly to Jacob & Esau.
### Method
EntityPlayer
### Parameters
#### Path Parameters
- **PlayerType** (PlayerType) - Required - The type of player to initialize as a twin.
### Returns
EntityPlayer
```
--------------------------------
### GetTransitionMode
Source: https://repentogon.com/RoomTransition.html
Gets the current transition mode of the game.
```APIDOC
## GetTransitionMode ()
### Description
Gets the current transition mode of the game.
### Method
`RoomTransition.GetTransitionMode()`
### Return Value
- int: The current transition mode.
```
--------------------------------
### GetSpreadAngle
Source: https://repentogon.com/MultiShotParams.html
Get the spread angle for the given WeaponType.
```APIDOC
## GetSpreadAngle (WeaponType WeaponType)
### Description
Retrieves the spread angle for a specific weapon type.
### Method
GET
### Endpoint
`/MultiShotParams/GetSpreadAngle`
### Parameters
#### Query Parameters
- **WeaponType** (WeaponType) - Required - The type of weapon for which to get the spread angle.
### Response
#### Success Response (200)
- **return_value** (float) - The spread angle for the specified weapon type.
```
--------------------------------
### Try Get Shop Discount
Source: https://repentogon.com/Room.html
Attempts to retrieve a shop discount for a given item index and price.
```csharp
int TryGetShopDiscount ( int ShopItemIdx, int Price )
```
--------------------------------
### GetPosition
Source: https://repentogon.com/HistoryHUD.html
Gets the current position of the HistoryHUD on the screen.
```APIDOC
## GetPosition ()
### Description
Returns the current position of the HistoryHUD.
### Response
#### Success Response (200)
- **Vector** - A Vector object representing the position of the HistoryHUD.
```
--------------------------------
### MC_POST_BOSS_INTRO_SHOW
Source: https://repentogon.com/enums/ModCallbacks.html
Callback triggered after a boss intro is shown.
```APIDOC
## MC_POST_BOSS_INTRO_SHOW
### Description
Callback triggered after a boss intro is shown.
### Method
Callback
### Parameters
#### Path Parameters
- **BossID1** (BossType) - Description
- **BossID2** (BossType) - Description
### Response
#### Success Response (200)
- **return value** (void) - Description
```
--------------------------------
### CreateWindow
Source: https://repentogon.com/ImGui.html
Creates a new window in the UI. Windows can contain other UI elements.
```APIDOC
## CreateWindow
### Description
Creates a new window in the UI. Windows can contain other UI elements.
### Function Signature
`void CreateWindow(string ElementId, string Title = "")`
### Parameters
* **ElementId** (string) - The unique ID for the window.
* **Title** (string, optional) - The title displayed in the window's title bar. Defaults to an empty string.
```
--------------------------------
### InitFlipState
Source: https://repentogon.com/EntityPickup.html
Initializes the flip state for the entity. Optionally sets up collectible graphics.
```APIDOC
## InitFlipState(CollectibleType = CollectibleType.COLLECTIBLE_NULL, SetupCollectibleGraphics = true)
### Description
Initializes the flip state for the entity. Optionally sets up collectible graphics.
### Method
void
### Parameters
#### Path Parameters
- **CollectibleType** (CollectibleType) - Optional - The collectible type to initialize with. Defaults to CollectibleType.COLLECTIBLE_NULL.
- **SetupCollectibleGraphics** (boolean) - Optional - Whether to set up collectible graphics. Defaults to true.
```
--------------------------------
### MC_POST_START_GREED_WAVE
Source: https://repentogon.com/enums/ModCallbacks.html
Fires at the start of a Greed Mode wave.
```APIDOC
## MC_POST_START_GREED_WAVE
### Description
Fires at the start of a Greed Mode wave.
### Function Args
- void
### Return Type
- void
```
--------------------------------
### MC_POST_START_GREED_WAVE
Source: https://repentogon.com/enums/ModCallbacks.html
Callback triggered after a greed wave starts.
```APIDOC
## MC_POST_START_GREED_WAVE
### Description
Callback triggered after a greed wave starts.
### Method
Callback
### Response
#### Success Response (200)
- **return value** (void) - Description
```
--------------------------------
### MC_PRE_LEVEL_INIT
Source: https://repentogon.com/enums/ModCallbacks.html
Callback that runs before the level is initialized. It accepts no return parameters.
```APIDOC
## MC_PRE_LEVEL_INIT
### Description
Callback that runs before the level is initialized. It accepts no return parameters.
### Function Args
void
### Optional Args
-
### Return Type
void
```
--------------------------------
### Sample Revive Logic in Lua
Source: https://repentogon.com/xml/items.html
Illustrates Lua code for implementing revive functionality using custom tags. Covers collectible-based revives with pre-death callbacks and null-item-based revives with post-death callbacks.
```lua
-- "Real" held collectible-based revive with higher priority than all vanilla revives, like 1UP.
mod:AddCallback(ModCallbacks.MC_PRE_TRIGGER_PLAYER_DEATH, function(_, player)
if player:HasCollectible(yourItemID, true) then
player:RemoveCollectible(yourItemID)
player:SetMinDamageCooldown(120) -- Grant iframes to the player.
return false -- Causes the player to revive on the spot with half a heart.
end
end)
-- Null Item-based revive effect with lower priority than vanilla revives such as 1UP.
-- Null Items (or any item TemporaryEffect) can be a good way to handle multiple extra lives.
local nullID = Isaac.GetNullItemIdByName("my null item")
mod:AddCallback(ModCallbacks.MC_TRIGGER_PLAYER_DEATH_POST_CHECK_REVIVES, function(_, player)
if player:GetEffects():HasNullEffect(nullID) then
player:GetEffects():RemoveNullEffect(nullID)
player:Revive() -- Calling Revive manually like this is acceptable, and will still prevent later callbacks from running.
-- You can manipulate the player's post-revive health here, such as fully healing them, or setting them to a single red heart container.
end
end)
```
--------------------------------
### GetVec2 Function
Source: https://repentogon.com/Capsule.html
Retrieves the starting position of the capsule.
```APIDOC
## GetVec2 Function
### Vector GetVec2 ( )
Returns the starting position of the capsule (can be set with `position`).
```
--------------------------------
### TrySpawnLadder
Source: https://repentogon.com/GridEntityRock.html
Attempts to spawn a ladder.
```APIDOC
## TrySpawnLadder
### Description
Attempts to spawn a ladder.
### Signature
`void TrySpawnLadder()`
```
--------------------------------
### MC_PRE_GET_RANDOM_ROOM_INDEX
Source: https://repentogon.com/enums/ModCallbacks.html
Callback triggered before getting a random room index.
```APIDOC
## MC_PRE_GET_RANDOM_ROOM_INDEX
### Description
Callback triggered before getting a random room index.
### Method
Callback
### Parameters
#### Path Parameters
- **RoomIndex** (int) - Description
- **IAmErrorRoom** (bool) - Description
- **Seed** (int) - Description
### Response
#### Success Response (200)
- **return value** (int) - Description
```
--------------------------------
### FriendBallEnemy
Source: https://repentogon.com/EntityPlayer.html
Gets the enemy entity associated with the Friend Ball.
```APIDOC
## FriendBallEnemy
### Description
Gets the enemy entity associated with the Friend Ball.
### Method
EntityDesc
```
--------------------------------
### Add ImGui Elements: Progress Bar, Slider, Input, Button
Source: https://repentogon.com/examples/ImGuiMenu.html
Demonstrates adding various ImGui elements to a window, including a progress bar, an integer slider, a text input for notifications, and buttons. The slider's value is printed on change, and the text input updates a notification message. A 'SameLine' element is used to place the notification button next to the input.
```lua
-- The fun menu will have four things:
-- A progress bar showing how close we are to missing Boss Rush.
-- A that updates some text.
-- A text input and button to cause a notification to appear.
-- A button that plays a funny sound (SoundEffect.SOUND_DERP).
-- First, add a progress bar showing how close we are to missing Boss Rush.
-- The code controlling the value of it as at the bottom of this file.
ImGui.AddProgressBar(
"ExampleMenuFunMenu",
"ExampleMenuBossRushProgress",
"Boss Rush deadline!",
0
)
-- Add that slider.
ImGui.AddSliderInteger(
"ExampleMenuFunMenu",
"ExampleMenuHpSlider",
"Cool slider", -- Slider label.
function (newValue) -- Function ran whenever the slider is changed.
print(newValue)
end,
50, -- Default value
0, -- Minimum value
100, -- Maximum value
"Coolness factor: %d%" -- Number label formatting. So, at default, the label will say "Coolness factor: 50"
)
-- Add the text input and notification.
ImGui.AddInputText(
"ExampleMenuFunMenu",
"ExampleMenuNotificationInput",
"", -- We'll use the hint text to indicate what this does instead of a label.
function (newValue) -- Function ran whenever the text input is updated.
notificationText = newValue
end,
"", -- Default value.
"What do you want to shout..." -- Hint text; This is the text that will appear when there is no user-inputted text in the box.
)
-- By default, ImGui elements are on separate lines.
-- Add a "SameLine" element to make the next element appear on the same line.
ImGui.AddElement(
"ExampleMenuFunMenu",
"", -- No element id needed since we're never gonna need to reference this later. We're allowed to add multiple elements to an empty id.
ImGuiElement.SameLine
)
ImGui.AddButton(
"ExampleMenuFunMenu",
"ExampleMenuNotificationButton",
"\u{f0a1}", -- Since this button will be small, we'll just put an emoji to indicate what it does.
function (clickCount)
-- Send a notification of type INFO with a lifetime of 5000 (in milliseconds).
ImGui.PushNotification(notificationText, ImGuiNotificationType.INFO, 5000)
end,
true -- It'll be a small button.
)
-- Let's also add a help marker to indicator what the button does.
-- Help markers look like: (?) and can be hovered over with your mouse to display a box of text.
ImGui.SetHelpmarker("ExampleMenuNotificationButton", "Send a notification with the text of your choice using this fashionable button!")
-- Finally, make a button that plays a funny sound.
ImGui.AddButton(
"ExampleMenuFunMenu",
"ExampleMenuFunnyButton",
"Funny button!", -- Button label.
function (clickCount)
```
--------------------------------
### CreateMenu
Source: https://repentogon.com/ImGui.html
Creates an entry in the main menu bar of Repentogon.
```APIDOC
## void CreateMenu ( string ElementId, string Label = "" )
Creates an entry to the main menu bar of Repentogon.
```
--------------------------------
### GetColorModifierLerpAmount
Source: https://repentogon.com/menus/MenuManager.html
Gets the absolute rate of change for the color modifier.
```APIDOC
## GetColorModifierLerpAmount
### Description
Returns the absolute rate of change for the color modifier (all values are positive).
### Method
GET
### Endpoint
MenuManager.GetColorModifierLerpAmount()
### Response
#### Success Response (200)
- **ColorModifier** - The color modifier's lerp amount.
```
--------------------------------
### GetTimeLeftSeconds
Source: https://repentogon.com/menus/DailyChallengeMenu.html
Gets the remaining time for the daily challenge in seconds.
```APIDOC
## GetTimeLeftSeconds
### Description
Returns the number of seconds remaining until the current daily challenge ends.
### Function Signature
int GetTimeLeftSeconds ( )
### Return Value
- int: The number of seconds left.
```
--------------------------------
### Lua: Triggering and Managing CustomCache
Source: https://repentogon.com/xml/items.html
These Lua examples show how to trigger custom cache evaluations immediately or queue them, retrieve cached values, and check for custom cache tags on items.
```lua
-- Triggers evaluation for the customcache immediately.
player:AddCustomCacheTag("mycustomcache", true)
```
```lua
-- Queue multiple customcaches for evaluation, but does not trigger evaluation immediately.
-- The evaluation will happen whenever a standard cache evaluation is triggered, such as via `player:EvaluateItems()`.
player:AddCustomCacheTag({"mycustomcache", "myothercustomcache"}, false)
```
```lua
-- Get the current cached value.
local cacheValue = player:GetCustomCacheValue("mycustomcache")
```
```lua
-- The tags listed in the `customcache` attribute can be checked via the ItemConfig.
local item = Isaac.GetItemConfig():GetCollectible(id)
```
```lua
-- Returns true if the entity has the tag string specified.
-- Capitalization does not matter.
if item:HasCustomCacheTag("mycustomcache") then
-- ...
end
```
```lua
-- Returns a table containing all customcache tags specified for this item.
-- Tags are provided in all lowercase.
local customCaches = item:GetCustomCacheTags()
```
--------------------------------
### GetTimeLeftMinutes
Source: https://repentogon.com/menus/DailyChallengeMenu.html
Gets the remaining time for the daily challenge in minutes.
```APIDOC
## GetTimeLeftMinutes
### Description
Returns the number of minutes remaining until the current daily challenge ends.
### Function Signature
int GetTimeLeftMinutes ( )
### Return Value
- int: The number of minutes left.
```
--------------------------------
### GetTimeLeftHours
Source: https://repentogon.com/menus/DailyChallengeMenu.html
Gets the remaining time for the daily challenge in hours.
```APIDOC
## GetTimeLeftHours
### Description
Returns the number of hours remaining until the current daily challenge ends.
### Function Signature
int GetTimeLeftHours ( )
### Return Value
- int: The number of hours left.
```
--------------------------------
### Load Rooms from STB File
Source: https://repentogon.com/CcpContainer_RoomConfigSet.html
Adds rooms from a specified .stb file to the RoomConfigSet. Files are loaded from the 'content(-repentogon)/rooms/' directory. If multiple mods have matching filenames, all will be loaded.
```lua
RoomConfigRoom[] LoadStb ( string StbFileName )
```
--------------------------------
### Get Camera Instance
Source: https://repentogon.com/Camera.html
Obtain an instance of the Camera class. This is typically done by accessing the current room's camera.
```lua
local camera = Game():GetRoom():GetCamera()
```
--------------------------------
### Get Water Color
Source: https://repentogon.com/Room.html
Returns the color of the water in the room.
```lua
KColor GetWaterColor ( )
```
--------------------------------
### MC_POST_BOSS_INTRO_SHOW
Source: https://repentogon.com/enums/ModCallbacks.html
Called immediately after the boss introduction sequence is initialized. It's used for setting up boss-specific elements or states. `BossID2` is relevant for 'Double Trouble' scenarios.
```APIDOC
## MC_POST_BOSS_INTRO_SHOW
### Description
Called right after the boss intro is initialized. `BossID2` is for Double Trouble.
### Function Args
- **BossID1** (BossType) - The type of the first boss.
- **BossID2** (BossType) - The type of the second boss (for Double Trouble).
### Optional Args
- None
### Return Type
- void
```
--------------------------------
### Get Loaded Modules
Source: https://repentogon.com/Isaac.html
Retrieves a list of loaded modules.
```C++
GetLoadedModules ()
```
--------------------------------
### Get Buttons Sprite
Source: https://repentogon.com/Isaac.html
Returns the sprite for controller buttons.
```C++
Sprite GetButtonsSprite ( )
```
--------------------------------
### Point Constructor
Source: https://repentogon.com/renderer/Point.html
Initializes a new Point object with specified properties. Default values are provided for width, color, and world space.
```APIDOC
## Point Constructor
### Description
Initializes a new Point object.
### Parameters
- **Position** (Vector) - The screen space position of the point.
- **SpritesheetCoordinate** (float) - The Y position on the spritesheet to be drawn at this point.
- **Width** (float) - Optional. A multiplier for the beam's width at this point. Defaults to 1.0.
- **Color** (Color) - Optional. The color of the beam at this point. Defaults to Default.
- **IsWorldSpace** (boolean) - Optional. If true, the Position will be converted from worldspace to screenspace during rendering. Defaults to false.
```
--------------------------------
### Get Minimap State
Source: https://repentogon.com/Minimap.html
Retrieves the current state of the minimap.
```lua
local state = Minimap.GetState()
```
--------------------------------
### Get History HUD
Source: https://repentogon.com/HUD.html
Returns an instance of the HistoryHUD object.
```lua
HistoryHUD GetHistoryHUD ( )
```
--------------------------------
### InitPostLevelInitStats
Source: https://repentogon.com/EntityPlayer.html
Initializes player stats after level initialization.
```APIDOC
## InitPostLevelInitStats
### Description
Initializes player stats after level initialization.
### Method
POST (assumed)
### Endpoint
/EntityPlayer/InitPostLevelInitStats
```
--------------------------------
### GetNumChainedLasers
Source: https://repentogon.com/EntityLaser.html
Gets the number of chained lasers that may spawn.
```APIDOC
## GetNumChainedLasers ()
### Description
Returns the number of additional lasers that may spawn at the end of this laser's trajectory. This is related to synergies like Monstro's Lung + Technology.
### Method
int GetNumChainedLasers ()
### Return Value
* **int** - The maximum number of chained lasers.
```
--------------------------------
### Setup Collectible Graphics (Static)
Source: https://repentogon.com/EntityPickup.html
Static method to replace a sprite's spritesheet with collectible graphics. Allows for custom seeds and loading graphics.
```lua
static void SetupCollectibleGraphics ( Sprite Sprite, integer Layer, CollectibleType Collectible, boolean Blind = false, integer Seed = Random(), boolean LoadGraphics = false )
```
--------------------------------
### Get
Source: https://repentogon.com/EntitiesSaveStateVector.html
Retrieves an EntitiesSaveState object from the vector at the specified index.
```APIDOC
## Get
### Description
Retrieves an EntitiesSaveState object from the vector at the specified index.
### Method
EntitiesSaveState
### Endpoint
N/A (Class method)
### Parameters
#### Path Parameters
- **Index** (int) - Required - The index of the entity to retrieve.
```
--------------------------------
### Show
Source: https://repentogon.com/ItemOverlay.html
Displays an item overlay with a specified Giantbook ID and an optional delay. The player can also be optionally specified.
```APIDOC
## Show
### Description
Displays an item overlay with a specified Giantbook ID and an optional delay. The player can also be optionally specified.
### Function Signature
`void Show(Giantbook GiantbookID, int Delay = 3, EntityPlayer = nil)`
### Parameters
- **GiantbookID** (Giantbook) - Required - The ID of the Giantbook to display.
- **Delay** (int) - Optional - The delay in seconds before showing the overlay. Defaults to 3.
- **EntityPlayer** (EntityPlayer) - Optional - The player entity to associate with the overlay. Defaults to nil.
```
--------------------------------
### SetupCollectibleGraphics
Source: https://repentogon.com/EntityPickup.html
Sets up collectible graphics for a given sprite. This is a static function.
```APIDOC
## SetupCollectibleGraphics(Sprite, Layer, Collectible, Blind = false, Seed = Random(), LoadGraphics = false)
### Description
Sets up collectible graphics for a given sprite.
Warning
This is a static function and must be called via `EntityPickup.SetupCollectibleGraphics(Sprite, Layer, Collectible, Blind, Seed, LoadGraphics)`.
### Method
static void
### Parameters
#### Path Parameters
- **Sprite** (Sprite) - Required - The sprite to set up graphics for.
- **Layer** (integer) - Required - The layer for the graphics.
- **Collectible** (CollectibleType) - Required - The collectible type.
- **Blind** (boolean) - Optional - Whether the graphics should be blind. Defaults to false.
- **Seed** (integer) - Optional - The seed for random generation. Defaults to Random().
- **LoadGraphics** (boolean) - Optional - Whether to load graphics. Defaults to false.
```