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,16 +1,38 @@
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
- local Map = ____lualib.Map
6
- local WeakMap = ____lualib.WeakMap
7
- local WeakSet = ____lualib.WeakSet
8
4
  local ____exports = {}
9
- local newTSTLClassFromMetatable
10
- local ____DefaultMap = require("classes.DefaultMap")
11
- local DefaultMap = ____DefaultMap.DefaultMap
5
+ local newTSTLClassFromMetatable, VANILLA_TSTL_CLASSES
6
+ --- Helper function to get the name of a TypeScriptToLua class. TSTL classes are Lua tables created
7
+ -- with the `__TS__Class` Lua function from the TSTL lualib. Their name is contained within
8
+ -- "constructor.name" metatable key.
9
+ --
10
+ -- For example, a `Map` class is has a name of "Map".
11
+ --
12
+ -- Returns undefined if the object is not a table or if the aforementioned metatable key does not
13
+ -- exist.
14
+ function ____exports.getTSTLClassName(self, object)
15
+ if type(object) ~= "table" then
16
+ return nil
17
+ end
18
+ local metatable = getmetatable(object)
19
+ if metatable == nil then
20
+ return nil
21
+ end
22
+ local constructor = metatable.constructor
23
+ if constructor == nil then
24
+ return nil
25
+ end
26
+ return constructor.name
27
+ end
28
+ --- Returns whether or not this is a class that is provided as part of the TypeScriptToLua
29
+ -- transpiler, such as a `Map` or a `Set`.
12
30
  function ____exports.isVanillaTSTLClass(self, object)
13
- return __TS__InstanceOf(object, Map) or __TS__InstanceOf(object, Set) or __TS__InstanceOf(object, WeakMap) or __TS__InstanceOf(object, WeakSet)
31
+ local className = ____exports.getTSTLClassName(nil, object)
32
+ if className == nil then
33
+ return false
34
+ end
35
+ return VANILLA_TSTL_CLASSES:has(className)
14
36
  end
15
37
  function newTSTLClassFromMetatable(self, metatable)
16
38
  local newClass = {}
@@ -18,10 +40,38 @@ function newTSTLClassFromMetatable(self, metatable)
18
40
  newClassMetatable:____constructor()
19
41
  return newClass
20
42
  end
43
+ VANILLA_TSTL_CLASSES = __TS__New(Set, {"Map", "Set", "WeakMap", "WeakSet"})
21
44
  local TSTL_CLASS_METATABLE_KEYS = __TS__New(Set, {"____constructor", "__index", "constructor"})
45
+ --- Helper function to determine if a given object is a TypeScriptToLua `Map`.
46
+ --
47
+ -- It is not reliable to use the `instanceof` operator to determine this because each Lua module has
48
+ -- their own copies of the entire lualib and thus their own instantiated version of a `Map`.
49
+ function ____exports.isDefaultMap(self, object)
50
+ local className = ____exports.getTSTLClassName(nil, object)
51
+ return className == "DefaultMap"
52
+ end
53
+ --- Returns whether or not this is a class that is provided by the `isaacscript-common` library, such
54
+ -- as a `DefaultMap`.
22
55
  function ____exports.isIsaacScriptCommonClass(self, object)
23
- return __TS__InstanceOf(object, DefaultMap)
56
+ return ____exports.isDefaultMap(nil, object)
57
+ end
58
+ --- Helper function to determine if a given object is a TypeScriptToLua `Map`.
59
+ --
60
+ -- It is not reliable to use the `instanceof` operator to determine this because each Lua module has
61
+ -- their own copies of the entire lualib and thus their own instantiated version of a `Map`.
62
+ function ____exports.isTSTLMap(self, object)
63
+ local className = ____exports.getTSTLClassName(nil, object)
64
+ return className == "Map"
65
+ end
66
+ --- Helper function to determine if a given object is a TypeScriptToLua `Set`.
67
+ --
68
+ -- It is not reliable to use the `instanceof` operator to determine this because each Lua module has
69
+ -- their own copies of the entire lualib and thus their own instantiated version of a `Set`.
70
+ function ____exports.isTSTLSet(self, object)
71
+ local className = ____exports.getTSTLClassName(nil, object)
72
+ return className == "Set"
24
73
  end
74
+ --- TypeScriptToLua classes are Lua tables that have a metatable with a certain amount of keys.
25
75
  function ____exports.isUserDefinedTSTLClass(self, object)
26
76
  if ____exports.isVanillaTSTLClass(nil, object) or ____exports.isIsaacScriptCommonClass(nil, object) then
27
77
  return false
@@ -46,6 +96,10 @@ function ____exports.isUserDefinedTSTLClass(self, object)
46
96
  end
47
97
  return numKeys == TSTL_CLASS_METATABLE_KEYS.size
48
98
  end
99
+ --- Initializes a new TypeScriptToLua class in the situation where you do not know what kind of class
100
+ -- it is. This function requires that you provide an instantiated class of the same type, as it will
101
+ -- use the class constructor that is present on the other object's metatable to initialize the new
102
+ -- class.
49
103
  function ____exports.newTSTLClass(self, oldClass)
50
104
  local metatable = getmetatable(oldClass)
51
105
  if metatable == nil then
package/functions/ui.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
3
+ /// <reference types="isaac-typescript-definitions" />
2
4
  /**
3
5
  * In the options menu, players have the ability to set a HUD offset. However, mods do not have
4
6
  * access to this value. To get around this, Mod Config Menu provides a separate HUD offset setting
package/functions/ui.lua CHANGED
@@ -14,6 +14,14 @@ function ____exports.getScreenBottomRightPos(self)
14
14
  local screenHeight = Isaac.GetScreenHeight()
15
15
  return Vector(screenWidth, screenHeight)
16
16
  end
17
+ --- In the options menu, players have the ability to set a HUD offset. However, mods do not have
18
+ -- access to this value. To get around this, Mod Config Menu provides a separate HUD offset setting
19
+ -- on the first page of the menu. This is intended to be set by end-users to match their vanilla HUD
20
+ -- offset setting so that mods can render UI elements to the screen in the correct position.
21
+ --
22
+ -- @returns If the user does not have Mod Config Menu enabled, or does not have this option set,
23
+ -- then this function will return `Vector.Zero.` Otherwise, it will return a Vector that
24
+ -- represents a HUD offset that should be added to the position of a UI element.
17
25
  function ____exports.getHUDOffsetVector(self)
18
26
  local defaultVector = copyVector(nil, VectorZero)
19
27
  local hudOffset = math.floor(Options.HUDOffset * 10)
@@ -30,6 +38,8 @@ function ____exports.getHUDOffsetVector(self)
30
38
  end
31
39
  return Vector(x, y)
32
40
  end
41
+ --- Returns how many hearts are in the heart UI row. If the player has more than 6 hearts, this
42
+ -- function will return 6.
33
43
  function ____exports.getHeartRowLength(self, player)
34
44
  local maxHearts = player:GetMaxHearts()
35
45
  local soulHearts = player:GetSoulHearts()
@@ -38,6 +48,9 @@ function ____exports.getHeartRowLength(self, player)
38
48
  local heartRowLength = combinedHearts / 2
39
49
  return math.min(heartRowLength, 6)
40
50
  end
51
+ --- Helper function to get the width of the first player's hearts on the UI. This is useful for
52
+ -- drawing UI elements to the right of where the player's hearts are. Make sure to use this in
53
+ -- combination with the the `getHUDOffsetVector` helper function.
41
54
  function ____exports.getHeartsUIWidth(self)
42
55
  local level = game:GetLevel()
43
56
  local curses = level:GetCurses()
@@ -81,6 +94,9 @@ function ____exports.getScreenTopRightPos(self)
81
94
  local bottomRight = ____exports.getScreenBottomRightPos(nil)
82
95
  return Vector(bottomRight.X, 0)
83
96
  end
97
+ --- Get how many hearts are currently being shown on the hearts UI.
98
+ --
99
+ -- This function is originally from piber20 Helper.
84
100
  function ____exports.getVisibleHearts(self, player)
85
101
  local effectiveMaxHearts = player:GetEffectiveMaxHearts()
86
102
  local soulHearts = player:GetSoulHearts()
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  /**
3
4
  * Helper function to get type safety on a switch statement.
4
5
  *
@@ -65,6 +66,7 @@ export declare function hexToKColor(hexString: string, alpha: float): KColor;
65
66
  * If only one argument is specified, then it will assume that the start is 0.
66
67
  */
67
68
  export declare function irange(start: int, end?: int): int[];
69
+ export declare function isPrimitive(variable: unknown): boolean;
68
70
  /**
69
71
  * Since this is a UI element, we do not want to draw it in water reflections. `renderOffset` will
70
72
  * be a non-zero value in reflections.
@@ -110,3 +112,17 @@ export declare function repeat(n: int, func: (i: int) => void): void;
110
112
  * This function does not actually do anything. (It is an "empty" function.)
111
113
  */
112
114
  export declare function todo(): void;
115
+ /**
116
+ * Helper function to sort a two-dimensional array by the first element.
117
+ *
118
+ * For example:
119
+ *
120
+ * ```ts
121
+ * const myArray = [[1, 2], [2, 3], [3, 4]];
122
+ * myArray.sort(twoDimensionalSort);
123
+ * ```
124
+ *
125
+ * From:
126
+ * https://stackoverflow.com/questions/16096872/how-to-sort-2-dimensional-array-by-column-value
127
+ */
128
+ export declare function twoDimensionalSort<T>(a: T[], b: T[]): -1 | 0 | 1;
@@ -1,13 +1,54 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__StringReplace = ____lualib.__TS__StringReplace
3
3
  local __TS__StringSubstr = ____lualib.__TS__StringSubstr
4
+ local __TS__TypeOf = ____lualib.__TS__TypeOf
4
5
  local ____exports = {}
5
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
7
  local RenderMode = ____isaac_2Dtypescript_2Ddefinitions.RenderMode
7
8
  local ____cachedClasses = require("cachedClasses")
8
9
  local game = ____cachedClasses.game
9
10
  local HEX_STRING_LENGTH = 6
11
+ --- Helper function to get type safety on a switch statement.
12
+ --
13
+ -- Very useful to be future-safe against people adding values to a type or an enum.
14
+ --
15
+ -- For example:
16
+ --
17
+ -- ```ts
18
+ -- enum Situation {
19
+ -- ONE,
20
+ -- TWO,
21
+ -- THREE,
22
+ -- // FOUR, // If we uncomment this line, the program will no longer compile
23
+ -- }
24
+ --
25
+ -- function handleSituation(situation: Situation) {
26
+ -- switch (situation) {
27
+ -- case Situation.ONE: {
28
+ -- return 41;
29
+ -- }
30
+ --
31
+ -- case Situation.TWO: {
32
+ -- return 68;
33
+ -- }
34
+ --
35
+ -- case Situation.THREE: {
36
+ -- return 12;
37
+ -- }
38
+ --
39
+ -- default: {
40
+ -- return ensureAllCases(situation);
41
+ -- }
42
+ -- }
43
+ -- }
44
+ -- ```
10
45
  ____exports.ensureAllCases = function(____, obj) return obj end
46
+ --- Helper function to return an array with the elements from start to end. It is inclusive at the
47
+ -- start and exclusive at the end. (The "e" stands for exclusive.)
48
+ --
49
+ -- For example, `erange(1, 3)` will return `[1, 2]`.
50
+ --
51
+ -- If only one argument is specified, then it will assume that the start is 0.
11
52
  function ____exports.erange(self, start, ____end)
12
53
  if ____end == nil then
13
54
  ____end = start
@@ -23,6 +64,8 @@ function ____exports.erange(self, start, ____end)
23
64
  end
24
65
  return array
25
66
  end
67
+ --- Helper function to log what is happening in functions that recursively move through nested data
68
+ -- structures.
26
69
  function ____exports.getTraversalDescription(self, key, traversalDescription)
27
70
  if traversalDescription ~= "" then
28
71
  traversalDescription = traversalDescription .. " --> "
@@ -30,6 +73,9 @@ function ____exports.getTraversalDescription(self, key, traversalDescription)
30
73
  traversalDescription = traversalDescription .. tostring(key)
31
74
  return traversalDescription
32
75
  end
76
+ --- Converts a hex string like "#33aa33" to a KColor object.
77
+ --
78
+ -- @param hexString A hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
33
79
  function ____exports.hexToKColor(self, hexString, alpha)
34
80
  hexString = __TS__StringReplace(hexString, "#", "")
35
81
  if #hexString ~= HEX_STRING_LENGTH then
@@ -53,6 +99,12 @@ function ____exports.hexToKColor(self, hexString, alpha)
53
99
  local base = 255
54
100
  return KColor(R / base, G / base, B / base, alpha)
55
101
  end
102
+ --- Helper function to return an array with the elements from start to end, inclusive. (The "i"
103
+ -- stands for inclusive.)
104
+ --
105
+ -- For example, `irange(1, 3)` will return `[1, 2, 3]`.
106
+ --
107
+ -- If only one argument is specified, then it will assume that the start is 0.
56
108
  function ____exports.irange(self, start, ____end)
57
109
  if ____end == nil then
58
110
  ____end = start
@@ -68,18 +120,46 @@ function ____exports.irange(self, start, ____end)
68
120
  end
69
121
  return array
70
122
  end
123
+ function ____exports.isPrimitive(self, variable)
124
+ local ____type = __TS__TypeOf(variable)
125
+ return ____type == "boolean" or ____type == "number" or ____type == "string"
126
+ end
127
+ --- Since this is a UI element, we do not want to draw it in water reflections. `renderOffset` will
128
+ -- be a non-zero value in reflections.
71
129
  function ____exports.isReflectionRender(self)
72
130
  local room = game:GetRoom()
73
131
  local renderMode = room:GetRenderMode()
74
132
  return renderMode == RenderMode.WATER_REFLECT
75
133
  end
134
+ --- Helper function to print something to the in-game console. Use this instead of invoking the
135
+ -- `Isaac.ConsoleOutput` method directly because it will automatically insert a newline at the end
136
+ -- of the message (which `Isaac.ConsoleOutput` does not do by default).
76
137
  function ____exports.printConsole(self, msg)
77
138
  Isaac.ConsoleOutput(msg .. "\n")
78
139
  end
140
+ --- Helper function to print whether something was enabled or disabled to the in-game console.
79
141
  function ____exports.printEnabled(self, enabled, description)
80
142
  local enabledText = enabled and "Enabled" or "Disabled"
81
143
  ____exports.printConsole(nil, ((enabledText .. " ") .. description) .. ".")
82
144
  end
145
+ --- Helper function to repeat code N times. This is faster to type and cleaner than using a for loop.
146
+ --
147
+ -- For example:
148
+ --
149
+ -- ```ts
150
+ -- const player = Isaac.GetPlayer();
151
+ -- repeat(10, () => {
152
+ -- player.AddCollectible(CollectibleType.STEVEN);
153
+ -- });
154
+ -- ```
155
+ --
156
+ -- The repeated function is passed the index of the iteration, if needed:
157
+ --
158
+ -- ```ts
159
+ -- repeat(3, (i) => {
160
+ -- print(i); // Prints "0", "1", "2"
161
+ -- });
162
+ -- ```
83
163
  ____exports["repeat"] = function(self, n, func)
84
164
  do
85
165
  local i = 0
@@ -89,6 +169,34 @@ ____exports["repeat"] = function(self, n, func)
89
169
  end
90
170
  end
91
171
  end
172
+ --- Helper function to signify that the enclosing code block is not yet complete. Using this function
173
+ -- is similar to writing a "TODO" comment, but it has the benefit of preventing ESLint errors due to
174
+ -- early returns.
175
+ --
176
+ -- When you see this function, it simply means that the programmer intends to add in more code to
177
+ -- this spot later.
178
+ --
179
+ -- This function does not actually do anything. (It is an "empty" function.)
92
180
  function ____exports.todo(self)
93
181
  end
182
+ --- Helper function to sort a two-dimensional array by the first element.
183
+ --
184
+ -- For example:
185
+ --
186
+ -- ```ts
187
+ -- const myArray = [[1, 2], [2, 3], [3, 4]];
188
+ -- myArray.sort(twoDimensionalSort);
189
+ -- ```
190
+ --
191
+ -- From:
192
+ -- https://stackoverflow.com/questions/16096872/how-to-sort-2-dimensional-array-by-column-value
193
+ function ____exports.twoDimensionalSort(self, a, b)
194
+ if a[1] == nil or b[1] == nil then
195
+ error("Failed to two-dimensional sort since the first element of the array was undefined.")
196
+ end
197
+ if a[1] == b[1] then
198
+ return 0
199
+ end
200
+ return a[1] < b[1] and -1 or 1
201
+ end
94
202
  return ____exports
@@ -1,11 +1,11 @@
1
1
  local ____exports = {}
2
2
  local OBJECT_NAME
3
- local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
- local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
5
3
  local ____SerializationBrand = require("enums.private.SerializationBrand")
6
4
  local SerializationBrand = ____SerializationBrand.SerializationBrand
7
5
  local ____SerializationType = require("enums.SerializationType")
8
6
  local SerializationType = ____SerializationType.SerializationType
7
+ local ____direction = require("functions.direction")
8
+ local angleToDirection = ____direction.angleToDirection
9
9
  local ____isaacAPIClass = require("functions.isaacAPIClass")
10
10
  local isaacAPIClassEquals = ____isaacAPIClass.isaacAPIClassEquals
11
11
  local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
@@ -15,11 +15,17 @@ local getNumbersFromTable = ____table.getNumbersFromTable
15
15
  local tableHasKeys = ____table.tableHasKeys
16
16
  local ____utils = require("functions.utils")
17
17
  local ensureAllCases = ____utils.ensureAllCases
18
+ --- Helper function to check if something is an instantiated Vector object.
18
19
  function ____exports.isVector(self, object)
19
20
  return isIsaacAPIClassOfType(nil, object, OBJECT_NAME)
20
21
  end
21
22
  local KEYS = {"X", "Y"}
22
23
  OBJECT_NAME = "Vector"
24
+ --- Helper function to copy a `Vector` object.
25
+ --
26
+ -- @param vector The vector to copy. In the case of deserialization, this will actually be a Lua
27
+ -- table instead of an instantiated Vector class.
28
+ -- @param serializationType Default is `SerializationType.NONE`.
23
29
  function ____exports.copyVector(self, vector, serializationType)
24
30
  if serializationType == nil then
25
31
  serializationType = SerializationType.NONE
@@ -76,6 +82,8 @@ function ____exports.copyVector(self, vector, serializationType)
76
82
  end
77
83
  until true
78
84
  end
85
+ --- Used to determine is the given table is a serialized `Vector` object created by the save data
86
+ -- manager and/or the `deepCopy` function.
79
87
  function ____exports.isSerializedVector(self, object)
80
88
  local objectType = type(object)
81
89
  if objectType ~= "table" then
@@ -91,21 +99,10 @@ end
91
99
  function ____exports.vectorEquals(self, vector1, vector2)
92
100
  return isaacAPIClassEquals(nil, vector1, vector2, KEYS)
93
101
  end
102
+ --- Helper function for finding out which way a vector is pointing.
94
103
  function ____exports.vectorToDirection(self, vector)
95
- local degrees = vector:GetAngleDegrees()
96
- if degrees > -45 and degrees < 45 then
97
- return Direction.RIGHT
98
- end
99
- if degrees >= 45 and degrees <= 135 then
100
- return Direction.DOWN
101
- end
102
- if degrees <= -45 and degrees >= -135 then
103
- return Direction.UP
104
- end
105
- if degrees > 135 or degrees < -135 then
106
- return Direction.LEFT
107
- end
108
- return Direction.NO_DIRECTION
104
+ local angleDegrees = vector:GetAngleDegrees()
105
+ return angleToDirection(nil, angleDegrees)
109
106
  end
110
107
  function ____exports.vectorToString(self, vector, round)
111
108
  if round == nil then
package/index.d.ts CHANGED
@@ -30,6 +30,7 @@ export { getTaintedLazarusSubPlayer } from "./features/taintedLazarusPlayers";
30
30
  export * from "./functions/array";
31
31
  export * from "./functions/benchmark";
32
32
  export * from "./functions/bitwise";
33
+ export * from "./functions/bombs";
33
34
  export * from "./functions/boss";
34
35
  export * from "./functions/cacheFlag";
35
36
  export * from "./functions/cards";
package/index.lua CHANGED
@@ -242,6 +242,14 @@ do
242
242
  end
243
243
  end
244
244
  end
245
+ do
246
+ local ____export = require("functions.bombs")
247
+ for ____exportKey, ____exportValue in pairs(____export) do
248
+ if ____exportKey ~= "default" then
249
+ ____exports[____exportKey] = ____exportValue
250
+ end
251
+ end
252
+ end
245
253
  do
246
254
  local ____export = require("functions.boss")
247
255
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -51,6 +51,8 @@ local ____postNPCStateChanged = require("callbacks.postNPCStateChanged")
51
51
  local postNPCStateChangedCallbackInit = ____postNPCStateChanged.postNPCStateChangedCallbackInit
52
52
  local ____postPickupCollect = require("callbacks.postPickupCollect")
53
53
  local postPickupCollectCallbackInit = ____postPickupCollect.postPickupCollectCallbackInit
54
+ local ____postPickupInitFirst = require("callbacks.postPickupInitFirst")
55
+ local postPickupInitFirstCallbackInit = ____postPickupInitFirst.postPickupInitFirstCallbackInit
54
56
  local ____postPickupInitLate = require("callbacks.postPickupInitLate")
55
57
  local postPickupInitLateCallbackInit = ____postPickupInitLate.postPickupInitLateCallbackInit
56
58
  local ____postPickupStateChanged = require("callbacks.postPickupStateChanged")
@@ -89,6 +91,8 @@ local ____postRoomClearChanged = require("callbacks.postRoomClearChanged")
89
91
  local postRoomClearChangedCallbackInit = ____postRoomClearChanged.postRoomClearChangedCallbackInit
90
92
  local ____postSacrifice = require("callbacks.postSacrifice")
91
93
  local postSacrificeCallbackInit = ____postSacrifice.postSacrificeCallbackInit
94
+ local ____postSlotDestroyed = require("callbacks.postSlotDestroyed")
95
+ local postSlotDestroyedCallbacksInit = ____postSlotDestroyed.postSlotDestroyedCallbacksInit
92
96
  local ____postSlotInitUpdate = require("callbacks.postSlotInitUpdate")
93
97
  local postSlotInitUpdateCallbacksInit = ____postSlotInitUpdate.postSlotInitUpdateCallbacksInit
94
98
  local ____postSlotRender = require("callbacks.postSlotRender")
@@ -142,6 +146,7 @@ function ____exports.initCustomCallbacks(self, mod)
142
146
  postNPCInitLateCallbackInit(nil, mod)
143
147
  postNPCStateChangedCallbackInit(nil, mod)
144
148
  postPickupCollectCallbackInit(nil, mod)
149
+ postPickupInitFirstCallbackInit(nil, mod)
145
150
  postPickupInitLateCallbackInit(nil, mod)
146
151
  postPickupStateChangedCallbackInit(nil, mod)
147
152
  postPitRenderInit(nil, mod)
@@ -161,6 +166,7 @@ function ____exports.initCustomCallbacks(self, mod)
161
166
  postRockUpdateInit(nil, mod)
162
167
  postRoomClearChangedCallbackInit(nil, mod)
163
168
  postSacrificeCallbackInit(nil, mod)
169
+ postSlotDestroyedCallbacksInit(nil, mod)
164
170
  postSlotInitUpdateCallbacksInit(nil, mod)
165
171
  postSlotRenderCallbacksInit(nil, mod)
166
172
  postSpikesRenderInit(nil, mod)
@@ -35,6 +35,7 @@ import { PostNPCInitLateRegisterParameters } from "../callbacks/subscriptions/po
35
35
  import { PostNPCStateChangedRegisterParameters } from "../callbacks/subscriptions/postNPCStateChanged";
36
36
  import { PostPEffectUpdateReorderedRegisterParameters } from "../callbacks/subscriptions/postPEffectUpdateReordered";
37
37
  import { PostPickupCollectRegisterParameters } from "../callbacks/subscriptions/postPickupCollect";
38
+ import { PostPickupInitFirstRegisterParameters } from "../callbacks/subscriptions/postPickupInitFirst";
38
39
  import { PostPickupInitLateRegisterParameters } from "../callbacks/subscriptions/postPickupInitLate";
39
40
  import { PostPickupStateChangedRegisterParameters } from "../callbacks/subscriptions/postPickupStateChanged";
40
41
  import { PostPitRenderRegisterParameters } from "../callbacks/subscriptions/postPitRender";
@@ -112,6 +113,7 @@ export interface AddCallbackParameterCustom {
112
113
  [ModCallbackCustom.POST_NPC_STATE_CHANGED]: PostNPCStateChangedRegisterParameters;
113
114
  [ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED]: PostPEffectUpdateReorderedRegisterParameters;
114
115
  [ModCallbackCustom.POST_PICKUP_COLLECT]: PostPickupCollectRegisterParameters;
116
+ [ModCallbackCustom.POST_PICKUP_INIT_FIRST]: PostPickupInitFirstRegisterParameters;
115
117
  [ModCallbackCustom.POST_PICKUP_INIT_LATE]: PostPickupInitLateRegisterParameters;
116
118
  [ModCallbackCustom.POST_PICKUP_STATE_CHANGED]: PostPickupStateChangedRegisterParameters;
117
119
  [ModCallbackCustom.POST_PIT_RENDER]: PostPitRenderRegisterParameters;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  /**
3
4
  * A collection of the four sprites necessary in order to render a charge bar.
4
5
  *
@@ -1,4 +1,6 @@
1
1
  /// <reference types="lua-types/5.3" />
2
+ /// <reference types="lua-types/5.3" />
3
+ /// <reference types="lua-types/5.3" />
2
4
  /// <reference types="typescript-to-lua/language-extensions" />
3
5
  export interface TSTLClassMetatable {
4
6
  ____constructor: () => void;
package/lualib_bundle.lua CHANGED
@@ -753,7 +753,7 @@ local function __TS__AsyncAwaiter(generator)
753
753
  return __TS__New(
754
754
  __TS__Promise,
755
755
  function(____, resolve, reject)
756
- local adopt, fulfilled, rejected, step, asyncCoroutine
756
+ local adopt, fulfilled, step, resolved, asyncCoroutine
757
757
  function adopt(self, value)
758
758
  local ____temp_0
759
759
  if __TS__InstanceOf(value, __TS__Promise) then
@@ -764,57 +764,44 @@ local function __TS__AsyncAwaiter(generator)
764
764
  return ____temp_0
765
765
  end
766
766
  function fulfilled(self, value)
767
- local success, errorOrErrorHandler, resultOrError = coroutine.resume(asyncCoroutine, value)
767
+ local success, resultOrError = coroutine.resume(asyncCoroutine, value)
768
768
  if success then
769
- step(nil, resultOrError, errorOrErrorHandler)
769
+ step(nil, resultOrError)
770
770
  else
771
- reject(nil, errorOrErrorHandler)
771
+ reject(nil, resultOrError)
772
772
  end
773
773
  end
774
- function rejected(self, handler)
775
- if handler then
776
- return function(____, value)
777
- local success, hasReturnedOrError, returnedValue = pcall(handler, value)
778
- if success then
779
- if hasReturnedOrError then
780
- resolve(nil, returnedValue)
781
- else
782
- step(nil, hasReturnedOrError, handler)
783
- end
784
- else
785
- reject(nil, hasReturnedOrError)
786
- end
787
- end
788
- else
789
- return function(____, value)
790
- reject(nil, value)
791
- end
774
+ function step(self, result)
775
+ if resolved then
776
+ return
792
777
  end
793
- end
794
- function step(self, result, errorHandler)
795
778
  if coroutine.status(asyncCoroutine) == "dead" then
796
779
  resolve(nil, result)
797
780
  else
798
781
  local ____self_1 = adopt(nil, result)
799
- ____self_1["then"](
800
- ____self_1,
801
- fulfilled,
802
- rejected(nil, errorHandler)
803
- )
782
+ ____self_1["then"](____self_1, fulfilled, reject)
804
783
  end
805
784
  end
785
+ resolved = false
806
786
  asyncCoroutine = coroutine.create(generator)
807
- local success, errorOrErrorHandler, resultOrError = coroutine.resume(asyncCoroutine)
787
+ local success, resultOrError = coroutine.resume(
788
+ asyncCoroutine,
789
+ function(____, v)
790
+ resolved = true
791
+ local ____self_2 = adopt(nil, v)
792
+ ____self_2["then"](____self_2, resolve, reject)
793
+ end
794
+ )
808
795
  if success then
809
- step(nil, resultOrError, errorOrErrorHandler)
796
+ step(nil, resultOrError)
810
797
  else
811
- reject(nil, errorOrErrorHandler)
798
+ reject(nil, resultOrError)
812
799
  end
813
800
  end
814
801
  )
815
802
  end
816
- local function __TS__Await(errorHandler, thing)
817
- return coroutine.yield(errorHandler, thing)
803
+ local function __TS__Await(thing)
804
+ return coroutine.yield(thing)
818
805
  end
819
806
 
820
807
  local function __TS__ClassExtends(target, base)
package/maps/cardMap.lua CHANGED
@@ -4,6 +4,7 @@ local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local Card = ____isaac_2Dtypescript_2Ddefinitions.Card
7
+ --- Maps card names to card sub-types.
7
8
  ____exports.CARD_MAP = __TS__New(Map, {
8
9
  {"fool", Card.FOOL},
9
10
  {"magician", Card.MAGICIAN},
@@ -2,6 +2,7 @@ local ____lualib = require("lualib_bundle")
2
2
  local Map = ____lualib.Map
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
+ --- Maps character names to character sub-types.
5
6
  ____exports.CHARACTER_MAP = __TS__New(Map, {
6
7
  {"isaac", 0},
7
8
  {"magdalene", 1},
@@ -7,6 +7,7 @@ local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
7
7
  local ____tears = require("functions.tears")
8
8
  local getTearsStat = ____tears.getTearsStat
9
9
  local DEFAULT_MAX_FIRE_DELAY = 10
10
+ --- The default fire delay is represented in the tear stat, not the `MaxFireDelay` value.
10
11
  ____exports.DEFAULT_PLAYER_STAT_MAP = __TS__New(
11
12
  Map,
12
13
  {
@@ -12,6 +12,8 @@ local PressurePlateVariant = ____isaac_2Dtypescript_2Ddefinitions.PressurePlateV
12
12
  local RockVariant = ____isaac_2Dtypescript_2Ddefinitions.RockVariant
13
13
  local StatueVariant = ____isaac_2Dtypescript_2Ddefinitions.StatueVariant
14
14
  local TrapdoorVariant = ____isaac_2Dtypescript_2Ddefinitions.TrapdoorVariant
15
+ --- This maps the GridEntityXMLType (i.e. the type contained in the room XML/STB file) to the
16
+ -- GridEntityType and the variant used by the game.
15
17
  ____exports.GRID_ENTITY_XML_MAP = __TS__New(Map, {
16
18
  {GridEntityXMLType.ROCK, {GridEntityType.ROCK, RockVariant.NORMAL}},
17
19
  {GridEntityXMLType.ROCK_BOMB, {GridEntityType.ROCK_BOMB, 0}},
@@ -4,6 +4,7 @@ local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local PillEffect = ____isaac_2Dtypescript_2Ddefinitions.PillEffect
7
+ --- Maps pill effect names to the values of the `PillEffect` enum.
7
8
  ____exports.PILL_EFFECT_MAP = __TS__New(Map, {
8
9
  {"badGas", PillEffect.BAD_GAS},
9
10
  {"gas", PillEffect.BAD_GAS},
@@ -5,6 +5,8 @@ local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
7
7
  ____exports.DEFAULT_TOP_LEFT_WALL_GRID_INDEX = 0
8
+ --- Only used for special room shapes where the top left wall grid index is not equal to
9
+ -- `DEFAULT_TOP_LEFT_WALL_GRID_INDEX`.
8
10
  ____exports.ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP = __TS__New(Map, {
9
11
  {RoomShape.IH, 30},
10
12
  {RoomShape.IV, 4},
@@ -4,6 +4,7 @@ local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
7
+ --- Maps room type names to room types.
7
8
  ____exports.ROOM_TYPE_MAP = __TS__New(Map, {
8
9
  {"null", RoomType.NULL},
9
10
  {"default", RoomType.DEFAULT},