isaacscript-common 15.4.2 → 15.4.4

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
 
@@ -7683,6 +7685,13 @@ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
7683
7685
  */
7684
7686
  export declare function isRoomShapeDoubleCharge(roomShape: RoomShape): boolean;
7685
7687
 
7688
+ /**
7689
+ * Helper function to check if the current room matches one of the given room types.
7690
+ *
7691
+ * This function is variadic, which means you can pass as many room types as you want to match for.
7692
+ */
7693
+ export declare function isRoomType(...roomTypes: RoomType[]): boolean;
7694
+
7686
7695
  /** Returns true for cards that have `CardType.RUNE`. */
7687
7696
  export declare function isRune(cardType: CardType): boolean;
7688
7697
 
@@ -11309,6 +11318,7 @@ export declare type PickupIndex = int & {
11309
11318
  declare class PickupIndexCreation extends Feature {
11310
11319
  private roomHistory;
11311
11320
  private postPickupInit;
11321
+ private trySetPickupIndex;
11312
11322
  private postEntityRemovePickup;
11313
11323
  private checkDespawningFromPlayerLeavingRoom;
11314
11324
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 15.4.2
3
+ isaacscript-common 15.4.4
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -13409,6 +13409,8 @@ ____exports.SeedEffect.SUPER_HOT = 77
13409
13409
  ____exports.SeedEffect[____exports.SeedEffect.SUPER_HOT] = "SUPER_HOT"
13410
13410
  ____exports.SeedEffect.RETRO_VISION = 78
13411
13411
  ____exports.SeedEffect[____exports.SeedEffect.RETRO_VISION] = "RETRO_VISION"
13412
+ ____exports.SeedEffect.G_FUEL = 79
13413
+ ____exports.SeedEffect[____exports.SeedEffect.G_FUEL] = "G_FUEL"
13412
13414
  return ____exports
13413
13415
  end,
13414
13416
  ["lua_modules.isaac-typescript-definitions.dist.src.enums.SkinColor"] = function(...)
@@ -14862,6 +14864,38 @@ ____exports.SoundEffect.BEAST_GROWL = 815
14862
14864
  ____exports.SoundEffect[____exports.SoundEffect.BEAST_GROWL] = "BEAST_GROWL"
14863
14865
  ____exports.SoundEffect.BEAST_GRUMBLE = 816
14864
14866
  ____exports.SoundEffect[____exports.SoundEffect.BEAST_GRUMBLE] = "BEAST_GRUMBLE"
14867
+ ____exports.SoundEffect.ULTRA_FAMINE_SHOOT = 817
14868
+ ____exports.SoundEffect[____exports.SoundEffect.ULTRA_FAMINE_SHOOT] = "ULTRA_FAMINE_SHOOT"
14869
+ ____exports.SoundEffect.G_FUEL_1 = 818
14870
+ ____exports.SoundEffect[____exports.SoundEffect.G_FUEL_1] = "G_FUEL_1"
14871
+ ____exports.SoundEffect.G_FUEL_2 = 819
14872
+ ____exports.SoundEffect[____exports.SoundEffect.G_FUEL_2] = "G_FUEL_2"
14873
+ ____exports.SoundEffect.G_FUEL_3 = 820
14874
+ ____exports.SoundEffect[____exports.SoundEffect.G_FUEL_3] = "G_FUEL_3"
14875
+ ____exports.SoundEffect.G_FUEL_4 = 821
14876
+ ____exports.SoundEffect[____exports.SoundEffect.G_FUEL_4] = "G_FUEL_4"
14877
+ ____exports.SoundEffect.EXPLOSION_SMALL = 822
14878
+ ____exports.SoundEffect[____exports.SoundEffect.EXPLOSION_SMALL] = "EXPLOSION_SMALL"
14879
+ ____exports.SoundEffect.EXPLOSION_BIG = 823
14880
+ ____exports.SoundEffect[____exports.SoundEffect.EXPLOSION_BIG] = "EXPLOSION_BIG"
14881
+ ____exports.SoundEffect.GUN_SHOT_MEDIUM = 824
14882
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_MEDIUM] = "GUN_SHOT_MEDIUM"
14883
+ ____exports.SoundEffect.GUN_SHOT_SMALL = 825
14884
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_SMALL] = "GUN_SHOT_SMALL"
14885
+ ____exports.SoundEffect.GUN_SHOT_LARGE = 826
14886
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_LARGE] = "GUN_SHOT_LARGE"
14887
+ ____exports.SoundEffect.GUN_SHOT_SPREAD = 827
14888
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_SPREAD] = "GUN_SHOT_SPREAD"
14889
+ ____exports.SoundEffect.AIR_HORN = 828
14890
+ ____exports.SoundEffect[____exports.SoundEffect.AIR_HORN] = "AIR_HORN"
14891
+ ____exports.SoundEffect.ITEM_EXPLOSION = 829
14892
+ ____exports.SoundEffect[____exports.SoundEffect.ITEM_EXPLOSION] = "ITEM_EXPLOSION"
14893
+ ____exports.SoundEffect.GUN_SHOT_MINI = 830
14894
+ ____exports.SoundEffect[____exports.SoundEffect.GUN_SHOT_MINI] = "GUN_SHOT_MINI"
14895
+ ____exports.SoundEffect.BULLET_RICOCHET = 831
14896
+ ____exports.SoundEffect[____exports.SoundEffect.BULLET_RICOCHET] = "BULLET_RICOCHET"
14897
+ ____exports.SoundEffect.ROCKET_LAUNCHER = 832
14898
+ ____exports.SoundEffect[____exports.SoundEffect.ROCKET_LAUNCHER] = "ROCKET_LAUNCHER"
14865
14899
  return ____exports
14866
14900
  end,
14867
14901
  ["lua_modules.isaac-typescript-definitions.dist.src.enums.StageID"] = function(...)
@@ -25197,6 +25231,7 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
25197
25231
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
25198
25232
  local Set = ____lualib.Set
25199
25233
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
25234
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
25200
25235
  local ____exports = {}
25201
25236
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
25202
25237
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
@@ -25473,6 +25508,15 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
25473
25508
  function(____, roomDescriptor) return roomDescriptor.Clear end
25474
25509
  )
25475
25510
  end
25511
+ function ____exports.isRoomType(self, ...)
25512
+ local roomTypes = {...}
25513
+ local room = game:GetRoom()
25514
+ local thisRoomType = room:GetType()
25515
+ return __TS__ArraySome(
25516
+ roomTypes,
25517
+ function(____, roomType) return roomType == thisRoomType end
25518
+ )
25519
+ end
25476
25520
  function ____exports.roomUpdateSafe(self)
25477
25521
  local room = game:GetRoom()
25478
25522
  local entities = getEntities(nil)
@@ -25496,12 +25540,12 @@ function ____exports.setRoomCleared(self)
25496
25540
  for ____, door in ipairs(getDoors(nil)) do
25497
25541
  do
25498
25542
  if isHiddenSecretRoomDoor(nil, door) then
25499
- goto __continue53
25543
+ goto __continue55
25500
25544
  end
25501
25545
  openDoorFast(nil, door)
25502
25546
  door.ExtraVisible = false
25503
25547
  end
25504
- ::__continue53::
25548
+ ::__continue55::
25505
25549
  end
25506
25550
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
25507
25551
  game:ShakeScreen(0)
@@ -33840,19 +33884,7 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
33840
33884
  room = {pickupIndexes = __TS__New(Map)}
33841
33885
  }
33842
33886
  self.postPickupInit = function(____, pickup)
33843
- local ptrHash = GetPtrHash(pickup)
33844
- if self.v.room.pickupIndexes:has(ptrHash) then
33845
- return
33846
- end
33847
- local room = game:GetRoom()
33848
- local isFirstVisit = room:IsFirstVisit()
33849
- local roomFrameCount = room:GetFrameCount()
33850
- if not isFirstVisit and roomFrameCount <= 0 then
33851
- return
33852
- end
33853
- local ____self_v_run_0, ____pickupCounter_1 = self.v.run, "pickupCounter"
33854
- ____self_v_run_0[____pickupCounter_1] = ____self_v_run_0[____pickupCounter_1] + 1
33855
- self.v.room.pickupIndexes:set(ptrHash, self.v.run.pickupCounter)
33887
+ self:trySetPickupIndex(pickup)
33856
33888
  end
33857
33889
  self.postEntityRemovePickup = function(____, entity)
33858
33890
  self:checkDespawningFromPlayerLeavingRoom(entity)
@@ -33871,8 +33903,8 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
33871
33903
  pickupIndex = self:getPostAscentPickupIndex(pickup)
33872
33904
  end
33873
33905
  if pickupIndex == nil then
33874
- local ____self_v_run_2, ____pickupCounter_3 = self.v.run, "pickupCounter"
33875
- ____self_v_run_2[____pickupCounter_3] = ____self_v_run_2[____pickupCounter_3] + 1
33906
+ local ____self_v_run_0, ____pickupCounter_1 = self.v.run, "pickupCounter"
33907
+ ____self_v_run_0[____pickupCounter_1] = ____self_v_run_0[____pickupCounter_1] + 1
33876
33908
  pickupIndex = self.v.run.pickupCounter
33877
33909
  end
33878
33910
  local ptrHash = GetPtrHash(pickup)
@@ -33884,6 +33916,21 @@ function PickupIndexCreation.prototype.____constructor(self, roomHistory)
33884
33916
  self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
33885
33917
  self.roomHistory = roomHistory
33886
33918
  end
33919
+ function PickupIndexCreation.prototype.trySetPickupIndex(self, pickup)
33920
+ local ptrHash = GetPtrHash(pickup)
33921
+ if self.v.room.pickupIndexes:has(ptrHash) then
33922
+ return
33923
+ end
33924
+ local room = game:GetRoom()
33925
+ local isFirstVisit = room:IsFirstVisit()
33926
+ local roomFrameCount = room:GetFrameCount()
33927
+ if not isFirstVisit and roomFrameCount <= 0 then
33928
+ return
33929
+ end
33930
+ local ____self_v_run_2, ____pickupCounter_3 = self.v.run, "pickupCounter"
33931
+ ____self_v_run_2[____pickupCounter_3] = ____self_v_run_2[____pickupCounter_3] + 1
33932
+ self.v.room.pickupIndexes:set(ptrHash, self.v.run.pickupCounter)
33933
+ end
33887
33934
  function PickupIndexCreation.prototype.checkDespawningFromPlayerLeavingRoom(self, entity)
33888
33935
  local ptrHash = GetPtrHash(entity)
33889
33936
  local pickupIndex = self.v.room.pickupIndexes:get(ptrHash)
@@ -33910,16 +33957,16 @@ function PickupIndexCreation.prototype.trackDespawningPickupMetadata(self, entit
33910
33957
  local room = game:GetRoom()
33911
33958
  local roomType = room:GetType()
33912
33959
  repeat
33913
- local ____switch20 = roomType
33914
- local ____cond20 = ____switch20 == RoomType.TREASURE
33915
- if ____cond20 then
33960
+ local ____switch21 = roomType
33961
+ local ____cond21 = ____switch21 == RoomType.TREASURE
33962
+ if ____cond21 then
33916
33963
  do
33917
33964
  self.v.run.pickupDataTreasureRooms:set(pickupIndex, pickupDescription)
33918
33965
  break
33919
33966
  end
33920
33967
  end
33921
- ____cond20 = ____cond20 or ____switch20 == RoomType.BOSS
33922
- if ____cond20 then
33968
+ ____cond21 = ____cond21 or ____switch21 == RoomType.BOSS
33969
+ if ____cond21 then
33923
33970
  do
33924
33971
  self.v.run.pickupDataBossRooms:set(pickupIndex, pickupDescription)
33925
33972
  break
@@ -33939,15 +33986,15 @@ function PickupIndexCreation.prototype.getPostAscentPickupIndex(self, pickup)
33939
33986
  local room = game:GetRoom()
33940
33987
  local roomType = room:GetType()
33941
33988
  repeat
33942
- local ____switch26 = roomType
33943
- local ____cond26 = ____switch26 == RoomType.TREASURE
33944
- if ____cond26 then
33989
+ local ____switch27 = roomType
33990
+ local ____cond27 = ____switch27 == RoomType.TREASURE
33991
+ if ____cond27 then
33945
33992
  do
33946
33993
  return getStoredPickupIndex(nil, pickup, self.v.run.pickupDataTreasureRooms)
33947
33994
  end
33948
33995
  end
33949
- ____cond26 = ____cond26 or ____switch26 == RoomType.BOSS
33950
- if ____cond26 then
33996
+ ____cond27 = ____cond27 or ____switch27 == RoomType.BOSS
33997
+ if ____cond27 then
33951
33998
  do
33952
33999
  return getStoredPickupIndex(nil, pickup, self.v.run.pickupDataBossRooms)
33953
34000
  end
@@ -33961,10 +34008,14 @@ function PickupIndexCreation.prototype.getPostAscentPickupIndex(self, pickup)
33961
34008
  end
33962
34009
  function PickupIndexCreation.prototype.getPickupIndex(self, pickup)
33963
34010
  local ptrHash = GetPtrHash(pickup)
34011
+ local pickupIndexInitial = self.v.room.pickupIndexes:get(ptrHash)
34012
+ if pickupIndexInitial == nil then
34013
+ self:trySetPickupIndex(pickup)
34014
+ end
33964
34015
  local pickupIndex = self.v.room.pickupIndexes:get(ptrHash)
33965
34016
  if pickupIndex == nil then
33966
34017
  local entityID = getEntityID(nil, pickup)
33967
- error((("Failed to get a pickup index for entity " .. entityID) .. " with hash: ") .. tostring(ptrHash))
34018
+ error("Failed to generate a new pickup index for pickup: " .. entityID)
33968
34019
  end
33969
34020
  return pickupIndex
33970
34021
  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,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,CAAC,MAAM,CAAgB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAgB,CAAC;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAkB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAsB,CAAC"}
@@ -42,6 +42,8 @@ ____exports.EMPTY_PNG_PATH = "gfx/none.png"
42
42
  --- The random items that appear when the player has 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
@@ -181,6 +181,12 @@ export declare function inStartingRoom(): boolean;
181
181
  * checked. Undefined by default.
182
182
  */
183
183
  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;
184
190
  /**
185
191
  * If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
186
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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,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;;;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;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAI5D;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"}
@@ -10,6 +10,7 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
10
10
  local __TS__StringIncludes = ____lualib.__TS__StringIncludes
11
11
  local Set = ____lualib.Set
12
12
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
13
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
13
14
  local ____exports = {}
14
15
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
15
16
  local AngelRoomSubType = ____isaac_2Dtypescript_2Ddefinitions.AngelRoomSubType
@@ -395,6 +396,18 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
395
396
  function(____, roomDescriptor) return roomDescriptor.Clear end
396
397
  )
397
398
  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
398
411
  --- If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
399
412
  -- slide around (such as the player). Since those entity velocities are already at zero, setting
400
413
  -- them to zero will have no effect. Thus, a generic solution is to record all of the entity
@@ -426,12 +439,12 @@ function ____exports.setRoomCleared(self)
426
439
  for ____, door in ipairs(getDoors(nil)) do
427
440
  do
428
441
  if isHiddenSecretRoomDoor(nil, door) then
429
- goto __continue53
442
+ goto __continue55
430
443
  end
431
444
  openDoorFast(nil, door)
432
445
  door.ExtraVisible = false
433
446
  end
434
- ::__continue53::
447
+ ::__continue55::
435
448
  end
436
449
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
437
450
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "15.4.2",
3
+ "version": "15.4.4",
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.3.0"
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);
@@ -527,6 +527,17 @@ export function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean {
527
527
  return matchingRooms.every((roomDescriptor) => roomDescriptor.Clear);
528
528
  }
529
529
 
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
+
530
541
  /**
531
542
  * If the `Room.Update` method is called in a `POST_NEW_ROOM` callback, then some entities will
532
543
  * slide around (such as the player). Since those entity velocities are already at zero, setting