1
+ import { game } from "../core/cachedClasses" ;
1
2
import { ReadonlySet } from "../types/ReadonlySet" ;
2
3
import { getAllPlayers } from "./playerIndex" ;
3
4
import { isFunction } from "./types" ;
@@ -177,8 +178,8 @@ export function isRepentance(): boolean {
177
178
'Failed to get the "__class" key of the Sprite metatable.' ,
178
179
) ;
179
180
180
- const getAnimation = classTable . get ( "GetAnimation" ) ;
181
- return isFunction ( getAnimation ) ;
181
+ const func = classTable . get ( "GetAnimation" ) ;
182
+ return isFunction ( func ) ;
182
183
}
183
184
184
185
/**
@@ -187,26 +188,15 @@ export function isRepentance(): boolean {
187
188
* This function should always be used over the `REPENTANCE_PLUS` constant, since the latter is not
188
189
* safe.
189
190
*
190
- * Specifically, this function checks for TODO :
191
- * https://bindingofisaacrebirth.fandom.com /wiki/V1.06.J818#Lua_Changes
191
+ * Specifically, this function checks for `Room:DamageGridWithSource` method :
192
+ * https://bindingofisaacrebirth.wiki.gg /wiki/The_Binding_of_Isaac:_Repentance%2B#Modding_Changes
192
193
*/
193
194
export function isRepentancePlus ( ) : boolean {
194
- const metatable = getmetatable ( Sprite ) as LuaMap < string , unknown > | undefined ;
195
- assertDefined (
196
- metatable ,
197
- "Failed to get the metatable of the Sprite global table." ,
198
- ) ;
199
-
200
- const classTable = metatable . get ( "__class" ) as
201
- | LuaMap < string , unknown >
202
- | undefined ;
203
- assertDefined (
204
- classTable ,
205
- 'Failed to get the "__class" key of the Sprite metatable.' ,
206
- ) ;
207
-
208
- const getAnimation = classTable . get ( "GetAnimation" ) ;
209
- return isFunction ( getAnimation ) ;
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 func = metatable . get ( "DamageGridWithSource" ) ;
199
+ return isFunction ( func ) ;
210
200
}
211
201
212
202
/**
0 commit comments