isaacscript-common 4.0.3 → 4.0.6

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 (370) hide show
  1. package/callbacks/postPlayerCollectible.lua +4 -2
  2. package/functions/collectibleSet.d.ts +37 -2
  3. package/functions/collectibleSet.lua +62 -15
  4. package/functions/player.lua +3 -4
  5. package/package.json +2 -2
  6. package/cachedClasses.ts +0 -39
  7. package/callbacks/customRevive.ts +0 -215
  8. package/callbacks/itemPickup.ts +0 -101
  9. package/callbacks/postAmbush.ts +0 -73
  10. package/callbacks/postBombExploded.ts +0 -26
  11. package/callbacks/postBombInitLate.ts +0 -36
  12. package/callbacks/postBoneSwing.ts +0 -64
  13. package/callbacks/postCollectibleInitFirst.ts +0 -40
  14. package/callbacks/postCursedTeleport.ts +0 -185
  15. package/callbacks/postCustomDoorEnter.ts +0 -292
  16. package/callbacks/postDiceRoomActivated.ts +0 -60
  17. package/callbacks/postDoorRender.ts +0 -26
  18. package/callbacks/postDoorUpdate.ts +0 -26
  19. package/callbacks/postEffectInitLate.ts +0 -36
  20. package/callbacks/postEffectStateChanged.ts +0 -43
  21. package/callbacks/postEsauJr.ts +0 -109
  22. package/callbacks/postFamiliarInitLate.ts +0 -36
  23. package/callbacks/postFamiliarStateChanged.ts +0 -43
  24. package/callbacks/postFlip.ts +0 -90
  25. package/callbacks/postGreedModeWave.ts +0 -41
  26. package/callbacks/postGridEntity.ts +0 -164
  27. package/callbacks/postGridEntityCollision.ts +0 -69
  28. package/callbacks/postGridEntityRender.ts +0 -26
  29. package/callbacks/postHolyMantleRemoved.ts +0 -55
  30. package/callbacks/postItemDischarged.ts +0 -154
  31. package/callbacks/postKnifeInitLate.ts +0 -36
  32. package/callbacks/postLaserInitLate.ts +0 -36
  33. package/callbacks/postNPCInitLate.ts +0 -36
  34. package/callbacks/postNPCStateChanged.ts +0 -42
  35. package/callbacks/postNewRoomEarly.ts +0 -96
  36. package/callbacks/postPickupCollect.ts +0 -48
  37. package/callbacks/postPickupInitFirst.ts +0 -70
  38. package/callbacks/postPickupInitLate.ts +0 -36
  39. package/callbacks/postPickupStateChanged.ts +0 -43
  40. package/callbacks/postPitRender.ts +0 -26
  41. package/callbacks/postPitUpdate.ts +0 -26
  42. package/callbacks/postPlayerChangeHealth.ts +0 -62
  43. package/callbacks/postPlayerChangeType.ts +0 -56
  44. package/callbacks/postPlayerCollectible.ts +0 -113
  45. package/callbacks/postPlayerFatalDamage.ts +0 -141
  46. package/callbacks/postPlayerInitLate.ts +0 -37
  47. package/callbacks/postPlayerReordered.ts +0 -142
  48. package/callbacks/postPoopRender.ts +0 -26
  49. package/callbacks/postPoopUpdate.ts +0 -26
  50. package/callbacks/postPressurePlateRender.ts +0 -26
  51. package/callbacks/postPressurePlateUpdate.ts +0 -26
  52. package/callbacks/postProjectileInitLate.ts +0 -36
  53. package/callbacks/postPurchase.ts +0 -64
  54. package/callbacks/postRockRender.ts +0 -26
  55. package/callbacks/postRockUpdate.ts +0 -26
  56. package/callbacks/postRoomClearChanged.ts +0 -57
  57. package/callbacks/postSacrifice.ts +0 -64
  58. package/callbacks/postSlotDestroyed.ts +0 -92
  59. package/callbacks/postSlotInitUpdate.ts +0 -68
  60. package/callbacks/postSlotRender.ts +0 -69
  61. package/callbacks/postSpikesRender.ts +0 -26
  62. package/callbacks/postSpikesUpdate.ts +0 -26
  63. package/callbacks/postTNTRender.ts +0 -26
  64. package/callbacks/postTNTUpdate.ts +0 -26
  65. package/callbacks/postTearInitLate.ts +0 -36
  66. package/callbacks/postTearInitVeryLate.ts +0 -41
  67. package/callbacks/postTransformation.ts +0 -59
  68. package/callbacks/postTrinketBreak.ts +0 -112
  69. package/callbacks/preBerserkDeath.ts +0 -49
  70. package/callbacks/preNewLevel.ts +0 -55
  71. package/callbacks/reorderedCallbacks.ts +0 -168
  72. package/callbacks/subscriptions/postAmbushFinished.ts +0 -32
  73. package/callbacks/subscriptions/postAmbushStarted.ts +0 -32
  74. package/callbacks/subscriptions/postBombInitLate.ts +0 -32
  75. package/callbacks/subscriptions/postBoneExploded.ts +0 -32
  76. package/callbacks/subscriptions/postBoneSwing.ts +0 -24
  77. package/callbacks/subscriptions/postCollectibleInitFirst.ts +0 -37
  78. package/callbacks/subscriptions/postCursedTeleport.ts +0 -24
  79. package/callbacks/subscriptions/postCustomDoorEnter.ts +0 -45
  80. package/callbacks/subscriptions/postCustomRevive.ts +0 -36
  81. package/callbacks/subscriptions/postDiceRoomActivated.ts +0 -38
  82. package/callbacks/subscriptions/postDoorRender.ts +0 -35
  83. package/callbacks/subscriptions/postDoorUpdate.ts +0 -35
  84. package/callbacks/subscriptions/postEffectInitLate.ts +0 -32
  85. package/callbacks/subscriptions/postEffectStateChanged.ts +0 -40
  86. package/callbacks/subscriptions/postEsauJr.ts +0 -24
  87. package/callbacks/subscriptions/postFamiliarInitLate.ts +0 -32
  88. package/callbacks/subscriptions/postFamiliarStateChanged.ts +0 -40
  89. package/callbacks/subscriptions/postFirstEsauJr.ts +0 -24
  90. package/callbacks/subscriptions/postFirstFlip.ts +0 -24
  91. package/callbacks/subscriptions/postFlip.ts +0 -22
  92. package/callbacks/subscriptions/postGameStartedReordered.ts +0 -24
  93. package/callbacks/subscriptions/postGreedModeWave.ts +0 -24
  94. package/callbacks/subscriptions/postGridEntityBroken.ts +0 -51
  95. package/callbacks/subscriptions/postGridEntityCollision.ts +0 -54
  96. package/callbacks/subscriptions/postGridEntityInit.ts +0 -51
  97. package/callbacks/subscriptions/postGridEntityRemove.ts +0 -52
  98. package/callbacks/subscriptions/postGridEntityRender.ts +0 -51
  99. package/callbacks/subscriptions/postGridEntityStateChanged.ts +0 -55
  100. package/callbacks/subscriptions/postGridEntityUpdate.ts +0 -51
  101. package/callbacks/subscriptions/postHolyMantleRemoved.ts +0 -48
  102. package/callbacks/subscriptions/postItemDischarged.ts +0 -43
  103. package/callbacks/subscriptions/postItemPickup.ts +0 -64
  104. package/callbacks/subscriptions/postKnifeInitLate.ts +0 -32
  105. package/callbacks/subscriptions/postLaserInitLate.ts +0 -32
  106. package/callbacks/subscriptions/postNPCInitLate.ts +0 -32
  107. package/callbacks/subscriptions/postNPCStateChanged.ts +0 -42
  108. package/callbacks/subscriptions/postNewLevelReordered.ts +0 -22
  109. package/callbacks/subscriptions/postNewRoomEarly.ts +0 -22
  110. package/callbacks/subscriptions/postNewRoomReordered.ts +0 -22
  111. package/callbacks/subscriptions/postPEffectUpdateReordered.ts +0 -40
  112. package/callbacks/subscriptions/postPickupCollect.ts +0 -35
  113. package/callbacks/subscriptions/postPickupInitFirst.ts +0 -32
  114. package/callbacks/subscriptions/postPickupInitLate.ts +0 -32
  115. package/callbacks/subscriptions/postPickupStateChanged.ts +0 -40
  116. package/callbacks/subscriptions/postPitRender.ts +0 -35
  117. package/callbacks/subscriptions/postPitUpdate.ts +0 -35
  118. package/callbacks/subscriptions/postPlayerChangeHealth.ts +0 -49
  119. package/callbacks/subscriptions/postPlayerChangeType.ts +0 -40
  120. package/callbacks/subscriptions/postPlayerCollectibleAdded.ts +0 -38
  121. package/callbacks/subscriptions/postPlayerCollectibleRemoved.ts +0 -38
  122. package/callbacks/subscriptions/postPlayerFatalDamage.ts +0 -68
  123. package/callbacks/subscriptions/postPlayerInitLate.ts +0 -40
  124. package/callbacks/subscriptions/postPlayerInitReordered.ts +0 -40
  125. package/callbacks/subscriptions/postPlayerRenderReordered.ts +0 -40
  126. package/callbacks/subscriptions/postPlayerUpdateReordered.ts +0 -40
  127. package/callbacks/subscriptions/postPoopRender.ts +0 -35
  128. package/callbacks/subscriptions/postPoopUpdate.ts +0 -35
  129. package/callbacks/subscriptions/postPressurePlateRender.ts +0 -37
  130. package/callbacks/subscriptions/postPressurePlateUpdate.ts +0 -37
  131. package/callbacks/subscriptions/postProjectileInitLate.ts +0 -35
  132. package/callbacks/subscriptions/postPurchase.ts +0 -31
  133. package/callbacks/subscriptions/postRockRender.ts +0 -35
  134. package/callbacks/subscriptions/postRockUpdate.ts +0 -35
  135. package/callbacks/subscriptions/postRoomClearChanged.ts +0 -30
  136. package/callbacks/subscriptions/postSacrifice.ts +0 -43
  137. package/callbacks/subscriptions/postSlotAnimationChanged.ts +0 -40
  138. package/callbacks/subscriptions/postSlotDestroyed.ts +0 -55
  139. package/callbacks/subscriptions/postSlotInit.ts +0 -32
  140. package/callbacks/subscriptions/postSlotRender.ts +0 -32
  141. package/callbacks/subscriptions/postSlotUpdate.ts +0 -32
  142. package/callbacks/subscriptions/postSpikesRender.ts +0 -35
  143. package/callbacks/subscriptions/postSpikesUpdate.ts +0 -35
  144. package/callbacks/subscriptions/postTNTRender.ts +0 -35
  145. package/callbacks/subscriptions/postTNTUpdate.ts +0 -35
  146. package/callbacks/subscriptions/postTearInitLate.ts +0 -32
  147. package/callbacks/subscriptions/postTearInitVeryLate.ts +0 -32
  148. package/callbacks/subscriptions/postTransformation.ts +0 -40
  149. package/callbacks/subscriptions/postTrinketBreak.ts +0 -38
  150. package/callbacks/subscriptions/preBerserkDeath.ts +0 -42
  151. package/callbacks/subscriptions/preCustomRevive.ts +0 -46
  152. package/callbacks/subscriptions/preItemPickup.ts +0 -64
  153. package/callbacks/subscriptions/preNewLevel.ts +0 -24
  154. package/classes/DefaultMap.ts +0 -174
  155. package/classes/ModUpgraded.ts +0 -84
  156. package/constants.ts +0 -162
  157. package/constantsFirstLast.ts +0 -217
  158. package/enums/AmbushType.ts +0 -4
  159. package/enums/HealthType.ts +0 -16
  160. package/enums/ModCallbackCustom.ts +0 -1278
  161. package/enums/PocketItemType.ts +0 -8
  162. package/enums/SerializationType.ts +0 -5
  163. package/enums/SlotDestructionType.ts +0 -4
  164. package/enums/private/CopyableIsaacAPIClassType.ts +0 -7
  165. package/enums/private/SaveDataKey.ts +0 -14
  166. package/enums/private/SerializationBrand.ts +0 -42
  167. package/features/characterHealthConversion.ts +0 -111
  168. package/features/characterStats.ts +0 -61
  169. package/features/debugDisplay/debugDisplay.ts +0 -221
  170. package/features/debugDisplay/exports.ts +0 -368
  171. package/features/debugDisplay/v.ts +0 -65
  172. package/features/deployJSONRoom.ts +0 -743
  173. package/features/disableInputs.ts +0 -193
  174. package/features/disableSound.ts +0 -77
  175. package/features/extraConsoleCommands/commandsDisplay.ts +0 -290
  176. package/features/extraConsoleCommands/commandsSubroutines.ts +0 -139
  177. package/features/extraConsoleCommands/init.ts +0 -334
  178. package/features/extraConsoleCommands/listCommands.ts +0 -1299
  179. package/features/extraConsoleCommands/v.ts +0 -14
  180. package/features/fadeInRemover.ts +0 -60
  181. package/features/fastReset.ts +0 -75
  182. package/features/forgottenSwitch.ts +0 -50
  183. package/features/getCollectibleItemPoolType.ts +0 -66
  184. package/features/persistentEntities.ts +0 -183
  185. package/features/playerInventory.ts +0 -135
  186. package/features/ponyDetection.ts +0 -74
  187. package/features/preventCollectibleRotation.ts +0 -115
  188. package/features/runInNFrames.ts +0 -148
  189. package/features/saveDataManager/constants.ts +0 -4
  190. package/features/saveDataManager/exports.ts +0 -229
  191. package/features/saveDataManager/load.ts +0 -99
  192. package/features/saveDataManager/main.ts +0 -195
  193. package/features/saveDataManager/maps.ts +0 -13
  194. package/features/saveDataManager/merge.ts +0 -194
  195. package/features/saveDataManager/save.ts +0 -74
  196. package/features/saveDataManager/serializationBrand.ts +0 -16
  197. package/features/sirenHelpers.ts +0 -129
  198. package/features/taintedLazarusPlayers.ts +0 -113
  199. package/featuresInitialized.ts +0 -20
  200. package/functions/ambush.ts +0 -47
  201. package/functions/array.ts +0 -410
  202. package/functions/benchmark.ts +0 -36
  203. package/functions/bitwise.ts +0 -24
  204. package/functions/bombs.ts +0 -12
  205. package/functions/boss.ts +0 -227
  206. package/functions/cacheFlag.ts +0 -12
  207. package/functions/cards.ts +0 -271
  208. package/functions/challenges.ts +0 -13
  209. package/functions/character.ts +0 -126
  210. package/functions/charge.ts +0 -237
  211. package/functions/chargeBar.ts +0 -67
  212. package/functions/collectibleCacheFlag.ts +0 -90
  213. package/functions/collectibleSet.ts +0 -56
  214. package/functions/collectibleTag.ts +0 -89
  215. package/functions/collectibles.ts +0 -659
  216. package/functions/color.ts +0 -128
  217. package/functions/debug.ts +0 -68
  218. package/functions/deepCopy.ts +0 -535
  219. package/functions/deepCopyTests.ts +0 -386
  220. package/functions/direction.ts +0 -49
  221. package/functions/doors.ts +0 -347
  222. package/functions/easing.ts +0 -182
  223. package/functions/eden.ts +0 -47
  224. package/functions/effects.ts +0 -20
  225. package/functions/entity.ts +0 -439
  226. package/functions/entitySpecific.ts +0 -889
  227. package/functions/entityTypes.ts +0 -6
  228. package/functions/enums.ts +0 -146
  229. package/functions/familiars.ts +0 -106
  230. package/functions/flag.ts +0 -165
  231. package/functions/flying.ts +0 -117
  232. package/functions/globals.ts +0 -242
  233. package/functions/gridEntity.ts +0 -511
  234. package/functions/gridEntitySpecific.ts +0 -112
  235. package/functions/input.ts +0 -139
  236. package/functions/isaacAPIClass.ts +0 -67
  237. package/functions/jsonHelpers.ts +0 -45
  238. package/functions/jsonRoom.ts +0 -100
  239. package/functions/kColor.ts +0 -129
  240. package/functions/language.ts +0 -13
  241. package/functions/level.ts +0 -31
  242. package/functions/log.ts +0 -720
  243. package/functions/map.ts +0 -56
  244. package/functions/math.ts +0 -149
  245. package/functions/mergeTests.ts +0 -288
  246. package/functions/npc.ts +0 -148
  247. package/functions/pickupVariants.ts +0 -60
  248. package/functions/pickups.ts +0 -499
  249. package/functions/pills.ts +0 -205
  250. package/functions/player.ts +0 -1056
  251. package/functions/playerDataStructures.ts +0 -150
  252. package/functions/playerHealth.ts +0 -382
  253. package/functions/playerIndex.ts +0 -195
  254. package/functions/pocketItems.ts +0 -149
  255. package/functions/positionVelocity.ts +0 -188
  256. package/functions/random.ts +0 -77
  257. package/functions/revive.ts +0 -201
  258. package/functions/rng.ts +0 -172
  259. package/functions/roomData.ts +0 -199
  260. package/functions/roomGrid.ts +0 -109
  261. package/functions/roomShape.ts +0 -80
  262. package/functions/rooms.ts +0 -648
  263. package/functions/run.ts +0 -36
  264. package/functions/saveFile.ts +0 -128
  265. package/functions/seeds.ts +0 -19
  266. package/functions/serialization.ts +0 -91
  267. package/functions/set.ts +0 -95
  268. package/functions/sound.ts +0 -9
  269. package/functions/spawnCollectible.ts +0 -104
  270. package/functions/sprite.ts +0 -107
  271. package/functions/stage.ts +0 -125
  272. package/functions/string.ts +0 -47
  273. package/functions/table.ts +0 -189
  274. package/functions/tears.ts +0 -32
  275. package/functions/transformations.ts +0 -131
  276. package/functions/trinketCacheFlag.ts +0 -60
  277. package/functions/trinketGive.ts +0 -157
  278. package/functions/trinkets.ts +0 -215
  279. package/functions/tstlClass.ts +0 -157
  280. package/functions/types.ts +0 -36
  281. package/functions/ui.ts +0 -138
  282. package/functions/utils.ts +0 -189
  283. package/functions/vector.ts +0 -126
  284. package/index.ts +0 -172
  285. package/initCustomCallbacks.ts +0 -132
  286. package/initFeatures.ts +0 -39
  287. package/interfaces/AddCallbackParameterCustom.ts +0 -188
  288. package/interfaces/ChargeBarSprites.ts +0 -12
  289. package/interfaces/JSONDoor.ts +0 -13
  290. package/interfaces/JSONEntity.ts +0 -16
  291. package/interfaces/JSONRoom.ts +0 -36
  292. package/interfaces/JSONRooms.ts +0 -12
  293. package/interfaces/JSONSpawn.ts +0 -14
  294. package/interfaces/PlayerHealth.ts +0 -16
  295. package/interfaces/PocketItemDescription.ts +0 -9
  296. package/interfaces/SaveData.ts +0 -29
  297. package/interfaces/TrinketSituation.ts +0 -9
  298. package/interfaces/private/TSTLClassMetatable.ts +0 -8
  299. package/maps/PHDPillConversions.ts +0 -21
  300. package/maps/cardMap.ts +0 -209
  301. package/maps/characterMap.ts +0 -87
  302. package/maps/collectibleDescriptionMap.ts +0 -732
  303. package/maps/collectibleNameMap.ts +0 -731
  304. package/maps/defaultPlayerStatMap.ts +0 -17
  305. package/maps/falsePHDPillConversions.ts +0 -35
  306. package/maps/gridEntityTypeToBrokenStateMap.ts +0 -50
  307. package/maps/gridEntityXMLMap.ts +0 -176
  308. package/maps/pillEffectMap.ts +0 -88
  309. package/maps/roomShapeToTopLeftWallGridIndexMap.ts +0 -18
  310. package/maps/roomTypeMap.ts +0 -40
  311. package/maps/trinketDescriptionMap.ts +0 -200
  312. package/maps/trinketNameMap.ts +0 -198
  313. package/objects/LRoomShapeToRectangles.ts +0 -44
  314. package/objects/callbackRegisterFunctions.ts +0 -187
  315. package/objects/cardDescriptions.ts +0 -105
  316. package/objects/cardNames.ts +0 -105
  317. package/objects/cardTypes.ts +0 -104
  318. package/objects/challengeNames.ts +0 -52
  319. package/objects/characterNames.ts +0 -48
  320. package/objects/coinSubTypeToValue.ts +0 -14
  321. package/objects/colors.ts +0 -16
  322. package/objects/directionNames.ts +0 -11
  323. package/objects/directionToDegrees.ts +0 -11
  324. package/objects/directionToVector.ts +0 -12
  325. package/objects/doorSlotFlagToDoorSlot.ts +0 -16
  326. package/objects/doorSlotToDirection.ts +0 -14
  327. package/objects/isaacAPIClassTypeToBrand.ts +0 -11
  328. package/objects/isaacAPIClassTypeToCopyFunction.ts +0 -18
  329. package/objects/languageNames.ts +0 -13
  330. package/objects/oppositeDoorSlots.ts +0 -15
  331. package/objects/pillEffectClasses.ts +0 -63
  332. package/objects/pillEffectNames.ts +0 -57
  333. package/objects/pillEffectTypes.ts +0 -62
  334. package/objects/roomShapeBounds.ts +0 -71
  335. package/objects/roomShapeLayoutSizes.ts +0 -45
  336. package/objects/roomShapeToBottomRightPosition.ts +0 -25
  337. package/objects/roomShapeToDoorSlots.ts +0 -83
  338. package/objects/roomShapeToDoorSlotsToGridIndexDelta.ts +0 -127
  339. package/objects/roomShapeToGridWidth.ts +0 -21
  340. package/objects/roomShapeToTopLeftPosition.ts +0 -26
  341. package/objects/roomShapeVolumes.ts +0 -38
  342. package/objects/roomTypeNames.ts +0 -36
  343. package/objects/serializedIsaacAPIClassTypeToIdentityFunction.ts +0 -14
  344. package/objects/stageTypeToLetter.ts +0 -15
  345. package/objects/transformationNames.ts +0 -18
  346. package/patchErrorFunctions.ts +0 -92
  347. package/sets/LRoomShapesSet.ts +0 -8
  348. package/sets/bossSets.ts +0 -470
  349. package/sets/charactersThatStartWithAnActiveItemSet.ts +0 -16
  350. package/sets/charactersWithBlackHeartFromEternalHeartSet.ts +0 -7
  351. package/sets/charactersWithFreeDevilDealsSet.ts +0 -4
  352. package/sets/charactersWithNoRedHeartsSet.ts +0 -17
  353. package/sets/charactersWithNoSoulHeartsSet.ts +0 -14
  354. package/sets/chestPickupVariantsSet.ts +0 -16
  355. package/sets/familiarsThatShootPlayerTearsSet.ts +0 -13
  356. package/sets/lostStyleCharactersSet.ts +0 -13
  357. package/sets/mineShaftRoomSubTypesSet.ts +0 -10
  358. package/sets/redHeartSubTypesSet.ts +0 -7
  359. package/sets/sinEntityTypesSet.ts +0 -11
  360. package/sets/singleUseActiveCollectibleTypesSet.ts +0 -13
  361. package/sets/storyBossesSet.ts +0 -17
  362. package/types/AnyEntity.ts +0 -12
  363. package/types/AwaitingTextInput.d.ts +0 -2
  364. package/types/CollectibleIndex.ts +0 -16
  365. package/types/PickingUpItem.ts +0 -89
  366. package/types/PlayerIndex.ts +0 -13
  367. package/types/private/IsaacAPIClass.ts +0 -3
  368. package/types/private/SerializedIsaacAPIClass.ts +0 -3
  369. package/types/private/TSTLClass.ts +0 -3
  370. 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
- }