isaacscript-common 4.0.1-dev.0 → 4.0.4

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 (378) hide show
  1. package/callbacks/postCursedTeleport.lua +2 -1
  2. package/callbacks/postEsauJr.lua +2 -1
  3. package/callbacks/postFlip.lua +4 -3
  4. package/callbacks/postItemDischarged.lua +4 -3
  5. package/callbacks/postNewRoomEarly.lua +2 -1
  6. package/callbacks/postSacrifice.lua +3 -2
  7. package/callbacks/postTrinketBreak.lua +3 -2
  8. package/callbacks/reorderedCallbacks.lua +1 -0
  9. package/classes/ModUpgraded.d.ts +5 -1
  10. package/classes/ModUpgraded.lua +2 -2
  11. package/features/playerInventory.lua +1 -0
  12. package/functions/player.lua +9 -14
  13. package/package.json +2 -2
  14. package/cachedClasses.ts +0 -39
  15. package/callbacks/customRevive.ts +0 -215
  16. package/callbacks/itemPickup.ts +0 -101
  17. package/callbacks/postAmbush.ts +0 -73
  18. package/callbacks/postBombExploded.ts +0 -26
  19. package/callbacks/postBombInitLate.ts +0 -36
  20. package/callbacks/postBoneSwing.ts +0 -64
  21. package/callbacks/postCollectibleInitFirst.ts +0 -40
  22. package/callbacks/postCursedTeleport.ts +0 -183
  23. package/callbacks/postCustomDoorEnter.ts +0 -292
  24. package/callbacks/postDiceRoomActivated.ts +0 -60
  25. package/callbacks/postDoorRender.ts +0 -26
  26. package/callbacks/postDoorUpdate.ts +0 -26
  27. package/callbacks/postEffectInitLate.ts +0 -36
  28. package/callbacks/postEffectStateChanged.ts +0 -43
  29. package/callbacks/postEsauJr.ts +0 -107
  30. package/callbacks/postFamiliarInitLate.ts +0 -36
  31. package/callbacks/postFamiliarStateChanged.ts +0 -43
  32. package/callbacks/postFlip.ts +0 -88
  33. package/callbacks/postGreedModeWave.ts +0 -41
  34. package/callbacks/postGridEntity.ts +0 -164
  35. package/callbacks/postGridEntityCollision.ts +0 -69
  36. package/callbacks/postGridEntityRender.ts +0 -26
  37. package/callbacks/postHolyMantleRemoved.ts +0 -55
  38. package/callbacks/postItemDischarged.ts +0 -149
  39. package/callbacks/postKnifeInitLate.ts +0 -36
  40. package/callbacks/postLaserInitLate.ts +0 -36
  41. package/callbacks/postNPCInitLate.ts +0 -36
  42. package/callbacks/postNPCStateChanged.ts +0 -42
  43. package/callbacks/postNewRoomEarly.ts +0 -90
  44. package/callbacks/postPickupCollect.ts +0 -48
  45. package/callbacks/postPickupInitFirst.ts +0 -70
  46. package/callbacks/postPickupInitLate.ts +0 -36
  47. package/callbacks/postPickupStateChanged.ts +0 -43
  48. package/callbacks/postPitRender.ts +0 -26
  49. package/callbacks/postPitUpdate.ts +0 -26
  50. package/callbacks/postPlayerChangeHealth.ts +0 -62
  51. package/callbacks/postPlayerChangeType.ts +0 -56
  52. package/callbacks/postPlayerCollectible.ts +0 -113
  53. package/callbacks/postPlayerFatalDamage.ts +0 -141
  54. package/callbacks/postPlayerInitLate.ts +0 -37
  55. package/callbacks/postPlayerReordered.ts +0 -142
  56. package/callbacks/postPoopRender.ts +0 -26
  57. package/callbacks/postPoopUpdate.ts +0 -26
  58. package/callbacks/postPressurePlateRender.ts +0 -26
  59. package/callbacks/postPressurePlateUpdate.ts +0 -26
  60. package/callbacks/postProjectileInitLate.ts +0 -36
  61. package/callbacks/postPurchase.ts +0 -64
  62. package/callbacks/postRockRender.ts +0 -26
  63. package/callbacks/postRockUpdate.ts +0 -26
  64. package/callbacks/postRoomClearChanged.ts +0 -57
  65. package/callbacks/postSacrifice.ts +0 -62
  66. package/callbacks/postSlotDestroyed.ts +0 -92
  67. package/callbacks/postSlotInitUpdate.ts +0 -68
  68. package/callbacks/postSlotRender.ts +0 -69
  69. package/callbacks/postSpikesRender.ts +0 -26
  70. package/callbacks/postSpikesUpdate.ts +0 -26
  71. package/callbacks/postTNTRender.ts +0 -26
  72. package/callbacks/postTNTUpdate.ts +0 -26
  73. package/callbacks/postTearInitLate.ts +0 -36
  74. package/callbacks/postTearInitVeryLate.ts +0 -41
  75. package/callbacks/postTransformation.ts +0 -59
  76. package/callbacks/postTrinketBreak.ts +0 -110
  77. package/callbacks/preBerserkDeath.ts +0 -49
  78. package/callbacks/preNewLevel.ts +0 -55
  79. package/callbacks/reorderedCallbacks.ts +0 -166
  80. package/callbacks/subscriptions/postAmbushFinished.ts +0 -32
  81. package/callbacks/subscriptions/postAmbushStarted.ts +0 -32
  82. package/callbacks/subscriptions/postBombInitLate.ts +0 -32
  83. package/callbacks/subscriptions/postBoneExploded.ts +0 -32
  84. package/callbacks/subscriptions/postBoneSwing.ts +0 -24
  85. package/callbacks/subscriptions/postCollectibleInitFirst.ts +0 -37
  86. package/callbacks/subscriptions/postCursedTeleport.ts +0 -24
  87. package/callbacks/subscriptions/postCustomDoorEnter.ts +0 -45
  88. package/callbacks/subscriptions/postCustomRevive.ts +0 -36
  89. package/callbacks/subscriptions/postDiceRoomActivated.ts +0 -38
  90. package/callbacks/subscriptions/postDoorRender.ts +0 -35
  91. package/callbacks/subscriptions/postDoorUpdate.ts +0 -35
  92. package/callbacks/subscriptions/postEffectInitLate.ts +0 -32
  93. package/callbacks/subscriptions/postEffectStateChanged.ts +0 -40
  94. package/callbacks/subscriptions/postEsauJr.ts +0 -24
  95. package/callbacks/subscriptions/postFamiliarInitLate.ts +0 -32
  96. package/callbacks/subscriptions/postFamiliarStateChanged.ts +0 -40
  97. package/callbacks/subscriptions/postFirstEsauJr.ts +0 -24
  98. package/callbacks/subscriptions/postFirstFlip.ts +0 -24
  99. package/callbacks/subscriptions/postFlip.ts +0 -22
  100. package/callbacks/subscriptions/postGameStartedReordered.ts +0 -24
  101. package/callbacks/subscriptions/postGreedModeWave.ts +0 -24
  102. package/callbacks/subscriptions/postGridEntityBroken.ts +0 -51
  103. package/callbacks/subscriptions/postGridEntityCollision.ts +0 -54
  104. package/callbacks/subscriptions/postGridEntityInit.ts +0 -51
  105. package/callbacks/subscriptions/postGridEntityRemove.ts +0 -52
  106. package/callbacks/subscriptions/postGridEntityRender.ts +0 -51
  107. package/callbacks/subscriptions/postGridEntityStateChanged.ts +0 -55
  108. package/callbacks/subscriptions/postGridEntityUpdate.ts +0 -51
  109. package/callbacks/subscriptions/postHolyMantleRemoved.ts +0 -48
  110. package/callbacks/subscriptions/postItemDischarged.ts +0 -43
  111. package/callbacks/subscriptions/postItemPickup.ts +0 -64
  112. package/callbacks/subscriptions/postKnifeInitLate.ts +0 -32
  113. package/callbacks/subscriptions/postLaserInitLate.ts +0 -32
  114. package/callbacks/subscriptions/postNPCInitLate.ts +0 -32
  115. package/callbacks/subscriptions/postNPCStateChanged.ts +0 -42
  116. package/callbacks/subscriptions/postNewLevelReordered.ts +0 -22
  117. package/callbacks/subscriptions/postNewRoomEarly.ts +0 -22
  118. package/callbacks/subscriptions/postNewRoomReordered.ts +0 -22
  119. package/callbacks/subscriptions/postPEffectUpdateReordered.ts +0 -40
  120. package/callbacks/subscriptions/postPickupCollect.ts +0 -35
  121. package/callbacks/subscriptions/postPickupInitFirst.ts +0 -32
  122. package/callbacks/subscriptions/postPickupInitLate.ts +0 -32
  123. package/callbacks/subscriptions/postPickupStateChanged.ts +0 -40
  124. package/callbacks/subscriptions/postPitRender.ts +0 -35
  125. package/callbacks/subscriptions/postPitUpdate.ts +0 -35
  126. package/callbacks/subscriptions/postPlayerChangeHealth.ts +0 -49
  127. package/callbacks/subscriptions/postPlayerChangeType.ts +0 -40
  128. package/callbacks/subscriptions/postPlayerCollectibleAdded.ts +0 -38
  129. package/callbacks/subscriptions/postPlayerCollectibleRemoved.ts +0 -38
  130. package/callbacks/subscriptions/postPlayerFatalDamage.ts +0 -68
  131. package/callbacks/subscriptions/postPlayerInitLate.ts +0 -40
  132. package/callbacks/subscriptions/postPlayerInitReordered.ts +0 -40
  133. package/callbacks/subscriptions/postPlayerRenderReordered.ts +0 -40
  134. package/callbacks/subscriptions/postPlayerUpdateReordered.ts +0 -40
  135. package/callbacks/subscriptions/postPoopRender.ts +0 -35
  136. package/callbacks/subscriptions/postPoopUpdate.ts +0 -35
  137. package/callbacks/subscriptions/postPressurePlateRender.ts +0 -37
  138. package/callbacks/subscriptions/postPressurePlateUpdate.ts +0 -37
  139. package/callbacks/subscriptions/postProjectileInitLate.ts +0 -35
  140. package/callbacks/subscriptions/postPurchase.ts +0 -31
  141. package/callbacks/subscriptions/postRockRender.ts +0 -35
  142. package/callbacks/subscriptions/postRockUpdate.ts +0 -35
  143. package/callbacks/subscriptions/postRoomClearChanged.ts +0 -30
  144. package/callbacks/subscriptions/postSacrifice.ts +0 -43
  145. package/callbacks/subscriptions/postSlotAnimationChanged.ts +0 -40
  146. package/callbacks/subscriptions/postSlotDestroyed.ts +0 -55
  147. package/callbacks/subscriptions/postSlotInit.ts +0 -32
  148. package/callbacks/subscriptions/postSlotRender.ts +0 -32
  149. package/callbacks/subscriptions/postSlotUpdate.ts +0 -32
  150. package/callbacks/subscriptions/postSpikesRender.ts +0 -35
  151. package/callbacks/subscriptions/postSpikesUpdate.ts +0 -35
  152. package/callbacks/subscriptions/postTNTRender.ts +0 -35
  153. package/callbacks/subscriptions/postTNTUpdate.ts +0 -35
  154. package/callbacks/subscriptions/postTearInitLate.ts +0 -32
  155. package/callbacks/subscriptions/postTearInitVeryLate.ts +0 -32
  156. package/callbacks/subscriptions/postTransformation.ts +0 -40
  157. package/callbacks/subscriptions/postTrinketBreak.ts +0 -38
  158. package/callbacks/subscriptions/preBerserkDeath.ts +0 -42
  159. package/callbacks/subscriptions/preCustomRevive.ts +0 -46
  160. package/callbacks/subscriptions/preItemPickup.ts +0 -64
  161. package/callbacks/subscriptions/preNewLevel.ts +0 -24
  162. package/classes/DefaultMap.ts +0 -174
  163. package/classes/ModUpgraded.ts +0 -77
  164. package/constants.ts +0 -162
  165. package/constantsFirstLast.ts +0 -217
  166. package/enums/AmbushType.ts +0 -4
  167. package/enums/HealthType.ts +0 -16
  168. package/enums/ModCallbackCustom.ts +0 -1278
  169. package/enums/PocketItemType.ts +0 -8
  170. package/enums/SerializationType.ts +0 -5
  171. package/enums/SlotDestructionType.ts +0 -4
  172. package/enums/private/CopyableIsaacAPIClassType.ts +0 -7
  173. package/enums/private/SaveDataKey.ts +0 -14
  174. package/enums/private/SerializationBrand.ts +0 -42
  175. package/features/characterHealthConversion.ts +0 -111
  176. package/features/characterStats.ts +0 -61
  177. package/features/debugDisplay/debugDisplay.ts +0 -221
  178. package/features/debugDisplay/exports.ts +0 -368
  179. package/features/debugDisplay/v.ts +0 -65
  180. package/features/deployJSONRoom.ts +0 -743
  181. package/features/disableInputs.ts +0 -193
  182. package/features/disableSound.ts +0 -77
  183. package/features/extraConsoleCommands/commandsDisplay.ts +0 -290
  184. package/features/extraConsoleCommands/commandsSubroutines.ts +0 -139
  185. package/features/extraConsoleCommands/init.ts +0 -334
  186. package/features/extraConsoleCommands/listCommands.ts +0 -1299
  187. package/features/extraConsoleCommands/v.ts +0 -14
  188. package/features/fadeInRemover.ts +0 -60
  189. package/features/fastReset.ts +0 -75
  190. package/features/forgottenSwitch.ts +0 -50
  191. package/features/getCollectibleItemPoolType.ts +0 -66
  192. package/features/persistentEntities.ts +0 -183
  193. package/features/playerInventory.ts +0 -133
  194. package/features/ponyDetection.ts +0 -74
  195. package/features/preventCollectibleRotation.ts +0 -115
  196. package/features/runInNFrames.ts +0 -148
  197. package/features/saveDataManager/constants.ts +0 -4
  198. package/features/saveDataManager/exports.ts +0 -229
  199. package/features/saveDataManager/load.ts +0 -99
  200. package/features/saveDataManager/main.ts +0 -195
  201. package/features/saveDataManager/maps.ts +0 -13
  202. package/features/saveDataManager/merge.ts +0 -194
  203. package/features/saveDataManager/save.ts +0 -74
  204. package/features/saveDataManager/serializationBrand.ts +0 -16
  205. package/features/sirenHelpers.ts +0 -129
  206. package/features/taintedLazarusPlayers.ts +0 -113
  207. package/featuresInitialized.ts +0 -20
  208. package/functions/ambush.ts +0 -47
  209. package/functions/array.ts +0 -410
  210. package/functions/benchmark.ts +0 -36
  211. package/functions/bitwise.ts +0 -24
  212. package/functions/bombs.ts +0 -12
  213. package/functions/boss.ts +0 -227
  214. package/functions/cacheFlag.ts +0 -12
  215. package/functions/cards.ts +0 -271
  216. package/functions/challenges.ts +0 -13
  217. package/functions/character.ts +0 -126
  218. package/functions/charge.ts +0 -237
  219. package/functions/chargeBar.ts +0 -67
  220. package/functions/collectibleCacheFlag.ts +0 -90
  221. package/functions/collectibleSet.ts +0 -56
  222. package/functions/collectibleTag.ts +0 -89
  223. package/functions/collectibles.ts +0 -659
  224. package/functions/color.ts +0 -128
  225. package/functions/debug.ts +0 -68
  226. package/functions/deepCopy.ts +0 -535
  227. package/functions/deepCopyTests.ts +0 -386
  228. package/functions/direction.ts +0 -49
  229. package/functions/doors.ts +0 -347
  230. package/functions/easing.ts +0 -182
  231. package/functions/eden.ts +0 -47
  232. package/functions/effects.ts +0 -20
  233. package/functions/entity.ts +0 -439
  234. package/functions/entitySpecific.ts +0 -889
  235. package/functions/entityTypes.ts +0 -6
  236. package/functions/enums.ts +0 -146
  237. package/functions/familiars.ts +0 -106
  238. package/functions/flag.ts +0 -165
  239. package/functions/flying.ts +0 -117
  240. package/functions/globals.ts +0 -242
  241. package/functions/gridEntity.ts +0 -511
  242. package/functions/gridEntitySpecific.ts +0 -112
  243. package/functions/input.ts +0 -139
  244. package/functions/isaacAPIClass.ts +0 -67
  245. package/functions/jsonHelpers.ts +0 -45
  246. package/functions/jsonRoom.ts +0 -100
  247. package/functions/kColor.ts +0 -129
  248. package/functions/language.ts +0 -13
  249. package/functions/level.ts +0 -31
  250. package/functions/log.ts +0 -720
  251. package/functions/map.ts +0 -56
  252. package/functions/math.ts +0 -149
  253. package/functions/mergeTests.ts +0 -288
  254. package/functions/npc.ts +0 -148
  255. package/functions/pickupVariants.ts +0 -60
  256. package/functions/pickups.ts +0 -499
  257. package/functions/pills.ts +0 -205
  258. package/functions/player.ts +0 -1060
  259. package/functions/playerDataStructures.ts +0 -150
  260. package/functions/playerHealth.ts +0 -382
  261. package/functions/playerIndex.ts +0 -195
  262. package/functions/pocketItems.ts +0 -149
  263. package/functions/positionVelocity.ts +0 -188
  264. package/functions/random.ts +0 -77
  265. package/functions/revive.ts +0 -201
  266. package/functions/rng.ts +0 -172
  267. package/functions/roomData.ts +0 -199
  268. package/functions/roomGrid.ts +0 -109
  269. package/functions/roomShape.ts +0 -80
  270. package/functions/rooms.ts +0 -648
  271. package/functions/run.ts +0 -36
  272. package/functions/saveFile.ts +0 -128
  273. package/functions/seeds.ts +0 -19
  274. package/functions/serialization.ts +0 -91
  275. package/functions/set.ts +0 -95
  276. package/functions/sound.ts +0 -9
  277. package/functions/spawnCollectible.ts +0 -104
  278. package/functions/sprite.ts +0 -107
  279. package/functions/stage.ts +0 -125
  280. package/functions/string.ts +0 -47
  281. package/functions/table.ts +0 -189
  282. package/functions/tears.ts +0 -32
  283. package/functions/transformations.ts +0 -131
  284. package/functions/trinketCacheFlag.ts +0 -60
  285. package/functions/trinketGive.ts +0 -157
  286. package/functions/trinkets.ts +0 -215
  287. package/functions/tstlClass.ts +0 -157
  288. package/functions/types.ts +0 -36
  289. package/functions/ui.ts +0 -138
  290. package/functions/utils.ts +0 -189
  291. package/functions/vector.ts +0 -126
  292. package/index.ts +0 -172
  293. package/initCustomCallbacks.ts +0 -132
  294. package/initFeatures.ts +0 -39
  295. package/interfaces/AddCallbackParameterCustom.ts +0 -188
  296. package/interfaces/ChargeBarSprites.ts +0 -12
  297. package/interfaces/JSONDoor.ts +0 -13
  298. package/interfaces/JSONEntity.ts +0 -16
  299. package/interfaces/JSONRoom.ts +0 -36
  300. package/interfaces/JSONRooms.ts +0 -12
  301. package/interfaces/JSONSpawn.ts +0 -14
  302. package/interfaces/PlayerHealth.ts +0 -16
  303. package/interfaces/PocketItemDescription.ts +0 -9
  304. package/interfaces/SaveData.ts +0 -29
  305. package/interfaces/TrinketSituation.ts +0 -9
  306. package/interfaces/private/TSTLClassMetatable.ts +0 -8
  307. package/maps/PHDPillConversions.ts +0 -21
  308. package/maps/cardMap.ts +0 -209
  309. package/maps/characterMap.ts +0 -87
  310. package/maps/collectibleDescriptionMap.ts +0 -732
  311. package/maps/collectibleNameMap.ts +0 -731
  312. package/maps/defaultPlayerStatMap.ts +0 -17
  313. package/maps/falsePHDPillConversions.ts +0 -35
  314. package/maps/gridEntityTypeToBrokenStateMap.ts +0 -50
  315. package/maps/gridEntityXMLMap.ts +0 -176
  316. package/maps/pillEffectMap.ts +0 -88
  317. package/maps/roomShapeToTopLeftWallGridIndexMap.ts +0 -18
  318. package/maps/roomTypeMap.ts +0 -40
  319. package/maps/trinketDescriptionMap.ts +0 -200
  320. package/maps/trinketNameMap.ts +0 -198
  321. package/objects/LRoomShapeToRectangles.ts +0 -44
  322. package/objects/callbackRegisterFunctions.ts +0 -187
  323. package/objects/cardDescriptions.ts +0 -105
  324. package/objects/cardNames.ts +0 -105
  325. package/objects/cardTypes.ts +0 -104
  326. package/objects/challengeNames.ts +0 -52
  327. package/objects/characterNames.ts +0 -48
  328. package/objects/coinSubTypeToValue.ts +0 -14
  329. package/objects/colors.ts +0 -16
  330. package/objects/directionNames.ts +0 -11
  331. package/objects/directionToDegrees.ts +0 -11
  332. package/objects/directionToVector.ts +0 -12
  333. package/objects/doorSlotFlagToDoorSlot.ts +0 -16
  334. package/objects/doorSlotToDirection.ts +0 -14
  335. package/objects/isaacAPIClassTypeToBrand.ts +0 -11
  336. package/objects/isaacAPIClassTypeToCopyFunction.ts +0 -18
  337. package/objects/languageNames.ts +0 -13
  338. package/objects/oppositeDoorSlots.ts +0 -15
  339. package/objects/pillEffectClasses.ts +0 -63
  340. package/objects/pillEffectNames.ts +0 -57
  341. package/objects/pillEffectTypes.ts +0 -62
  342. package/objects/roomShapeBounds.ts +0 -71
  343. package/objects/roomShapeLayoutSizes.ts +0 -45
  344. package/objects/roomShapeToBottomRightPosition.ts +0 -25
  345. package/objects/roomShapeToDoorSlots.ts +0 -83
  346. package/objects/roomShapeToDoorSlotsToGridIndexDelta.ts +0 -127
  347. package/objects/roomShapeToGridWidth.ts +0 -21
  348. package/objects/roomShapeToTopLeftPosition.ts +0 -26
  349. package/objects/roomShapeVolumes.ts +0 -38
  350. package/objects/roomTypeNames.ts +0 -36
  351. package/objects/serializedIsaacAPIClassTypeToIdentityFunction.ts +0 -14
  352. package/objects/stageTypeToLetter.ts +0 -15
  353. package/objects/transformationNames.ts +0 -18
  354. package/patchErrorFunctions.ts +0 -92
  355. package/sets/LRoomShapesSet.ts +0 -8
  356. package/sets/bossSets.ts +0 -470
  357. package/sets/charactersThatStartWithAnActiveItemSet.ts +0 -16
  358. package/sets/charactersWithBlackHeartFromEternalHeartSet.ts +0 -7
  359. package/sets/charactersWithFreeDevilDealsSet.ts +0 -4
  360. package/sets/charactersWithNoRedHeartsSet.ts +0 -17
  361. package/sets/charactersWithNoSoulHeartsSet.ts +0 -14
  362. package/sets/chestPickupVariantsSet.ts +0 -16
  363. package/sets/familiarsThatShootPlayerTearsSet.ts +0 -13
  364. package/sets/lostStyleCharactersSet.ts +0 -13
  365. package/sets/mineShaftRoomSubTypesSet.ts +0 -10
  366. package/sets/redHeartSubTypesSet.ts +0 -7
  367. package/sets/sinEntityTypesSet.ts +0 -11
  368. package/sets/singleUseActiveCollectibleTypesSet.ts +0 -13
  369. package/sets/storyBossesSet.ts +0 -17
  370. package/types/AnyEntity.ts +0 -12
  371. package/types/AwaitingTextInput.d.ts +0 -2
  372. package/types/CollectibleIndex.ts +0 -16
  373. package/types/PickingUpItem.ts +0 -89
  374. package/types/PlayerIndex.ts +0 -13
  375. package/types/private/IsaacAPIClass.ts +0 -3
  376. package/types/private/SerializedIsaacAPIClass.ts +0 -3
  377. package/types/private/TSTLClass.ts +0 -3
  378. package/upgradeMod.ts +0 -55
@@ -1,659 +0,0 @@
1
- import {
2
- CollectiblePedestalType,
3
- CollectibleType,
4
- EntityType,
5
- ItemConfigTag,
6
- ItemConfigTagZero,
7
- ItemType,
8
- PickupPrice,
9
- PickupVariant,
10
- RoomType,
11
- } from "isaac-typescript-definitions";
12
- import { game, itemConfig } from "../cachedClasses";
13
- import { BLIND_ITEM_PNG_PATH, DEFAULT_ITEM_POOL_TYPE } from "../constants";
14
- import {
15
- FIRST_COLLECTIBLE_TYPE,
16
- FIRST_MODDED_COLLECTIBLE_TYPE,
17
- LAST_COLLECTIBLE_TYPE,
18
- LAST_VANILLA_COLLECTIBLE_TYPE,
19
- } from "../constantsFirstLast";
20
- import {
21
- COLLECTIBLE_DESCRIPTION_MAP,
22
- DEFAULT_COLLECTIBLE_DESCRIPTION,
23
- } from "../maps/collectibleDescriptionMap";
24
- import {
25
- COLLECTIBLE_NAME_MAP,
26
- DEFAULT_COLLECTIBLE_NAME,
27
- } from "../maps/collectibleNameMap";
28
- import { SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET } from "../sets/singleUseActiveCollectibleTypesSet";
29
- import { CollectibleIndex } from "../types/CollectibleIndex";
30
- import { getEntityID } from "./entity";
31
- import { isCollectible } from "./pickupVariants";
32
- import { getRoomListIndex } from "./roomData";
33
- import { clearSprite, spriteEquals } from "./sprite";
34
- import { irange } from "./utils";
35
-
36
- const COLLECTIBLE_SPRITE_LAYER = 1;
37
- const COLLECTIBLE_SHADOW_LAYER = 4;
38
-
39
- // Glitched items start at id 4294967295 (the final 32-bit integer) and increment backwards.
40
- const GLITCHED_ITEM_THRESHOLD = 4000000000;
41
-
42
- // The `isBlindCollectible` function needs a reference sprite to work properly.
43
- const questionMarkSprite = initQuestionMarkSprite();
44
-
45
- function initQuestionMarkSprite() {
46
- const sprite = Sprite();
47
- sprite.Load("gfx/005.100_collectible.anm2", false);
48
- sprite.ReplaceSpritesheet(1, "gfx/items/collectibles/questionmark.png");
49
- sprite.LoadGraphics();
50
-
51
- return sprite;
52
- }
53
-
54
- export function clearCollectibleSprite(collectible: EntityPickup): void {
55
- setCollectibleSprite(collectible, undefined);
56
- }
57
-
58
- /** Helper function to check if two collectible sprites have the same sprite sheet loaded. */
59
- export function collectibleSpriteEquals(
60
- sprite1: Sprite,
61
- sprite2: Sprite,
62
- ): boolean {
63
- // We start at negative 40 texels upwards, as by default we assume a collectible that is sitting
64
- // on a pedestal. We finish at positive 10 texels downwards, in order to make comparing shop items
65
- // more accurate.
66
- const xStart = -1;
67
- const xFinish = 1;
68
- const xIncrement = 1;
69
- const yStart = -40;
70
- const yFinish = 10;
71
- const yIncrement = 3;
72
-
73
- return spriteEquals(
74
- sprite1,
75
- sprite2,
76
- COLLECTIBLE_SPRITE_LAYER,
77
- xStart,
78
- xFinish,
79
- xIncrement,
80
- yStart,
81
- yFinish,
82
- yIncrement,
83
- );
84
- }
85
-
86
- /**
87
- * Helper function to get the in-game description for a collectible. Returns "Unknown" if the
88
- * provided collectible type was not valid.
89
- */
90
- export function getCollectibleDescription(
91
- collectibleType: CollectibleType,
92
- ): string {
93
- // "ItemConfigItem.Description" is bugged with vanilla items on patch v1.7.6, so we use a
94
- // hard-coded map as a workaround.
95
- const collectibleDescription =
96
- COLLECTIBLE_DESCRIPTION_MAP.get(collectibleType);
97
- if (collectibleDescription !== undefined) {
98
- return collectibleDescription;
99
- }
100
-
101
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
102
- if (itemConfigItem !== undefined) {
103
- return itemConfigItem.Description;
104
- }
105
-
106
- return DEFAULT_COLLECTIBLE_DESCRIPTION;
107
- }
108
-
109
- /**
110
- * Helper function to get the coin cost that a collectible item would be if it were being offered in
111
- * a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
112
- */
113
- export function getCollectibleDevilCoinPrice(
114
- collectibleType: CollectibleType,
115
- ): int {
116
- if (collectibleType === CollectibleType.NULL) {
117
- return 0;
118
- }
119
-
120
- const defaultCollectiblePrice = 15;
121
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
122
- if (itemConfigItem === undefined) {
123
- return defaultCollectiblePrice;
124
- }
125
-
126
- return itemConfigItem.DevilPrice * defaultCollectiblePrice;
127
- }
128
-
129
- /**
130
- * Helper function to get the heart cost that a collectible item would be if it were being offered
131
- * in a Devil Room deal. Returns 0 if passed `CollectibleType.NULL`.
132
- */
133
- export function getCollectibleDevilHeartPrice(
134
- collectibleType: CollectibleType,
135
- player: EntityPlayer,
136
- ): PickupPrice {
137
- const maxHearts = player.GetMaxHearts();
138
-
139
- if (collectibleType === CollectibleType.NULL) {
140
- return 0;
141
- }
142
-
143
- if (maxHearts === 0) {
144
- return PickupPrice.THREE_SOUL_HEARTS;
145
- }
146
-
147
- const defaultCollectiblePrice = PickupPrice.ONE_HEART;
148
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
149
- if (itemConfigItem === undefined) {
150
- return defaultCollectiblePrice;
151
- }
152
-
153
- const twoHeartPrice =
154
- maxHearts === 2
155
- ? PickupPrice.ONE_HEART_AND_TWO_SOUL_HEARTS
156
- : PickupPrice.TWO_HEARTS;
157
-
158
- return itemConfigItem.DevilPrice === 2
159
- ? twoHeartPrice
160
- : PickupPrice.ONE_HEART;
161
- }
162
-
163
- /**
164
- * Helper function to get the path to a collectible's sprite. Returns the path to the question mark
165
- * sprite (i.e. from Curse of the Blind) if the provided collectible type was not valid.
166
- */
167
- export function getCollectibleGfxFilename(
168
- collectibleType: CollectibleType,
169
- ): string {
170
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
171
- if (itemConfigItem === undefined) {
172
- return BLIND_ITEM_PNG_PATH;
173
- }
174
-
175
- return itemConfigItem.GfxFileName;
176
- }
177
-
178
- /**
179
- * Mods often have to track variables relating to a collectible. Finding an index for these kinds of
180
- * data structures is difficult, since collectibles are respawned every time a player re-enters a
181
- * room, so the `PtrHash` will change. Instead, we use a 4-tuple of the room list index, the grid
182
- * index of the collectible in the room, the collectible's SubType, and the collectible's InitSeed.
183
- *
184
- * Collectibles that are shifted by Tainted Isaac's mechanic will have unique collectible indexes
185
- * because the SubType is different. (The collectible entities share the same InitSeed.)
186
- *
187
- * Collectibles that are rolled (with e.g. a D6) will have unique collectible indexes because the
188
- * SubType and InitSeed are different. If you want to track collectibles independently of any
189
- * rerolls, then you can use the `PtrHash` as an index instead. (The `PtrHash` will not persist
190
- * between rooms, however.)
191
- *
192
- * Note that:
193
- * - The grid index is a necessary part of the collectible index because Diplopia and Crooked Penny
194
- * can cause two or more collectibles with the same SubType and InitSeed to exist in the same
195
- * room.
196
- * - This index will fail in the case where the player uses Diplopia or a successful Crooked Penny
197
- * seven or more times in the same room, since that will cause two or more collectibles with the
198
- * same grid index, SubType, and InitSeed to exist.
199
- * - The SubType is a necessary part of the collectible index because Tainted Isaac will
200
- * continuously cause collectibles to morph into new sub-types with the same InitSeed.
201
- * - Using a collectible's position as part of the index is problematic, since players can push a
202
- * pedestal. (Even using the grid index does not solve this problem, since it is possible in
203
- * certain cases for collectibles to be spawned at a position that is not aligned with the grid,
204
- * and the pedestal pushed to an adjacent tile, but this case should be extremely rare.)
205
- * - Mega Chests spawn two collectibles on the exact same position. However, both of them will have
206
- * different InitSeeds, so this is not a problem for this indexing scheme.
207
- * - The indexing scheme used is different for collectibles that are inside of a Treasure Room or
208
- * Boss Room, in order to handle the case of the player seeing the same collectible again in a
209
- * post-Ascent Treasure Room or Boss Room. A 5-tuple of stage, stage type, grid index, SubType,
210
- * and InitSeed is used in this case. (Using the room list index or the room grid index is not
211
- * suitable for this purpose, since both of these values can change in the post-Ascent rooms.)
212
- * Even though Treasure Rooms and Boss Rooms are grouped together in this scheme, there probably
213
- * will not be collectibles with the same grid index, SubType, and InitSeed.
214
- */
215
- export function getCollectibleIndex(
216
- collectible: EntityPickup,
217
- ): CollectibleIndex {
218
- if (!isCollectible(collectible)) {
219
- const entityID = getEntityID(collectible);
220
- error(
221
- `The "getCollectibleIndex" function was given a non-collectible: ${entityID}`,
222
- );
223
- }
224
-
225
- const level = game.GetLevel();
226
- const stage = level.GetStage();
227
- const stageType = level.GetStageType();
228
- const room = game.GetRoom();
229
- const roomType = room.GetType();
230
- const gridIndex = room.GetGridIndex(collectible.Position);
231
- const roomListIndex = getRoomListIndex();
232
-
233
- // Handle the special case of being in a Treasure Room or Boss Room.
234
- if (roomType === RoomType.TREASURE || roomType === RoomType.BOSS) {
235
- return `${stage},${stageType},${gridIndex},${collectible.SubType},${collectible.InitSeed}` as CollectibleIndex;
236
- }
237
-
238
- return `${roomListIndex},${gridIndex},${collectible.SubType},${collectible.InitSeed}` as CollectibleIndex;
239
- }
240
-
241
- /**
242
- * Helper function to get the initial amount of charges that a collectible has. Returns 0 if the
243
- * provided collectible type was not valid.
244
- */
245
- export function getCollectibleInitCharge(
246
- collectibleType: CollectibleType,
247
- ): int {
248
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
249
- if (itemConfigItem === undefined) {
250
- return 0;
251
- }
252
-
253
- return itemConfigItem.InitCharge;
254
- }
255
-
256
- /**
257
- * Helper function to get the `ItemType` of a collectible. Returns `ItemType.ITEM_NULL` if the
258
- * provided collectible type was not valid.
259
- */
260
- export function getCollectibleItemType(
261
- collectibleType: CollectibleType,
262
- ): ItemType {
263
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
264
- if (itemConfigItem === undefined) {
265
- return ItemType.NULL;
266
- }
267
-
268
- return itemConfigItem.Type;
269
- }
270
-
271
- /**
272
- * Helper function to get the maximum amount of charges that a collectible has. Returns 0 if the
273
- * provided collectible type was not valid.
274
- */
275
- export function getCollectibleMaxCharges(
276
- collectibleType: CollectibleType,
277
- ): int {
278
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
279
- if (itemConfigItem === undefined) {
280
- return 0;
281
- }
282
-
283
- return itemConfigItem.MaxCharges;
284
- }
285
-
286
- /**
287
- * Helper function to get the name of a collectible. Returns "Unknown" if the provided collectible
288
- * type is not valid.
289
- *
290
- * For example:
291
- *
292
- * ```ts
293
- * const collectibleType = CollectibleType.SAD_ONION;
294
- * const collectibleName = getCollectibleName(collectibleType); // collectibleName is "Sad Onion"
295
- * ```
296
- */
297
- export function getCollectibleName(collectibleType: CollectibleType): string {
298
- // "ItemConfigItem.Name" is bugged with vanilla items on patch v1.7.6, so we use a hard-coded map
299
- // as a workaround.
300
- const collectibleName = COLLECTIBLE_NAME_MAP.get(collectibleType);
301
- if (collectibleName !== undefined) {
302
- return collectibleName;
303
- }
304
-
305
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
306
- if (itemConfigItem !== undefined) {
307
- return itemConfigItem.Name;
308
- }
309
-
310
- return DEFAULT_COLLECTIBLE_NAME;
311
- }
312
-
313
- export function getCollectiblePedestalType(
314
- collectible: EntityPickup,
315
- ): CollectiblePedestalType {
316
- if (!isCollectible(collectible)) {
317
- const entityID = getEntityID(collectible);
318
- error(
319
- `The "getCollectiblePedestalType" function was given a non-collectible: ${entityID}`,
320
- );
321
- }
322
-
323
- const sprite = collectible.GetSprite();
324
- return sprite.GetOverlayFrame();
325
- }
326
-
327
- /**
328
- * Helper function to get the path to a collectible's quality. Returns 0 if the provided collectible
329
- * type was not valid.
330
- */
331
- export function getCollectibleQuality(collectibleType: CollectibleType): int {
332
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
333
- if (itemConfigItem === undefined) {
334
- return 0;
335
- }
336
-
337
- return itemConfigItem.Quality;
338
- }
339
-
340
- /**
341
- * Helper function to get the tags of a collectible (which is the composition of zero or more
342
- * `ItemConfigTag`). Returns 0 if the provided collectible type is not valid.
343
- *
344
- * For example:
345
- *
346
- * ```ts
347
- * const collectibleType = CollectibleType.SAD_ONION;
348
- * const itemConfigTags = getCollectibleTags(collectibleType); // itemConfigTags is "18350080"
349
- * ```
350
- */
351
- export function getCollectibleTags(
352
- collectibleType: CollectibleType,
353
- ): BitFlags<ItemConfigTag> {
354
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
355
- return itemConfigItem === undefined ? ItemConfigTagZero : itemConfigItem.Tags;
356
- }
357
-
358
- /**
359
- * Helper function to get an array that represents the range from the first collectible type to the
360
- * last collectible type. This will include integers that do not represent any valid collectible
361
- * types.
362
- *
363
- * This function is only useful when building collectible type objects. For most purposes, you
364
- * should use the `getCollectibleSet` helper function instead.
365
- */
366
- export function getCollectibleTypeRange(): CollectibleType[] {
367
- return irange(
368
- FIRST_COLLECTIBLE_TYPE,
369
- LAST_COLLECTIBLE_TYPE,
370
- ) as CollectibleType[];
371
- }
372
-
373
- /**
374
- * Helper function to get an array that represents the all modded collectible types.
375
- *
376
- * This function is only useful when building collectible type objects. For most purposes, you
377
- * should use the `getModdedCollectibleSet` helper function instead.
378
- *
379
- * Returns an empty array if there are no modded collectible types.
380
- *
381
- * (This function is named differently from the `getVanillaCollectibleTypeRange` function because
382
- * all modded collectible types are contiguous. Thus, each value represents a real
383
- * `CollectibleType`.)
384
- */
385
- export function getModdedCollectibleTypes(): CollectibleType[] {
386
- if (LAST_VANILLA_COLLECTIBLE_TYPE === LAST_COLLECTIBLE_TYPE) {
387
- return [];
388
- }
389
-
390
- return irange(
391
- FIRST_MODDED_COLLECTIBLE_TYPE,
392
- LAST_COLLECTIBLE_TYPE,
393
- ) as CollectibleType[];
394
- }
395
-
396
- /**
397
- * Helper function to get an array that represents the range from the first collectible type to the
398
- * last vanilla collectible type. This will include integers that do not represent any valid
399
- * collectible types.
400
- *
401
- * This function is only useful when building collectible type objects. For most purposes, you
402
- * should use the `getVanillaCollectibleSet` helper function instead.
403
- */
404
- export function getVanillaCollectibleTypeRange(): CollectibleType[] {
405
- return irange(
406
- FIRST_COLLECTIBLE_TYPE,
407
- LAST_VANILLA_COLLECTIBLE_TYPE,
408
- ) as CollectibleType[];
409
- }
410
-
411
- /** Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`. */
412
- export function isActiveCollectible(collectibleType: CollectibleType): boolean {
413
- const itemType = getCollectibleItemType(collectibleType);
414
- return itemType === ItemType.ACTIVE;
415
- }
416
-
417
- /** Returns true if the collectible has a red question mark sprite. */
418
- export function isBlindCollectible(collectible: EntityPickup): boolean {
419
- if (!isCollectible(collectible)) {
420
- const entityID = getEntityID(collectible);
421
- error(
422
- `The "isBlindCollectible" function was given a non-collectible: ${entityID}`,
423
- );
424
- }
425
-
426
- const sprite = collectible.GetSprite();
427
- const animation = sprite.GetAnimation();
428
- const frame = sprite.GetFrame();
429
-
430
- questionMarkSprite.SetFrame(animation, frame);
431
- return collectibleSpriteEquals(sprite, questionMarkSprite);
432
- }
433
-
434
- /**
435
- * Returns whether or not the given collectible is a "glitched" item. All items are replaced by
436
- * glitched items once a player has TMTRAINER. However, glitched items can also "naturally" appear
437
- * in secret rooms and I AM ERROR rooms if the "Corrupted Data" achievement is unlocked.
438
- */
439
- export function isGlitchedCollectible(pickup: EntityPickup): boolean {
440
- return (
441
- pickup.Variant === PickupVariant.COLLECTIBLE &&
442
- pickup.SubType > GLITCHED_ITEM_THRESHOLD
443
- );
444
- }
445
-
446
- /**
447
- * Returns true if the collectible has the "Hidden" attribute in the item config.
448
- *
449
- * Hidden collectibles will not show up in any pools and Eden will not start with them.
450
- */
451
- export function isHiddenCollectible(collectibleType: CollectibleType): boolean {
452
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
453
- return itemConfigItem !== undefined && itemConfigItem.Hidden;
454
- }
455
-
456
- /**
457
- * Returns true if the item type in the item config is equal to `ItemType.ITEM_PASSIVE` or
458
- * `ItemType.ITEM_FAMILIAR`.
459
- */
460
- export function isPassiveCollectible(
461
- collectibleType: CollectibleType,
462
- ): boolean {
463
- const itemType = getCollectibleItemType(collectibleType);
464
- return itemType === ItemType.PASSIVE || itemType === ItemType.FAMILIAR;
465
- }
466
-
467
- /**
468
- * Helper function to determine if a particular collectible will disappear from the player's
469
- * inventory upon use. Note that this will not work will modded items, as there is no way to
470
- * dynamically know if a modded item will disappear.
471
- */
472
- export function isSingleUseCollectible(
473
- collectibleType: CollectibleType,
474
- ): boolean {
475
- return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET.has(collectibleType);
476
- }
477
-
478
- export function isValidCollectibleType(
479
- collectibleType: CollectibleType,
480
- ): boolean {
481
- const itemConfigItem = itemConfig.GetCollectible(collectibleType);
482
- return itemConfigItem !== undefined;
483
- }
484
-
485
- /**
486
- * Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
487
- * should remove an item.
488
- *
489
- * The "item tracker" in this function does not refer to the in-game item tracker, but rather to the
490
- * Python program located at: https://github.com/Rchardon/RebirthItemTracker
491
- */
492
- export function removeCollectibleFromItemTracker(
493
- collectibleType: CollectibleType,
494
- ): void {
495
- const collectibleName = getCollectibleName(collectibleType);
496
-
497
- // This cannot use the "log" function since the prefix will prevent the Rebirth Item Tracker from
498
- // recognizing the message.
499
- Isaac.DebugString(
500
- `Removing collectible ${collectibleType} (${collectibleName}) on player 0 (Player)`,
501
- );
502
- }
503
-
504
- /**
505
- * Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
506
- * frame delay before they can be picked up by a player.
507
- */
508
- export function removeCollectiblePickupDelay(collectible: EntityPickup): void {
509
- if (!isCollectible(collectible)) {
510
- const entityID = getEntityID(collectible);
511
- error(
512
- `The "removeCollectiblePickupDelay" function was given a non-collectible: ${entityID}`,
513
- );
514
- }
515
-
516
- collectible.Wait = 0;
517
- }
518
-
519
- /**
520
- * Helper function to set a collectible sprite to a question mark (i.e. how collectibles look when
521
- * the player has Curse of the Blind).
522
- */
523
- export function setCollectibleBlind(collectible: EntityPickup): void {
524
- if (!isCollectible(collectible)) {
525
- const entityID = getEntityID(collectible);
526
- error(
527
- `The "setCollectibleBlind" function was given a non-collectible: ${entityID}`,
528
- );
529
- }
530
-
531
- setCollectibleSprite(collectible, BLIND_ITEM_PNG_PATH);
532
- }
533
-
534
- /**
535
- * Helper function to remove the collectible from a collectible pedestal and make it appear as if a
536
- * player has already taken the item. This is accomplished by changing the sub-type to
537
- * `CollectibleType.NULL` and then setting the sprite to an empty/missing PNG file.
538
- *
539
- * For more information, see the documentation for the "clearSprite" helper function.
540
- */
541
- export function setCollectibleEmpty(collectible: EntityPickup): void {
542
- if (!isCollectible(collectible)) {
543
- const entityID = getEntityID(collectible);
544
- error(
545
- `The "setCollectibleEmpty" function was given a non-collectible: ${entityID}`,
546
- );
547
- }
548
-
549
- collectible.SubType = CollectibleType.NULL;
550
- clearCollectibleSprite(collectible);
551
- }
552
-
553
- /**
554
- * Helper function to change a collectible into a "glitched" item (like the ones that appear when
555
- * the player has TMTRAINER).
556
- */
557
- export function setCollectibleGlitched(collectible: EntityPickup): void {
558
- if (!isCollectible(collectible)) {
559
- const entityID = getEntityID(collectible);
560
- error(
561
- `The "setCollectibleGlitched" function was given a non-collectible: ${entityID}`,
562
- );
563
- }
564
-
565
- // We need to generate a new glitched item. Thus, we temporarily give the player TMTRAINER, if
566
- // necessary.
567
- const player = Isaac.GetPlayer();
568
- const hasTMTRAINER = player.HasCollectible(CollectibleType.TMTRAINER);
569
- if (!hasTMTRAINER) {
570
- player.AddCollectible(CollectibleType.TMTRAINER, 0, false);
571
- }
572
-
573
- const itemPool = game.GetItemPool();
574
- const collectibleType = itemPool.GetCollectible(DEFAULT_ITEM_POOL_TYPE);
575
- setCollectibleSubType(collectible, collectibleType);
576
-
577
- if (!hasTMTRAINER) {
578
- player.RemoveCollectible(CollectibleType.TMTRAINER);
579
- }
580
- }
581
-
582
- /**
583
- * Helper function to change the sprite of a collectible pedestal entity.
584
- *
585
- * For more information about removing the collectible sprite, see the documentation for the
586
- * "clearSprite" helper function.
587
- *
588
- * @param collectible The collectible whose sprite you want to modify.
589
- * @param pngPath Equal to either the spritesheet path to load (e.g.
590
- * "gfx/items/collectibles/collectibles_001_thesadonion.png") or undefined. If
591
- * undefined, the sprite will be removed, making it appear like the collectible has
592
- * already been taken by the player.
593
- */
594
- export function setCollectibleSprite(
595
- collectible: EntityPickup,
596
- pngPath: string | undefined,
597
- ): void {
598
- if (!isCollectible(collectible)) {
599
- const entityID = getEntityID(collectible);
600
- error(
601
- `The "setCollectibleSprite" function was given a non-collectible: ${entityID}`,
602
- );
603
- }
604
-
605
- const sprite = collectible.GetSprite();
606
- if (pngPath === undefined) {
607
- clearSprite(sprite, COLLECTIBLE_SPRITE_LAYER, COLLECTIBLE_SHADOW_LAYER);
608
- } else {
609
- sprite.ReplaceSpritesheet(COLLECTIBLE_SPRITE_LAYER, pngPath);
610
- sprite.LoadGraphics();
611
- }
612
- }
613
-
614
- /**
615
- * Helper function to change the collectible on a pedestal. Simply updating the `SubType` property
616
- * is not sufficient because the sprite will not change.
617
- */
618
- export function setCollectibleSubType(
619
- collectible: EntityPickup,
620
- newCollectibleType: CollectibleType,
621
- ): void {
622
- if (!isCollectible(collectible)) {
623
- const entityID = getEntityID(collectible);
624
- error(
625
- `The "setCollectibleSubType" function was given a non-collectible: ${entityID}`,
626
- );
627
- }
628
-
629
- // You cannot morph a pedestal to "CollectibleType.NULL"; it would instead create a new random
630
- // collectible item.
631
- if (newCollectibleType === CollectibleType.NULL) {
632
- setCollectibleEmpty(collectible);
633
- return;
634
- }
635
-
636
- // The naive way to change a collectible's sub-type is to set it directly. However, doing this
637
- // will not update the sprite. Manually updating the sprite works in most situations, but does not
638
- // work when the pedestal is empty. Instead, we can simply morph the collectible, which seems to
639
- // work in all situations.
640
- collectible.Morph(
641
- EntityType.PICKUP,
642
- PickupVariant.COLLECTIBLE,
643
- newCollectibleType,
644
- true,
645
- true,
646
- true,
647
- );
648
- }
649
-
650
- /**
651
- * Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that
652
- * the build has been rerolled.
653
- */
654
- export function setCollectiblesRerolledForItemTracker(): void {
655
- // This cannot use the "log" function since the prefix will prevent the Rebirth Item Tracker from
656
- // recognizing the message. The number here does not matter since the tracker does not check for a
657
- // specific number.
658
- Isaac.DebugString("Added 3 Collectibles");
659
- }