isaacscript-common 1.2.177 → 1.2.180

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local ____exports = {}
5
+ local hasSubscriptions, postPickupInitCollectible, v
6
+ local ____exports = require("features.saveDataManager.exports")
7
+ local saveDataManager = ____exports.saveDataManager
8
+ local ____collectibles = require("functions.collectibles")
9
+ local getCollectibleIndex = ____collectibles.getCollectibleIndex
10
+ local ____postCollectibleInitFirst = require("callbacks.subscriptions.postCollectibleInitFirst")
11
+ local postCollectibleInitFirstFire = ____postCollectibleInitFirst.postCollectibleInitFirstFire
12
+ local postCollectibleInitFirstHasSubscriptions = ____postCollectibleInitFirst.postCollectibleInitFirstHasSubscriptions
13
+ function hasSubscriptions(self)
14
+ return postCollectibleInitFirstHasSubscriptions(nil)
15
+ end
16
+ function postPickupInitCollectible(self, collectible)
17
+ local collectibleIndex = getCollectibleIndex(nil, collectible)
18
+ if v.run.seenCollectibles:has(collectibleIndex) then
19
+ return
20
+ end
21
+ v.run.seenCollectibles:add(collectibleIndex)
22
+ postCollectibleInitFirstFire(nil, collectible)
23
+ end
24
+ v = {run = {seenCollectibles = __TS__New(Set)}}
25
+ function ____exports.postCollectibleInitFirstCallbackInit(self, mod)
26
+ saveDataManager(nil, "postCollectibleInitFirst", v, hasSubscriptions)
27
+ mod:AddCallback(ModCallbacks.MC_POST_PICKUP_INIT, postPickupInitCollectible, 100)
28
+ end
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
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare type PostCollectibleInitFirstCallbackType = (collectible: EntityPickup) => void;
@@ -0,0 +1,24 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
3
+ local ____exports = {}
4
+ local subscriptions = {}
5
+ function ____exports.postCollectibleInitFirstHasSubscriptions(self)
6
+ return #subscriptions > 0
7
+ end
8
+ function ____exports.postCollectibleInitFirstRegister(self, callback, collectibleType)
9
+ __TS__ArrayPush(subscriptions, {callback, collectibleType})
10
+ end
11
+ function ____exports.postCollectibleInitFirstFire(self, collectible)
12
+ for ____, ____value in ipairs(subscriptions) do
13
+ local callback = ____value[1]
14
+ local collectibleType = ____value[2]
15
+ do
16
+ if collectibleType ~= nil and collectibleType ~= collectible.SubType then
17
+ goto __continue5
18
+ end
19
+ callback(nil, collectible)
20
+ end
21
+ ::__continue5::
22
+ end
23
+ end
24
+ return ____exports
@@ -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),
@@ -27,35 +27,36 @@ export declare enum ModCallbacksCustom {
27
27
  MC_POST_PROJECTILE_INIT_LATE = 18,
28
28
  MC_POST_NPC_INIT_LATE = 19,
29
29
  MC_POST_EFFECT_INIT_LATE = 20,
30
- MC_POST_PICKUP_COLLECT = 21,
31
- MC_PRE_ITEM_PICKUP = 22,
32
- MC_POST_ITEM_PICKUP = 23,
33
- MC_POST_PLAYER_CHANGE_TYPE = 24,
34
- MC_POST_PLAYER_CHANGE_HEALTH = 25,
35
- MC_POST_PLAYER_FATAL_DAMAGE = 26,
36
- MC_PRE_BERSERK_DEATH = 27,
37
- MC_PRE_CUSTOM_REVIVE = 28,
38
- MC_POST_CUSTOM_REVIVE = 29,
39
- MC_POST_FLIP = 30,
40
- MC_POST_FIRST_FLIP = 31,
41
- MC_POST_ESAU_JR = 32,
42
- MC_POST_FIRST_ESAU_JR = 33,
43
- MC_POST_TRANSFORMATION = 34,
44
- MC_POST_PURCHASE = 35,
45
- MC_POST_SACRIFICE = 36,
46
- MC_POST_CURSED_TELEPORT = 37,
47
- MC_POST_TRINKET_BREAK = 38,
48
- MC_POST_SLOT_INIT = 39,
49
- MC_POST_SLOT_UPDATE = 40,
50
- MC_POST_SLOT_RENDER = 41,
51
- MC_POST_SLOT_ANIMATION_CHANGED = 42,
52
- MC_POST_SLOT_DESTROYED = 43,
53
- MC_POST_GRID_ENTITY_INIT = 44,
54
- MC_POST_GRID_ENTITY_UPDATE = 45,
55
- MC_POST_GRID_ENTITY_REMOVE = 46,
56
- MC_POST_GRID_ENTITY_STATE_CHANGE = 47,
57
- MC_POST_GRID_ENTITY_BROKEN = 48,
58
- MC_POST_GRID_ENTITY_COLLISION = 49,
59
- MC_POST_BONE_SWING = 50,
60
- MC_POST_CUSTOM_DOOR_ENTER = 51
30
+ MC_POST_COLLECTIBLE_INIT_FIRST = 21,
31
+ MC_POST_PICKUP_COLLECT = 22,
32
+ MC_PRE_ITEM_PICKUP = 23,
33
+ MC_POST_ITEM_PICKUP = 24,
34
+ MC_POST_PLAYER_CHANGE_TYPE = 25,
35
+ MC_POST_PLAYER_CHANGE_HEALTH = 26,
36
+ MC_POST_PLAYER_FATAL_DAMAGE = 27,
37
+ MC_PRE_BERSERK_DEATH = 28,
38
+ MC_PRE_CUSTOM_REVIVE = 29,
39
+ MC_POST_CUSTOM_REVIVE = 30,
40
+ MC_POST_FLIP = 31,
41
+ MC_POST_FIRST_FLIP = 32,
42
+ MC_POST_ESAU_JR = 33,
43
+ MC_POST_FIRST_ESAU_JR = 34,
44
+ MC_POST_TRANSFORMATION = 35,
45
+ MC_POST_PURCHASE = 36,
46
+ MC_POST_SACRIFICE = 37,
47
+ MC_POST_CURSED_TELEPORT = 38,
48
+ MC_POST_TRINKET_BREAK = 39,
49
+ MC_POST_SLOT_INIT = 40,
50
+ MC_POST_SLOT_UPDATE = 41,
51
+ MC_POST_SLOT_RENDER = 42,
52
+ MC_POST_SLOT_ANIMATION_CHANGED = 43,
53
+ MC_POST_SLOT_DESTROYED = 44,
54
+ MC_POST_GRID_ENTITY_INIT = 45,
55
+ MC_POST_GRID_ENTITY_UPDATE = 46,
56
+ MC_POST_GRID_ENTITY_REMOVE = 47,
57
+ MC_POST_GRID_ENTITY_STATE_CHANGE = 48,
58
+ MC_POST_GRID_ENTITY_BROKEN = 49,
59
+ MC_POST_GRID_ENTITY_COLLISION = 50,
60
+ MC_POST_BONE_SWING = 51,
61
+ MC_POST_CUSTOM_DOOR_ENTER = 52
61
62
  }
@@ -43,66 +43,68 @@ ____exports.ModCallbacksCustom.MC_POST_NPC_INIT_LATE = 19
43
43
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_NPC_INIT_LATE] = "MC_POST_NPC_INIT_LATE"
44
44
  ____exports.ModCallbacksCustom.MC_POST_EFFECT_INIT_LATE = 20
45
45
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_EFFECT_INIT_LATE] = "MC_POST_EFFECT_INIT_LATE"
46
- ____exports.ModCallbacksCustom.MC_POST_PICKUP_COLLECT = 21
46
+ ____exports.ModCallbacksCustom.MC_POST_COLLECTIBLE_INIT_FIRST = 21
47
+ ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_COLLECTIBLE_INIT_FIRST] = "MC_POST_COLLECTIBLE_INIT_FIRST"
48
+ ____exports.ModCallbacksCustom.MC_POST_PICKUP_COLLECT = 22
47
49
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PICKUP_COLLECT] = "MC_POST_PICKUP_COLLECT"
48
- ____exports.ModCallbacksCustom.MC_PRE_ITEM_PICKUP = 22
50
+ ____exports.ModCallbacksCustom.MC_PRE_ITEM_PICKUP = 23
49
51
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_PRE_ITEM_PICKUP] = "MC_PRE_ITEM_PICKUP"
50
- ____exports.ModCallbacksCustom.MC_POST_ITEM_PICKUP = 23
52
+ ____exports.ModCallbacksCustom.MC_POST_ITEM_PICKUP = 24
51
53
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_ITEM_PICKUP] = "MC_POST_ITEM_PICKUP"
52
- ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_TYPE = 24
54
+ ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_TYPE = 25
53
55
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_TYPE] = "MC_POST_PLAYER_CHANGE_TYPE"
54
- ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_HEALTH = 25
56
+ ____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_HEALTH = 26
55
57
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_CHANGE_HEALTH] = "MC_POST_PLAYER_CHANGE_HEALTH"
56
- ____exports.ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE = 26
58
+ ____exports.ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE = 27
57
59
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PLAYER_FATAL_DAMAGE] = "MC_POST_PLAYER_FATAL_DAMAGE"
58
- ____exports.ModCallbacksCustom.MC_PRE_BERSERK_DEATH = 27
60
+ ____exports.ModCallbacksCustom.MC_PRE_BERSERK_DEATH = 28
59
61
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_PRE_BERSERK_DEATH] = "MC_PRE_BERSERK_DEATH"
60
- ____exports.ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE = 28
62
+ ____exports.ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE = 29
61
63
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_PRE_CUSTOM_REVIVE] = "MC_PRE_CUSTOM_REVIVE"
62
- ____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE = 29
64
+ ____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE = 30
63
65
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_CUSTOM_REVIVE] = "MC_POST_CUSTOM_REVIVE"
64
- ____exports.ModCallbacksCustom.MC_POST_FLIP = 30
66
+ ____exports.ModCallbacksCustom.MC_POST_FLIP = 31
65
67
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FLIP] = "MC_POST_FLIP"
66
- ____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP = 31
68
+ ____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP = 32
67
69
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FIRST_FLIP] = "MC_POST_FIRST_FLIP"
68
- ____exports.ModCallbacksCustom.MC_POST_ESAU_JR = 32
70
+ ____exports.ModCallbacksCustom.MC_POST_ESAU_JR = 33
69
71
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_ESAU_JR] = "MC_POST_ESAU_JR"
70
- ____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR = 33
72
+ ____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR = 34
71
73
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_FIRST_ESAU_JR] = "MC_POST_FIRST_ESAU_JR"
72
- ____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION = 34
74
+ ____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION = 35
73
75
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_TRANSFORMATION] = "MC_POST_TRANSFORMATION"
74
- ____exports.ModCallbacksCustom.MC_POST_PURCHASE = 35
76
+ ____exports.ModCallbacksCustom.MC_POST_PURCHASE = 36
75
77
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_PURCHASE] = "MC_POST_PURCHASE"
76
- ____exports.ModCallbacksCustom.MC_POST_SACRIFICE = 36
78
+ ____exports.ModCallbacksCustom.MC_POST_SACRIFICE = 37
77
79
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SACRIFICE] = "MC_POST_SACRIFICE"
78
- ____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT = 37
80
+ ____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT = 38
79
81
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_CURSED_TELEPORT] = "MC_POST_CURSED_TELEPORT"
80
- ____exports.ModCallbacksCustom.MC_POST_TRINKET_BREAK = 38
82
+ ____exports.ModCallbacksCustom.MC_POST_TRINKET_BREAK = 39
81
83
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_TRINKET_BREAK] = "MC_POST_TRINKET_BREAK"
82
- ____exports.ModCallbacksCustom.MC_POST_SLOT_INIT = 39
84
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_INIT = 40
83
85
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_INIT] = "MC_POST_SLOT_INIT"
84
- ____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE = 40
86
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE = 41
85
87
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_UPDATE] = "MC_POST_SLOT_UPDATE"
86
- ____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER = 41
88
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER = 42
87
89
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_RENDER] = "MC_POST_SLOT_RENDER"
88
- ____exports.ModCallbacksCustom.MC_POST_SLOT_ANIMATION_CHANGED = 42
90
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_ANIMATION_CHANGED = 43
89
91
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_ANIMATION_CHANGED] = "MC_POST_SLOT_ANIMATION_CHANGED"
90
- ____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED = 43
92
+ ____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED = 44
91
93
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_SLOT_DESTROYED] = "MC_POST_SLOT_DESTROYED"
92
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT = 44
94
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT = 45
93
95
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_INIT] = "MC_POST_GRID_ENTITY_INIT"
94
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE = 45
96
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE = 46
95
97
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_UPDATE] = "MC_POST_GRID_ENTITY_UPDATE"
96
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 46
98
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE = 47
97
99
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_REMOVE] = "MC_POST_GRID_ENTITY_REMOVE"
98
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_STATE_CHANGE = 47
100
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_STATE_CHANGE = 48
99
101
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_STATE_CHANGE] = "MC_POST_GRID_ENTITY_STATE_CHANGE"
100
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_BROKEN = 48
102
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_BROKEN = 49
101
103
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_BROKEN] = "MC_POST_GRID_ENTITY_BROKEN"
102
- ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION = 49
104
+ ____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION = 50
103
105
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_GRID_ENTITY_COLLISION] = "MC_POST_GRID_ENTITY_COLLISION"
104
- ____exports.ModCallbacksCustom.MC_POST_BONE_SWING = 50
106
+ ____exports.ModCallbacksCustom.MC_POST_BONE_SWING = 51
105
107
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_BONE_SWING] = "MC_POST_BONE_SWING"
106
- ____exports.ModCallbacksCustom.MC_POST_CUSTOM_DOOR_ENTER = 51
108
+ ____exports.ModCallbacksCustom.MC_POST_CUSTOM_DOOR_ENTER = 52
107
109
  ____exports.ModCallbacksCustom[____exports.ModCallbacksCustom.MC_POST_CUSTOM_DOOR_ENTER] = "MC_POST_CUSTOM_DOOR_ENTER"
108
110
  return ____exports
@@ -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,19 +22,25 @@ 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
- * When collectibles are rolled (e.g. with a D6), their InitSeed changes. If you want to track
29
- * collectibles independently of any rerolls, then use the `PtrHash` as an index instead. (The
30
- * `PtrHash` will not persist between rooms, however.)
28
+ * Collectibles that are shifted by Tainted Isaac's mechanic will have unique collectible indexes
29
+ * because the SubType is different. (The collectible entities share the same InitSeed.)
30
+ *
31
+ * Collectibles that are rolled (with e.g. a D6) will have unique collectible indexes because the
32
+ * SubType and InitSeed are different. If you want to track collectibles independently of any
33
+ * rerolls, then you can use the `PtrHash` as an index instead. (The `PtrHash` will not persist
34
+ * between rooms, however.)
31
35
  *
32
36
  * Note that:
33
37
  * - The grid index is a necessary part of the collectible index because Diplopia and Crooked Penny
34
- * can cause two or more collectibles with the same sub-type and InitSeed to exist in the same room.
38
+ * can cause two or more collectibles with the same SubType and InitSeed to exist in the same room.
35
39
  * - This index will fail in the case where the player uses Diplopia or a successful Crooked Penny
36
40
  * seven or more times in the same room, since that will cause two or more collectibles with the
37
- * same grid index and InitSeed to exist.
41
+ * same grid index, SubType, and InitSeed to exist.
42
+ * - The SubType is a necessary part of the collectible index because Tainted Isaac will
43
+ * continuously cause collectibles to morph into new sub-types with the same InitSeed.
38
44
  * - Using a collectible's position as part of the index is problematic, since players can push a
39
45
  * pedestal. (Even using the grid index does not solve this problem, since it is possible in certain
40
46
  * cases for collectibles to be spawned at a position that is not aligned with the grid, and the
@@ -43,11 +49,11 @@ export declare function getCollectibleGfxFilename(collectibleType: CollectibleTy
43
49
  * different InitSeeds, so this is not a problem for this indexing scheme.
44
50
  * - The indexing scheme used is different for collectibles that are inside of a Treasure Room, in
45
51
  * 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
52
+ * Treasure Room. A 5-tuple of stage, stage type, grid index, SubType, and InitSeed is used in this
53
+ * case. (Using the room list index or the room grid index is not suitable for this purpose, since
54
+ * both of these values can change in the post-Ascent Treasure Room.) Even though there can be two
49
55
  * Treasure Rooms on an XL floor, both Treasure Rooms should not have collectibles with the same
50
- * InitSeed.
56
+ * grid index, Subtype, and InitSeed.
51
57
  */
52
58
  export declare function getCollectibleIndex(collectible: EntityPickup): CollectibleIndex;
53
59
  /**
@@ -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/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ export { initCustomDoor, spawnCustomDoor, } from "./callbacks/postCustomDoorEnte
3
3
  export { forceNewLevelCallback, forceNewRoomCallback, } from "./callbacks/reorderedCallbacks";
4
4
  export * from "./classes/DefaultMap";
5
5
  export * from "./classes/ModUpgraded";
6
- export * from "./classes/Null";
7
6
  export * from "./constants";
8
7
  export * from "./enums/CardType";
9
8
  export * from "./enums/CollectiblePedestalType";
@@ -13,7 +12,6 @@ export * from "./enums/PillEffectClass";
13
12
  export * from "./enums/PillEffectType";
14
13
  export * from "./enums/PocketItemType";
15
14
  export * from "./enums/SerializationType";
16
- export { isCollectiblePreviouslySeen } from "./features/collectiblesSeen";
17
15
  export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/deployJSONRoom";
18
16
  export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, disableShootingInputs, enableAllInputs, enableAllInputsExceptFor, } from "./features/disableInputs";
19
17
  export { disableAllSound, enableAllSound } from "./features/disableSound";
package/dist/index.lua CHANGED
@@ -38,14 +38,6 @@ do
38
38
  end
39
39
  end
40
40
  end
41
- do
42
- local ____export = require("classes.Null")
43
- for ____exportKey, ____exportValue in pairs(____export) do
44
- if ____exportKey ~= "default" then
45
- ____exports[____exportKey] = ____exportValue
46
- end
47
- end
48
- end
49
41
  do
50
42
  local ____export = require("constants")
51
43
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -118,11 +110,6 @@ do
118
110
  end
119
111
  end
120
112
  end
121
- do
122
- local ____collectiblesSeen = require("features.collectiblesSeen")
123
- local isCollectiblePreviouslySeen = ____collectiblesSeen.isCollectiblePreviouslySeen
124
- ____exports.isCollectiblePreviouslySeen = isCollectiblePreviouslySeen
125
- end
126
113
  do
127
114
  local ____deployJSONRoom = require("features.deployJSONRoom")
128
115
  local deployJSONRoom = ____deployJSONRoom.deployJSONRoom
@@ -4,6 +4,8 @@ local ____postBombInitLate = require("callbacks.subscriptions.postBombInitLate")
4
4
  local postBombInitLateRegister = ____postBombInitLate.postBombInitLateRegister
5
5
  local ____postBoneSwing = require("callbacks.subscriptions.postBoneSwing")
6
6
  local postBoneSwingRegister = ____postBoneSwing.postBoneSwingRegister
7
+ local ____postCollectibleInitFirst = require("callbacks.subscriptions.postCollectibleInitFirst")
8
+ local postCollectibleInitFirstRegister = ____postCollectibleInitFirst.postCollectibleInitFirstRegister
7
9
  local ____postCursedTeleport = require("callbacks.subscriptions.postCursedTeleport")
8
10
  local postCursedTeleportRegister = ____postCursedTeleport.postCursedTeleportRegister
9
11
  local ____postCustomDoorEnter = require("callbacks.subscriptions.postCustomDoorEnter")
@@ -128,6 +130,7 @@ ____exports.CALLBACK_REGISTER_FUNCTIONS = {
128
130
  [ModCallbacksCustom.MC_POST_PROJECTILE_INIT_LATE] = postProjectileInitLateRegister,
129
131
  [ModCallbacksCustom.MC_POST_NPC_INIT_LATE] = postNPCInitLateRegister,
130
132
  [ModCallbacksCustom.MC_POST_EFFECT_INIT_LATE] = postEffectInitLateRegister,
133
+ [ModCallbacksCustom.MC_POST_COLLECTIBLE_INIT_FIRST] = postCollectibleInitFirstRegister,
131
134
  [ModCallbacksCustom.MC_POST_PICKUP_COLLECT] = postPickupCollectRegister,
132
135
  [ModCallbacksCustom.MC_PRE_ITEM_PICKUP] = preItemPickupRegister,
133
136
  [ModCallbacksCustom.MC_POST_ITEM_PICKUP] = postItemPickupRegister,
@@ -1,6 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  import { PostBombInitLateCallbackType } from "../callbacks/subscriptions/postBombInitLate";
3
3
  import { PostBoneSwingCallbackType } from "../callbacks/subscriptions/postBoneSwing";
4
+ import { PostCollectibleInitFirstCallbackType } from "../callbacks/subscriptions/postCollectibleInitFirst";
4
5
  import { PostCursedTeleportCallbackType } from "../callbacks/subscriptions/postCursedTeleport";
5
6
  import { PostCustomDoorEnterCallbackType } from "../callbacks/subscriptions/postCustomDoorEnter";
6
7
  import { PostCustomReviveCallbackType } from "../callbacks/subscriptions/postCustomRevive";
@@ -127,7 +128,11 @@ export interface AddCallbackParametersCustom {
127
128
  ];
128
129
  [ModCallbacksCustom.MC_POST_EFFECT_INIT_LATE]: [
129
130
  callback: PostEffectInitLateCallbackType,
130
- effectVariant?: EffectVariant
131
+ effectVariant?: EffectVariant | int
132
+ ];
133
+ [ModCallbacksCustom.MC_POST_COLLECTIBLE_INIT_FIRST]: [
134
+ callback: PostCollectibleInitFirstCallbackType,
135
+ collectibleType?: CollectibleType | int
131
136
  ];
132
137
  [ModCallbacksCustom.MC_POST_PICKUP_COLLECT]: [
133
138
  callback: PostPickupCollectCallbackType,
@@ -10,6 +10,8 @@ local ____postBombInitLate = require("callbacks.postBombInitLate")
10
10
  local postBombInitLateCallbackInit = ____postBombInitLate.postBombInitLateCallbackInit
11
11
  local ____postBoneSwing = require("callbacks.postBoneSwing")
12
12
  local postBoneSwingCallbackInit = ____postBoneSwing.postBoneSwingCallbackInit
13
+ local ____postCollectibleInitFirst = require("callbacks.postCollectibleInitFirst")
14
+ local postCollectibleInitFirstCallbackInit = ____postCollectibleInitFirst.postCollectibleInitFirstCallbackInit
13
15
  local ____postCursedTeleport = require("callbacks.postCursedTeleport")
14
16
  local postCursedTeleportCallbackInit = ____postCursedTeleport.postCursedTeleportCallbackInit
15
17
  local ____postCustomDoorEnter = require("callbacks.postCustomDoorEnter")
@@ -76,8 +78,6 @@ local ____roomClearChange = require("callbacks.roomClearChange")
76
78
  local roomClearChangeCallbackInit = ____roomClearChange.roomClearChangeCallbackInit
77
79
  local ____ModUpgraded = require("classes.ModUpgraded")
78
80
  local ModUpgraded = ____ModUpgraded.ModUpgraded
79
- local ____collectiblesSeen = require("features.collectiblesSeen")
80
- local collectiblesSeenInit = ____collectiblesSeen.collectiblesSeenInit
81
81
  local ____deployJSONRoom = require("features.deployJSONRoom")
82
82
  local deployJSONRoomInit = ____deployJSONRoom.deployJSONRoomInit
83
83
  local ____disableInputs = require("features.disableInputs")
@@ -123,6 +123,7 @@ function initCustomCallbacks(self, mod)
123
123
  postProjectileInitLateCallbackInit(nil, mod)
124
124
  postNPCInitLateCallbackInit(nil, mod)
125
125
  postEffectInitLateCallbackInit(nil, mod)
126
+ postCollectibleInitFirstCallbackInit(nil, mod)
126
127
  postPickupCollectCallbackInit(nil, mod)
127
128
  itemPickupCallbacksInit(nil, mod)
128
129
  postPlayerChangeTypeCallbackInit(nil, mod)
@@ -156,7 +157,6 @@ function initFeatures(self, mod)
156
157
  isPonyActiveInit(nil, mod)
157
158
  playerInventoryInit(nil, mod)
158
159
  taintedLazarusPlayersInit(nil, mod)
159
- collectiblesSeenInit(nil, mod)
160
160
  end
161
161
  function ____exports.upgradeMod(self, modVanilla, verbose)
162
162
  if verbose == nil then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.177",
3
+ "version": "1.2.180",
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",