isaacscript-common 1.0.495 → 1.0.499

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 (120) hide show
  1. package/dist/callbacks/customRevive.lua +9 -5
  2. package/dist/callbacks/itemPickup.lua +9 -5
  3. package/dist/callbacks/postBombInitLate.lua +5 -3
  4. package/dist/callbacks/postCursedTeleport.lua +5 -3
  5. package/dist/callbacks/postEffectInitLate.lua +5 -3
  6. package/dist/callbacks/postEsauJr.lua +9 -5
  7. package/dist/callbacks/postFamiliarInitLate.lua +5 -3
  8. package/dist/callbacks/postFlip.lua +9 -5
  9. package/dist/callbacks/postGridEntity.lua +13 -7
  10. package/dist/callbacks/postKnifeInitLate.lua +5 -3
  11. package/dist/callbacks/postLaserInitLate.lua +5 -3
  12. package/dist/callbacks/postNPCInitLate.lua +5 -3
  13. package/dist/callbacks/postPickupCollect.lua +5 -3
  14. package/dist/callbacks/postPickupInitLate.lua +5 -3
  15. package/dist/callbacks/postPlayerChangeHealth.lua +5 -3
  16. package/dist/callbacks/postPlayerChangeType.lua +5 -3
  17. package/dist/callbacks/postPlayerFatalDamage.lua +5 -3
  18. package/dist/callbacks/postPlayerInitLate.lua +5 -3
  19. package/dist/callbacks/postPlayerReordered.lua +16 -10
  20. package/dist/callbacks/postProjectileInitLate.lua +5 -3
  21. package/dist/callbacks/postPurchase.lua +11 -3
  22. package/dist/callbacks/postSacrifice.lua +5 -3
  23. package/dist/callbacks/postSlotInitUpdate.lua +9 -5
  24. package/dist/callbacks/postSlotRenderBroken.lua +9 -5
  25. package/dist/callbacks/postTearInitLate.lua +5 -3
  26. package/dist/callbacks/postTransformation.lua +5 -3
  27. package/dist/callbacks/reorderedCallbacks.lua +18 -12
  28. package/dist/callbacks/subscriptions/postBombInitLate.d.ts +3 -3
  29. package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -3
  30. package/dist/callbacks/subscriptions/postCursedTeleport.d.ts +3 -3
  31. package/dist/callbacks/subscriptions/postCursedTeleport.lua +3 -3
  32. package/dist/callbacks/subscriptions/postCustomRevive.d.ts +3 -3
  33. package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -3
  34. package/dist/callbacks/subscriptions/postEffectInitLate.d.ts +3 -3
  35. package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -3
  36. package/dist/callbacks/subscriptions/postEsauJr.d.ts +3 -3
  37. package/dist/callbacks/subscriptions/postEsauJr.lua +3 -3
  38. package/dist/callbacks/subscriptions/postFamiliarInitLate.d.ts +3 -3
  39. package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -3
  40. package/dist/callbacks/subscriptions/postFirstEsauJr.d.ts +3 -3
  41. package/dist/callbacks/subscriptions/postFirstEsauJr.lua +3 -3
  42. package/dist/callbacks/subscriptions/postFirstFlip.d.ts +3 -3
  43. package/dist/callbacks/subscriptions/postFirstFlip.lua +3 -3
  44. package/dist/callbacks/subscriptions/postFlip.d.ts +3 -3
  45. package/dist/callbacks/subscriptions/postFlip.lua +3 -3
  46. package/dist/callbacks/subscriptions/postGameStartedReordered.d.ts +3 -3
  47. package/dist/callbacks/subscriptions/postGameStartedReordered.lua +3 -3
  48. package/dist/callbacks/subscriptions/postGridEntityInit.d.ts +3 -3
  49. package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -3
  50. package/dist/callbacks/subscriptions/postGridEntityRemove.d.ts +3 -3
  51. package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -3
  52. package/dist/callbacks/subscriptions/postGridEntityUpdate.d.ts +3 -3
  53. package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -3
  54. package/dist/callbacks/subscriptions/postItemPickup.d.ts +3 -3
  55. package/dist/callbacks/subscriptions/postItemPickup.lua +3 -3
  56. package/dist/callbacks/subscriptions/postKnifeInitLate.d.ts +3 -3
  57. package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -3
  58. package/dist/callbacks/subscriptions/postLaserInitLate.d.ts +3 -3
  59. package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -3
  60. package/dist/callbacks/subscriptions/postNPCInitLate.d.ts +3 -3
  61. package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -3
  62. package/dist/callbacks/subscriptions/postNewLevelReordered.d.ts +3 -3
  63. package/dist/callbacks/subscriptions/postNewLevelReordered.lua +3 -3
  64. package/dist/callbacks/subscriptions/postNewRoomReordered.d.ts +3 -3
  65. package/dist/callbacks/subscriptions/postNewRoomReordered.lua +3 -3
  66. package/dist/callbacks/subscriptions/postPickupCollect.d.ts +3 -3
  67. package/dist/callbacks/subscriptions/postPickupCollect.lua +3 -3
  68. package/dist/callbacks/subscriptions/postPickupInitLate.d.ts +3 -3
  69. package/dist/callbacks/subscriptions/postPickupInitLate.lua +3 -3
  70. package/dist/callbacks/subscriptions/postPlayerChangeHealth.d.ts +3 -3
  71. package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +3 -3
  72. package/dist/callbacks/subscriptions/postPlayerChangeType.d.ts +3 -3
  73. package/dist/callbacks/subscriptions/postPlayerChangeType.lua +3 -3
  74. package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts +3 -3
  75. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +3 -3
  76. package/dist/callbacks/subscriptions/postPlayerInitLate.d.ts +3 -3
  77. package/dist/callbacks/subscriptions/postPlayerInitLate.lua +3 -3
  78. package/dist/callbacks/subscriptions/postPlayerInitReordered.d.ts +3 -3
  79. package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +3 -3
  80. package/dist/callbacks/subscriptions/postPlayerRenderReordered.d.ts +3 -3
  81. package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +3 -3
  82. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.d.ts +3 -3
  83. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +3 -3
  84. package/dist/callbacks/subscriptions/postProjectileInitLate.d.ts +3 -3
  85. package/dist/callbacks/subscriptions/postProjectileInitLate.lua +3 -3
  86. package/dist/callbacks/subscriptions/postPurchase.d.ts +3 -3
  87. package/dist/callbacks/subscriptions/postPurchase.lua +3 -3
  88. package/dist/callbacks/subscriptions/postSacrifice.d.ts +3 -3
  89. package/dist/callbacks/subscriptions/postSacrifice.lua +3 -3
  90. package/dist/callbacks/subscriptions/postSlotDestroyed.d.ts +3 -3
  91. package/dist/callbacks/subscriptions/postSlotDestroyed.lua +3 -3
  92. package/dist/callbacks/subscriptions/postSlotInit.d.ts +3 -3
  93. package/dist/callbacks/subscriptions/postSlotInit.lua +3 -3
  94. package/dist/callbacks/subscriptions/postSlotRender.d.ts +3 -3
  95. package/dist/callbacks/subscriptions/postSlotRender.lua +3 -3
  96. package/dist/callbacks/subscriptions/postSlotUpdate.d.ts +3 -3
  97. package/dist/callbacks/subscriptions/postSlotUpdate.lua +3 -3
  98. package/dist/callbacks/subscriptions/postTearInitLate.d.ts +3 -3
  99. package/dist/callbacks/subscriptions/postTearInitLate.lua +3 -3
  100. package/dist/callbacks/subscriptions/postTransformation.d.ts +3 -3
  101. package/dist/callbacks/subscriptions/postTransformation.lua +3 -3
  102. package/dist/callbacks/subscriptions/preCustomRevive.d.ts +3 -3
  103. package/dist/callbacks/subscriptions/preCustomRevive.lua +3 -3
  104. package/dist/callbacks/subscriptions/preItemPickup.d.ts +3 -3
  105. package/dist/callbacks/subscriptions/preItemPickup.lua +3 -3
  106. package/dist/constants.d.ts +26 -0
  107. package/dist/constants.lua +13 -0
  108. package/dist/features/getCollectibleItemPoolType.lua +5 -22
  109. package/dist/functions/collectibles.d.ts +26 -1
  110. package/dist/functions/collectibles.lua +23 -4
  111. package/dist/functions/gridEntity.d.ts +2 -3
  112. package/dist/functions/gridEntity.lua +3 -1
  113. package/dist/functions/rooms.d.ts +4 -5
  114. package/dist/functions/rooms.lua +5 -11
  115. package/dist/functions/sprite.d.ts +11 -0
  116. package/dist/functions/sprite.lua +9 -0
  117. package/dist/index.d.ts +0 -1
  118. package/dist/index.lua +0 -8
  119. package/dist/types/ModUpgraded.lua +234 -78
  120. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PreCustomReviveCallbackType = (player: EntityPlayer) => int | void;
3
- export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PreCustomReviveCallbackType): void;
5
- export declare function fire(player: EntityPlayer): int | void;
3
+ export declare function preCustomReviveHasSubscriptions(): boolean;
4
+ export declare function preCustomReviveRegister(callback: PreCustomReviveCallbackType): void;
5
+ export declare function preCustomReviveFire(player: EntityPlayer): int | void;
@@ -2,13 +2,13 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local subscriptions = {}
5
- function ____exports.hasSubscriptions(self)
5
+ function ____exports.preCustomReviveHasSubscriptions(self)
6
6
  return #subscriptions > 0
7
7
  end
8
- function ____exports.register(self, callback)
8
+ function ____exports.preCustomReviveRegister(self, callback)
9
9
  __TS__ArrayPush(subscriptions, {callback})
10
10
  end
11
- function ____exports.fire(self, player)
11
+ function ____exports.preCustomReviveFire(self, player)
12
12
  local callback
13
13
  for ____, ____value in ipairs(subscriptions) do
14
14
  callback = ____value[1]
@@ -1,6 +1,6 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  import { PickingUpItem } from "../../types/PickingUpItem";
3
3
  export declare type PreItemPickupCallbackType = (player: EntityPlayer, pickingUpItem: PickingUpItem) => void;
4
- export declare function hasSubscriptions(): boolean;
5
- export declare function register(callback: PreItemPickupCallbackType, itemType?: ItemType, itemID?: int): void;
6
- export declare function fire(player: EntityPlayer, pickingUpItem: PickingUpItem): void;
4
+ export declare function preItemPickupHasSubscriptions(): boolean;
5
+ export declare function preItemPickupRegister(callback: PreItemPickupCallbackType, itemType?: ItemType, itemID?: int): void;
6
+ export declare function preItemPickupFire(player: EntityPlayer, pickingUpItem: PickingUpItem): void;
@@ -2,13 +2,13 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local subscriptions = {}
5
- function ____exports.hasSubscriptions(self)
5
+ function ____exports.preItemPickupHasSubscriptions(self)
6
6
  return #subscriptions > 0
7
7
  end
8
- function ____exports.register(self, callback, itemType, itemID)
8
+ function ____exports.preItemPickupRegister(self, callback, itemType, itemID)
9
9
  __TS__ArrayPush(subscriptions, {callback, itemType, itemID})
10
10
  end
11
- function ____exports.fire(self, player, pickingUpItem)
11
+ function ____exports.preItemPickupFire(self, player, pickingUpItem)
12
12
  local itemID
13
13
  local itemType
14
14
  local callback
@@ -4,6 +4,11 @@
4
4
  * For more info, see the documentation for the `getAzazelBrimstoneDistance()` function.
5
5
  */
6
6
  export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
7
+ /**
8
+ * The path to the png file for collectible items during Curse of the Blind, making them appear with
9
+ * a red question mark.
10
+ */
11
+ export declare const BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.png";
7
12
  /** Bombs explode when their frame count is equal to this value. */
8
13
  export declare const BOMB_EXPLODE_FRAME = 45;
9
14
  export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
@@ -17,6 +22,20 @@ export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
17
22
  * includes The Lost and Tainted Lost.
18
23
  */
19
24
  export declare const CHARACTERS_WITH_NO_SOUL_HEARTS: Set<PlayerType>;
25
+ /**
26
+ * A collection of common colors that can be reused. Note that if you want to further modify these
27
+ * colors, you should copy them first with the `copyColor` function.
28
+ */
29
+ export declare const COLORS: {
30
+ Black: Color;
31
+ Red: Color;
32
+ Green: Color;
33
+ Blue: Color;
34
+ Yellow: Color;
35
+ Pink: Color;
36
+ Cyan: Color;
37
+ White: Color;
38
+ };
20
39
  export declare const DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE;
21
40
  /** This is also the distance that a player spawns from the door that they enter a room from. */
22
41
  export declare const DISTANCE_OF_GRID_TILE = 40;
@@ -27,6 +46,13 @@ export declare const DOOR_HITBOX_DISTANCE = 11;
27
46
  * value.
28
47
  */
29
48
  export declare const EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45;
49
+ /**
50
+ * A non-existent or completely transparent PNG file for use in clearing sprites. For more
51
+ * information, see the documentation for the `clearSprite()` helper function.
52
+ */
53
+ export declare const EMPTY_PNG_PATH = "gfx/none.png";
54
+ /** As of Repentance, the final stage is floor 13 (which is the Home floor). */
55
+ export declare const FINAL_STAGE: number;
30
56
  /**
31
57
  * The random items that appear when the player has TMTRAINER are generated on the fly as they are
32
58
  * encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
@@ -2,6 +2,7 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  ____exports.AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125
5
+ ____exports.BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.png"
5
6
  ____exports.BOMB_EXPLODE_FRAME = 45
6
7
  ____exports.CHARACTERS_WITH_AN_ACTIVE_ITEM = __TS__New(Set, {
7
8
  PlayerType.PLAYER_ISAAC,
@@ -33,10 +34,22 @@ ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {
33
34
  PlayerType.PLAYER_THELOST_B,
34
35
  PlayerType.PLAYER_KEEPER_B
35
36
  })
37
+ ____exports.COLORS = {
38
+ Black = Color(1, 1, 1),
39
+ Red = Color(1, 0, 0),
40
+ Green = Color(0, 1, 0),
41
+ Blue = Color(0, 0, 1),
42
+ Yellow = Color(1, 1, 0),
43
+ Pink = Color(1, 0, 1),
44
+ Cyan = Color(0, 1, 1),
45
+ White = Color(1, 1, 1)
46
+ }
36
47
  ____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE
37
48
  ____exports.DISTANCE_OF_GRID_TILE = 40
38
49
  ____exports.DOOR_HITBOX_DISTANCE = 11
39
50
  ____exports.EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45
51
+ ____exports.EMPTY_PNG_PATH = "gfx/none.png"
52
+ ____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
40
53
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
41
54
  ____exports.GENESIS_ROOM_VARIANT = 1000
42
55
  ____exports.GENESIS_ROOM_SUBTYPE = 99
@@ -1,35 +1,19 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local postPickupInitCollectible, preGetCollectible, v
4
+ local postPickupInitCollectible, v
5
5
  local ____errors = require("errors")
6
6
  local getUpgradeErrorMsg = ____errors.getUpgradeErrorMsg
7
- local ____array = require("functions.array")
8
- local arrayEmpty = ____array.arrayEmpty
9
7
  local ____rooms = require("functions.rooms")
10
- local getRoomIndex = ____rooms.getRoomIndex
11
8
  local getRoomItemPoolType = ____rooms.getRoomItemPoolType
12
- local getRoomVisitedCount = ____rooms.getRoomVisitedCount
13
9
  local ____exports = require("features.saveDataManager.exports")
14
10
  local saveDataManager = ____exports.saveDataManager
15
11
  function postPickupInitCollectible(self, pickup)
16
- local itemPoolType = __TS__ArrayShift(v.run.collectibleQueue)
17
- if itemPoolType == nil then
18
- return
19
- end
12
+ local game = Game()
13
+ local itemPool = game:GetItemPool()
20
14
  local ptrHash = GetPtrHash(pickup)
21
- v.run.collectibleItemPoolTypeMap:set(ptrHash, itemPoolType)
22
- end
23
- function preGetCollectible(self, itemPoolType, _decrease, _seed)
24
- local roomIndex = getRoomIndex(nil)
25
- local roomVisitedCount = getRoomVisitedCount(nil)
26
- if roomIndex ~= v.run.currentRoomIndex or roomVisitedCount ~= v.run.currentRoomVisitedCount then
27
- v.run.currentRoomIndex = roomIndex
28
- v.run.currentRoomVisitedCount = roomVisitedCount
29
- arrayEmpty(nil, v.run.collectibleQueue)
30
- v.run.collectibleItemPoolTypeMap:clear()
31
- end
32
- __TS__ArrayPush(v.run.collectibleQueue, itemPoolType)
15
+ local lastItemPoolType = itemPool:GetLastPool()
16
+ v.run.collectibleItemPoolTypeMap:set(ptrHash, lastItemPoolType)
33
17
  end
34
18
  local FEATURE_NAME = "get collectible item pool type"
35
19
  local initialized = false
@@ -43,7 +27,6 @@ function ____exports.getCollectibleItemPoolTypeInit(self, mod)
43
27
  initialized = true
44
28
  saveDataManager(nil, "getCollectibleItemPoolType", v)
45
29
  mod:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, postPickupInitCollectible, PickupVariant.PICKUP_COLLECTIBLE)
46
- mod:AddCallback(ModCallbacks.MC_PRE_GET_COLLECTIBLE, preGetCollectible)
47
30
  end
48
31
  function ____exports.getCollectibleItemPoolType(self, collectible)
49
32
  if not initialized then
@@ -56,6 +56,12 @@ export declare function isGlitchedCollectible(entity: Entity): boolean;
56
56
  */
57
57
  export declare function isPassiveCollectible(collectibleType: CollectibleType | int): boolean;
58
58
  export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
59
+ /**
60
+ * Helper function to see if a particular collectible will disappear from the player's inventory
61
+ * upon use. Note that this will not work will modded items, as there is no way to dynamically know
62
+ * if a modded item will disappear.
63
+ */
64
+ export declare function isSingleUseCollectible(collectibleType: CollectibleType | int): boolean;
59
65
  /**
60
66
  * Helper function to remove all of the collectibles in the room.
61
67
  *
@@ -78,7 +84,26 @@ export declare function removeCollectiblePickupDelay(collectible: EntityPickup):
78
84
  */
79
85
  export declare function removeCollectibleFromItemTracker(collectibleType: CollectibleType | int): void;
80
86
  export declare function setCollectibleBlind(collectible: EntityPickup): void;
81
- export declare function setCollectibleSprite(collectible: EntityPickup, pngPath: string): void;
87
+ /**
88
+ * Helper function to remove the collectible from a collectible pedestal and make it appear as if a
89
+ * player has already taken the item. This is accomplished by setting its sprite to an empty/missing
90
+ * PNG file.
91
+ *
92
+ * For more information, see the documentation for the "EMPTY_PNG_FILENAME" constant.
93
+ */
94
+ export declare function setCollectibleEmpty(collectible: EntityPickup): void;
95
+ /**
96
+ * Helper function to change the sprite of a collectible pedestal entity.
97
+ *
98
+ * For more information about removing the collectible sprite, see the documentation for the
99
+ * "EMPTY_PNG_FILENAME" constant.
100
+ *
101
+ * @param collectible The collectible whose sprite you want to modify.
102
+ * @param pngPath Optional. Equal to the spritesheet path to load (e.g.
103
+ * "gfx/items/collectibles/collectibles_001_thesadonion.png"). If not specified, will remove the
104
+ * sprite, making it appear like the collectible has already been taken by the player.
105
+ */
106
+ export declare function setCollectibleSprite(collectible: EntityPickup, pngPath?: string): void;
82
107
  /**
83
108
  * Helper function to change the collectible on a pedestal. Simply updating the SubType property is
84
109
  * not sufficient because the sprite will not change.
@@ -1,23 +1,32 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local COLLECTIBLE_SPRITE_LAYER
4
+ local COLLECTIBLE_SPRITE_LAYER, COLLECTIBLE_SHADOW_LAYER
5
+ local ____constants = require("constants")
6
+ local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
7
+ local SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = ____constants.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES
5
8
  local ____collectibleDescriptionMap = require("maps.collectibleDescriptionMap")
6
9
  local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
7
10
  local ____collectibleNameMap = require("maps.collectibleNameMap")
8
11
  local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
9
12
  local ____entity = require("functions.entity")
10
13
  local removeAllPickups = ____entity.removeAllPickups
14
+ local ____sprite = require("functions.sprite")
15
+ local clearSprite = ____sprite.clearSprite
11
16
  function ____exports.setCollectibleSprite(self, collectible, pngPath)
12
17
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
13
18
  error("You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant))
14
19
  end
15
20
  local sprite = collectible:GetSprite()
16
- sprite:ReplaceSpritesheet(COLLECTIBLE_SPRITE_LAYER, pngPath)
17
- sprite:LoadGraphics()
21
+ if pngPath == nil then
22
+ clearSprite(nil, sprite, COLLECTIBLE_SPRITE_LAYER, COLLECTIBLE_SHADOW_LAYER)
23
+ else
24
+ sprite:ReplaceSpritesheet(COLLECTIBLE_SPRITE_LAYER, pngPath)
25
+ sprite:LoadGraphics()
26
+ end
18
27
  end
19
28
  COLLECTIBLE_SPRITE_LAYER = 1
20
- local BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.png"
29
+ COLLECTIBLE_SHADOW_LAYER = 4
21
30
  local GLITCHED_ITEM_THRESHOLD = 4000000000
22
31
  function ____exports.collectibleHasTag(self, collectibleType, tag)
23
32
  local itemConfig = Isaac.GetItemConfig()
@@ -136,6 +145,9 @@ end
136
145
  function ____exports.isQuestCollectible(self, collectibleType)
137
146
  return ____exports.collectibleHasTag(nil, collectibleType, 32768)
138
147
  end
148
+ function ____exports.isSingleUseCollectible(self, collectibleType)
149
+ return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES:has(collectibleType)
150
+ end
139
151
  function ____exports.removeAllCollectibles(self, collectibleType, cap)
140
152
  removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
141
153
  end
@@ -155,6 +167,13 @@ function ____exports.setCollectibleBlind(self, collectible)
155
167
  end
156
168
  ____exports.setCollectibleSprite(nil, collectible, BLIND_ITEM_PNG_PATH)
157
169
  end
170
+ function ____exports.setCollectibleEmpty(self, collectible)
171
+ if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
172
+ error("You cannot set a collectible to be empty for pickups of variant: " .. tostring(collectible.Variant))
173
+ end
174
+ collectible.SubType = CollectibleType.COLLECTIBLE_NULL
175
+ ____exports.setCollectibleSprite(nil, collectible)
176
+ end
158
177
  function ____exports.setCollectibleSubType(self, collectible, newCollectibleType)
159
178
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
160
179
  error("You cannot set a collectible sub type for pickups of variant: " .. tostring(collectible.Variant))
@@ -78,10 +78,9 @@ export declare function removeAllMatchingGridEntities(...gridEntityType: GridEnt
78
78
  export declare function removeGridEntity(gridEntity: GridEntity, updateRoom?: boolean): void;
79
79
  /**
80
80
  * Helper function to make a grid entity invisible. This is accomplished by setting its sprite to
81
- * "gfx/none.png" (a non-existent PNG file).
81
+ * an empty/missing PNG file.
82
82
  *
83
- * Using this function will cause spurious errors in the "log.txt file". If you want to remove them,
84
- * create a transparent 1 pixel PNG file in your resources folder at "gfx/none.png".
83
+ * For more information, see the documentation for the "EMPTY_PNG_FILENAME" constant.
85
84
  */
86
85
  export declare function setGridEntityInvisible(gridEntity: GridEntity): void;
87
86
  export declare function spawnGiantPoop(topLeftGridIndex: int): void;
@@ -1,6 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
+ local ____constants = require("constants")
5
+ local EMPTY_PNG_PATH = ____constants.EMPTY_PNG_PATH
4
6
  local ____gridEntityXMLMap = require("maps.gridEntityXMLMap")
5
7
  local GRID_ENTITY_XML_MAP = ____gridEntityXMLMap.GRID_ENTITY_XML_MAP
6
8
  local ____rooms = require("functions.rooms")
@@ -139,7 +141,7 @@ function ____exports.removeAllMatchingGridEntities(self, ...)
139
141
  end
140
142
  function ____exports.setGridEntityInvisible(self, gridEntity)
141
143
  local sprite = gridEntity:GetSprite()
142
- sprite:ReplaceSpritesheet(0, "gfx/none.png")
144
+ sprite:ReplaceSpritesheet(0, EMPTY_PNG_PATH)
143
145
  sprite:LoadGraphics()
144
146
  end
145
147
  function ____exports.spawnGiantPoop(self, topLeftGridIndex)
@@ -24,9 +24,9 @@ export declare function getRoomData(): RoomConfig | undefined;
24
24
  export declare function getRoomDataType(): int;
25
25
  /**
26
26
  * Helper function to get the room index of the current room. Use this instead of calling
27
- * `Game().GetLevel().GetCurrentRoomIndex()` directly to avoid bugs with big rooms.
28
- * (Big rooms will return the specific 1x1 quadrant that the player entered the room at,
29
- * which can break data structures that use the room index as an index.)
27
+ * `Level.GetCurrentRoomIndex()` directly to avoid bugs with big rooms. (Big rooms will return the
28
+ * specific 1x1 quadrant that the player entered the room at, which can break data structures that
29
+ * use the room index as an index.)
30
30
  */
31
31
  export declare function getRoomIndex(): int;
32
32
  /**
@@ -38,8 +38,7 @@ export declare function getRoomIndex(): int;
38
38
  export declare function getRoomIndexesForType(roomType: RoomType): Set<int>;
39
39
  /**
40
40
  * Helper function to get the item pool type for the current room. For example, this returns
41
- * `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room. Returns
42
- * `DEFAULT_ITEM_POOL_TYPE` if there is no particular pool associated with the current room type.
41
+ * `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room.
43
42
  */
44
43
  export declare function getRoomItemPoolType(): ItemPoolType;
45
44
  /**
@@ -2,12 +2,9 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local ____constants = require("constants")
5
- local DEFAULT_ITEM_POOL_TYPE = ____constants.DEFAULT_ITEM_POOL_TYPE
6
5
  local GENESIS_ROOM_SUBTYPE = ____constants.GENESIS_ROOM_SUBTYPE
7
6
  local GENESIS_ROOM_VARIANT = ____constants.GENESIS_ROOM_VARIANT
8
7
  local MAX_ROOM_INDEX = ____constants.MAX_ROOM_INDEX
9
- local ____roomTypeToItemPoolMap = require("maps.roomTypeToItemPoolMap")
10
- local ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = ____roomTypeToItemPoolMap.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP
11
8
  local ____doors = require("functions.doors")
12
9
  local closeAllDoors = ____doors.closeAllDoors
13
10
  local getDoors = ____doors.getDoors
@@ -23,10 +20,6 @@ local hasFlag = ____flag.hasFlag
23
20
  function ____exports.getRoomIndex(self)
24
21
  local game = Game()
25
22
  local level = game:GetLevel()
26
- local roomIndex = level:GetCurrentRoomIndex()
27
- if roomIndex < 0 then
28
- return roomIndex
29
- end
30
23
  local roomDesc = level:GetCurrentRoomDesc()
31
24
  return roomDesc.SafeGridIndex
32
25
  end
@@ -88,10 +81,11 @@ function ____exports.getRoomIndexesForType(self, roomType)
88
81
  end
89
82
  function ____exports.getRoomItemPoolType(self)
90
83
  local game = Game()
84
+ local itemPool = game:GetItemPool()
91
85
  local room = game:GetRoom()
92
86
  local roomType = room:GetType()
93
- local itemPoolType = ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP:get(roomType)
94
- return itemPoolType == nil and DEFAULT_ITEM_POOL_TYPE or itemPoolType
87
+ local roomSeed = room:GetSpawnSeed()
88
+ return itemPool:GetPoolForRoom(roomType, roomSeed)
95
89
  end
96
90
  function ____exports.getRoomName(self)
97
91
  local roomData = ____exports.getRoomData(nil)
@@ -223,14 +217,14 @@ function ____exports.setRoomCleared(self)
223
217
  for ____, door in ipairs(getDoors(nil)) do
224
218
  do
225
219
  if isHiddenSecretRoomDoor(nil, door) then
226
- goto __continue39
220
+ goto __continue38
227
221
  end
228
222
  door.State = DoorState.STATE_OPEN
229
223
  local sprite = door:GetSprite()
230
224
  sprite:Play("Opened", true)
231
225
  door.ExtraVisible = false
232
226
  end
233
- ::__continue39::
227
+ ::__continue38::
234
228
  end
235
229
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
236
230
  game:ShakeScreen(0)
@@ -1,4 +1,15 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Helper function to clear a specific layer from a sprite. This function is variadic, so pass as
4
+ * many layer IDs as you want to clear.
5
+ *
6
+ * Since there is no official API method to "clear" a sprite, we can work around it by setting the
7
+ * spritesheet to a non-existent or completely transparent file. If the path to the spritesheet does
8
+ * not exist, then this function might cause spurious errors to appear in the "log.txt file". To
9
+ * silence these errors, create a transparent 1 pixel PNG file in your mod's resources folder at the
10
+ * path corresponding to the "EMPTY_PNG_PATH" constant.
11
+ */
12
+ export declare function clearSprite(sprite: Sprite, ...layerIDs: int[]): void;
2
13
  /**
3
14
  * Helper function that returns the number of the final frame in a particular animation for a
4
15
  * sprite. By default, it will use the currently playing animation, but you can also specify a
@@ -1,5 +1,14 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
+ local ____constants = require("constants")
4
+ local EMPTY_PNG_PATH = ____constants.EMPTY_PNG_PATH
5
+ function ____exports.clearSprite(self, sprite, ...)
6
+ local layerIDs = {...}
7
+ for ____, layerID in ipairs(layerIDs) do
8
+ sprite:ReplaceSpritesheet(layerID, EMPTY_PNG_PATH)
9
+ end
10
+ sprite:LoadGraphics()
11
+ end
3
12
  function ____exports.getFinalFrameOfAnimation(self, sprite, animation)
4
13
  local currentAnimation = sprite:GetAnimation()
5
14
  local currentFrame = sprite:GetFrame()
package/dist/index.d.ts CHANGED
@@ -52,7 +52,6 @@ export * from "./maps/cardNameMap";
52
52
  export * from "./maps/collectibleNameMap";
53
53
  export * from "./maps/gridEntityXMLMap";
54
54
  export * from "./maps/pillEffectNameMap";
55
- export * from "./maps/roomTypeToItemPoolMap";
56
55
  export * from "./maps/transformationMap";
57
56
  export * from "./maps/trinketNameMap";
58
57
  export * from "./sets/cards";
package/dist/index.lua CHANGED
@@ -422,14 +422,6 @@ do
422
422
  end
423
423
  end
424
424
  end
425
- do
426
- local ____export = require("maps.roomTypeToItemPoolMap")
427
- for ____exportKey, ____exportValue in pairs(____export) do
428
- if ____exportKey ~= "default" then
429
- ____exports[____exportKey] = ____exportValue
430
- end
431
- end
432
- end
433
425
  do
434
426
  local ____export = require("maps.transformationMap")
435
427
  for ____exportKey, ____exportValue in pairs(____export) do