isaacscript-common 2.3.2 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/cachedClasses.d.ts +6 -4
  2. package/cachedClasses.lua +24 -0
  3. package/callbacks/customRevive.lua +2 -0
  4. package/callbacks/itemPickup.lua +2 -0
  5. package/callbacks/postBombInitLate.lua +2 -0
  6. package/callbacks/postBoneSwing.lua +2 -0
  7. package/callbacks/postCollectibleInitFirst.lua +2 -0
  8. package/callbacks/postCursedTeleport.lua +2 -0
  9. package/callbacks/postCustomDoorEnter.lua +44 -0
  10. package/callbacks/postDoorRender.lua +2 -0
  11. package/callbacks/postDoorUpdate.lua +2 -0
  12. package/callbacks/postEffectInitLate.lua +2 -0
  13. package/callbacks/postEffectStateChanged.lua +2 -0
  14. package/callbacks/postEsauJr.lua +2 -0
  15. package/callbacks/postFamiliarInitLate.lua +2 -0
  16. package/callbacks/postFamiliarStateChanged.lua +2 -0
  17. package/callbacks/postFlip.lua +2 -0
  18. package/callbacks/postGreedModeWave.lua +2 -0
  19. package/callbacks/postGridEntity.lua +2 -0
  20. package/callbacks/postGridEntityCollision.lua +2 -0
  21. package/callbacks/postGridEntityRender.lua +2 -0
  22. package/callbacks/postHolyMantleRemoved.lua +2 -0
  23. package/callbacks/postKnifeInitLate.lua +2 -0
  24. package/callbacks/postLaserInitLate.lua +2 -0
  25. package/callbacks/postNPCInitLate.lua +2 -0
  26. package/callbacks/postNPCStateChanged.lua +2 -0
  27. package/callbacks/postNewRoomEarly.lua +2 -0
  28. package/callbacks/postPickupCollect.lua +2 -0
  29. package/callbacks/postPickupInitFirst.d.ts +1 -0
  30. package/callbacks/postPickupInitFirst.lua +55 -0
  31. package/callbacks/postPickupInitLate.lua +2 -0
  32. package/callbacks/postPickupStateChanged.lua +2 -0
  33. package/callbacks/postPitRender.lua +2 -0
  34. package/callbacks/postPitUpdate.lua +2 -0
  35. package/callbacks/postPlayerChangeHealth.lua +2 -0
  36. package/callbacks/postPlayerChangeType.lua +2 -0
  37. package/callbacks/postPlayerFatalDamage.lua +2 -0
  38. package/callbacks/postPlayerInitLate.lua +2 -0
  39. package/callbacks/postPlayerReordered.lua +2 -0
  40. package/callbacks/postPoopRender.lua +2 -0
  41. package/callbacks/postPoopUpdate.lua +2 -0
  42. package/callbacks/postPressurePlateRender.lua +2 -0
  43. package/callbacks/postPressurePlateUpdate.lua +2 -0
  44. package/callbacks/postProjectileInitLate.lua +2 -0
  45. package/callbacks/postPurchase.lua +2 -0
  46. package/callbacks/postRockRender.lua +2 -0
  47. package/callbacks/postRockUpdate.lua +2 -0
  48. package/callbacks/postRoomClearChanged.lua +2 -0
  49. package/callbacks/postSacrifice.lua +2 -0
  50. package/callbacks/postSlotDestroyed.d.ts +1 -0
  51. package/callbacks/postSlotDestroyed.lua +66 -0
  52. package/callbacks/postSlotInitUpdate.lua +2 -0
  53. package/callbacks/postSlotRender.lua +5 -21
  54. package/callbacks/postSpikesRender.lua +2 -0
  55. package/callbacks/postSpikesUpdate.lua +2 -0
  56. package/callbacks/postTNTRender.lua +2 -0
  57. package/callbacks/postTNTUpdate.lua +2 -0
  58. package/callbacks/postTearInitLate.lua +2 -0
  59. package/callbacks/postTearInitVeryLate.lua +2 -0
  60. package/callbacks/postTransformation.lua +2 -0
  61. package/callbacks/postTrinketBreak.lua +2 -0
  62. package/callbacks/preBerserkDeath.lua +2 -0
  63. package/callbacks/preNewLevel.lua +2 -0
  64. package/callbacks/reorderedCallbacks.lua +16 -0
  65. package/callbacks/subscriptions/postBombInitLate.lua +6 -0
  66. package/callbacks/subscriptions/postBoneSwing.lua +6 -0
  67. package/callbacks/subscriptions/postCollectibleInitFirst.lua +6 -0
  68. package/callbacks/subscriptions/postCursedTeleport.lua +6 -0
  69. package/callbacks/subscriptions/postCustomDoorEnter.lua +6 -0
  70. package/callbacks/subscriptions/postCustomRevive.d.ts +1 -0
  71. package/callbacks/subscriptions/postCustomRevive.lua +6 -0
  72. package/callbacks/subscriptions/postDoorRender.d.ts +1 -0
  73. package/callbacks/subscriptions/postDoorRender.lua +6 -0
  74. package/callbacks/subscriptions/postDoorUpdate.d.ts +1 -0
  75. package/callbacks/subscriptions/postDoorUpdate.lua +6 -0
  76. package/callbacks/subscriptions/postEffectInitLate.lua +6 -0
  77. package/callbacks/subscriptions/postEffectStateChanged.lua +6 -0
  78. package/callbacks/subscriptions/postEsauJr.lua +6 -0
  79. package/callbacks/subscriptions/postFamiliarInitLate.lua +6 -0
  80. package/callbacks/subscriptions/postFamiliarStateChanged.lua +6 -0
  81. package/callbacks/subscriptions/postFirstEsauJr.lua +6 -0
  82. package/callbacks/subscriptions/postFirstFlip.lua +6 -0
  83. package/callbacks/subscriptions/postFlip.lua +6 -0
  84. package/callbacks/subscriptions/postGameStartedReordered.lua +6 -0
  85. package/callbacks/subscriptions/postGreedModeWave.lua +6 -0
  86. package/callbacks/subscriptions/postGridEntityBroken.lua +6 -0
  87. package/callbacks/subscriptions/postGridEntityCollision.lua +6 -0
  88. package/callbacks/subscriptions/postGridEntityInit.lua +6 -0
  89. package/callbacks/subscriptions/postGridEntityRemove.lua +6 -0
  90. package/callbacks/subscriptions/postGridEntityRender.lua +6 -0
  91. package/callbacks/subscriptions/postGridEntityStateChanged.lua +6 -0
  92. package/callbacks/subscriptions/postGridEntityUpdate.lua +6 -0
  93. package/callbacks/subscriptions/postHolyMantleRemoved.lua +6 -0
  94. package/callbacks/subscriptions/postItemDischarged.lua +6 -0
  95. package/callbacks/subscriptions/postItemPickup.lua +6 -0
  96. package/callbacks/subscriptions/postKnifeInitLate.lua +6 -0
  97. package/callbacks/subscriptions/postLaserInitLate.lua +6 -0
  98. package/callbacks/subscriptions/postNPCInitLate.lua +6 -0
  99. package/callbacks/subscriptions/postNPCStateChanged.lua +6 -0
  100. package/callbacks/subscriptions/postNewLevelReordered.lua +6 -0
  101. package/callbacks/subscriptions/postNewRoomEarly.lua +6 -0
  102. package/callbacks/subscriptions/postNewRoomReordered.lua +6 -0
  103. package/callbacks/subscriptions/postPEffectUpdateReordered.lua +6 -0
  104. package/callbacks/subscriptions/postPickupCollect.d.ts +1 -0
  105. package/callbacks/subscriptions/postPickupCollect.lua +6 -0
  106. package/callbacks/subscriptions/postPickupInitFirst.d.ts +3 -0
  107. package/callbacks/subscriptions/postPickupInitFirst.lua +29 -0
  108. package/callbacks/subscriptions/postPickupInitLate.lua +6 -0
  109. package/callbacks/subscriptions/postPickupStateChanged.d.ts +1 -0
  110. package/callbacks/subscriptions/postPickupStateChanged.lua +6 -0
  111. package/callbacks/subscriptions/postPitRender.d.ts +1 -0
  112. package/callbacks/subscriptions/postPitRender.lua +6 -0
  113. package/callbacks/subscriptions/postPitUpdate.d.ts +1 -0
  114. package/callbacks/subscriptions/postPitUpdate.lua +6 -0
  115. package/callbacks/subscriptions/postPlayerChangeHealth.lua +6 -0
  116. package/callbacks/subscriptions/postPlayerChangeType.lua +6 -0
  117. package/callbacks/subscriptions/postPlayerFatalDamage.lua +6 -0
  118. package/callbacks/subscriptions/postPlayerInitLate.lua +6 -0
  119. package/callbacks/subscriptions/postPlayerInitReordered.lua +6 -0
  120. package/callbacks/subscriptions/postPlayerRenderReordered.lua +6 -0
  121. package/callbacks/subscriptions/postPlayerUpdateReordered.lua +6 -0
  122. package/callbacks/subscriptions/postPoopRender.d.ts +1 -0
  123. package/callbacks/subscriptions/postPoopRender.lua +6 -0
  124. package/callbacks/subscriptions/postPoopUpdate.d.ts +1 -0
  125. package/callbacks/subscriptions/postPoopUpdate.lua +6 -0
  126. package/callbacks/subscriptions/postPressurePlateRender.d.ts +1 -0
  127. package/callbacks/subscriptions/postPressurePlateRender.lua +6 -0
  128. package/callbacks/subscriptions/postPressurePlateUpdate.d.ts +1 -0
  129. package/callbacks/subscriptions/postPressurePlateUpdate.lua +6 -0
  130. package/callbacks/subscriptions/postProjectileInitLate.lua +6 -0
  131. package/callbacks/subscriptions/postPurchase.lua +6 -0
  132. package/callbacks/subscriptions/postRockRender.d.ts +1 -0
  133. package/callbacks/subscriptions/postRockRender.lua +6 -0
  134. package/callbacks/subscriptions/postRockUpdate.d.ts +1 -0
  135. package/callbacks/subscriptions/postRockUpdate.lua +6 -0
  136. package/callbacks/subscriptions/postRoomClearChanged.lua +6 -0
  137. package/callbacks/subscriptions/postSacrifice.lua +6 -0
  138. package/callbacks/subscriptions/postSlotAnimationChanged.lua +6 -0
  139. package/callbacks/subscriptions/postSlotDestroyed.lua +6 -0
  140. package/callbacks/subscriptions/postSlotInit.lua +6 -0
  141. package/callbacks/subscriptions/postSlotRender.lua +6 -0
  142. package/callbacks/subscriptions/postSlotUpdate.lua +6 -0
  143. package/callbacks/subscriptions/postSpikesRender.d.ts +1 -0
  144. package/callbacks/subscriptions/postSpikesRender.lua +6 -0
  145. package/callbacks/subscriptions/postSpikesUpdate.d.ts +1 -0
  146. package/callbacks/subscriptions/postSpikesUpdate.lua +6 -0
  147. package/callbacks/subscriptions/postTNTRender.d.ts +1 -0
  148. package/callbacks/subscriptions/postTNTRender.lua +6 -0
  149. package/callbacks/subscriptions/postTNTUpdate.d.ts +1 -0
  150. package/callbacks/subscriptions/postTNTUpdate.lua +6 -0
  151. package/callbacks/subscriptions/postTearInitLate.lua +6 -0
  152. package/callbacks/subscriptions/postTearInitVeryLate.lua +6 -0
  153. package/callbacks/subscriptions/postTransformation.lua +6 -0
  154. package/callbacks/subscriptions/postTrinketBreak.lua +6 -0
  155. package/callbacks/subscriptions/preBerserkDeath.lua +6 -0
  156. package/callbacks/subscriptions/preCustomRevive.lua +6 -0
  157. package/callbacks/subscriptions/preItemPickup.lua +6 -0
  158. package/callbacks/subscriptions/preNewLevel.lua +6 -0
  159. package/classes/DefaultMap.d.ts +70 -39
  160. package/classes/DefaultMap.lua +94 -43
  161. package/classes/ModUpgraded.d.ts +3 -3
  162. package/classes/ModUpgraded.lua +5 -0
  163. package/constants.lua +41 -0
  164. package/constantsFirstLast.lua +63 -0
  165. package/enums/HealthType.lua +3 -0
  166. package/enums/ModCallbackCustom.d.ts +62 -40
  167. package/enums/ModCallbackCustom.lua +46 -38
  168. package/enums/private/CopyableIsaacAPIClassType.lua +1 -0
  169. package/enums/private/SerializationBrand.lua +5 -0
  170. package/features/characterHealthConversion.lua +6 -0
  171. package/features/characterStats.lua +17 -0
  172. package/features/debugDisplay/exports.d.ts +17 -0
  173. package/features/debugDisplay/exports.lua +90 -0
  174. package/features/debugDisplay/v.d.ts +17 -0
  175. package/features/deployJSONRoom.d.ts +1 -0
  176. package/features/deployJSONRoom.lua +56 -0
  177. package/features/disableInputs.lua +45 -0
  178. package/features/disableSound.lua +14 -0
  179. package/features/extraConsoleCommands/commandsDisplay.lua +90 -0
  180. package/features/extraConsoleCommands/init.lua +16 -0
  181. package/features/extraConsoleCommands/listCommands.lua +172 -0
  182. package/features/fadeInRemover.lua +10 -0
  183. package/features/fastReset.lua +10 -0
  184. package/features/forgottenSwitch.lua +4 -0
  185. package/features/getCollectibleItemPoolType.lua +5 -0
  186. package/features/playerInventory.lua +18 -0
  187. package/features/ponyDetection.lua +4 -0
  188. package/features/preventCollectibleRotation.lua +9 -0
  189. package/features/runInNFrames.lua +50 -0
  190. package/features/saveDataManager/constants.lua +1 -0
  191. package/features/saveDataManager/exports.lua +115 -0
  192. package/features/saveDataManager/load.lua +12 -8
  193. package/features/saveDataManager/main.lua +16 -3
  194. package/features/saveDataManager/maps.lua +3 -0
  195. package/features/saveDataManager/merge.lua +53 -21
  196. package/features/saveDataManager/save.lua +12 -7
  197. package/features/sirenHelpers.lua +13 -0
  198. package/features/taintedLazarusPlayers.lua +11 -0
  199. package/featuresInitialized.lua +6 -0
  200. package/functions/array.d.ts +2 -0
  201. package/functions/array.lua +85 -0
  202. package/functions/benchmark.lua +6 -0
  203. package/functions/bombs.d.ts +3 -0
  204. package/functions/bombs.lua +12 -0
  205. package/functions/boss.lua +35 -0
  206. package/functions/cacheFlag.lua +4 -0
  207. package/functions/cards.lua +60 -0
  208. package/functions/challenges.lua +1 -0
  209. package/functions/character.lua +23 -0
  210. package/functions/charge.lua +39 -0
  211. package/functions/chargeBar.d.ts +1 -0
  212. package/functions/chargeBar.lua +4 -0
  213. package/functions/collectibleCacheFlag.lua +15 -0
  214. package/functions/collectibleSet.lua +3 -0
  215. package/functions/collectibleTag.lua +9 -0
  216. package/functions/collectibles.d.ts +13 -8
  217. package/functions/collectibles.lua +147 -3
  218. package/functions/color.lua +18 -0
  219. package/functions/debug.lua +18 -0
  220. package/functions/deepCopy.lua +60 -26
  221. package/functions/deepCopyTests.lua +8 -5
  222. package/functions/direction.d.ts +8 -0
  223. package/functions/direction.lua +27 -0
  224. package/functions/doors.d.ts +1 -0
  225. package/functions/doors.lua +58 -0
  226. package/functions/entity.d.ts +4 -4
  227. package/functions/entity.lua +94 -6
  228. package/functions/entitySpecific.d.ts +20 -20
  229. package/functions/entitySpecific.lua +182 -0
  230. package/functions/entityTypes.d.ts +1 -1
  231. package/functions/entityTypes.lua +1 -0
  232. package/functions/enums.d.ts +2 -0
  233. package/functions/enums.lua +62 -0
  234. package/functions/familiars.lua +52 -0
  235. package/functions/flag.lua +77 -0
  236. package/functions/flying.lua +10 -0
  237. package/functions/globals.lua +8 -10
  238. package/functions/gridEntity.lua +105 -0
  239. package/functions/gridEntitySpecific.d.ts +5 -0
  240. package/functions/gridEntitySpecific.lua +8 -0
  241. package/functions/input.lua +11 -0
  242. package/functions/isaacAPIClass.d.ts +4 -4
  243. package/functions/isaacAPIClass.lua +15 -3
  244. package/functions/jsonHelpers.lua +11 -0
  245. package/functions/jsonRoom.d.ts +2 -0
  246. package/functions/jsonRoom.lua +5 -0
  247. package/functions/kColor.lua +9 -0
  248. package/functions/language.lua +5 -0
  249. package/functions/log.lua +31 -3
  250. package/functions/map.lua +18 -0
  251. package/functions/math.lua +26 -0
  252. package/functions/npc.lua +24 -0
  253. package/functions/pickupVariants.d.ts +11 -11
  254. package/functions/pickupVariants.lua +11 -0
  255. package/functions/pickups.d.ts +9 -9
  256. package/functions/pickups.lua +67 -0
  257. package/functions/pills.lua +45 -0
  258. package/functions/player.d.ts +7 -0
  259. package/functions/player.lua +210 -9
  260. package/functions/playerDataStructures.lua +65 -0
  261. package/functions/playerHealth.d.ts +3 -0
  262. package/functions/playerHealth.lua +92 -63
  263. package/functions/playerIndex.d.ts +2 -0
  264. package/functions/playerIndex.lua +47 -0
  265. package/functions/pocketItems.lua +18 -0
  266. package/functions/positionVelocity.d.ts +3 -0
  267. package/functions/positionVelocity.lua +46 -0
  268. package/functions/random.d.ts +2 -0
  269. package/functions/random.lua +32 -0
  270. package/functions/revive.d.ts +2 -0
  271. package/functions/revive.lua +15 -0
  272. package/functions/rng.d.ts +1 -0
  273. package/functions/rng.lua +19 -0
  274. package/functions/roomData.lua +68 -0
  275. package/functions/roomGrid.lua +21 -0
  276. package/functions/roomShape.lua +22 -0
  277. package/functions/rooms.lua +100 -0
  278. package/functions/run.lua +5 -0
  279. package/functions/seeds.lua +4 -0
  280. package/functions/serialization.lua +6 -2
  281. package/functions/set.d.ts +1 -0
  282. package/functions/set.lua +22 -0
  283. package/functions/spawnCollectible.lua +24 -0
  284. package/functions/sprite.d.ts +2 -0
  285. package/functions/sprite.lua +25 -0
  286. package/functions/stage.lua +16 -0
  287. package/functions/string.lua +6 -0
  288. package/functions/table.d.ts +12 -0
  289. package/functions/table.lua +53 -0
  290. package/functions/tears.d.ts +1 -0
  291. package/functions/tears.lua +12 -0
  292. package/functions/transformations.lua +18 -0
  293. package/functions/trinketCacheFlag.lua +3 -0
  294. package/functions/trinketGive.lua +24 -0
  295. package/functions/trinkets.lua +52 -0
  296. package/functions/tstlClass.d.ts +34 -0
  297. package/functions/tstlClass.lua +63 -9
  298. package/functions/ui.d.ts +2 -0
  299. package/functions/ui.lua +16 -0
  300. package/functions/utils.d.ts +16 -0
  301. package/functions/utils.lua +108 -0
  302. package/functions/vector.lua +13 -16
  303. package/index.d.ts +1 -0
  304. package/index.lua +8 -0
  305. package/initCustomCallbacks.lua +6 -0
  306. package/interfaces/AddCallbackParameterCustom.d.ts +2 -0
  307. package/interfaces/ChargeBarSprites.d.ts +1 -0
  308. package/interfaces/private/TSTLClassMetatable.d.ts +2 -0
  309. package/lualib_bundle.lua +21 -34
  310. package/maps/cardMap.lua +1 -0
  311. package/maps/characterMap.lua +1 -0
  312. package/maps/defaultPlayerStatMap.lua +1 -0
  313. package/maps/gridEntityXMLMap.lua +2 -0
  314. package/maps/pillEffectMap.lua +1 -0
  315. package/maps/roomShapeToTopLeftWallGridIndexMap.lua +2 -0
  316. package/maps/roomTypeMap.lua +1 -0
  317. package/objects/LRoomShapeToRectangles.lua +2 -0
  318. package/objects/callbackRegisterFunctions.lua +3 -0
  319. package/objects/colors.lua +4 -0
  320. package/objects/oppositeDoorSlots.d.ts +4 -0
  321. package/objects/oppositeDoorSlots.lua +15 -0
  322. package/objects/roomShapeBounds.lua +2 -0
  323. package/objects/roomShapeLayoutSizes.lua +4 -0
  324. package/objects/roomShapeToBottomRightPosition.lua +2 -0
  325. package/objects/roomShapeToDoorSlotsToGridIndexDelta.lua +2 -0
  326. package/objects/roomShapeToTopLeftPosition.lua +2 -0
  327. package/objects/roomShapeVolumes.lua +3 -0
  328. package/package.json +2 -2
  329. package/patchErrorFunctions.lua +8 -0
  330. package/sets/bossSets.lua +23 -0
  331. package/sets/charactersWithNoRedHeartsSet.lua +2 -0
  332. package/sets/charactersWithNoSoulHeartsSet.lua +2 -0
  333. package/sets/lostStyleCharactersSet.lua +2 -0
  334. package/types/AnyEntity.d.ts +10 -0
  335. package/types/PickingUpItem.lua +7 -0
  336. package/upgradeMod.d.ts +4 -4
  337. package/upgradeMod.lua +18 -0
@@ -1,11 +1,9 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Set = ____lualib.Set
3
3
  local __TS__New = ____lualib.__TS__New
4
- local __TS__InstanceOf = ____lualib.__TS__InstanceOf
5
4
  local Map = ____lualib.Map
6
- local WeakMap = ____lualib.WeakMap
7
- local WeakSet = ____lualib.WeakSet
8
5
  local __TS__Iterator = ____lualib.__TS__Iterator
6
+ local __TS__ArraySort = ____lualib.__TS__ArraySort
9
7
  local __TS__ArraySome = ____lualib.__TS__ArraySome
10
8
  local ____exports = {}
11
9
  local deepCopyTable, deepCopyDefaultMap, deepCopyMap, deepCopySet, deepCopyTSTLClass, deepCopyArray, deepCopyNormalLuaTable, getCopiedEntries, checkMetatable, deepCopyUserdata, COPYABLE_ISAAC_API_CLASS_TYPES_SET
@@ -26,19 +24,50 @@ local isArray = ____array.isArray
26
24
  local ____enums = require("functions.enums")
27
25
  local getEnumValues = ____enums.getEnumValues
28
26
  local ____isaacAPIClass = require("functions.isaacAPIClass")
29
- local getIsaacAPIClassType = ____isaacAPIClass.getIsaacAPIClassType
27
+ local getIsaacAPIClassName = ____isaacAPIClass.getIsaacAPIClassName
30
28
  local ____log = require("functions.log")
31
29
  local log = ____log.log
30
+ local logTable = ____log.logTable
32
31
  local ____serialization = require("functions.serialization")
33
32
  local copyIsaacAPIClass = ____serialization.copyIsaacAPIClass
34
33
  local deserializeIsaacAPIClass = ____serialization.deserializeIsaacAPIClass
35
34
  local isSerializedIsaacAPIClass = ____serialization.isSerializedIsaacAPIClass
36
35
  local ____tstlClass = require("functions.tstlClass")
36
+ local getTSTLClassName = ____tstlClass.getTSTLClassName
37
+ local isDefaultMap = ____tstlClass.isDefaultMap
38
+ local isTSTLMap = ____tstlClass.isTSTLMap
39
+ local isTSTLSet = ____tstlClass.isTSTLSet
37
40
  local isUserDefinedTSTLClass = ____tstlClass.isUserDefinedTSTLClass
38
41
  local newTSTLClass = ____tstlClass.newTSTLClass
39
42
  local ____utils = require("functions.utils")
40
43
  local ensureAllCases = ____utils.ensureAllCases
41
44
  local getTraversalDescription = ____utils.getTraversalDescription
45
+ local twoDimensionalSort = ____utils.twoDimensionalSort
46
+ --- `deepCopy` is a semi-generic deep cloner. It will recursively copy all of the values so that none
47
+ -- of the nested references remain.
48
+ --
49
+ -- It supports the following object types:
50
+ --
51
+ -- - Primitives (i.e. strings, numbers, and booleans)
52
+ -- - `LuaTable` / basic TSTL objects
53
+ -- - TSTL `Map`
54
+ -- - TSTL `Set`
55
+ -- - TSTL classes
56
+ -- - `DefaultMap`
57
+ -- - Isaac `Color` objects
58
+ -- - Isaac `KColor` objects
59
+ -- - Isaac `RNG` objects
60
+ -- - Isaac `Vector` objects
61
+ --
62
+ -- It does not support:
63
+ -- - objects with values of `null` (since that transpiles to `nil`)
64
+ -- - other Isaac API objects such as `EntityPtr` (that have a type of "userdata")
65
+ --
66
+ -- @param value The primitive or object to copy.
67
+ -- @param serializationType Has 3 possible values. Can leave objects as-is, or can serialize objects
68
+ -- to Lua tables, or can deserialize Lua tables to objects. Default is
69
+ -- `SerializationType.NONE`.
70
+ -- @param traversalDescription Used to track the current key that we are operating on.
42
71
  function ____exports.deepCopy(self, value, serializationType, traversalDescription)
43
72
  if serializationType == nil then
44
73
  serializationType = SerializationType.NONE
@@ -95,19 +124,20 @@ function ____exports.deepCopy(self, value, serializationType, traversalDescripti
95
124
  until true
96
125
  end
97
126
  function deepCopyTable(self, ____table, serializationType, traversalDescription)
98
- if __TS__InstanceOf(____table, DefaultMap) or ____table[SerializationBrand.DEFAULT_MAP] ~= nil then
127
+ if isDefaultMap(nil, ____table) or ____table[SerializationBrand.DEFAULT_MAP] ~= nil then
99
128
  return deepCopyDefaultMap(nil, ____table, serializationType, traversalDescription)
100
129
  end
101
- if __TS__InstanceOf(____table, Map) or ____table[SerializationBrand.MAP] ~= nil then
130
+ if isTSTLMap(nil, ____table) or ____table[SerializationBrand.MAP] ~= nil then
102
131
  return deepCopyMap(nil, ____table, serializationType, traversalDescription)
103
132
  end
104
- if __TS__InstanceOf(____table, Set) or ____table[SerializationBrand.SET] ~= nil then
133
+ if isTSTLSet(nil, ____table) or ____table[SerializationBrand.SET] ~= nil then
105
134
  return deepCopySet(nil, ____table, serializationType, traversalDescription)
106
135
  end
107
- if __TS__InstanceOf(____table, WeakMap) then
136
+ local className = getTSTLClassName(nil, ____table)
137
+ if className == "WeakMap" then
108
138
  error("The deep copy function does not support copying the \"WeakMap\" class for: " .. traversalDescription)
109
139
  end
110
- if __TS__InstanceOf(____table, WeakSet) then
140
+ if className == "WeakSet" then
111
141
  error("The deep copy function does not support copying the \"WeakSet\" class for: " .. traversalDescription)
112
142
  end
113
143
  if isUserDefinedTSTLClass(nil, ____table) then
@@ -123,13 +153,13 @@ function deepCopyTable(self, ____table, serializationType, traversalDescription)
123
153
  return deepCopyNormalLuaTable(nil, ____table, serializationType, traversalDescription)
124
154
  end
125
155
  function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescription)
126
- local ____temp_0
127
- if __TS__InstanceOf(defaultMap, DefaultMap) then
128
- ____temp_0 = defaultMap:getConstructorArg()
156
+ local ____isDefaultMap_result_0
157
+ if isDefaultMap(nil, defaultMap) then
158
+ ____isDefaultMap_result_0 = defaultMap:getConstructorArg()
129
159
  else
130
- ____temp_0 = nil
160
+ ____isDefaultMap_result_0 = nil
131
161
  end
132
- local constructorArg = ____temp_0
162
+ local constructorArg = ____isDefaultMap_result_0
133
163
  local newDefaultMap
134
164
  repeat
135
165
  local ____switch23 = serializationType
@@ -155,7 +185,7 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
155
185
  ____cond23 = ____cond23 or ____switch23 == SerializationType.DESERIALIZE
156
186
  if ____cond23 then
157
187
  do
158
- if __TS__InstanceOf(defaultMap, DefaultMap) then
188
+ if isDefaultMap(nil, defaultMap) then
159
189
  error(("The deep copy function failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
160
190
  end
161
191
  local defaultMapValue = defaultMap[SerializationBrand.DEFAULT_MAP_VALUE]
@@ -176,7 +206,7 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
176
206
  local entries = ____getCopiedEntries_result_1.entries
177
207
  local convertedNumberKeysToStrings = ____getCopiedEntries_result_1.convertedNumberKeysToStrings
178
208
  if convertedNumberKeysToStrings then
179
- if __TS__InstanceOf(newDefaultMap, DefaultMap) then
209
+ if isDefaultMap(nil, newDefaultMap) then
180
210
  newDefaultMap:set(SerializationBrand.OBJECT_WITH_NUMBER_KEYS, "")
181
211
  else
182
212
  newDefaultMap[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
@@ -185,7 +215,7 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
185
215
  for ____, ____value in ipairs(entries) do
186
216
  local key = ____value[1]
187
217
  local value = ____value[2]
188
- if __TS__InstanceOf(newDefaultMap, DefaultMap) then
218
+ if isDefaultMap(nil, newDefaultMap) then
189
219
  newDefaultMap:set(key, value)
190
220
  else
191
221
  newDefaultMap[key] = value
@@ -205,7 +235,7 @@ function deepCopyMap(self, map, serializationType, traversalDescription)
205
235
  local entries = ____getCopiedEntries_result_2.entries
206
236
  local convertedNumberKeysToStrings = ____getCopiedEntries_result_2.convertedNumberKeysToStrings
207
237
  if convertedNumberKeysToStrings then
208
- if __TS__InstanceOf(newMap, Map) then
238
+ if isTSTLMap(nil, newMap) then
209
239
  newMap:set(SerializationBrand.OBJECT_WITH_NUMBER_KEYS, "")
210
240
  else
211
241
  newMap[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
@@ -214,7 +244,7 @@ function deepCopyMap(self, map, serializationType, traversalDescription)
214
244
  for ____, ____value in ipairs(entries) do
215
245
  local key = ____value[1]
216
246
  local value = ____value[2]
217
- if __TS__InstanceOf(newMap, Map) then
247
+ if isTSTLMap(nil, newMap) then
218
248
  newMap:set(key, value)
219
249
  else
220
250
  newMap[key] = value
@@ -234,7 +264,7 @@ function deepCopySet(self, set, serializationType, traversalDescription)
234
264
  local entries = ____getCopiedEntries_result_3.entries
235
265
  local convertedNumberKeysToStrings = ____getCopiedEntries_result_3.convertedNumberKeysToStrings
236
266
  if convertedNumberKeysToStrings then
237
- if __TS__InstanceOf(newSet, Set) then
267
+ if isTSTLSet(nil, newSet) then
238
268
  error("The deep copy function cannot convert number keys to strings for a Set.")
239
269
  else
240
270
  newSet[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
@@ -242,7 +272,7 @@ function deepCopySet(self, set, serializationType, traversalDescription)
242
272
  end
243
273
  for ____, ____value in ipairs(entries) do
244
274
  local key = ____value[1]
245
- if __TS__InstanceOf(newSet, Set) then
275
+ if isTSTLSet(nil, newSet) then
246
276
  newSet:add(key)
247
277
  else
248
278
  newSet[key] = ""
@@ -295,7 +325,7 @@ function deepCopyNormalLuaTable(self, ____table, serializationType, traversalDes
295
325
  end
296
326
  function getCopiedEntries(self, object, serializationType, traversalDescription)
297
327
  local entries = {}
298
- if __TS__InstanceOf(object, Map) or __TS__InstanceOf(object, Set) then
328
+ if isTSTLMap(nil, object) or isTSTLSet(nil, object) or isDefaultMap(nil, object) then
299
329
  for ____, ____value in __TS__Iterator(object:entries()) do
300
330
  local key = ____value[1]
301
331
  local value = ____value[2]
@@ -306,6 +336,10 @@ function getCopiedEntries(self, object, serializationType, traversalDescription)
306
336
  entries[#entries + 1] = {key, value}
307
337
  end
308
338
  end
339
+ if SAVE_DATA_MANAGER_DEBUG then
340
+ logTable(entries)
341
+ __TS__ArraySort(entries, twoDimensionalSort)
342
+ end
309
343
  local hasNumberKeys = __TS__ArraySome(
310
344
  entries,
311
345
  function(____, ____bindingPattern0)
@@ -321,14 +355,14 @@ function getCopiedEntries(self, object, serializationType, traversalDescription)
321
355
  local value = ____value[2]
322
356
  do
323
357
  if isSerializationBrand(nil, key) then
324
- goto __continue78
358
+ goto __continue79
325
359
  end
326
360
  traversalDescription = getTraversalDescription(nil, key, traversalDescription)
327
361
  local newValue = ____exports.deepCopy(nil, value, serializationType, traversalDescription)
328
362
  local keyToUse = convertNumberKeysToStrings and tostring(key) or key
329
363
  copiedEntries[#copiedEntries + 1] = {keyToUse, newValue}
330
364
  end
331
- ::__continue78::
365
+ ::__continue79::
332
366
  end
333
367
  return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
334
368
  end
@@ -338,10 +372,10 @@ function checkMetatable(self, ____table, traversalDescription)
338
372
  return
339
373
  end
340
374
  local tableDescription = traversalDescription == "" and "the table to copy" or ("\"" .. traversalDescription) .. "\""
341
- error(("The deepCopy function detected that \"" .. tableDescription) .. "\" has a metatable. Copying tables with metatables is not supported, unless they are explicitly handled by the save data manager. (e.g. TypeScriptToLua Maps, TypeScriptToLua Sets, etc.)")
375
+ error(("The deepCopy function detected that " .. tableDescription) .. " has a metatable. Copying tables with metatables is not supported, unless they are explicitly handled by the save data manager. (e.g. TypeScriptToLua Maps, TypeScriptToLua Sets, etc.)")
342
376
  end
343
377
  function deepCopyUserdata(self, value, serializationType, traversalDescription)
344
- local classType = getIsaacAPIClassType(nil, value)
378
+ local classType = getIsaacAPIClassName(nil, value)
345
379
  if classType == nil then
346
380
  error("The deep copy function was not able to derive the Isaac API class type for: " .. traversalDescription)
347
381
  end
@@ -1,7 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local Map = ____lualib.Map
3
3
  local __TS__New = ____lualib.__TS__New
4
- local __TS__InstanceOf = ____lualib.__TS__InstanceOf
5
4
  local Set = ____lualib.Set
6
5
  local ____exports = {}
7
6
  local copiedObjectIsTable, copiedObjectHasKeyAndValueString, copiedTableHasKeyAndValueNumber, copiedTableDoesNotCoerceTypes, copiedObjectHasNoReferencesForPrimitivesForward, copiedObjectHasNoReferencesForPrimitivesBackward, copiedObjectHasNoReferencesForArray, copiedObjectHasChildObject, copiedMapIsMap, copiedMapHasValue, copiedSetIsSet, copiedSetHasValue, copiedMapHasChildMap, copiedDefaultMapHasChildDefaultMap, copiedDefaultMapHasBrand
@@ -17,6 +16,10 @@ local ____deepCopy = require("functions.deepCopy")
17
16
  local deepCopy = ____deepCopy.deepCopy
18
17
  local ____log = require("functions.log")
19
18
  local log = ____log.log
19
+ local ____tstlClass = require("functions.tstlClass")
20
+ local isDefaultMap = ____tstlClass.isDefaultMap
21
+ local isTSTLMap = ____tstlClass.isTSTLMap
22
+ local isTSTLSet = ____tstlClass.isTSTLSet
20
23
  function copiedObjectIsTable(self)
21
24
  local oldObject = {abc = "def"}
22
25
  local newObject = deepCopy(nil, oldObject)
@@ -173,7 +176,7 @@ function copiedMapIsMap(self)
173
176
  if newMapType ~= "table" then
174
177
  error("The copied Map was not a table.")
175
178
  end
176
- if not __TS__InstanceOf(newMap, Map) then
179
+ if not isTSTLMap(nil, newMap) then
177
180
  error("The copied Map was not a Map.")
178
181
  end
179
182
  end
@@ -202,7 +205,7 @@ function copiedSetIsSet(self)
202
205
  if newSetType ~= "table" then
203
206
  error("The copied Set was not a table.")
204
207
  end
205
- if not __TS__InstanceOf(newSet, Set) then
208
+ if not isTSTLSet(nil, newSet) then
206
209
  error("The copied Set was not a Map.")
207
210
  end
208
211
  end
@@ -235,7 +238,7 @@ function copiedMapHasChildMap(self)
235
238
  if newChildMapType ~= "table" then
236
239
  error("The copied child Map had a type of: " .. newChildMapType)
237
240
  end
238
- if not __TS__InstanceOf(newChildMap, Map) then
241
+ if not isTSTLMap(nil, newChildMap) then
239
242
  error("The copied child Map was not a Map.")
240
243
  end
241
244
  local value = newChildMap:get(childMapKey)
@@ -269,7 +272,7 @@ function copiedDefaultMapHasChildDefaultMap(self)
269
272
  if newChildMapType ~= "table" then
270
273
  error("The copied child DefaultMap had a type of: " .. newChildMapType)
271
274
  end
272
- if not __TS__InstanceOf(newChildMap, DefaultMap) then
275
+ if not isDefaultMap(nil, newChildMap) then
273
276
  error("The copied child DefaultMap was not a DefaultMap.")
274
277
  end
275
278
  local newChildMapValue1 = newChildMap:get(childMapKey1)
@@ -1,4 +1,12 @@
1
1
  import { Direction } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to convert the degrees of an angle to the `Direction` enum.
4
+ *
5
+ * Note that this function considers 0 degrees to be pointing to the right, which is unusual because
6
+ * 0 normally corresponds to up. (This corresponds to how the `Vector.GetAngleDegrees` method
7
+ * works.)
8
+ */
9
+ export declare function angleToDirection(angleDegrees: int): Direction;
2
10
  export declare function directionToDegrees(direction: Direction): int;
3
11
  export declare function directionToVector(direction: Direction): Vector;
4
12
  export declare function getDirectionName(direction: Direction): string | undefined;
@@ -1,10 +1,37 @@
1
1
  local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
2
4
  local ____directionNames = require("objects.directionNames")
3
5
  local DIRECTION_NAMES = ____directionNames.DIRECTION_NAMES
4
6
  local ____directionToDegrees = require("objects.directionToDegrees")
5
7
  local DIRECTION_TO_DEGREES = ____directionToDegrees.DIRECTION_TO_DEGREES
6
8
  local ____directionToVector = require("objects.directionToVector")
7
9
  local DIRECTION_TO_VECTOR = ____directionToVector.DIRECTION_TO_VECTOR
10
+ --- Helper function to convert the degrees of an angle to the `Direction` enum.
11
+ --
12
+ -- Note that this function considers 0 degrees to be pointing to the right, which is unusual because
13
+ -- 0 normally corresponds to up. (This corresponds to how the `Vector.GetAngleDegrees` method
14
+ -- works.)
15
+ function ____exports.angleToDirection(self, angleDegrees)
16
+ local positiveDegrees = angleDegrees
17
+ while positiveDegrees < 0 do
18
+ positiveDegrees = positiveDegrees + 360
19
+ end
20
+ local normalizedDegrees = positiveDegrees % 360
21
+ if normalizedDegrees < 45 then
22
+ return Direction.RIGHT
23
+ end
24
+ if normalizedDegrees < 135 then
25
+ return Direction.DOWN
26
+ end
27
+ if normalizedDegrees < 225 then
28
+ return Direction.LEFT
29
+ end
30
+ if normalizedDegrees < 315 then
31
+ return Direction.UP
32
+ end
33
+ return Direction.RIGHT
34
+ end
8
35
  function ____exports.directionToDegrees(self, direction)
9
36
  return DIRECTION_TO_DEGREES[direction]
10
37
  end
@@ -45,6 +45,7 @@ export declare function getDoors(...roomTypes: RoomType[]): GridEntityDoor[];
45
45
  * that match any of the N room grid indexes.
46
46
  */
47
47
  export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
48
+ export declare function getOppositeDoorSlot(doorSlot: DoorSlot): DoorSlot | undefined;
48
49
  export declare function getRepentanceDoor(): GridEntityDoor | undefined;
49
50
  /** Helper function to find unused door slots in the room that can be used to make custom doors. */
50
51
  export declare function getUnusedDoorSlots(): DoorSlot[];
@@ -18,6 +18,8 @@ local DEFAULT_DOOR_SLOT = ____doorSlotFlagToDoorSlot.DEFAULT_DOOR_SLOT
18
18
  local DOOR_SLOT_FLAG_TO_DOOR_SLOT = ____doorSlotFlagToDoorSlot.DOOR_SLOT_FLAG_TO_DOOR_SLOT
19
19
  local ____doorSlotToDirection = require("objects.doorSlotToDirection")
20
20
  local DOOR_SLOT_TO_DIRECTION = ____doorSlotToDirection.DOOR_SLOT_TO_DIRECTION
21
+ local ____oppositeDoorSlots = require("objects.oppositeDoorSlots")
22
+ local OPPOSITE_DOOR_SLOTS = ____oppositeDoorSlots.OPPOSITE_DOOR_SLOTS
21
23
  local ____roomShapeToDoorSlots = require("objects.roomShapeToDoorSlots")
22
24
  local ROOM_SHAPE_TO_DOOR_SLOTS = ____roomShapeToDoorSlots.ROOM_SHAPE_TO_DOOR_SLOTS
23
25
  local ____direction = require("functions.direction")
@@ -27,11 +29,19 @@ local getEnumValues = ____enums.getEnumValues
27
29
  function ____exports.doorSlotToDirection(self, doorSlot)
28
30
  return DOOR_SLOT_TO_DIRECTION[doorSlot]
29
31
  end
32
+ --- Helper function to help calculate the position that a player will enter a room at.
33
+ --
34
+ -- When players enter a room, they do not appear exactly on the location of the door, because then
35
+ -- they would immediately collide with the loading zone. Instead, they are offset by a certain
36
+ -- amount of units.
30
37
  function ____exports.getDoorEnterPositionOffset(self, doorSlot)
31
38
  local direction = ____exports.doorSlotToDirection(nil, doorSlot)
32
39
  local vector = directionToVector(nil, direction)
33
40
  return vector * ROOM_ENTRY_OFFSET_FROM_DOOR
34
41
  end
42
+ --- Helper function to get all of the doors in the room. By default, it will return every door. You
43
+ -- can optionally specify one or more room types to return only the doors that match the specified
44
+ -- room types.
35
45
  function ____exports.getDoors(self, ...)
36
46
  local roomTypes = {...}
37
47
  local room = game:GetRoom()
@@ -60,10 +70,14 @@ function ____exports.isSecretRoomDoor(self, door)
60
70
  local filename = sprite:GetFilename()
61
71
  return filename == "gfx/grid/Door_08_HoleInWall.anm2"
62
72
  end
73
+ --- Helper function to remove a single door.
63
74
  function ____exports.removeDoor(self, door)
64
75
  local room = game:GetRoom()
65
76
  room:RemoveDoor(door.Slot)
66
77
  end
78
+ --- Helper function to remove the doors provided.
79
+ --
80
+ -- This function is variadic, meaning that you can specify as many doors as you want to remove.
67
81
  function ____exports.removeDoors(self, ...)
68
82
  local doors = {...}
69
83
  for ____, door in ipairs(doors) do
@@ -76,6 +90,8 @@ function ____exports.closeAllDoors(self)
76
90
  door:Close(true)
77
91
  end
78
92
  end
93
+ --- Use this instead of the `GridEntityDoor.Close` method if you want the door to immediately close
94
+ -- without an animation.
79
95
  function ____exports.closeDoorFast(self, door)
80
96
  door.State = DoorState.CLOSED
81
97
  local sprite = door:GetSprite()
@@ -105,6 +121,8 @@ function ____exports.getDevilRoomDoor(self)
105
121
  end
106
122
  return ____temp_1
107
123
  end
124
+ --- If there is both a Devil Room and an Angel Room door, this function will return door with the
125
+ -- lowest slot number.
108
126
  function ____exports.getDevilRoomOrAngelRoomDoor(self)
109
127
  local devilRoomOrAngelRoomDoors = ____exports.getDoors(nil, RoomType.DEVIL, RoomType.ANGEL)
110
128
  local ____temp_2
@@ -115,14 +133,24 @@ function ____exports.getDevilRoomOrAngelRoomDoor(self)
115
133
  end
116
134
  return ____temp_2
117
135
  end
136
+ --- Helper function to get the position that a player will enter a room at.
137
+ --
138
+ -- When players enter a room, they do not appear exactly on the location of the door, because then
139
+ -- they would immediately collide with the loading zone. Instead, they are offset by a certain
140
+ -- amount of units.
118
141
  function ____exports.getDoorEnterPosition(self, door)
119
142
  local offset = ____exports.getDoorEnterPositionOffset(nil, door.Slot)
120
143
  return door.Position + offset
121
144
  end
145
+ --- Helper function to get the possible door slots that can exist for a given room shape.
122
146
  function ____exports.getDoorSlotsForRoomShape(self, roomShape)
123
147
  local doorSlots = ROOM_SHAPE_TO_DOOR_SLOTS[roomShape]
124
148
  return doorSlots == nil and __TS__New(Set) or doorSlots
125
149
  end
150
+ --- Helper function to get all of the doors in the room that lead to the provided room index.
151
+ --
152
+ -- This function is variadic, meaning that you can specify N arguments to return all of the doors
153
+ -- that match any of the N room grid indexes.
126
154
  function ____exports.getDoorsToRoomIndex(self, ...)
127
155
  local roomGridIndex = {...}
128
156
  local roomGridIndexesSet = __TS__New(Set, roomGridIndex)
@@ -132,6 +160,9 @@ function ____exports.getDoorsToRoomIndex(self, ...)
132
160
  function(____, door) return roomGridIndexesSet:has(door.TargetRoomIndex) end
133
161
  )
134
162
  end
163
+ function ____exports.getOppositeDoorSlot(self, doorSlot)
164
+ return OPPOSITE_DOOR_SLOTS[doorSlot]
165
+ end
135
166
  function ____exports.getRepentanceDoor(self)
136
167
  local doors = ____exports.getDoors(nil)
137
168
  return __TS__ArrayFind(
@@ -139,6 +170,7 @@ function ____exports.getRepentanceDoor(self)
139
170
  function(____, door) return ____exports.isRepentanceDoor(nil, door) end
140
171
  )
141
172
  end
173
+ --- Helper function to find unused door slots in the room that can be used to make custom doors.
142
174
  function ____exports.getUnusedDoorSlots(self)
143
175
  local room = game:GetRoom()
144
176
  local doorSlots = getEnumValues(nil, DoorSlot)
@@ -153,10 +185,13 @@ end
153
185
  function ____exports.isDevilRoomDoor(self, door)
154
186
  return door.TargetRoomType == RoomType.DEVIL
155
187
  end
188
+ --- Helper function to see if a door slot could exist for a given room shape.
156
189
  function ____exports.isDoorSlotInRoomShape(self, doorSlot, roomShape)
157
190
  local doorSlots = ____exports.getDoorSlotsForRoomShape(nil, roomShape)
158
191
  return doorSlots:has(doorSlot)
159
192
  end
193
+ --- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
194
+ -- to spend one key to open it. It has a sprite filename of "gfx/grid/Door_Downpour.anm2".
160
195
  function ____exports.isDoorToDownpour(self, door)
161
196
  if not ____exports.isRepentanceDoor(nil, door) then
162
197
  return false
@@ -165,6 +200,8 @@ function ____exports.isDoorToDownpour(self, door)
165
200
  local filename = sprite:GetFilename()
166
201
  return filename == "gfx/grid/Door_Downpour.anm2"
167
202
  end
203
+ --- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
204
+ -- to spend two hearts to open it. It has a sprite filename of "gfx/grid/Door_Mausoleum.anm2".
168
205
  function ____exports.isDoorToMausoleum(self, door)
169
206
  if not ____exports.isRepentanceDoor(nil, door) then
170
207
  return false
@@ -173,6 +210,8 @@ function ____exports.isDoorToMausoleum(self, door)
173
210
  local filename = sprite:GetFilename()
174
211
  return filename == "gfx/grid/Door_Mausoleum.anm2"
175
212
  end
213
+ --- This refers to the "strange door" located on the first room of Depths 2. You open it with either
214
+ -- a Polaroid or a Negative. It has a sprite filename of "gfx/grid/Door_Mausoleum_Alt.anm2".
176
215
  function ____exports.isDoorToMausoleumAscent(self, door)
177
216
  if not ____exports.isRepentanceDoor(nil, door) then
178
217
  return false
@@ -181,6 +220,8 @@ function ____exports.isDoorToMausoleumAscent(self, door)
181
220
  local filename = sprite:GetFilename()
182
221
  return filename == "gfx/grid/Door_Mausoleum_Alt.anm2"
183
222
  end
223
+ --- This refers to the Repentance door that spawns in a boss room after defeating the boss. You have
224
+ -- to spend two bombs to open it. It has a sprite filename of "gfx/grid/Door_Mines.anm2".
184
225
  function ____exports.isDoorToMines(self, door)
185
226
  if not ____exports.isRepentanceDoor(nil, door) then
186
227
  return false
@@ -189,6 +230,8 @@ function ____exports.isDoorToMines(self, door)
189
230
  local filename = sprite:GetFilename()
190
231
  return filename == "gfx/grid/Door_Mines.anm2"
191
232
  end
233
+ --- This refers to the Repentance door that spawns after defeating Mom. You open it with the
234
+ -- completed knife. It has a sprite filename of "gfx/grid/Door_MomsHeart.anm2".
192
235
  function ____exports.isDoorToMomsHeart(self, door)
193
236
  if not ____exports.isRepentanceDoor(nil, door) then
194
237
  return false
@@ -202,6 +245,12 @@ function ____exports.isHiddenSecretRoomDoor(self, door)
202
245
  local animation = sprite:GetAnimation()
203
246
  return ____exports.isSecretRoomDoor(nil, door) and animation == "Hidden"
204
247
  end
248
+ --- Helper function to reset an unlocked door back to a locked state. Doing this is non-trivial
249
+ -- because in addition to calling the `GridEntityDoor.SetLocked` method, you must also:
250
+ --
251
+ -- - Set the `VisitedCount` of the room's `RoomDescription` to 0.
252
+ -- - Set the variant to `DoorVariant.DOOR_LOCKED`.
253
+ -- - Close the door.
205
254
  function ____exports.lockDoor(self, door)
206
255
  local level = game:GetLevel()
207
256
  local roomDescriptor = level:GetRoomByIdx(door.TargetRoomIndex)
@@ -210,16 +259,25 @@ function ____exports.lockDoor(self, door)
210
259
  door:SetLocked(true)
211
260
  door:Close(true)
212
261
  end
262
+ --- For the purposes of this function, doors to Secret Rooms or Super Secret Rooms that have not been
263
+ -- discovered yet will not be opened.
213
264
  function ____exports.openAllDoors(self)
214
265
  for ____, door in ipairs(____exports.getDoors(nil)) do
215
266
  door:Open()
216
267
  end
217
268
  end
269
+ --- Use this instead of the `GridEntityDoor.Open` method if you want the door to immediately open
270
+ -- without an animation.
218
271
  function ____exports.openDoorFast(self, door)
219
272
  door.State = DoorState.OPEN
220
273
  local sprite = door:GetSprite()
221
274
  sprite:Play("Opened", true)
222
275
  end
276
+ --- Helper function to remove all of the doors in the room. By default, it will remove every door.
277
+ -- You can optionally specify one or more room types to remove only the doors that match the
278
+ -- specified room types.
279
+ --
280
+ -- @returns The number of doors removed.
223
281
  function ____exports.removeAllDoors(self, ...)
224
282
  local doors = ____exports.getDoors(nil, ...)
225
283
  ____exports.removeDoors(
@@ -96,17 +96,17 @@ export declare function parseEntityTypeVariantString(entityTypeVariantString: st
96
96
  * @param entityVariant Optional. The variant to match. Default is -1. -1 matches every variant.
97
97
  * @param entitySubType Optional. The sub-type to match. Default is -1. -1 matches every sub-type.
98
98
  * @param cap Optional. If specified, will only remove the given amount of collectibles.
99
- * @returns True if one or more entities were removed, false otherwise.
99
+ * @returns An array of the entities that were removed.
100
100
  */
101
- export declare function removeAllMatchingEntities(entityType: EntityType, entityVariant?: number, entitySubType?: number, cap?: int | undefined): boolean;
101
+ export declare function removeAllMatchingEntities(entityType: EntityType, entityVariant?: number, entitySubType?: number, cap?: int | undefined): Entity[];
102
102
  /**
103
103
  * Helper function to remove all of the entities in the supplied array.
104
104
  *
105
105
  * @param entities The array of entities to remove.
106
106
  * @param cap Optional. If specified, will only remove the given amount of entities.
107
- * @returns True if one or more entities were removed, false otherwise.
107
+ * @returns An array of the entities that were removed.
108
108
  */
109
- export declare function removeEntities(entities: Entity[], cap?: int): boolean;
109
+ export declare function removeEntities<T extends AnyEntity>(entities: T[], cap?: int): T[];
110
110
  /**
111
111
  * Helper function to reroll an enemy. Use this instead of the vanilla "Game.RerollEnemy" function
112
112
  * if you want the rerolled enemy to be returned.