isaacscript-common 15.4.3 → 15.4.5

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.
package/dist/index.d.ts CHANGED
@@ -3725,6 +3725,8 @@ export declare const FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION;
3725
3725
  * The random items that appear when the player has TMTRAINER are generated on the fly as they are
3726
3726
  * encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
3727
3727
  * second TMTRAINER item subtracts one from that, and so on.
3728
+ *
3729
+ * This is equal to 4294967295.
3728
3730
  */
3729
3731
  export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: CollectibleType;
3730
3732
 
@@ -6890,6 +6892,13 @@ export declare function inMirrorRoom(): boolean;
6890
6892
  */
6891
6893
  export declare function inRectangle(position: Vector, topLeft: Vector, bottomRight: Vector): boolean;
6892
6894
 
6895
+ /**
6896
+ * Helper function to check if the current room matches one of the given room types.
6897
+ *
6898
+ * This function is variadic, which means you can pass as many room types as you want to match for.
6899
+ */
6900
+ export declare function inRoomType(...roomTypes: RoomType[]): boolean;
6901
+
6893
6902
  /**
6894
6903
  * Helper function for checking if the current room is a secret exit that leads to a Repentance
6895
6904
  * floor.
@@ -7683,13 +7692,6 @@ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
7683
7692
  */
7684
7693
  export declare function isRoomShapeDoubleCharge(roomShape: RoomShape): boolean;
7685
7694
 
7686
- /**
7687
- * Helper function to check if the current room matches one of the given room types.
7688
- *
7689
- * This function is variadic, which means you can pass as many room types as you want to match for.
7690
- */
7691
- export declare function isRoomType(...roomTypes: RoomType[]): boolean;
7692
-
7693
7695
  /** Returns true for cards that have `CardType.RUNE`. */
7694
7696
  export declare function isRune(cardType: CardType): boolean;
7695
7697
 
@@ -11316,6 +11318,7 @@ export declare type PickupIndex = int & {
11316
11318
  declare class PickupIndexCreation extends Feature {
11317
11319
  private roomHistory;
11318
11320
  private postPickupInit;
11321
+ private trySetPickupIndex;
11319
11322
  private postEntityRemovePickup;
11320
11323
  private checkDespawningFromPlayerLeavingRoom;
11321
11324
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 15.4.3
3
+ isaacscript-common 15.4.5
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -11199,6 +11199,7 @@ local TearFlagInternal = {
11199
11199
  CARD_DROP_DEATH = getTearFlag(nil, 79),
11200
11200
  RUNE_DROP_DEATH = getTearFlag(nil, 80),
11201
11201
  TELEPORT = getTearFlag(nil, 81),
11202
+ SHORT_RANGE = getTearFlag(nil, 82),
11202
11203
  REROLL_ROCK_WISP = getTearFlag(nil, 115),
11203
11204
  MOM_STOMP_WISP = getTearFlag(nil, 116),
11204
11205
  ENEMY_TO_WISP = getTearFlag(nil, 117),
@@ -13409,6 +13410,8 @@ ____exports.SeedEffect.SUPER_HOT = 77
13409
13410
  ____exports.SeedEffect[____exports.SeedEffect.SUPER_HOT] = "SUPER_HOT"
13410
13411
  ____exports.SeedEffect.RETRO_VISION = 78
13411
13412
  ____exports.SeedEffect[____exports.SeedEffect.RETRO_VISION] = "RETRO_VISION"
13413
+ ____exports.SeedEffect.G_FUEL = 79
13414
+ ____exports.SeedEffect[____exports.SeedEffect.G_FUEL] = "G_FUEL"
13412
13415
  return ____exports
13413
13416
  end,
13414
13417
  ["lua_modules.isaac-typescript-definitions.dist.src.enums.SkinColor"] = function(...)
@@ -14862,6 +14865,38 @@ ____exports.SoundEffect.BEAST_GROWL = 815
14862
14865
  ____exports.SoundEffect[____exports.SoundEffect.BEAST_GROWL] = "BEAST_GROWL"
14863
14866
  ____exports.SoundEffect.BEAST_GRUMBLE = 816
14864
14867
  ____exports.SoundEffect[____exports.SoundEffect.BEAST_GRUMBLE] = "BEAST_GRUMBLE"
14868
+ ____exports.SoundEffect.ULTRA_FAMINE_SHOOT = 817
14869
+ ____exports.SoundEffect[____exports.SoundEffect.ULTRA_FAMINE_SHOOT] = "ULTRA_FAMINE_SHOOT"
14870
+ ____exports.SoundEffect.G_FUEL_1 = 818
14871
+ ____exports.SoundEffect[____exports.SoundEffect.G_FUEL_1] = "G_FUEL_1"
14872
+ ____exports.SoundEffect.G_FUEL_2 = 819
14873
+ ____exports.SoundEffect[____exports.SoundEffect.G_FUEL_2] = "G_FUEL_2"
14874
+ ____exports.SoundEffect.G_FUEL_3 = 820
14875
+ ____exports.SoundEffect[____exports.SoundEffect.G_FUEL_3] = "G_FUEL_3"
14876
+ ____exports.SoundEffect.G_FUEL_4 = 821
14877
+ ____exports.SoundEffect[____exports.SoundEffect.G_FUEL_4] = "G_FUEL_4"
14878
+ ____exports.SoundEffect.EXPLOSION_SMALL = 822
14879
+ ____exports.SoundEffect[____exports.SoundEffect.EXPLOSION_SMALL] = "EXPLOSION_SMALL"
14880
+ ____exports.SoundEffect.EXPLOSION_BIG = 823
14881
+ ____exports.SoundEffect[____exports.SoundEffect.EXPLOSION_BIG] = "EXPLOSION_BIG"
14882
+ ____exports.SoundEffect.GUN_SHOT_MEDIUM = 824
14883
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_MEDIUM] = "GUN_SHOT_MEDIUM"
14884
+ ____exports.SoundEffect.GUN_SHOT_SMALL = 825
14885
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_SMALL] = "GUN_SHOT_SMALL"
14886
+ ____exports.SoundEffect.GUN_SHOT_LARGE = 826
14887
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_LARGE] = "GUN_SHOT_LARGE"
14888
+ ____exports.SoundEffect.GUN_SHOT_SPREAD = 827
14889
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_SPREAD] = "GUN_SHOT_SPREAD"
14890
+ ____exports.SoundEffect.AIR_HORN = 828
14891
+ ____exports.SoundEffect[____exports.SoundEffect.AIR_HORN] = "AIR_HORN"
14892
+ ____exports.SoundEffect.ITEM_EXPLOSION = 829
14893
+ ____exports.SoundEffect[____exports.SoundEffect.ITEM_EXPLOSION] = "ITEM_EXPLOSION"
14894
+ ____exports.SoundEffect.GUN_SHOT_MINI = 830
14895
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_MINI] = "GUN_SHOT_MINI"
14896
+ ____exports.SoundEffect.BULLET_RICOCHET = 831
14897
+ ____exports.SoundEffect[____exports.SoundEffect.BULLET_RICOCHET] = "BULLET_RICOCHET"
14898
+ ____exports.SoundEffect.ROCKET_LAUNCHER = 832
14899
+ ____exports.SoundEffect[____exports.SoundEffect.ROCKET_LAUNCHER] = "ROCKET_LAUNCHER"
14865
14900
  return ____exports
14866
14901
  end,
14867
14902
  ["lua_modules.isaac-typescript-definitions.dist.src.enums.StageID"] = function(...)
@@ -25195,9 +25230,9 @@ local __TS__Spread = ____lualib.__TS__Spread
25195
25230
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
25196
25231
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
25197
25232
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
25233
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
25198
25234
  local Set = ____lualib.Set
25199
25235
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
25200
- local __TS__ArraySome = ____lualib.__TS__ArraySome
25201
25236
  local ____exports = {}
25202
25237
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
25203
25238
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
@@ -25443,6 +25478,15 @@ function ____exports.inMirrorRoom(self)
25443
25478
  local roomSubType = getRoomSubType(nil)
25444
25479
  return roomType == RoomType.DEFAULT and (roomStageID == StageID.DOWNPOUR or roomStageID == StageID.DROSS) and roomSubType == asNumber(nil, DownpourRoomSubType.MIRROR)
25445
25480
  end
25481
+ function ____exports.inRoomType(self, ...)
25482
+ local roomTypes = {...}
25483
+ local room = game:GetRoom()
25484
+ local thisRoomType = room:GetType()
25485
+ return __TS__ArraySome(
25486
+ roomTypes,
25487
+ function(____, roomType) return roomType == thisRoomType end
25488
+ )
25489
+ end
25446
25490
  function ____exports.inSecretExit(self)
25447
25491
  local roomGridIndex = getRoomGridIndex(nil)
25448
25492
  return roomGridIndex == asNumber(nil, GridRoom.SECRET_EXIT)
@@ -25474,15 +25518,6 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
25474
25518
  function(____, roomDescriptor) return roomDescriptor.Clear end
25475
25519
  )
25476
25520
  end
25477
- function ____exports.isRoomType(self, ...)
25478
- local roomTypes = {...}
25479
- local room = game:GetRoom()
25480
- local thisRoomType = room:GetType()
25481
- return __TS__ArraySome(
25482
- roomTypes,
25483
- function(____, roomType) return roomType == thisRoomType end
25484
- )
25485
- end
25486
25521
  function ____exports.roomUpdateSafe(self)
25487
25522
  local room = game:GetRoom()
25488
25523
  local entities = getEntities(nil)
@@ -33850,19 +33885,7 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
33850
33885
  room = {pickupIndexes = __TS__New(Map)}
33851
33886
  }
33852
33887
  self.postPickupInit = function(____, pickup)
33853
- local ptrHash = GetPtrHash(pickup)
33854
- if self.v.room.pickupIndexes:has(ptrHash) then
33855
- return
33856
- end
33857
- local room = game:GetRoom()
33858
- local isFirstVisit = room:IsFirstVisit()
33859
- local roomFrameCount = room:GetFrameCount()
33860
- if not isFirstVisit and roomFrameCount <= 0 then
33861
- return
33862
- end
33863
- local ____self_v_run_0, ____pickupCounter_1 = self.v.run, "pickupCounter"
33864
- ____self_v_run_0[____pickupCounter_1] = ____self_v_run_0[____pickupCounter_1] + 1
33865
- self.v.room.pickupIndexes:set(ptrHash, self.v.run.pickupCounter)
33888
+ self:trySetPickupIndex(pickup)
33866
33889
  end
33867
33890
  self.postEntityRemovePickup = function(____, entity)
33868
33891
  self:checkDespawningFromPlayerLeavingRoom(entity)
@@ -33881,8 +33904,8 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
33881
33904
  pickupIndex = self:getPostAscentPickupIndex(pickup)
33882
33905
  end
33883
33906
  if pickupIndex == nil then
33884
- local ____self_v_run_2, ____pickupCounter_3 = self.v.run, "pickupCounter"
33885
- ____self_v_run_2[____pickupCounter_3] = ____self_v_run_2[____pickupCounter_3] + 1
33907
+ local ____self_v_run_0, ____pickupCounter_1 = self.v.run, "pickupCounter"
33908
+ ____self_v_run_0[____pickupCounter_1] = ____self_v_run_0[____pickupCounter_1] + 1
33886
33909
  pickupIndex = self.v.run.pickupCounter
33887
33910
  end
33888
33911
  local ptrHash = GetPtrHash(pickup)
@@ -33894,6 +33917,21 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
33894
33917
  self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
33895
33918
  self.roomHistory = roomHistory
33896
33919
  end
33920
+ function PickupIndexCreation.prototype.trySetPickupIndex(self, pickup)
33921
+ local ptrHash = GetPtrHash(pickup)
33922
+ if self.v.room.pickupIndexes:has(ptrHash) then
33923
+ return
33924
+ end
33925
+ local room = game:GetRoom()
33926
+ local isFirstVisit = room:IsFirstVisit()
33927
+ local roomFrameCount = room:GetFrameCount()
33928
+ if not isFirstVisit and roomFrameCount <= 0 then
33929
+ return
33930
+ end
33931
+ local ____self_v_run_2, ____pickupCounter_3 = self.v.run, "pickupCounter"
33932
+ ____self_v_run_2[____pickupCounter_3] = ____self_v_run_2[____pickupCounter_3] + 1
33933
+ self.v.room.pickupIndexes:set(ptrHash, self.v.run.pickupCounter)
33934
+ end
33897
33935
  function PickupIndexCreation.prototype.checkDespawningFromPlayerLeavingRoom(self, entity)
33898
33936
  local ptrHash = GetPtrHash(entity)
33899
33937
  local pickupIndex = self.v.room.pickupIndexes:get(ptrHash)
@@ -33920,16 +33958,16 @@ function PickupIndexCreation.prototype.trackDespawningPickupMetadata(self, entit
33920
33958
  local room = game:GetRoom()
33921
33959
  local roomType = room:GetType()
33922
33960
  repeat
33923
- local ____switch20 = roomType
33924
- local ____cond20 = ____switch20 == RoomType.TREASURE
33925
- if ____cond20 then
33961
+ local ____switch21 = roomType
33962
+ local ____cond21 = ____switch21 == RoomType.TREASURE
33963
+ if ____cond21 then
33926
33964
  do
33927
33965
  self.v.run.pickupDataTreasureRooms:set(pickupIndex, pickupDescription)
33928
33966
  break
33929
33967
  end
33930
33968
  end
33931
- ____cond20 = ____cond20 or ____switch20 == RoomType.BOSS
33932
- if ____cond20 then
33969
+ ____cond21 = ____cond21 or ____switch21 == RoomType.BOSS
33970
+ if ____cond21 then
33933
33971
  do
33934
33972
  self.v.run.pickupDataBossRooms:set(pickupIndex, pickupDescription)
33935
33973
  break
@@ -33949,15 +33987,15 @@ function PickupIndexCreation.prototype.getPostAscentPickupIndex(self, pickup)
33949
33987
  local room = game:GetRoom()
33950
33988
  local roomType = room:GetType()
33951
33989
  repeat
33952
- local ____switch26 = roomType
33953
- local ____cond26 = ____switch26 == RoomType.TREASURE
33954
- if ____cond26 then
33990
+ local ____switch27 = roomType
33991
+ local ____cond27 = ____switch27 == RoomType.TREASURE
33992
+ if ____cond27 then
33955
33993
  do
33956
33994
  return getStoredPickupIndex(nil, pickup, self.v.run.pickupDataTreasureRooms)
33957
33995
  end
33958
33996
  end
33959
- ____cond26 = ____cond26 or ____switch26 == RoomType.BOSS
33960
- if ____cond26 then
33997
+ ____cond27 = ____cond27 or ____switch27 == RoomType.BOSS
33998
+ if ____cond27 then
33961
33999
  do
33962
34000
  return getStoredPickupIndex(nil, pickup, self.v.run.pickupDataBossRooms)
33963
34001
  end
@@ -33971,10 +34009,14 @@ function PickupIndexCreation.prototype.getPostAscentPickupIndex(self, pickup)
33971
34009
  end
33972
34010
  function PickupIndexCreation.prototype.getPickupIndex(self, pickup)
33973
34011
  local ptrHash = GetPtrHash(pickup)
34012
+ local pickupIndexInitial = self.v.room.pickupIndexes:get(ptrHash)
34013
+ if pickupIndexInitial == nil then
34014
+ self:trySetPickupIndex(pickup)
34015
+ end
33974
34016
  local pickupIndex = self.v.room.pickupIndexes:get(ptrHash)
33975
34017
  if pickupIndex == nil then
33976
34018
  local entityID = getEntityID(nil, pickup)
33977
- error((("Failed to get a pickup index for entity " .. entityID) .. " with hash: ") .. tostring(ptrHash))
34019
+ error("Failed to generate a new pickup index for pickup: " .. entityID)
33978
34020
  end
33979
34021
  return pickupIndex
33980
34022
  end
@@ -4,6 +4,7 @@ import { Feature } from "../../private/Feature";
4
4
  export declare class PickupIndexCreation extends Feature {
5
5
  private roomHistory;
6
6
  private postPickupInit;
7
+ private trySetPickupIndex;
7
8
  private postEntityRemovePickup;
8
9
  private checkDespawningFromPlayerLeavingRoom;
9
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PickupIndexCreation.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PickupIndexCreation.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQhD,qBAAa,mBAAoB,SAAQ,OAAO;IAsB9C,OAAO,CAAC,WAAW,CAAc;IAwBjC,OAAO,CAAC,cAAc,CAoBpB;IAIF,OAAO,CAAC,sBAAsB,CAE5B;IAEF,OAAO,CAAC,oCAAoC;IAc5C;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAkDrC,OAAO,CAAC,oBAAoB,CA6B1B;IAEF,OAAO,CAAC,wBAAwB;IAyBhC;;;;;;;;;;;;;;;OAeG;IAEI,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;CAYzD"}
1
+ {"version":3,"file":"PickupIndexCreation.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/PickupIndexCreation.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQhD,qBAAa,mBAAoB,SAAQ,OAAO;IAsB9C,OAAO,CAAC,WAAW,CAAc;IAwBjC,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,sBAAsB,CAE5B;IAEF,OAAO,CAAC,oCAAoC;IAc5C;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IAkDrC,OAAO,CAAC,oBAAoB,CA6B1B;IAEF,OAAO,CAAC,wBAAwB;IAyBhC;;;;;;;;;;;;;;;OAeG;IAEI,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;CAezD"}
@@ -62,19 +62,7 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
62
62
  room = {pickupIndexes = __TS__New(Map)}
63
63
  }
64
64
  self.postPickupInit = function(____, pickup)
65
- local ptrHash = GetPtrHash(pickup)
66
- if self.v.room.pickupIndexes:has(ptrHash) then
67
- return
68
- end
69
- local room = game:GetRoom()
70
- local isFirstVisit = room:IsFirstVisit()
71
- local roomFrameCount = room:GetFrameCount()
72
- if not isFirstVisit and roomFrameCount <= 0 then
73
- return
74
- end
75
- local ____self_v_run_0, ____pickupCounter_1 = self.v.run, "pickupCounter"
76
- ____self_v_run_0[____pickupCounter_1] = ____self_v_run_0[____pickupCounter_1] + 1
77
- self.v.room.pickupIndexes:set(ptrHash, self.v.run.pickupCounter)
65
+ self:trySetPickupIndex(pickup)
78
66
  end
79
67
  self.postEntityRemovePickup = function(____, entity)
80
68
  self:checkDespawningFromPlayerLeavingRoom(entity)
@@ -93,8 +81,8 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
93
81
  pickupIndex = self:getPostAscentPickupIndex(pickup)
94
82
  end
95
83
  if pickupIndex == nil then
96
- local ____self_v_run_2, ____pickupCounter_3 = self.v.run, "pickupCounter"
97
- ____self_v_run_2[____pickupCounter_3] = ____self_v_run_2[____pickupCounter_3] + 1
84
+ local ____self_v_run_0, ____pickupCounter_1 = self.v.run, "pickupCounter"
85
+ ____self_v_run_0[____pickupCounter_1] = ____self_v_run_0[____pickupCounter_1] + 1
98
86
  pickupIndex = self.v.run.pickupCounter
99
87
  end
100
88
  local ptrHash = GetPtrHash(pickup)
@@ -106,6 +94,21 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
106
94
  self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
107
95
  self.roomHistory = roomHistory
108
96
  end
97
+ function PickupIndexCreation.prototype.trySetPickupIndex(self, pickup)
98
+ local ptrHash = GetPtrHash(pickup)
99
+ if self.v.room.pickupIndexes:has(ptrHash) then
100
+ return
101
+ end
102
+ local room = game:GetRoom()
103
+ local isFirstVisit = room:IsFirstVisit()
104
+ local roomFrameCount = room:GetFrameCount()
105
+ if not isFirstVisit and roomFrameCount <= 0 then
106
+ return
107
+ end
108
+ local ____self_v_run_2, ____pickupCounter_3 = self.v.run, "pickupCounter"
109
+ ____self_v_run_2[____pickupCounter_3] = ____self_v_run_2[____pickupCounter_3] + 1
110
+ self.v.room.pickupIndexes:set(ptrHash, self.v.run.pickupCounter)
111
+ end
109
112
  function PickupIndexCreation.prototype.checkDespawningFromPlayerLeavingRoom(self, entity)
110
113
  local ptrHash = GetPtrHash(entity)
111
114
  local pickupIndex = self.v.room.pickupIndexes:get(ptrHash)
@@ -132,16 +135,16 @@ function PickupIndexCreation.prototype.trackDespawningPickupMetadata(self, entit
132
135
  local room = game:GetRoom()
133
136
  local roomType = room:GetType()
134
137
  repeat
135
- local ____switch20 = roomType
136
- local ____cond20 = ____switch20 == RoomType.TREASURE
137
- if ____cond20 then
138
+ local ____switch21 = roomType
139
+ local ____cond21 = ____switch21 == RoomType.TREASURE
140
+ if ____cond21 then
138
141
  do
139
142
  self.v.run.pickupDataTreasureRooms:set(pickupIndex, pickupDescription)
140
143
  break
141
144
  end
142
145
  end
143
- ____cond20 = ____cond20 or ____switch20 == RoomType.BOSS
144
- if ____cond20 then
146
+ ____cond21 = ____cond21 or ____switch21 == RoomType.BOSS
147
+ if ____cond21 then
145
148
  do
146
149
  self.v.run.pickupDataBossRooms:set(pickupIndex, pickupDescription)
147
150
  break
@@ -161,15 +164,15 @@ function PickupIndexCreation.prototype.getPostAscentPickupIndex(self, pickup)
161
164
  local room = game:GetRoom()
162
165
  local roomType = room:GetType()
163
166
  repeat
164
- local ____switch26 = roomType
165
- local ____cond26 = ____switch26 == RoomType.TREASURE
166
- if ____cond26 then
167
+ local ____switch27 = roomType
168
+ local ____cond27 = ____switch27 == RoomType.TREASURE
169
+ if ____cond27 then
167
170
  do
168
171
  return getStoredPickupIndex(nil, pickup, self.v.run.pickupDataTreasureRooms)
169
172
  end
170
173
  end
171
- ____cond26 = ____cond26 or ____switch26 == RoomType.BOSS
172
- if ____cond26 then
174
+ ____cond27 = ____cond27 or ____switch27 == RoomType.BOSS
175
+ if ____cond27 then
173
176
  do
174
177
  return getStoredPickupIndex(nil, pickup, self.v.run.pickupDataBossRooms)
175
178
  end
@@ -183,10 +186,14 @@ function PickupIndexCreation.prototype.getPostAscentPickupIndex(self, pickup)
183
186
  end
184
187
  function PickupIndexCreation.prototype.getPickupIndex(self, pickup)
185
188
  local ptrHash = GetPtrHash(pickup)
189
+ local pickupIndexInitial = self.v.room.pickupIndexes:get(ptrHash)
190
+ if pickupIndexInitial == nil then
191
+ self:trySetPickupIndex(pickup)
192
+ end
186
193
  local pickupIndex = self.v.room.pickupIndexes:get(ptrHash)
187
194
  if pickupIndex == nil then
188
195
  local entityID = getEntityID(nil, pickup)
189
- error((("Failed to get a pickup index for entity " .. entityID) .. " with hash: ") .. tostring(ptrHash))
196
+ error("Failed to generate a new pickup index for pickup: " .. entityID)
190
197
  end
191
198
  return pickupIndex
192
199
  end
@@ -44,6 +44,8 @@ export declare const EMPTY_PNG_PATH = "gfx/none.png";
44
44
  * The random items that appear when the player has TMTRAINER are generated on the fly as they are
45
45
  * encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
46
46
  * second TMTRAINER item subtracts one from that, and so on.
47
+ *
48
+ * This is equal to 4294967295.
47
49
  */
48
50
  export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: import("isaac-typescript-definitions").CollectibleType;
49
51
  /** Game frames are what is returned by the `Game.GetFrameCount` method. */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAMtC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;EAI7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,SAAS,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,4CAA4C,CAAC;AAE7E,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,iGAAiG;AACjG,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAE5D,gGAAgG;AAChG,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAE7C;;;;GAIG;AAEH,eAAO,MAAM,+BAA+B,wDAAmC,CAAC;AAEhF,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,6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TMTRAINER are generated on the fly as they are
43
43
  -- encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
44
44
  -- second TMTRAINER item subtracts one from that, and so on.
45
+ --
46
+ -- This is equal to 4294967295.
45
47
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = asCollectibleType(nil, (1 << 32) - 1)
46
48
  --- Game frames are what is returned by the `Game.GetFrameCount` method.
47
49
  ____exports.GAME_FRAMES_PER_SECOND = 30
@@ -151,6 +151,12 @@ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
151
151
  * rooms are marked with a specific sub-type.)
152
152
  */
153
153
  export declare function inMirrorRoom(): boolean;
154
+ /**
155
+ * Helper function to check if the current room matches one of the given room types.
156
+ *
157
+ * This function is variadic, which means you can pass as many room types as you want to match for.
158
+ */
159
+ export declare function inRoomType(...roomTypes: RoomType[]): boolean;
154
160
  /**
155
161
  * Helper function for checking if the current room is a secret exit that leads to a Repentance
156
162
  * floor.
@@ -181,12 +187,6 @@ export declare function inStartingRoom(): boolean;
181
187
  * checked. Undefined by default.
182
188
  */
183
189
  export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
184
- /**
185
- * Helper function to check if the current room matches one of the given room types.
186
- *
187
- * This function is variadic, which means you can pass as many room types as you want to match for.
188
- */
189
- export declare function isRoomType(...roomTypes: RoomType[]): boolean;
190
190
  /**
191
191
  * If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
192
192
  * slide around (such as the player). Since those entity velocities are already at zero, setting
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,MAAM,EACN,SAAS,EAMT,YAAY,EAEZ,UAAU,EAGV,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAkCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAenD;AAED;;;GAGG;A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AO,CAUtC;AAED,+FAA+F;AAC/F,wBAAgB,OAAO,IAAI,OAAO,CAUjC;AAED,gGAAgG;AAChG,wBAAgB,eAAe,IAAI,OAAO,CAIzC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAWhE;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAWtC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAI5D;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAItC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAItC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,CAgBxE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAWrC;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAG5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8BrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC"}
@@ -8,9 +8,9 @@ local __TS__Spread = ____lualib.__TS__Spread
8
8
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
9
9
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
10
10
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
11
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
11
12
  local Set = ____lualib.Set
12
13
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
13
- local __TS__ArraySome = ____lualib.__TS__ArraySome
14
14
  local ____exports = {}
15
15
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
16
16
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
@@ -347,6 +347,18 @@ function ____exports.inMirrorRoom(self)
347
347
  local roomSubType = getRoomSubType(nil)
348
348
  return roomType == RoomType.DEFAULT and (roomStageID == StageID.DOWNPOUR or roomStageID == StageID.DROSS) and roomSubType == asNumber(nil, DownpourRoomSubType.MIRROR)
349
349
  end
350
+ --- Helper function to check if the current room matches one of the given room types.
351
+ --
352
+ -- This function is variadic, which means you can pass as many room types as you want to match for.
353
+ function ____exports.inRoomType(self, ...)
354
+ local roomTypes = {...}
355
+ local room = game:GetRoom()
356
+ local thisRoomType = room:GetType()
357
+ return __TS__ArraySome(
358
+ roomTypes,
359
+ function(____, roomType) return roomType == thisRoomType end
360
+ )
361
+ end
350
362
  --- Helper function for checking if the current room is a secret exit that leads to a Repentance
351
363
  -- floor.
352
364
  function ____exports.inSecretExit(self)
@@ -396,18 +408,6 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
396
408
  function(____, roomDescriptor) return roomDescriptor.Clear end
397
409
  )
398
410
  end
399
- --- Helper function to check if the current room matches one of the given room types.
400
- --
401
- -- This function is variadic, which means you can pass as many room types as you want to match for.
402
- function ____exports.isRoomType(self, ...)
403
- local roomTypes = {...}
404
- local room = game:GetRoom()
405
- local thisRoomType = room:GetType()
406
- return __TS__ArraySome(
407
- roomTypes,
408
- function(____, roomType) return roomType == thisRoomType end
409
- )
410
- end
411
411
  --- If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
412
412
  -- slide around (such as the player). Since those entity velocities are already at zero, setting
413
413
  -- them to zero will have no effect. Thus, a generic solution is to record all of the entity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "15.4.3",
3
+ "version": "15.4.5",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/src/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^9.0.6"
25
+ "isaac-typescript-definitions": "^9.4.1"
26
26
  }
27
27
  }
@@ -69,6 +69,10 @@ export class PickupIndexCreation extends Feature {
69
69
 
70
70
  // ModCallback.POST_PICKUP_INIT (34)
71
71
  private postPickupInit = (pickup: EntityPickup) => {
72
+ this.trySetPickupIndex(pickup);
73
+ };
74
+
75
+ private trySetPickupIndex(pickup: EntityPickup): void {
72
76
  const ptrHash = GetPtrHash(pickup);
73
77
 
74
78
  // In certain situations, pickups can be morphed, and this should not incur a new pickup
@@ -88,7 +92,7 @@ export class PickupIndexCreation extends Feature {
88
92
 
89
93
  this.v.run.pickupCounter++;
90
94
  this.v.room.pickupIndexes.set(ptrHash, this.v.run.pickupCounter);
91
- };
95
+ }
92
96
 
93
97
  // ModCallback.POST_ENTITY_REMOVE (67)
94
98
  // EntityType.PICKUP (5)
@@ -239,12 +243,15 @@ export class PickupIndexCreation extends Feature {
239
243
  @Exported
240
244
  public getPickupIndex(pickup: EntityPickup): PickupIndex {
241
245
  const ptrHash = GetPtrHash(pickup);
246
+ const pickupIndexInitial = this.v.room.pickupIndexes.get(ptrHash);
247
+ if (pickupIndexInitial === undefined) {
248
+ this.trySetPickupIndex(pickup);
249
+ }
250
+
242
251
  const pickupIndex = this.v.room.pickupIndexes.get(ptrHash);
243
252
  if (pickupIndex === undefined) {
244
253
  const entityID = getEntityID(pickup);
245
- error(
246
- `Failed to get a pickup index for entity ${entityID} with hash: ${ptrHash}`,
247
- );
254
+ error(`Failed to generate a new pickup index for pickup: ${entityID}`);
248
255
  }
249
256
 
250
257
  return pickupIndex;
@@ -65,6 +65,8 @@ export const EMPTY_PNG_PATH = "gfx/none.png";
65
65
  * The random items that appear when the player has TMTRAINER are generated on the fly as they are
66
66
  * encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
67
67
  * second TMTRAINER item subtracts one from that, and so on.
68
+ *
69
+ * This is equal to 4294967295.
68
70
  */
69
71
 
70
72
  export const FIRST_GLITCHED_COLLECTIBLE_TYPE = asCollectibleType((1 << 32) - 1);
@@ -463,6 +463,17 @@ export function inMirrorRoom(): boolean {
463
463
  );
464
464
  }
465
465
 
466
+ /**
467
+ * Helper function to check if the current room matches one of the given room types.
468
+ *
469
+ * This function is variadic, which means you can pass as many room types as you want to match for.
470
+ */
471
+ export function inRoomType(...roomTypes: RoomType[]): boolean {
472
+ const room = game.GetRoom();
473
+ const thisRoomType = room.GetType();
474
+ return roomTypes.some((roomType) => roomType === thisRoomType);
475
+ }
476
+
466
477
  /**
467
478
  * Helper function for checking if the current room is a secret exit that leads to a Repentance
468
479
  * floor.
@@ -527,17 +538,6 @@ export function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean {
527
538
  return matchingRooms.every((roomDescriptor) => roomDescriptor.Clear);
528
539
  }
529
540
 
530
- /**
531
- * Helper function to check if the current room matches one of the given room types.
532
- *
533
- * This function is variadic, which means you can pass as many room types as you want to match for.
534
- */
535
- export function isRoomType(...roomTypes: RoomType[]): boolean {
536
- const room = game.GetRoom();
537
- const thisRoomType = room.GetType();
538
- return roomTypes.some((roomType) => roomType === thisRoomType);
539
- }
540
-
541
541
  /**
542
542
  * If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
543
543
  * slide around (such as the player). Since those entity velocities are already at zero, setting