isaacscript-common 1.2.178 → 1.2.179

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.
@@ -24,6 +24,6 @@ end
24
24
  v = {run = {seenCollectibles = __TS__New(Set)}}
25
25
  function ____exports.postCollectibleInitFirstCallbackInit(self, mod)
26
26
  saveDataManager(nil, "postCollectibleInitFirst", v, hasSubscriptions)
27
- mod:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, postPickupInitCollectible, PickupVariant.PICKUP_COLLECTIBLE)
27
+ mod:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, postPickupInitCollectible, 100)
28
28
  end
29
29
  return ____exports
@@ -33,7 +33,7 @@ function entityTakeDmgPlayer(self, tookDamage, _damageAmount, _damageFlags, _dam
33
33
  goto __continue8
34
34
  end
35
35
  trinketMap:set(trinketType, numTrinketsHeld)
36
- local numTrinketsOnGround = Isaac.CountEntities(nil, EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_TRINKET, trinketType)
36
+ local numTrinketsOnGround = Isaac.CountEntities(nil, EntityType.ENTITY_PICKUP, 350, trinketType)
37
37
  if numTrinketsOnGround > 0 then
38
38
  goto __continue8
39
39
  end
@@ -38,18 +38,18 @@ ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {
38
38
  PlayerType.PLAYER_KEEPER_B
39
39
  })
40
40
  ____exports.CHEST_PICKUP_VARIANTS = __TS__New(Set, {
41
- PickupVariant.PICKUP_CHEST,
42
- PickupVariant.PICKUP_BOMBCHEST,
43
- PickupVariant.PICKUP_SPIKEDCHEST,
44
- PickupVariant.PICKUP_ETERNALCHEST,
45
- PickupVariant.PICKUP_MIMICCHEST,
46
- PickupVariant.PICKUP_OLDCHEST,
47
- PickupVariant.PICKUP_WOODENCHEST,
48
- PickupVariant.PICKUP_MEGACHEST,
49
- PickupVariant.PICKUP_HAUNTEDCHEST,
50
- PickupVariant.PICKUP_LOCKEDCHEST,
51
- PickupVariant.PICKUP_REDCHEST,
52
- PickupVariant.PICKUP_MOMSCHEST
41
+ 50,
42
+ 51,
43
+ 52,
44
+ 53,
45
+ 54,
46
+ 55,
47
+ 56,
48
+ 57,
49
+ 58,
50
+ 60,
51
+ 360,
52
+ 390
53
53
  })
54
54
  ____exports.COLORS = {
55
55
  Black = Color(1, 1, 1),
@@ -237,7 +237,7 @@ function spawnNormalEntityForJSONRoom(self, entityType, variant, subType, x, y,
237
237
  local roomType = room:GetType()
238
238
  local position = gridToPos(nil, x, y)
239
239
  local entity
240
- if entityType == EntityType.ENTITY_PICKUP and variant == PickupVariant.PICKUP_COLLECTIBLE then
240
+ if entityType == EntityType.ENTITY_PICKUP and variant == 100 then
241
241
  local options = roomType == RoomType.ROOM_ANGEL
242
242
  entity = spawnCollectible(
243
243
  nil,
@@ -372,7 +372,7 @@ function ____exports.cards(self)
372
372
  local position = gridToPos(nil, x, y)
373
373
  Isaac.Spawn(
374
374
  EntityType.ENTITY_PICKUP,
375
- PickupVariant.PICKUP_TAROTCARD,
375
+ 300,
376
376
  cardType,
377
377
  position,
378
378
  Vector.Zero,
@@ -654,7 +654,7 @@ function ____exports.pills(self)
654
654
  local position = gridToPos(nil, x, y)
655
655
  Isaac.Spawn(
656
656
  EntityType.ENTITY_PICKUP,
657
- PickupVariant.PICKUP_PILL,
657
+ 70,
658
658
  subType,
659
659
  position,
660
660
  Vector.Zero,
@@ -877,7 +877,7 @@ function ____exports.spawnGoldenTrinket(self, params)
877
877
  local centerPos = room:GetCenterPos()
878
878
  Isaac.Spawn(
879
879
  EntityType.ENTITY_PICKUP,
880
- PickupVariant.PICKUP_TRINKET,
880
+ 350,
881
881
  goldenTrinketType,
882
882
  centerPos,
883
883
  Vector.Zero,
@@ -23,11 +23,11 @@ local FEATURE_NAME = "get collectible item pool type"
23
23
  v = {run = {collectibleItemPoolTypeMap = __TS__New(Map)}}
24
24
  function ____exports.getCollectibleItemPoolTypeInit(self, mod)
25
25
  saveDataManager(nil, "getCollectibleItemPoolType", v)
26
- mod:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, postPickupInitCollectible, PickupVariant.PICKUP_COLLECTIBLE)
26
+ mod:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, postPickupInitCollectible, 100)
27
27
  end
28
28
  function ____exports.getCollectibleItemPoolType(self, collectible)
29
29
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
30
- if collectible.Type ~= EntityType.ENTITY_PICKUP or collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
30
+ if collectible.Type ~= EntityType.ENTITY_PICKUP or collectible.Variant ~= 100 then
31
31
  local entityID = getEntityID(nil, collectible)
32
32
  error("The \"getCollectibleItemPoolType\" function was given a non-collectible: " .. entityID)
33
33
  end
@@ -34,11 +34,11 @@ v = {room = {trackedCollectibles = __TS__New(Map)}}
34
34
  function ____exports.preventCollectibleRotateInit(self, mod)
35
35
  saveDataManager(nil, "preventCollectibleRotate", v)
36
36
  mod:AddCallback(ModCallbacks.MC_USE_CARD, useCardSoulOfIsaac, Card.CARD_SOUL_ISAAC)
37
- mod:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, postPickupUpdateCollectible, PickupVariant.PICKUP_COLLECTIBLE)
37
+ mod:AddCallback(ModCallbacks.MC_POST_PICKUP_UPDATE, postPickupUpdateCollectible, 100)
38
38
  end
39
39
  function ____exports.preventCollectibleRotate(self, collectible, collectibleType)
40
40
  errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
41
- if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
41
+ if collectible.Variant ~= 100 then
42
42
  error("You cannot prevent the rotation for pickups of variant: " .. tostring(collectible.Variant))
43
43
  end
44
44
  local index = getMapIndex(nil, collectible)
@@ -22,8 +22,8 @@ export declare function getCollectibleGfxFilename(collectibleType: CollectibleTy
22
22
  /**
23
23
  * Mods often have to track variables relating to a collectible. Finding an index for these kinds of
24
24
  * data structures is difficult, since collectibles are respawned every time a player re-enters a
25
- * room, so the `PtrHash` will change. Instead, we use a 3-tuple of the room list index, the grid
26
- * index of the collectible in the room, and the collectible's InitSeed.
25
+ * room, so the `PtrHash` will change. Instead, we use a 4-tuple of the room list index, the grid
26
+ * index of the collectible in the room, the collectible's SubType, and the collectible's InitSeed.
27
27
  *
28
28
  * When collectibles are rolled (e.g. with a D6), their InitSeed changes. If you want to track
29
29
  * collectibles independently of any rerolls, then use the `PtrHash` as an index instead. (The
@@ -35,6 +35,9 @@ export declare function getCollectibleGfxFilename(collectibleType: CollectibleTy
35
35
  * - This index will fail in the case where the player uses Diplopia or a successful Crooked Penny
36
36
  * seven or more times in the same room, since that will cause two or more collectibles with the
37
37
  * same grid index and InitSeed to exist.
38
+ * - The sub-type is a necessary part of the collectible index because Tainted Isaac will
39
+ * continuously cause collectibles to morph into new sub-types with the same InitSeed. (For the
40
+ * purposes of this index, the "shifted" items are considered to be separate collectibles.)
38
41
  * - Using a collectible's position as part of the index is problematic, since players can push a
39
42
  * pedestal. (Even using the grid index does not solve this problem, since it is possible in certain
40
43
  * cases for collectibles to be spawned at a position that is not aligned with the grid, and the
@@ -43,9 +46,9 @@ export declare function getCollectibleGfxFilename(collectibleType: CollectibleTy
43
46
  * different InitSeeds, so this is not a problem for this indexing scheme.
44
47
  * - The indexing scheme used is different for collectibles that are inside of a Treasure Room, in
45
48
  * order to handle the case of the player seeing the same collectible again in a post-Ascent
46
- * Treasure Room. An 4-tuple of stage, stage type, grid index, and InitSeed is used in this case.
47
- * (Using the room list index or the room grid index is not suitable for this purpose, since both
48
- * of these values can change in the post-Ascent Treasure Room.) Even though there can be two
49
+ * Treasure Room. A 5-tuple of stage, stage type, grid index, SubType, and InitSeed is used in this
50
+ * case. (Using the room list index or the room grid index is not suitable for this purpose, since
51
+ * both of these values can change in the post-Ascent Treasure Room.) Even though there can be two
49
52
  * Treasure Rooms on an XL floor, both Treasure Rooms should not have collectibles with the same
50
53
  * InitSeed.
51
54
  */
@@ -23,7 +23,7 @@ local getRoomListIndex = ____roomData.getRoomListIndex
23
23
  local ____sprite = require("functions.sprite")
24
24
  local clearSprite = ____sprite.clearSprite
25
25
  function ____exports.setCollectibleSprite(self, collectible, pngPath)
26
- if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
26
+ if collectible.Variant ~= 100 then
27
27
  error("You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant))
28
28
  end
29
29
  local sprite = collectible:GetSprite()
@@ -89,7 +89,7 @@ function ____exports.getCollectibleGfxFilename(self, collectibleType)
89
89
  return itemConfigItem.GfxFileName
90
90
  end
91
91
  function ____exports.getCollectibleIndex(self, collectible)
92
- if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
92
+ if collectible.Variant ~= 100 then
93
93
  error("You cannot get a collectible index for pickups of variant: " .. tostring(collectible.Variant))
94
94
  end
95
95
  local level = game:GetLevel()
@@ -100,9 +100,9 @@ function ____exports.getCollectibleIndex(self, collectible)
100
100
  local gridIndex = room:GetGridIndex(collectible.Position)
101
101
  local roomListIndex = getRoomListIndex(nil)
102
102
  if roomType == RoomType.ROOM_TREASURE then
103
- return (((((tostring(stage) .. ",") .. tostring(stageType)) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.InitSeed)
103
+ return (((((((tostring(stage) .. ",") .. tostring(stageType)) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.SubType)) .. ",") .. tostring(collectible.InitSeed)
104
104
  end
105
- return (((tostring(roomListIndex) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.InitSeed)
105
+ return (((((tostring(roomListIndex) .. ",") .. tostring(gridIndex)) .. ",") .. tostring(collectible.SubType)) .. ",") .. tostring(collectible.InitSeed)
106
106
  end
107
107
  function ____exports.getCollectibleInitCharge(self, collectibleType)
108
108
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
@@ -137,7 +137,7 @@ function ____exports.getCollectibleName(self, collectibleType)
137
137
  return DEFAULT_COLLECTIBLE_NAME
138
138
  end
139
139
  function ____exports.getCollectiblePedestalType(self, collectible)
140
- if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
140
+ if collectible.Variant ~= 100 then
141
141
  error("You cannot get the pedestal type for pickups of variant: " .. tostring(collectible.Variant))
142
142
  end
143
143
  local sprite = collectible:GetSprite()
@@ -154,7 +154,7 @@ function ____exports.getCollectibles(self, matchingSubType)
154
154
  if matchingSubType == nil then
155
155
  matchingSubType = -1
156
156
  end
157
- return getPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, matchingSubType)
157
+ return getPickups(nil, 100, matchingSubType)
158
158
  end
159
159
  function ____exports.getMaxCollectibleType(self)
160
160
  return itemConfig:GetCollectibles().Size - 1
@@ -164,7 +164,7 @@ function ____exports.isActiveCollectible(self, collectibleType)
164
164
  return itemType == ItemType.ITEM_ACTIVE
165
165
  end
166
166
  function ____exports.isGlitchedCollectible(self, pickup)
167
- return pickup.Variant == PickupVariant.PICKUP_COLLECTIBLE and pickup.SubType > GLITCHED_ITEM_THRESHOLD
167
+ return pickup.Variant == 100 and pickup.SubType > GLITCHED_ITEM_THRESHOLD
168
168
  end
169
169
  function ____exports.isPassiveCollectible(self, collectibleType)
170
170
  local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
@@ -177,33 +177,33 @@ function ____exports.isSingleUseCollectible(self, collectibleType)
177
177
  return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES:has(collectibleType)
178
178
  end
179
179
  function ____exports.removeAllCollectibles(self, collectibleType, cap)
180
- return removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
180
+ return removeAllPickups(nil, 100, collectibleType, cap)
181
181
  end
182
182
  function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
183
183
  local collectibleName = ____exports.getCollectibleName(nil, collectibleType)
184
184
  Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
185
185
  end
186
186
  function ____exports.removeCollectiblePickupDelay(self, collectible)
187
- if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
187
+ if collectible.Variant ~= 100 then
188
188
  error("You cannot remove pickup delay for pickups of variant: " .. tostring(collectible.Variant))
189
189
  end
190
190
  collectible.Wait = 0
191
191
  end
192
192
  function ____exports.setCollectibleBlind(self, collectible)
193
- if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
193
+ if collectible.Variant ~= 100 then
194
194
  error("You cannot set a collectible to be blind for pickups of variant: " .. tostring(collectible.Variant))
195
195
  end
196
196
  ____exports.setCollectibleSprite(nil, collectible, BLIND_ITEM_PNG_PATH)
197
197
  end
198
198
  function ____exports.setCollectibleEmpty(self, collectible)
199
- if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
199
+ if collectible.Variant ~= 100 then
200
200
  error("You cannot set a collectible to be empty for pickups of variant: " .. tostring(collectible.Variant))
201
201
  end
202
202
  collectible.SubType = CollectibleType.COLLECTIBLE_NULL
203
203
  ____exports.clearCollectibleSprite(nil, collectible)
204
204
  end
205
205
  function ____exports.setCollectibleSubType(self, collectible, newCollectibleType)
206
- if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
206
+ if collectible.Variant ~= 100 then
207
207
  error("You cannot set a collectible sub-type for pickups of variant: " .. tostring(collectible.Variant))
208
208
  end
209
209
  if newCollectibleType == CollectibleType.COLLECTIBLE_NULL then
@@ -212,7 +212,7 @@ function ____exports.setCollectibleSubType(self, collectible, newCollectibleType
212
212
  end
213
213
  collectible:Morph(
214
214
  EntityType.ENTITY_PICKUP,
215
- PickupVariant.PICKUP_COLLECTIBLE,
215
+ 100,
216
216
  newCollectibleType,
217
217
  true,
218
218
  true,
@@ -26,7 +26,7 @@ function ____exports.spawnCollectible(self, collectibleType, position, seed, opt
26
26
  end
27
27
  local collectible = game:Spawn(
28
28
  EntityType.ENTITY_PICKUP,
29
- PickupVariant.PICKUP_COLLECTIBLE,
29
+ 100,
30
30
  position,
31
31
  Vector.Zero,
32
32
  nil,
@@ -68,7 +68,7 @@ function ____exports.getTrinkets(self, matchingSubType)
68
68
  if matchingSubType == nil then
69
69
  matchingSubType = -1
70
70
  end
71
- return getPickups(nil, PickupVariant.PICKUP_TRINKET, matchingSubType)
71
+ return getPickups(nil, 350, matchingSubType)
72
72
  end
73
73
  function ____exports.hasOpenTrinketSlot(self, player)
74
74
  local character = player:GetPlayerType()
@@ -82,7 +82,7 @@ function ____exports.isGoldenTrinket(self, trinketType)
82
82
  return trinketType > TRINKET_GOLDEN_FLAG
83
83
  end
84
84
  function ____exports.setTrinketSprite(self, trinket, pngPath)
85
- if trinket.Variant ~= PickupVariant.PICKUP_TRINKET then
85
+ if trinket.Variant ~= 350 then
86
86
  error("You cannot set a trinket sprite for pickups of variant: " .. tostring(trinket.Variant))
87
87
  end
88
88
  local sprite = trinket:GetSprite()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.178",
3
+ "version": "1.2.179",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.371",
28
+ "isaac-typescript-definitions": "^1.0.372",
29
29
  "isaacscript-lint": "^1.0.93",
30
30
  "isaacscript-tsconfig": "^1.1.8",
31
31
  "typedoc": "^0.22.13",