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
@@ -15,6 +15,7 @@ local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
15
15
  local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
16
16
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
17
17
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
18
+ local FamiliarVariant = ____isaac_2Dtypescript_2Ddefinitions.FamiliarVariant
18
19
  local NullItemID = ____isaac_2Dtypescript_2Ddefinitions.NullItemID
19
20
  local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
20
21
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
@@ -49,6 +50,7 @@ local addTearsStat = ____tears.addTearsStat
49
50
  local ____utils = require("functions.utils")
50
51
  local ensureAllCases = ____utils.ensureAllCases
51
52
  local ____repeat = ____utils["repeat"]
53
+ --- Helper function to get an array containing the characters of all of the current players.
52
54
  function ____exports.getCharacters(self)
53
55
  local players = getPlayers(nil)
54
56
  return __TS__ArrayMap(
@@ -56,6 +58,10 @@ function ____exports.getCharacters(self)
56
58
  function(____, player) return player:GetPlayerType() end
57
59
  )
58
60
  end
61
+ --- Returns the maximum heart containers that the provided player can have. Normally, this is 12, but
62
+ -- it can change depending on the character (e.g. Keeper) and other things (e.g. Mother's Kiss).
63
+ -- This function does not account for Broken Hearts; use the `getPlayerAvailableHeartSlots` helper
64
+ -- function for that.
59
65
  function ____exports.getPlayerMaxHeartContainers(self, player)
60
66
  local character = player:GetPlayerType()
61
67
  local characterMaxHeartContainers = getCharacterMaxHeartContainers(nil, character)
@@ -72,12 +78,18 @@ function ____exports.getPlayerMaxHeartContainers(self, player)
72
78
  end
73
79
  return characterMaxHeartContainers
74
80
  end
81
+ --- Helper function to check if a player is a specific character (i.e. `PlayerType`).
82
+ --
83
+ -- This function is variadic, meaning that you can supply as many characters as you want to check
84
+ -- for. Returns true if the player is any of the supplied characters.
75
85
  function ____exports.isCharacter(self, player, ...)
76
86
  local characters = {...}
77
87
  local characterSet = __TS__New(Set, characters)
78
88
  local character = player:GetPlayerType()
79
89
  return characterSet:has(character)
80
90
  end
91
+ --- Helper function for detecting when a player is Keeper or Tainted Keeper. Useful for situations
92
+ -- where you want to know if the health is coin hearts, for example.
81
93
  function ____exports.isKeeper(self, player)
82
94
  local character = player:GetPlayerType()
83
95
  return character == PlayerType.KEEPER or character == PlayerType.KEEPER_B
@@ -110,6 +122,19 @@ function ____exports.addCollectibleCostume(self, player, collectibleType)
110
122
  end
111
123
  player:AddCostume(itemConfigItem, false)
112
124
  end
125
+ --- Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
126
+ -- from the EvaluateCache callback.
127
+ --
128
+ -- Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
129
+ -- to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
130
+ --
131
+ -- This function supports the following cache flags:
132
+ -- - CacheFlag.DAMAGE (1 << 0)
133
+ -- - CacheFlag.FIRE_DELAY (1 << 1)
134
+ -- - CacheFlag.SHOT_SPEED (1 << 2)
135
+ -- - CacheFlag.RANGE (1 << 3)
136
+ -- - CacheFlag.SPEED (1 << 4)
137
+ -- - CacheFlag.LUCK (1 << 10)
113
138
  function ____exports.addStat(self, player, cacheFlag, amount)
114
139
  if not STAT_CACHE_FLAGS_SET:has(cacheFlag) then
115
140
  error("You cannot add a stat to a player with the cache flag of: " .. tostring(cacheFlag))
@@ -186,6 +211,10 @@ function ____exports.anyPlayerHasTrinket(self, trinketType)
186
211
  function(____, player) return player:HasTrinket(trinketType) end
187
212
  )
188
213
  end
214
+ --- Helper function to determine if the given character is present.
215
+ --
216
+ -- This function is variadic, meaning that you can supply as many characters as you want to check
217
+ -- for. Returns true if any of the characters supplied are present.
189
218
  function ____exports.anyPlayerIs(self, ...)
190
219
  local matchingCharacters = {...}
191
220
  local matchingCharacterSet = __TS__New(Set, matchingCharacters)
@@ -195,10 +224,19 @@ function ____exports.anyPlayerIs(self, ...)
195
224
  function(____, character) return matchingCharacterSet:has(character) end
196
225
  )
197
226
  end
227
+ --- Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
228
+ --
229
+ -- The following situations allow for this to be true:
230
+ -- - the player has Leo (collectible 302)
231
+ -- - the player has Thunder Thighs (collectible 314)
232
+ -- - the player is under the effects of Mega Mush (collectible 625)
233
+ -- - the player has Stompy (transformation 13)
198
234
  function ____exports.canPlayerCrushRocks(self, player)
199
235
  local effects = player:GetEffects()
200
236
  return player:HasCollectible(CollectibleType.LEO) or player:HasCollectible(CollectibleType.THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.MEGA_MUSH) or player:HasPlayerForm(PlayerForm.STOMPY)
201
237
  end
238
+ --- Helper function to find the active slot that the player has the corresponding collectible type
239
+ -- in. Returns undefined if the player does not have the collectible in any active slot.
202
240
  function ____exports.getActiveItemSlot(self, player, collectibleType)
203
241
  local activeSlots = getEnumValues(nil, ActiveSlot)
204
242
  return __TS__ArrayFind(
@@ -209,6 +247,10 @@ function ____exports.getActiveItemSlot(self, player, collectibleType)
209
247
  end
210
248
  )
211
249
  end
250
+ --- Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
251
+ -- `EntityPlayer` object or a tear height stat.
252
+ --
253
+ -- The formula for calculating it is: 32 - 2.5 * player.TearHeight
212
254
  function ____exports.getAzazelBrimstoneDistance(self, playerOrTearHeight)
213
255
  local tearHeight = tonumber(playerOrTearHeight)
214
256
  if tearHeight == nil then
@@ -232,6 +274,8 @@ function ____exports.getClosestPlayer(self, position)
232
274
  end
233
275
  return closestPlayer
234
276
  end
277
+ --- Helper function to get an array of temporary effects for a player. This is helpful so that you
278
+ -- don't have to manually create an array from an `EffectsList` object.
235
279
  function ____exports.getEffectsList(self, player)
236
280
  local effects = player:GetEffects()
237
281
  local effectsList = effects:GetEffectsList()
@@ -248,6 +292,8 @@ function ____exports.getEffectsList(self, player)
248
292
  end
249
293
  return effectArray
250
294
  end
295
+ --- Helper function to return the player with the highest ID, according to the `Isaac.GetPlayer`
296
+ -- method.
251
297
  function ____exports.getFinalPlayer(self)
252
298
  local players = getPlayers(nil)
253
299
  local lastPlayer = getLastElement(nil, players)
@@ -256,6 +302,9 @@ function ____exports.getFinalPlayer(self)
256
302
  end
257
303
  return lastPlayer
258
304
  end
305
+ --- Helper function to get the first player with the lowest frame count. Useful to find a freshly
306
+ -- spawned player after using items like Esau Jr. Don't use this function if two or more players
307
+ -- will be spawned on the same frame.
259
308
  function ____exports.getNewestPlayer(self)
260
309
  local newestPlayer = nil
261
310
  local lowestFrame = math.huge
@@ -270,6 +319,9 @@ function ____exports.getNewestPlayer(self)
270
319
  end
271
320
  return newestPlayer
272
321
  end
322
+ --- Returns the number of slots that the player has remaining for new heart containers, accounting
323
+ -- for broken hearts. For example, if the player is Judas and has 1 red heart containers and 2 full
324
+ -- soul hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
273
325
  function ____exports.getPlayerAvailableHeartSlots(self, player)
274
326
  local maxHeartContainers = ____exports.getPlayerMaxHeartContainers(nil, player)
275
327
  local effectiveMaxHearts = player:GetEffectiveMaxHearts()
@@ -281,11 +333,19 @@ function ____exports.getPlayerAvailableHeartSlots(self, player)
281
333
  local totalOccupiedHeartSlots = totalHeartContainers + brokenHearts
282
334
  return maxHeartContainers - totalOccupiedHeartSlots
283
335
  end
336
+ --- Returns the number of black hearts that the player has, excluding any soul hearts. For example,
337
+ -- if the player has one full black heart, one full soul heart, and one half black heart, this
338
+ -- function returns 3.
339
+ --
340
+ -- This is different from the `EntityPlayer.GetBlackHearts` method, since that returns a bitmask.
284
341
  function ____exports.getPlayerBlackHearts(self, player)
285
342
  local blackHeartsBitmask = player:GetBlackHearts()
286
343
  local blackHeartBits = countSetBits(nil, blackHeartsBitmask)
287
344
  return blackHeartBits * 2
288
345
  end
346
+ --- Iterates over all players and checks if any are close enough to the specified position.
347
+ --
348
+ -- @returns The first player found when iterating upwards from index 0.
289
349
  function ____exports.getPlayerCloserThan(self, position, distance)
290
350
  local players = getPlayers(nil)
291
351
  return __TS__ArrayFind(
@@ -293,6 +353,10 @@ function ____exports.getPlayerCloserThan(self, position, distance)
293
353
  function(____, player) return player.Position:Distance(position) <= distance end
294
354
  )
295
355
  end
356
+ --- Helper function to return the total amount of collectibles that a player has that match the
357
+ -- collectible type(s) provided.
358
+ --
359
+ -- This function is variadic, meaning that you can specify N collectible types.
296
360
  function ____exports.getPlayerCollectibleCount(self, player, ...)
297
361
  local collectibleTypes = {...}
298
362
  local numCollectibles = 0
@@ -301,6 +365,8 @@ function ____exports.getPlayerCollectibleCount(self, player, ...)
301
365
  end
302
366
  return numCollectibles
303
367
  end
368
+ --- Iterates over every item in the game and returns a map containing the number of each item that
369
+ -- the player has.
304
370
  function ____exports.getPlayerCollectibleMap(self, player)
305
371
  local collectibleSet = getCollectibleSet(nil)
306
372
  local collectibleMap = __TS__New(Map)
@@ -312,11 +378,43 @@ function ____exports.getPlayerCollectibleMap(self, player)
312
378
  end
313
379
  return collectibleMap
314
380
  end
381
+ --- Helper function to get the player from a tear, laser, bomb, etc.
382
+ function ____exports.getPlayerFromTear(self, entity)
383
+ if entity.Parent ~= nil then
384
+ local player = entity.Parent:ToPlayer()
385
+ if player ~= nil then
386
+ return player
387
+ end
388
+ local familiar = entity.Parent:ToFamiliar()
389
+ if familiar ~= nil and familiar.Variant == FamiliarVariant.INCUBUS then
390
+ return familiar.Player
391
+ end
392
+ end
393
+ if entity.SpawnerEntity ~= nil then
394
+ local player = entity.SpawnerEntity:ToPlayer()
395
+ if player ~= nil then
396
+ return player
397
+ end
398
+ local familiar = entity.SpawnerEntity:ToFamiliar()
399
+ if familiar ~= nil and familiar.Variant == FamiliarVariant.INCUBUS then
400
+ return familiar.Player
401
+ end
402
+ end
403
+ return nil
404
+ end
405
+ --- Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
406
+ -- if the player has one full black heart, one full soul heart, and one half black heart, this
407
+ -- function returns 3.
408
+ --
409
+ -- This is different from the `EntityPlayer.GetHearts` method, since that returns a value that
410
+ -- includes rotten hearts.
315
411
  function ____exports.getPlayerHearts(self, player)
316
412
  local rottenHearts = player:GetRottenHearts()
317
413
  local hearts = player:GetHearts()
318
414
  return hearts - rottenHearts * 2
319
415
  end
416
+ --- Helper function that returns the type of the rightmost heart. This does not including golden
417
+ -- hearts or broken hearts, since they cannot be damaged directly.
320
418
  function ____exports.getPlayerLastHeart(self, player)
321
419
  local hearts = player:GetHearts()
322
420
  local effectiveMaxHearts = player:GetEffectiveMaxHearts()
@@ -358,10 +456,20 @@ function ____exports.getPlayerLastHeart(self, player)
358
456
  end
359
457
  return HealthType.RED
360
458
  end
459
+ --- Helper function to get the proper name of the player. Use this instead of the
460
+ -- `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
461
+ -- characters.
361
462
  function ____exports.getPlayerName(self, player)
362
463
  local character = player:GetPlayerType()
363
464
  return ____exports.isModdedPlayer(nil, player) and player:GetName() or getCharacterName(nil, character)
364
465
  end
466
+ --- Returns the combined value of all of the player's red hearts, soul/black hearts, and bone hearts,
467
+ -- minus the value of the player's rotten hearts.
468
+ --
469
+ -- This is equivalent to the number of hits that the player can currently take, but does not take
470
+ -- into account double damage from champion enemies and/or being on later floors. (For example, on
471
+ -- Womb 1, players who have 1 soul heart remaining would die in 1 hit to anything, even though this
472
+ -- function would report that they have 2 hits remaining.)
365
473
  function ____exports.getPlayerNumHitsRemaining(self, player)
366
474
  local hearts = player:GetHearts()
367
475
  local soulHearts = player:GetSoulHearts()
@@ -370,11 +478,21 @@ function ____exports.getPlayerNumHitsRemaining(self, player)
370
478
  local rottenHearts = player:GetRottenHearts()
371
479
  return hearts + soulHearts + boneHearts + eternalHearts - rottenHearts
372
480
  end
481
+ --- Returns the number of soul hearts that the player has, excluding any black hearts. For example,
482
+ -- if the player has one full black heart, one full soul heart, and one half black heart, this
483
+ -- function returns 2.
484
+ --
485
+ -- This is different from the `EntityPlayer.GetSoulHearts` method, since that returns the combined
486
+ -- number of soul hearts and black hearts.
373
487
  function ____exports.getPlayerSoulHearts(self, player)
374
488
  local soulHearts = player:GetSoulHearts()
375
489
  local blackHearts = ____exports.getPlayerBlackHearts(nil, player)
376
490
  return soulHearts - blackHearts
377
491
  end
492
+ --- Helper function to get all of the players that are a certain character.
493
+ --
494
+ -- This function is variadic, meaning that you can supply as many characters as you want to check
495
+ -- for. Returns true if any of the characters supplied are present.
378
496
  function ____exports.getPlayersOfType(self, ...)
379
497
  local characters = {...}
380
498
  local charactersSet = __TS__New(Set, characters)
@@ -387,6 +505,10 @@ function ____exports.getPlayersOfType(self, ...)
387
505
  end
388
506
  )
389
507
  end
508
+ --- Helper function to get only the players that have a certain collectible.
509
+ --
510
+ -- This function is variadic, meaning that you can supply as many collectible types as you want to
511
+ -- check for. It only returns the players that have all of the collectibles.
390
512
  function ____exports.getPlayersWithCollectible(self, ...)
391
513
  local collectibleTypes = {...}
392
514
  local players = getPlayers(nil)
@@ -398,6 +520,10 @@ function ____exports.getPlayersWithCollectible(self, ...)
398
520
  ) end
399
521
  )
400
522
  end
523
+ --- Helper function to get only the players that have a certain trinket.
524
+ --
525
+ -- This function is variadic, meaning that you can supply as many trinket types as you want to check
526
+ -- for. It only returns the players that have all of the trinkets.
401
527
  function ____exports.getPlayersWithTrinket(self, ...)
402
528
  local trinketTypes = {...}
403
529
  local players = getPlayers(nil)
@@ -409,12 +535,22 @@ function ____exports.getPlayersWithTrinket(self, ...)
409
535
  ) end
410
536
  )
411
537
  end
538
+ --- Helper function to determine how many heart containers that Tainted Magdalene has that will not
539
+ -- be automatically depleted over time. By default, this is 2, but this function will return 4 so
540
+ -- that it is consistent with the `player.GetHearts` and `player.GetMaxHearts` methods.
541
+ --
542
+ -- If Tainted Magdalene has Birthright, she will gained an additional non-temporary heart container.
543
+ --
544
+ -- This function does not validate whether or not the provided player is Tainted Magdalene; that
545
+ -- should be accomplished before invoking this function.
412
546
  function ____exports.getTaintedMagdaleneNonTemporaryMaxHearts(self, player)
413
547
  local maxHearts = player:GetMaxHearts()
414
548
  local hasBirthright = player:HasCollectible(CollectibleType.BIRTHRIGHT)
415
549
  local maxNonTemporaryMaxHearts = hasBirthright and 6 or 4
416
550
  return math.min(maxHearts, maxNonTemporaryMaxHearts)
417
551
  end
552
+ --- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
553
+ -- Onion and player 2 has 2 Sad Onions, then this function would return 3.
418
554
  function ____exports.getTotalPlayerCollectibles(self, collectibleType)
419
555
  local players = getPlayers(nil)
420
556
  local numCollectiblesArray = __TS__ArrayMap(
@@ -423,10 +559,16 @@ function ____exports.getTotalPlayerCollectibles(self, collectibleType)
423
559
  )
424
560
  return sumArray(nil, numCollectiblesArray)
425
561
  end
562
+ --- After touching a white fire, a player will turn into The Lost until they clear a room.
426
563
  function ____exports.hasLostCurse(self, player)
427
564
  local effects = player:GetEffects()
428
565
  return effects:HasNullEffect(NullItemID.LOST_CURSE)
429
566
  end
567
+ --- Returns whether or not the player can hold an additional active item, beyond what they are
568
+ -- currently carrying. This takes the Schoolbag into account.
569
+ --
570
+ -- If the player is the Tainted Soul, this always returns false, since that character cannot pick up
571
+ -- items. (Only Tainted Forgotten can pick up items.)
430
572
  function ____exports.hasOpenActiveItemSlot(self, player)
431
573
  if ____exports.isCharacter(nil, player, PlayerType.THE_SOUL_B) then
432
574
  return false
@@ -443,10 +585,25 @@ function ____exports.isActiveSlotEmpty(self, player, activeSlot)
443
585
  local activeCollectibleType = player:GetActiveItem(activeSlot)
444
586
  return activeCollectibleType == CollectibleType.NULL
445
587
  end
588
+ --- Helper function for detecting when a player is Bethany or Tainted Bethany. This is useful if you
589
+ -- need to adjust UI elements to account for Bethany's soul charges or Tainted Bethany's blood
590
+ -- charges.
446
591
  function ____exports.isBethany(self, player)
447
592
  local character = player:GetPlayerType()
448
593
  return character == PlayerType.BETHANY or character == PlayerType.BETHANY_B
449
594
  end
595
+ --- Helper function to see if a damage source is from a player. Use this instead of comparing to the
596
+ -- entity directly because it takes familiars into account.
597
+ function ____exports.isDamageFromPlayer(self, damageSource)
598
+ local player = damageSource:ToPlayer()
599
+ if player ~= nil then
600
+ return true
601
+ end
602
+ local indirectPlayer = ____exports.getPlayerFromTear(nil, damageSource)
603
+ return indirectPlayer ~= nil
604
+ end
605
+ --- Helper function for detecting when a player is Eden or Tainted Eden. Useful for situations where
606
+ -- you want to know if the starting stats were randomized, for example.
450
607
  function ____exports.isEden(self, player)
451
608
  local character = player:GetPlayerType()
452
609
  return character == PlayerType.EDEN or character == PlayerType.EDEN_B
@@ -454,14 +611,18 @@ end
454
611
  function ____exports.isFirstPlayer(self, player)
455
612
  return getPlayerIndexVanilla(nil, player) == 0
456
613
  end
614
+ --- Helper function for detecting when a player is Jacob or Esau. This will only match the
615
+ -- non-tainted versions of these characters.
457
616
  function ____exports.isJacobOrEsau(self, player)
458
617
  local character = player:GetPlayerType()
459
618
  return character == PlayerType.JACOB or character == PlayerType.ESAU
460
619
  end
620
+ --- Helper function for detecting when a player is The Lost or Tainted Lost.
461
621
  function ____exports.isLost(self, player)
462
622
  local character = player:GetPlayerType()
463
623
  return character == PlayerType.THE_LOST or character == PlayerType.THE_LOST_B
464
624
  end
625
+ --- Helper function for detecting if a player is one of the Tainted characters.
465
626
  function ____exports.isTainted(self, player)
466
627
  local character = player:GetPlayerType()
467
628
  local ____isVanillaPlayer_result_0
@@ -472,16 +633,25 @@ function ____exports.isTainted(self, player)
472
633
  end
473
634
  return ____isVanillaPlayer_result_0
474
635
  end
636
+ --- Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus.
475
637
  function ____exports.isTaintedLazarus(self, player)
476
638
  local character = player:GetPlayerType()
477
639
  return character == PlayerType.LAZARUS_B or character == PlayerType.LAZARUS_2_B
478
640
  end
641
+ --- Helper function to add one or more collectibles to a player.
642
+ --
643
+ -- This function is variadic, meaning that you can supply as many collectible types as you want to
644
+ -- add.
479
645
  function ____exports.playerAddCollectible(self, player, ...)
480
646
  local collectibleTypes = {...}
481
647
  for ____, collectibleType in ipairs(collectibleTypes) do
482
648
  player:AddCollectible(collectibleType)
483
649
  end
484
650
  end
651
+ --- Helper function to check to see if a player has one or more collectibles.
652
+ --
653
+ -- This function is variadic, meaning that you can supply as many collectible types as you want to
654
+ -- check for. Returns true if the player has any of the supplied collectible types.
485
655
  function ____exports.playerHasCollectible(self, player, ...)
486
656
  local collectibleTypes = {...}
487
657
  return __TS__ArraySome(
@@ -489,6 +659,8 @@ function ____exports.playerHasCollectible(self, player, ...)
489
659
  function(____, collectibleType) return player:HasCollectible(collectibleType) end
490
660
  )
491
661
  end
662
+ --- Helper function to remove a collectible costume from a player. Use this helper function to avoid
663
+ -- having to request the collectible from the item config.
492
664
  function ____exports.removeCollectibleCostume(self, player, collectibleType)
493
665
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
494
666
  if itemConfigItem == nil then
@@ -496,6 +668,10 @@ function ____exports.removeCollectibleCostume(self, player, collectibleType)
496
668
  end
497
669
  player:RemoveCostume(itemConfigItem)
498
670
  end
671
+ --- Helper function to remove the Dead Eye multiplier from a player.
672
+ --
673
+ -- Note that each time the `EntityPlayer.ClearDeadEyeCharge` method is called, it only has a chance
674
+ -- of working, so this function calls it 100 times to be safe.
499
675
  function ____exports.removeDeadEyeMultiplier(self, player)
500
676
  ____repeat(
501
677
  nil,
@@ -505,6 +681,8 @@ function ____exports.removeDeadEyeMultiplier(self, player)
505
681
  end
506
682
  )
507
683
  end
684
+ --- Helper function to remove a trinket costume from a player. Use this helper function to avoid
685
+ -- having to request the trinket from the item config.
508
686
  function ____exports.removeTrinketCostume(self, player, trinketType)
509
687
  local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
510
688
  if itemConfigTrinket == nil then
@@ -512,6 +690,20 @@ function ____exports.removeTrinketCostume(self, player, trinketType)
512
690
  end
513
691
  player:RemoveCostume(itemConfigTrinket)
514
692
  end
693
+ --- Helper function to set an active collectible to a particular slot. This has different behavior
694
+ -- than calling the `player.AddCollectible` method with the `activeSlot` argument, because this
695
+ -- function will not shift existing items into the Schoolbag and it handles
696
+ -- `ActiveSlot.SLOT_POCKET2`.
697
+ --
698
+ -- Note that if an item is set to `ActiveSlot.SLOT_POCKET2`, it will disappear after being used and
699
+ -- will be automatically removed upon entering a new room.
700
+ --
701
+ -- @param player The player to give the item to.
702
+ -- @param collectibleType The collectible type of the item to give.
703
+ -- @param activeSlot The slot to set.
704
+ -- @param charge Optional. The argument of charges to set. If not specified, the item will be set
705
+ -- with maximum charges.
706
+ -- @param keepInPools Optional. Whether or not to remove the item from pools. Default is false.
515
707
  function ____exports.setActiveItem(self, player, collectibleType, activeSlot, charge, keepInPools)
516
708
  if keepInPools == nil then
517
709
  keepInPools = false
@@ -527,9 +719,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
527
719
  itemPool:RemoveCollectible(collectibleType)
528
720
  end
529
721
  repeat
530
- local ____switch113 = activeSlot
531
- local ____cond113 = ____switch113 == ActiveSlot.PRIMARY
532
- if ____cond113 then
722
+ local ____switch122 = activeSlot
723
+ local ____cond122 = ____switch122 == ActiveSlot.PRIMARY
724
+ if ____cond122 then
533
725
  do
534
726
  if primaryCollectibleType ~= CollectibleType.NULL then
535
727
  player:RemoveCollectible(primaryCollectibleType)
@@ -538,8 +730,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
538
730
  break
539
731
  end
540
732
  end
541
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.SECONDARY
542
- if ____cond113 then
733
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.SECONDARY
734
+ if ____cond122 then
543
735
  do
544
736
  if primaryCollectibleType ~= CollectibleType.NULL then
545
737
  player:RemoveCollectible(primaryCollectibleType)
@@ -554,16 +746,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
554
746
  break
555
747
  end
556
748
  end
557
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET
558
- if ____cond113 then
749
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET
750
+ if ____cond122 then
559
751
  do
560
752
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
561
753
  player:SetActiveCharge(charge, activeSlot)
562
754
  break
563
755
  end
564
756
  end
565
- ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET_SINGLE_USE
566
- if ____cond113 then
757
+ ____cond122 = ____cond122 or ____switch122 == ActiveSlot.POCKET_SINGLE_USE
758
+ if ____cond122 then
567
759
  do
568
760
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
569
761
  break
@@ -576,6 +768,13 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
576
768
  end
577
769
  until true
578
770
  end
771
+ --- Helper function to blindfold the player by using a hack with the challenge variable.
772
+ --
773
+ -- The method used in this function was discovered by im_tem.
774
+ --
775
+ -- @param player The player to apply or remove the blindfold state from.
776
+ -- @param enabled Whether or not to apply or remove the blindfold.
777
+ -- @param modifyCostume Optional. Whether to add or remove the blindfold costume. Default is true.
579
778
  function ____exports.setBlindfold(self, player, enabled, modifyCostume)
580
779
  if modifyCostume == nil then
581
780
  modifyCostume = true
@@ -598,6 +797,8 @@ function ____exports.setBlindfold(self, player, enabled, modifyCostume)
598
797
  end
599
798
  end
600
799
  end
800
+ --- Helper function to use an active item without showing an animation, keeping the item, or adding
801
+ -- any costumes.
601
802
  function ____exports.useActiveItemTemp(self, player, collectibleType)
602
803
  player:UseActiveItem(
603
804
  collectibleType,
@@ -4,33 +4,98 @@ local Set = ____lualib.Set
4
4
  local ____exports = {}
5
5
  local ____playerIndex = require("functions.playerIndex")
6
6
  local getPlayerIndex = ____playerIndex.getPlayerIndex
7
+ --- Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
8
+ -- `Map.set` method if you have a map of this type.
9
+ --
10
+ -- For example:
11
+ --
12
+ -- ```ts
13
+ -- const v = {
14
+ -- run: {
15
+ -- playersSpeedBoost: new Map<PlayerIndex, int>(),
16
+ -- },
17
+ -- };
18
+ --
19
+ -- function incrementSpeedBoost(player: EntityPlayer) {
20
+ -- const oldSpeedBoost = mapGetPlayer(v.run.playersSpeedBoost, player);
21
+ -- const newSpeedBoost = oldSpeedBoost + 0.1;
22
+ -- mapSetPlayer(v.run.playersSpeedBoost, player);
23
+ -- }
24
+ -- ```
7
25
  function ____exports.mapSetPlayer(self, map, player, value)
8
26
  local playerIndex = getPlayerIndex(nil, player)
9
27
  map:set(playerIndex, value)
10
28
  end
29
+ --- Helper function to make using default maps with an index of `PlayerIndex` easier. Use this
30
+ -- instead of the `DefaultMap.getAndSetDefault` method if you have a default map of this type.
31
+ --
32
+ -- For example:
33
+ --
34
+ -- ```ts
35
+ -- const v = {
36
+ -- run: {
37
+ -- playersSpeedBoost: new DefaultMap<PlayerIndex, int>(0),
38
+ -- },
39
+ -- };
40
+ --
41
+ -- function evaluateCacheSpeed(player: EntityPlayer) {
42
+ -- player.MoveSpeed = defaultMapGetPlayer(v.run.playersSpeedBoost, player);
43
+ -- }
44
+ -- ```
11
45
  function ____exports.defaultMapGetPlayer(self, map, player, ...)
12
46
  local playerIndex = getPlayerIndex(nil, player)
13
47
  return map:getAndSetDefault(playerIndex, ...)
14
48
  end
49
+ --- Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
50
+ -- `Map.set` method if you have a map of this type.
51
+ --
52
+ -- Since `Map` and `DefaultMap` set values in the same way, this function is simply an alias for the
53
+ -- `mapSetPlayer` helper function.
15
54
  function ____exports.defaultMapSetPlayer(self, map, player, value)
16
55
  ____exports.mapSetPlayer(nil, map, player, value)
17
56
  end
57
+ --- Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
58
+ -- `Map.get` method if you have a map of this type.
59
+ --
60
+ -- For example:
61
+ --
62
+ -- ```ts
63
+ -- const v = {
64
+ -- run: {
65
+ -- playersSpeedBoost: new Map<PlayerIndex, int>(),
66
+ -- },
67
+ -- };
68
+ --
69
+ -- function incrementSpeedBoost(player: EntityPlayer) {
70
+ -- const oldSpeedBoost = mapGetPlayer(v.run.playersSpeedBoost, player);
71
+ -- const newSpeedBoost = oldSpeedBoost + 0.1;
72
+ -- mapSetPlayer(v.run.playersSpeedBoost, player);
73
+ -- }
74
+ -- ```
18
75
  function ____exports.mapGetPlayer(self, map, player)
19
76
  local playerIndex = getPlayerIndex(nil, player)
20
77
  return map:get(playerIndex)
21
78
  end
79
+ --- Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
80
+ -- `Map.has` method if you have a map of this type.
22
81
  function ____exports.mapHasPlayer(self, map, player)
23
82
  local playerIndex = getPlayerIndex(nil, player)
24
83
  return map:has(playerIndex)
25
84
  end
85
+ --- Helper function to make using sets with an type of `PlayerIndex` easier. Use this instead of the
86
+ -- `Set.add` method if you have a set of this type.
26
87
  function ____exports.setAddPlayer(self, set, player)
27
88
  local playerIndex = getPlayerIndex(nil, player)
28
89
  return set:add(playerIndex)
29
90
  end
91
+ --- Helper function to make using sets with an type of `PlayerIndex` easier. Use this instead of the
92
+ -- `Set.delete` method if you have a set of this type.
30
93
  function ____exports.setDeletePlayer(self, set, player)
31
94
  local playerIndex = getPlayerIndex(nil, player)
32
95
  return set:delete(playerIndex)
33
96
  end
97
+ --- Helper function to make using sets with an type of `PlayerIndex` easier. Use this instead of the
98
+ -- `Set.has` method if you have a set of this type.
34
99
  function ____exports.setHasPlayer(self, set, player)
35
100
  local playerIndex = getPlayerIndex(nil, player)
36
101
  return set:has(playerIndex)
@@ -1,4 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
2
3
  import { HealthType } from "../enums/HealthType";
3
4
  import { PlayerHealth } from "../interfaces/PlayerHealth";
4
5
  export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
@@ -11,6 +12,8 @@ export declare function addPlayerHealthType(player: EntityPlayer, healthType: He
11
12
  */
12
13
  export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth;
13
14
  export declare function getPlayerHealthType(player: EntityPlayer, healthType: HealthType): int;
15
+ export declare function playerConvertBlackHeartsToSoulHearts(player: EntityPlayer): void;
16
+ export declare function playerConvertSoulHeartsToBlackHearts(player: EntityPlayer): void;
14
17
  export declare function removeAllPlayerHealth(player: EntityPlayer): void;
15
18
  /**
16
19
  * Helper function to set a player's health to a specific state. You can use this in combination