1+ import { game } from "../core/cachedClasses" ;
12import { ReadonlySet } from "../types/ReadonlySet" ;
23import { getAllPlayers } from "./playerIndex" ;
34import { isFunction } from "./types" ;
@@ -155,7 +156,7 @@ export function isMultiplayer(): boolean {
155156}
156157
157158/**
158- * Helper function to check if the player is using Afterbirth+ or Repentance .
159+ * Helper function to check if the player has the Repentance DLC installed .
159160 *
160161 * This function should always be used over the `REPENTANCE` constant, since the latter is not safe.
161162 *
@@ -181,6 +182,23 @@ export function isRepentance(): boolean {
181182 return isFunction ( getAnimation ) ;
182183}
183184
185+ /**
186+ * Helper function to check if the player has the Repentance+ DLC installed.
187+ *
188+ * This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
189+ * safe.
190+ *
191+ * Specifically, this function checks for `Room:DamageGridWithSource` method:
192+ * https://bindingofisaacrebirth.wiki.gg/wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
193+ */
194+ export function isRepentancePlus ( ) : boolean {
195+ const room = game . GetRoom ( ) ;
196+ const metatable = getmetatable ( room ) as LuaMap < string , unknown > | undefined ;
197+ assertDefined ( metatable , "Failed to get the metatable of the room class." ) ;
198+ const damageGridWithSource = metatable . get ( "DamageGridWithSource" ) ;
199+ return isFunction ( damageGridWithSource ) ;
200+ }
201+
184202/**
185203 * Helper function to check if the player is using REPENTOGON, an exe-hack which expands the modding
186204 * API.
0 commit comments