isaacscript-common 2.3.1 → 3.1.0

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 (327) 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/postPickupInitLate.lua +2 -0
  30. package/callbacks/postPickupStateChanged.lua +2 -0
  31. package/callbacks/postPitRender.lua +2 -0
  32. package/callbacks/postPitUpdate.lua +2 -0
  33. package/callbacks/postPlayerChangeHealth.lua +2 -0
  34. package/callbacks/postPlayerChangeType.lua +2 -0
  35. package/callbacks/postPlayerFatalDamage.lua +2 -0
  36. package/callbacks/postPlayerInitLate.lua +2 -0
  37. package/callbacks/postPlayerReordered.lua +2 -0
  38. package/callbacks/postPoopRender.lua +2 -0
  39. package/callbacks/postPoopUpdate.lua +2 -0
  40. package/callbacks/postPressurePlateRender.lua +2 -0
  41. package/callbacks/postPressurePlateUpdate.lua +2 -0
  42. package/callbacks/postProjectileInitLate.lua +2 -0
  43. package/callbacks/postPurchase.lua +2 -0
  44. package/callbacks/postRockRender.lua +2 -0
  45. package/callbacks/postRockUpdate.lua +2 -0
  46. package/callbacks/postRoomClearChanged.lua +2 -0
  47. package/callbacks/postSacrifice.lua +2 -0
  48. package/callbacks/postSlotDestroyed.d.ts +1 -0
  49. package/callbacks/postSlotDestroyed.lua +66 -0
  50. package/callbacks/postSlotInitUpdate.lua +2 -0
  51. package/callbacks/postSlotRender.lua +5 -21
  52. package/callbacks/postSpikesRender.lua +2 -0
  53. package/callbacks/postSpikesUpdate.lua +2 -0
  54. package/callbacks/postTNTRender.lua +2 -0
  55. package/callbacks/postTNTUpdate.lua +2 -0
  56. package/callbacks/postTearInitLate.lua +2 -0
  57. package/callbacks/postTearInitVeryLate.lua +2 -0
  58. package/callbacks/postTransformation.lua +2 -0
  59. package/callbacks/postTrinketBreak.lua +2 -0
  60. package/callbacks/preBerserkDeath.lua +2 -0
  61. package/callbacks/preNewLevel.lua +2 -0
  62. package/callbacks/reorderedCallbacks.lua +16 -0
  63. package/callbacks/subscriptions/postBombInitLate.lua +6 -0
  64. package/callbacks/subscriptions/postBoneSwing.lua +6 -0
  65. package/callbacks/subscriptions/postCollectibleInitFirst.lua +6 -0
  66. package/callbacks/subscriptions/postCursedTeleport.lua +6 -0
  67. package/callbacks/subscriptions/postCustomDoorEnter.lua +6 -0
  68. package/callbacks/subscriptions/postCustomRevive.d.ts +1 -0
  69. package/callbacks/subscriptions/postCustomRevive.lua +6 -0
  70. package/callbacks/subscriptions/postDoorRender.d.ts +1 -0
  71. package/callbacks/subscriptions/postDoorRender.lua +6 -0
  72. package/callbacks/subscriptions/postDoorUpdate.d.ts +1 -0
  73. package/callbacks/subscriptions/postDoorUpdate.lua +6 -0
  74. package/callbacks/subscriptions/postEffectInitLate.lua +6 -0
  75. package/callbacks/subscriptions/postEffectStateChanged.lua +6 -0
  76. package/callbacks/subscriptions/postEsauJr.lua +6 -0
  77. package/callbacks/subscriptions/postFamiliarInitLate.lua +6 -0
  78. package/callbacks/subscriptions/postFamiliarStateChanged.lua +6 -0
  79. package/callbacks/subscriptions/postFirstEsauJr.lua +6 -0
  80. package/callbacks/subscriptions/postFirstFlip.lua +6 -0
  81. package/callbacks/subscriptions/postFlip.lua +6 -0
  82. package/callbacks/subscriptions/postGameStartedReordered.lua +6 -0
  83. package/callbacks/subscriptions/postGreedModeWave.lua +6 -0
  84. package/callbacks/subscriptions/postGridEntityBroken.lua +6 -0
  85. package/callbacks/subscriptions/postGridEntityCollision.lua +6 -0
  86. package/callbacks/subscriptions/postGridEntityInit.lua +6 -0
  87. package/callbacks/subscriptions/postGridEntityRemove.lua +6 -0
  88. package/callbacks/subscriptions/postGridEntityRender.lua +6 -0
  89. package/callbacks/subscriptions/postGridEntityStateChanged.lua +6 -0
  90. package/callbacks/subscriptions/postGridEntityUpdate.lua +6 -0
  91. package/callbacks/subscriptions/postHolyMantleRemoved.lua +6 -0
  92. package/callbacks/subscriptions/postItemDischarged.lua +6 -0
  93. package/callbacks/subscriptions/postItemPickup.lua +6 -0
  94. package/callbacks/subscriptions/postKnifeInitLate.lua +6 -0
  95. package/callbacks/subscriptions/postLaserInitLate.lua +6 -0
  96. package/callbacks/subscriptions/postNPCInitLate.lua +6 -0
  97. package/callbacks/subscriptions/postNPCStateChanged.lua +6 -0
  98. package/callbacks/subscriptions/postNewLevelReordered.lua +6 -0
  99. package/callbacks/subscriptions/postNewRoomEarly.lua +6 -0
  100. package/callbacks/subscriptions/postNewRoomReordered.lua +6 -0
  101. package/callbacks/subscriptions/postPEffectUpdateReordered.lua +6 -0
  102. package/callbacks/subscriptions/postPickupCollect.d.ts +1 -0
  103. package/callbacks/subscriptions/postPickupCollect.lua +6 -0
  104. package/callbacks/subscriptions/postPickupInitLate.lua +6 -0
  105. package/callbacks/subscriptions/postPickupStateChanged.d.ts +1 -0
  106. package/callbacks/subscriptions/postPickupStateChanged.lua +6 -0
  107. package/callbacks/subscriptions/postPitRender.d.ts +1 -0
  108. package/callbacks/subscriptions/postPitRender.lua +6 -0
  109. package/callbacks/subscriptions/postPitUpdate.d.ts +1 -0
  110. package/callbacks/subscriptions/postPitUpdate.lua +6 -0
  111. package/callbacks/subscriptions/postPlayerChangeHealth.lua +6 -0
  112. package/callbacks/subscriptions/postPlayerChangeType.lua +6 -0
  113. package/callbacks/subscriptions/postPlayerFatalDamage.lua +6 -0
  114. package/callbacks/subscriptions/postPlayerInitLate.lua +6 -0
  115. package/callbacks/subscriptions/postPlayerInitReordered.lua +6 -0
  116. package/callbacks/subscriptions/postPlayerRenderReordered.lua +6 -0
  117. package/callbacks/subscriptions/postPlayerUpdateReordered.lua +6 -0
  118. package/callbacks/subscriptions/postPoopRender.d.ts +1 -0
  119. package/callbacks/subscriptions/postPoopRender.lua +6 -0
  120. package/callbacks/subscriptions/postPoopUpdate.d.ts +1 -0
  121. package/callbacks/subscriptions/postPoopUpdate.lua +6 -0
  122. package/callbacks/subscriptions/postPressurePlateRender.d.ts +1 -0
  123. package/callbacks/subscriptions/postPressurePlateRender.lua +6 -0
  124. package/callbacks/subscriptions/postPressurePlateUpdate.d.ts +1 -0
  125. package/callbacks/subscriptions/postPressurePlateUpdate.lua +6 -0
  126. package/callbacks/subscriptions/postProjectileInitLate.lua +6 -0
  127. package/callbacks/subscriptions/postPurchase.lua +6 -0
  128. package/callbacks/subscriptions/postRockRender.d.ts +1 -0
  129. package/callbacks/subscriptions/postRockRender.lua +6 -0
  130. package/callbacks/subscriptions/postRockUpdate.d.ts +1 -0
  131. package/callbacks/subscriptions/postRockUpdate.lua +6 -0
  132. package/callbacks/subscriptions/postRoomClearChanged.lua +6 -0
  133. package/callbacks/subscriptions/postSacrifice.lua +6 -0
  134. package/callbacks/subscriptions/postSlotAnimationChanged.lua +6 -0
  135. package/callbacks/subscriptions/postSlotDestroyed.lua +6 -0
  136. package/callbacks/subscriptions/postSlotInit.lua +6 -0
  137. package/callbacks/subscriptions/postSlotRender.lua +6 -0
  138. package/callbacks/subscriptions/postSlotUpdate.lua +6 -0
  139. package/callbacks/subscriptions/postSpikesRender.d.ts +1 -0
  140. package/callbacks/subscriptions/postSpikesRender.lua +6 -0
  141. package/callbacks/subscriptions/postSpikesUpdate.d.ts +1 -0
  142. package/callbacks/subscriptions/postSpikesUpdate.lua +6 -0
  143. package/callbacks/subscriptions/postTNTRender.d.ts +1 -0
  144. package/callbacks/subscriptions/postTNTRender.lua +6 -0
  145. package/callbacks/subscriptions/postTNTUpdate.d.ts +1 -0
  146. package/callbacks/subscriptions/postTNTUpdate.lua +6 -0
  147. package/callbacks/subscriptions/postTearInitLate.lua +6 -0
  148. package/callbacks/subscriptions/postTearInitVeryLate.lua +6 -0
  149. package/callbacks/subscriptions/postTransformation.lua +6 -0
  150. package/callbacks/subscriptions/postTrinketBreak.lua +6 -0
  151. package/callbacks/subscriptions/preBerserkDeath.lua +6 -0
  152. package/callbacks/subscriptions/preCustomRevive.lua +6 -0
  153. package/callbacks/subscriptions/preItemPickup.lua +6 -0
  154. package/callbacks/subscriptions/preNewLevel.lua +6 -0
  155. package/classes/DefaultMap.d.ts +70 -39
  156. package/classes/DefaultMap.lua +94 -43
  157. package/classes/ModUpgraded.d.ts +3 -3
  158. package/classes/ModUpgraded.lua +5 -0
  159. package/constants.lua +41 -0
  160. package/constantsFirstLast.lua +63 -0
  161. package/enums/HealthType.lua +3 -0
  162. package/enums/ModCallbackCustom.d.ts +1 -1
  163. package/enums/ModCallbackCustom.lua +6 -0
  164. package/enums/private/CopyableIsaacAPIClassType.lua +1 -0
  165. package/enums/private/SerializationBrand.lua +5 -0
  166. package/features/characterHealthConversion.lua +6 -0
  167. package/features/characterStats.lua +17 -0
  168. package/features/debugDisplay/exports.d.ts +17 -0
  169. package/features/debugDisplay/exports.lua +90 -0
  170. package/features/debugDisplay/v.d.ts +17 -0
  171. package/features/deployJSONRoom.d.ts +1 -0
  172. package/features/deployJSONRoom.lua +56 -0
  173. package/features/disableInputs.lua +45 -0
  174. package/features/disableSound.lua +14 -0
  175. package/features/extraConsoleCommands/commandsDisplay.lua +90 -0
  176. package/features/extraConsoleCommands/init.lua +16 -0
  177. package/features/extraConsoleCommands/listCommands.lua +172 -0
  178. package/features/fadeInRemover.lua +10 -0
  179. package/features/fastReset.lua +10 -0
  180. package/features/forgottenSwitch.lua +4 -0
  181. package/features/getCollectibleItemPoolType.lua +5 -0
  182. package/features/playerInventory.lua +18 -0
  183. package/features/ponyDetection.lua +4 -0
  184. package/features/preventCollectibleRotation.lua +9 -0
  185. package/features/runInNFrames.lua +50 -0
  186. package/features/saveDataManager/constants.lua +1 -0
  187. package/features/saveDataManager/exports.lua +115 -0
  188. package/features/saveDataManager/load.lua +12 -8
  189. package/features/saveDataManager/main.lua +16 -3
  190. package/features/saveDataManager/maps.lua +3 -0
  191. package/features/saveDataManager/merge.lua +53 -21
  192. package/features/saveDataManager/save.lua +12 -7
  193. package/features/sirenHelpers.lua +13 -0
  194. package/features/taintedLazarusPlayers.lua +11 -0
  195. package/featuresInitialized.lua +6 -0
  196. package/functions/array.d.ts +2 -0
  197. package/functions/array.lua +85 -0
  198. package/functions/benchmark.lua +6 -0
  199. package/functions/boss.lua +35 -0
  200. package/functions/cacheFlag.lua +4 -0
  201. package/functions/cards.lua +60 -0
  202. package/functions/challenges.lua +1 -0
  203. package/functions/character.lua +23 -0
  204. package/functions/charge.lua +39 -0
  205. package/functions/chargeBar.d.ts +1 -0
  206. package/functions/chargeBar.lua +4 -0
  207. package/functions/collectibleCacheFlag.lua +15 -0
  208. package/functions/collectibleSet.lua +3 -0
  209. package/functions/collectibleTag.lua +9 -0
  210. package/functions/collectibles.d.ts +6 -1
  211. package/functions/collectibles.lua +146 -2
  212. package/functions/color.lua +18 -0
  213. package/functions/debug.lua +18 -0
  214. package/functions/deepCopy.lua +60 -26
  215. package/functions/deepCopyTests.lua +8 -5
  216. package/functions/direction.d.ts +1 -0
  217. package/functions/direction.lua +22 -0
  218. package/functions/doors.d.ts +1 -0
  219. package/functions/doors.lua +58 -0
  220. package/functions/entity.d.ts +4 -4
  221. package/functions/entity.lua +94 -6
  222. package/functions/entitySpecific.d.ts +20 -20
  223. package/functions/entitySpecific.lua +182 -0
  224. package/functions/entityTypes.d.ts +1 -1
  225. package/functions/entityTypes.lua +1 -0
  226. package/functions/enums.d.ts +2 -0
  227. package/functions/enums.lua +62 -0
  228. package/functions/familiars.lua +52 -0
  229. package/functions/flag.lua +77 -0
  230. package/functions/flying.lua +10 -0
  231. package/functions/globals.lua +8 -10
  232. package/functions/gridEntity.lua +105 -0
  233. package/functions/gridEntitySpecific.d.ts +5 -0
  234. package/functions/gridEntitySpecific.lua +8 -0
  235. package/functions/input.lua +11 -0
  236. package/functions/isaacAPIClass.d.ts +4 -4
  237. package/functions/isaacAPIClass.lua +15 -3
  238. package/functions/jsonHelpers.lua +11 -0
  239. package/functions/jsonRoom.d.ts +2 -0
  240. package/functions/jsonRoom.lua +5 -0
  241. package/functions/kColor.lua +9 -0
  242. package/functions/language.lua +5 -0
  243. package/functions/log.lua +31 -3
  244. package/functions/map.lua +18 -0
  245. package/functions/math.lua +26 -0
  246. package/functions/npc.lua +24 -0
  247. package/functions/pickupVariants.d.ts +11 -11
  248. package/functions/pickupVariants.lua +11 -0
  249. package/functions/pickups.d.ts +9 -9
  250. package/functions/pickups.lua +67 -0
  251. package/functions/pills.lua +45 -0
  252. package/functions/player.lua +166 -0
  253. package/functions/playerDataStructures.lua +65 -0
  254. package/functions/playerHealth.d.ts +1 -0
  255. package/functions/playerHealth.lua +10 -0
  256. package/functions/playerIndex.d.ts +2 -0
  257. package/functions/playerIndex.lua +47 -0
  258. package/functions/pocketItems.lua +18 -0
  259. package/functions/positionVelocity.d.ts +3 -0
  260. package/functions/positionVelocity.lua +46 -0
  261. package/functions/random.d.ts +2 -0
  262. package/functions/random.lua +32 -0
  263. package/functions/revive.d.ts +2 -0
  264. package/functions/revive.lua +15 -0
  265. package/functions/rng.d.ts +1 -0
  266. package/functions/rng.lua +19 -0
  267. package/functions/roomData.lua +68 -0
  268. package/functions/roomGrid.lua +21 -0
  269. package/functions/roomShape.lua +22 -0
  270. package/functions/rooms.lua +100 -0
  271. package/functions/run.lua +5 -0
  272. package/functions/seeds.lua +4 -0
  273. package/functions/serialization.lua +6 -2
  274. package/functions/set.d.ts +1 -0
  275. package/functions/set.lua +22 -0
  276. package/functions/spawnCollectible.lua +24 -0
  277. package/functions/sprite.d.ts +2 -0
  278. package/functions/sprite.lua +25 -0
  279. package/functions/stage.lua +16 -0
  280. package/functions/string.lua +6 -0
  281. package/functions/table.d.ts +12 -0
  282. package/functions/table.lua +53 -0
  283. package/functions/tears.d.ts +1 -0
  284. package/functions/tears.lua +12 -0
  285. package/functions/transformations.lua +18 -0
  286. package/functions/trinketCacheFlag.lua +3 -0
  287. package/functions/trinketGive.lua +24 -0
  288. package/functions/trinkets.lua +52 -0
  289. package/functions/tstlClass.d.ts +34 -0
  290. package/functions/tstlClass.lua +63 -9
  291. package/functions/ui.d.ts +2 -0
  292. package/functions/ui.lua +16 -0
  293. package/functions/utils.d.ts +16 -0
  294. package/functions/utils.lua +108 -0
  295. package/functions/vector.lua +13 -16
  296. package/index.d.ts +1 -0
  297. package/initCustomCallbacks.lua +3 -0
  298. package/interfaces/ChargeBarSprites.d.ts +1 -0
  299. package/interfaces/private/TSTLClassMetatable.d.ts +2 -0
  300. package/lualib_bundle.lua +21 -34
  301. package/maps/cardMap.lua +1 -0
  302. package/maps/characterMap.lua +1 -0
  303. package/maps/defaultPlayerStatMap.lua +1 -0
  304. package/maps/gridEntityXMLMap.lua +2 -0
  305. package/maps/pillEffectMap.lua +1 -0
  306. package/maps/roomShapeToTopLeftWallGridIndexMap.lua +2 -0
  307. package/maps/roomTypeMap.lua +1 -0
  308. package/objects/LRoomShapeToRectangles.lua +2 -0
  309. package/objects/colors.lua +4 -0
  310. package/objects/oppositeDoorSlots.d.ts +4 -0
  311. package/objects/oppositeDoorSlots.lua +15 -0
  312. package/objects/roomShapeBounds.lua +2 -0
  313. package/objects/roomShapeLayoutSizes.lua +4 -0
  314. package/objects/roomShapeToBottomRightPosition.lua +2 -0
  315. package/objects/roomShapeToDoorSlotsToGridIndexDelta.lua +2 -0
  316. package/objects/roomShapeToTopLeftPosition.lua +2 -0
  317. package/objects/roomShapeVolumes.lua +3 -0
  318. package/package.json +2 -2
  319. package/patchErrorFunctions.lua +8 -0
  320. package/sets/bossSets.lua +23 -0
  321. package/sets/charactersWithNoRedHeartsSet.lua +2 -0
  322. package/sets/charactersWithNoSoulHeartsSet.lua +2 -0
  323. package/sets/lostStyleCharactersSet.lua +2 -0
  324. package/types/AnyEntity.d.ts +10 -0
  325. package/types/PickingUpItem.lua +7 -0
  326. package/upgradeMod.d.ts +4 -4
  327. package/upgradeMod.lua +18 -0
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postPurchaseHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postPurchaseRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postPurchaseFire(self, player, pickup)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  export declare type PostRockRenderRegisterParameters = [
3
4
  callback: (rock: GridEntityRock) => void,
4
5
  gridEntityVariant?: int
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postRockRenderHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postRockRenderRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postRockRenderFire(self, rock)
11
17
  local gridEntityVariant = rock:GetVariant()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  export declare type PostRockUpdateRegisterParameters = [
3
4
  callback: (rock: GridEntityRock) => void,
4
5
  gridEntityVariant?: int
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postRockUpdateHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postRockUpdateRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postRockUpdateFire(self, rock)
11
17
  local gridEntityVariant = rock:GetVariant()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postRoomClearChangedHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postRoomClearChangedRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postRoomClearChangedFire(self, roomClear)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postSacrificeHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postSacrificeRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postSacrificeFire(self, player, numSacrifices)
11
17
  local character = player:GetPlayerType()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postSlotAnimationChangedHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postSlotAnimationChangedRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postSlotAnimationChangedFire(self, slot, previousAnimation, currentAnimation)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postSlotDestroyedHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postSlotDestroyedRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postSlotDestroyedFire(self, slot)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postSlotInitHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postSlotInitRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postSlotInitFire(self, slot)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postSlotRenderHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postSlotRenderRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postSlotRenderFire(self, slot)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postSlotUpdateHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postSlotUpdateRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postSlotUpdateFire(self, slot)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  export declare type PostSpikesRenderRegisterParameters = [
3
4
  callback: (spikes: GridEntitySpikes) => void,
4
5
  gridEntityVariant?: int
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postSpikesRenderHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postSpikesRenderRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postSpikesRenderFire(self, spikes)
11
17
  local gridEntityVariant = spikes:GetVariant()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  export declare type PostSpikesUpdateRegisterParameters = [
3
4
  callback: (spikes: GridEntitySpikes) => void,
4
5
  gridEntityVariant?: int
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postSpikesUpdateHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postSpikesUpdateRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postSpikesUpdateFire(self, spikes)
11
17
  local gridEntityVariant = spikes:GetVariant()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  export declare type PostTNTRenderRegisterParameters = [
3
4
  callback: (tnt: GridEntityTNT) => void,
4
5
  gridEntityVariant?: int
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postTNTRenderHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postTNTRenderRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postTNTRenderFire(self, tnt)
11
17
  local gridEntityVariant = tnt:GetVariant()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  export declare type PostTNTUpdateRegisterParameters = [
3
4
  callback: (tnt: GridEntityTNT) => void,
4
5
  gridEntityVariant?: int
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postTNTUpdateHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postTNTUpdateRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postTNTUpdateFire(self, tnt)
11
17
  local gridEntityVariant = tnt:GetVariant()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postTearInitLateHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postTearInitLateRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postTearInitLateFire(self, tear)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postTearInitVeryLateHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postTearInitVeryLateRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postTearInitVeryLateFire(self, tear)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postTransformationHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postTransformationRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postTransformationFire(self, player, playerForm, hasForm)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.postTrinketBreakHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.postTrinketBreakRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.postTrinketBreakFire(self, player, trinketType)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.preBerserkDeathHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.preBerserkDeathRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.preBerserkDeathFire(self, player)
11
17
  local character = player:GetPlayerType()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.preCustomReviveHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.preCustomReviveRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.preCustomReviveFire(self, player)
11
17
  local character = player:GetPlayerType()
12
18
  for ____, ____value in ipairs(subscriptions) do
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.preItemPickupHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.preItemPickupRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.preItemPickupFire(self, player, pickingUpItem)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,12 +1,18 @@
1
1
  local ____exports = {}
2
2
  local subscriptions = {}
3
+ ---
4
+ -- @internal
3
5
  function ____exports.preNewLevelHasSubscriptions(self)
4
6
  return #subscriptions > 0
5
7
  end
8
+ ---
9
+ -- @internal
6
10
  function ____exports.preNewLevelRegister(self, ...)
7
11
  local args = {...}
8
12
  subscriptions[#subscriptions + 1] = args
9
13
  end
14
+ ---
15
+ -- @internal
10
16
  function ____exports.preNewLevelFire(self, player)
11
17
  for ____, ____value in ipairs(subscriptions) do
12
18
  local callback = ____value[1]
@@ -1,79 +1,110 @@
1
1
  /**
2
- * A function that creates the value for your default map. For example, if it was a default map
3
- * containing maps, the factory function would be: `() => new Map()`
2
+ * A function that creates the default value for your `DefaultMap`. For example, if it was a
3
+ * `DefaultMap` containing maps, the factory function would be: `() => new Map()`
4
4
  */
5
5
  export declare type FactoryFunction<V, Args extends unknown[]> = (...extraArgs: Args) => V;
6
- declare type FirstArg<K, V, Args extends unknown[]> = Iterable<[K, V]> | V | FactoryFunction<V, Args>;
7
- declare type SecondArg<V, Args extends unknown[]> = V | FactoryFunction<V, Args>;
8
6
  /**
9
- * An extended `Map` with some new methods:
7
+ * `DefaultMap` is a data structure that makes working with default values easier.
10
8
  *
11
- * - `getAndSetDefault` - If the key exists, this will return the same thing as the `get` method.
12
- * Otherwise, it will set a default value to the key, and then return the default value.
13
- * - `getDefaultValue` - Returns the default value to be used for a new key. (If a factory function
14
- * was provided during instantiation, this will execute the factory function.)
15
- * - `getConstructorArg` - Helper method for cloning the map. Returns either the default value or
16
- * the reference to the factory function.
9
+ * It is a common pattern to look up a value in a `Map`, and then, if the value does not exist, set
10
+ * a default value for the key, and then return the default value. `DefaultMap` abstracts this
11
+ * operation away by providing the `getAndSetDefault` method.
17
12
  *
18
- * When instantiating a new DefaultMap, you must specify either a default value or a function that
19
- * returns a default value.
13
+ * Using a `DefaultMap` is nice because it makes code more declarative, since you specify what the
14
+ * default value is alongside the types of the keys/values.
20
15
  *
21
- * For example:
16
+ * When instantiating a new `DefaultMap`, you must specify default value as the first argument. (The
17
+ * default value is the initial value that will be assigned to every new entry in the
18
+ * `getAndSetDefault` method.) For example:
22
19
  *
23
20
  * ```ts
24
21
  * // Initializes a new empty DefaultMap with a default value of "foo".
25
- * const defaultMapWithPrimitive = new DefaultMap<string, string>("foo");
22
+ * const defaultMapWithString = new DefaultMap<string, string>("foo");
26
23
  *
27
- * // Initializes a new empty DefaultMap with a default value of a new Map.
28
- * const defaultMapWithFactory = new DefaultMap<string, Map<string, string>>(() => {
29
- * return new Map();
30
- * })
24
+ * const value = defaultMapWithString.getAndSetDefault("bar");
25
+ * // value is now "foo" and an entry for "bar" is now set.
26
+ * ```
31
27
  *
32
- * // Initializes a DefaultMap with some initial values and a default value of "bar".
33
- * const defaultMapWithInitialValues = new DefaultMap<string, string>([
34
- * ["a1", "a2"],
35
- * ["b1", "b2"],
36
- * ], "bar");
28
+ * Sometimes, instead of having a static initial value for every entry in the map, you will want a
29
+ * dynamic initial value that is contingent upon the key or some other variable. In these cases, you
30
+ * can instead specify that the `DefaultMap` should run a function that will return the initial
31
+ * value. (This is referred to as a "factory function".) For example:
32
+ *
33
+ * ```ts
34
+ * // Initializes a new empty DefaultMap with a default value based on "someGlobalVariable".
35
+ * const factoryFunction = () => someGlobalVariable ? 0 : 1;
36
+ * const defaultMapWithFactoryFunction = new DefaultMap<string, string>(factoryFunction);
37
37
  * ```
38
38
  *
39
- * If specified, the first argument of a factory function must always be equal to the key:
39
+ * Note that in TypeScript and Lua, booleans, numbers, and strings are "passed by value". This means
40
+ * that when the `DefaultMap` creates a new entry, if the default value is one of these 3 types, the
41
+ * values will be copied. On the other hand, arrays and maps and other complex data structures are
42
+ * "passed by reference". This means that when the `DefaultMap` creates a new entry, if the default
43
+ * value is an array, then it would not be copied. Instead, the same shared array would be assigned
44
+ * to every entry. Thus, to solve this problem, any variable that is passed by reference must be
45
+ * created using a factory function to ensure that each copy is unique. For example:
40
46
  *
41
47
  * ```ts
42
- * const defaultMapWithConditionalDefaultValue = new DefaultMap<number, number>((key: number) => {
43
- * return isOdd(key) ? 0 : 1;
44
- * });
48
+ * // Initializes a new empty DefaultMap with a default value of a new empty array.
49
+ * const factoryFunction = () => [] as ;
50
+ * const defaultMapWithArray = new DefaultMap<string, string[]>(factoryFunction);
45
51
  * ```
46
52
  *
47
- * You can also specify a factory function that takes a generic amount of arguments beyond the
48
- * first:
53
+ * In the previous two examples, the factory functions did not have any arguments. But you can also
54
+ * specify a factory function that takes one or more arguments:
49
55
  *
50
56
  * ```ts
51
57
  * const factoryFunction = (arg: boolean) => arg ? 0 : 1;
52
- * const defaultMapWithExtraArgs = new DefaultMap<string, string, [arg: boolean]>(factoryFunction);
58
+ * const defaultMapWithArg = new DefaultMap<string, string, [arg: boolean]>(factoryFunction);
53
59
  * ```
60
+ *
61
+ * Similar to a normal `Map`, you can also include an initializer list in the constructor as the
62
+ * second argument:
63
+ *
64
+ * ```ts
65
+ * // Initializes a DefaultMap with a default value of "foo" and some initial values.
66
+ * const defaultMapWithInitialValues = new DefaultMap<string, string>("foo", [
67
+ * ["a1", "a2"],
68
+ * ["b1", "b2"],
69
+ * ], );
70
+ * ```
71
+ *
72
+ * Finally, note that `DefaultMap` has the following additional utility methods:
73
+ *
74
+ * - `getAndSetDefault` - The method that is called inside the overridden `get` method. In most
75
+ * cases, you can use the overridden `get` method instead of calling this function directly.
76
+ * However, if a factory function was provided during instantiation, and the factory function has
77
+ * one or more arguments, then you must call this method instead (and provide the corresponding
78
+ * arguments).
79
+ * - `getWithoutDefault` - Calls the original `Map.get` function (without setting the default
80
+ * value).
81
+ * - `getDefaultValue` - Returns the default value to be used for a new key. (If a factory function
82
+ * was provided during instantiation, this will execute the factory function.)
83
+ * - `getConstructorArg` - Helper method for cloning the map. Returns either the default value or
84
+ * the reference to the factory function.
54
85
  */
55
- export declare class DefaultMap<K, V, Args extends unknown[] = []> extends Map<K, V> {
86
+ export declare class DefaultMap<Key, Value, Args extends unknown[] = []> extends Map<Key, Value> {
56
87
  private defaultValue;
57
88
  private defaultValueFactory;
58
89
  /**
59
90
  * See the main `DefaultMap` documentation:
60
91
  * https://isaacscript.github.io/isaacscript-common/classes/classes_DefaultMap.DefaultMap
61
92
  */
62
- constructor(iterableOrDefaultValueOrDefaultValueFactory: FirstArg<K, V, Args>, defaultValueOrDefaultValueFactory?: SecondArg<V, Args>);
93
+ constructor(defaultValueOrFactoryFunction: Value | FactoryFunction<Value, Args>, initializerArray?: Iterable<[Key, Value]>);
63
94
  /**
64
- * If the key exists, this will return the same thing as the `get` method. Otherwise, it will set
65
- * a default value to the key, and then return the default value.
95
+ * If the key exists, this will return the same thing as the normal `Map.get` method. Otherwise,
96
+ * it will set a default value for the provided key, and then return the default value.
66
97
  */
67
- getAndSetDefault(key: K, ...extraArgs: Args): V;
98
+ getAndSetDefault(key: Key, ...extraArgs: Args): Value;
99
+ getWithoutDefault(key: Key): Value | undefined;
68
100
  /**
69
101
  * Returns the default value to be used for a new key. (If a factory function was provided during
70
102
  * instantiation, this will execute the factory function.)
71
103
  */
72
- getDefaultValue(...extraArgs: Args): V;
104
+ getDefaultValue(...extraArgs: Args): Value;
73
105
  /**
74
106
  * Helper method for cloning the map. Returns either the default value or a reference to the
75
107
  * factory function.
76
108
  */
77
- getConstructorArg(): V | FactoryFunction<V, Args>;
109
+ getConstructorArg(): Value | FactoryFunction<Value, Args>;
78
110
  }
79
- export {};