isaacscript-common 39.0.0 → 39.0.1

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.
@@ -12918,6 +12918,7 @@ declare class ModdedElementDetection extends Feature {
12918
12918
  }
12919
12919
 
12920
12920
  declare class ModdedElementSets extends Feature {
12921
+ private arraysInitialized;
12921
12922
  private readonly allCollectibleTypesArray;
12922
12923
  private readonly allCollectibleTypesSet;
12923
12924
  private readonly vanillaCollectibleTypesArray;
@@ -12953,6 +12954,7 @@ declare class ModdedElementSets extends Feature {
12953
12954
  */
12954
12955
  private readonly cardSet;
12955
12956
  private readonly moddedElementDetection;
12957
+ private lazyInit;
12956
12958
  private lazyInitVanillaCollectibleTypes;
12957
12959
  private lazyInitModdedCollectibleTypes;
12958
12960
  private lazyInitVanillaTrinketTypes;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 39.0.0
3
+ isaacscript-common 39.0.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -38635,6 +38635,7 @@ ModdedElementSets.name = "ModdedElementSets"
38635
38635
  __TS__ClassExtends(ModdedElementSets, Feature)
38636
38636
  function ModdedElementSets.prototype.____constructor(self, moddedElementDetection)
38637
38637
  Feature.prototype.____constructor(self)
38638
+ self.arraysInitialized = false
38638
38639
  self.allCollectibleTypesArray = {}
38639
38640
  self.allCollectibleTypesSet = __TS__New(Set)
38640
38641
  self.vanillaCollectibleTypesArray = {}
@@ -38666,10 +38667,26 @@ function ModdedElementSets.prototype.____constructor(self, moddedElementDetectio
38666
38667
  self.featuresUsed = {ISCFeature.MODDED_ELEMENT_DETECTION}
38667
38668
  self.moddedElementDetection = moddedElementDetection
38668
38669
  end
38669
- function ModdedElementSets.prototype.lazyInitVanillaCollectibleTypes(self)
38670
- if #self.vanillaCollectibleTypesArray > 0 then
38670
+ function ModdedElementSets.prototype.lazyInit(self)
38671
+ if self.arraysInitialized then
38671
38672
  return
38672
38673
  end
38674
+ self.arraysInitialized = true
38675
+ self:lazyInitVanillaCollectibleTypes()
38676
+ self:lazyInitModdedCollectibleTypes()
38677
+ self:lazyInitVanillaTrinketTypes()
38678
+ self:lazyInitModdedTrinketTypes()
38679
+ self:lazyInitVanillaCardTypes()
38680
+ self:lazyInitModdedCardTypes()
38681
+ self:lazyInitTagToCollectibleTypesMap()
38682
+ self:lazyInitCacheFlagToCollectibleTypesMap()
38683
+ self:lazyInitCacheFlagToTrinketTypesMap()
38684
+ self:lazyInitFlyingCollectibleTypesSet()
38685
+ self:lazyInitFlyingTrinketTypesSet()
38686
+ self:lazyInitEdenCollectibleTypesSet()
38687
+ self:lazyInitCardTypes()
38688
+ end
38689
+ function ModdedElementSets.prototype.lazyInitVanillaCollectibleTypes(self)
38673
38690
  local vanillaCollectibleTypeRange = getVanillaCollectibleTypeRange(nil)
38674
38691
  for ____, collectibleType in ipairs(vanillaCollectibleTypeRange) do
38675
38692
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
@@ -38681,10 +38698,6 @@ function ModdedElementSets.prototype.lazyInitVanillaCollectibleTypes(self)
38681
38698
  end
38682
38699
  end
38683
38700
  function ModdedElementSets.prototype.lazyInitModdedCollectibleTypes(self)
38684
- if #self.moddedCollectibleTypesArray > 0 then
38685
- return
38686
- end
38687
- self:lazyInitVanillaCollectibleTypes()
38688
38701
  for ____, collectibleType in ipairs(self.vanillaCollectibleTypesArray) do
38689
38702
  local ____self_allCollectibleTypesArray_1 = self.allCollectibleTypesArray
38690
38703
  ____self_allCollectibleTypesArray_1[#____self_allCollectibleTypesArray_1 + 1] = collectibleType
@@ -38704,9 +38717,6 @@ function ModdedElementSets.prototype.lazyInitModdedCollectibleTypes(self)
38704
38717
  end
38705
38718
  end
38706
38719
  function ModdedElementSets.prototype.lazyInitVanillaTrinketTypes(self)
38707
- if #self.vanillaTrinketTypesArray > 0 then
38708
- return
38709
- end
38710
38720
  local vanillaTrinketTypeRange = getVanillaTrinketTypeRange(nil)
38711
38721
  for ____, trinketType in ipairs(vanillaTrinketTypeRange) do
38712
38722
  local itemConfigItem = itemConfig:GetTrinket(trinketType)
@@ -38718,10 +38728,6 @@ function ModdedElementSets.prototype.lazyInitVanillaTrinketTypes(self)
38718
38728
  end
38719
38729
  end
38720
38730
  function ModdedElementSets.prototype.lazyInitModdedTrinketTypes(self)
38721
- if #self.moddedTrinketTypesArray > 0 then
38722
- return
38723
- end
38724
- self:lazyInitVanillaTrinketTypes()
38725
38731
  for ____, trinketType in ipairs(self.vanillaTrinketTypesArray) do
38726
38732
  local ____self_allTrinketTypesArray_5 = self.allTrinketTypesArray
38727
38733
  ____self_allTrinketTypesArray_5[#____self_allTrinketTypesArray_5 + 1] = trinketType
@@ -38741,9 +38747,6 @@ function ModdedElementSets.prototype.lazyInitModdedTrinketTypes(self)
38741
38747
  end
38742
38748
  end
38743
38749
  function ModdedElementSets.prototype.lazyInitVanillaCardTypes(self)
38744
- if #self.vanillaCardTypesArray > 0 then
38745
- return
38746
- end
38747
38750
  local vanillaCardTypes = getVanillaCardTypes(nil)
38748
38751
  for ____, cardType in ipairs(vanillaCardTypes) do
38749
38752
  local itemConfigCard = itemConfig:GetCard(cardType)
@@ -38755,10 +38758,6 @@ function ModdedElementSets.prototype.lazyInitVanillaCardTypes(self)
38755
38758
  end
38756
38759
  end
38757
38760
  function ModdedElementSets.prototype.lazyInitModdedCardTypes(self)
38758
- if #self.moddedCardTypesArray > 0 then
38759
- return
38760
- end
38761
- self:lazyInitVanillaCardTypes()
38762
38761
  for ____, cardType in ipairs(self.vanillaCardTypesArray) do
38763
38762
  local ____self_allCardTypesArray_9 = self.allCardTypesArray
38764
38763
  ____self_allCardTypesArray_9[#____self_allCardTypesArray_9 + 1] = cardType
@@ -38778,9 +38777,6 @@ function ModdedElementSets.prototype.lazyInitModdedCardTypes(self)
38778
38777
  end
38779
38778
  end
38780
38779
  function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
38781
- if self.tagToCollectibleTypesMap.size > 0 then
38782
- return
38783
- end
38784
38780
  for ____, itemConfigTag in ipairs(ITEM_CONFIG_TAG_VALUES) do
38785
38781
  self.tagToCollectibleTypesMap:set(
38786
38782
  itemConfigTag,
@@ -38791,7 +38787,7 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
38791
38787
  for ____, itemConfigTag in ipairs(ITEM_CONFIG_TAG_VALUES) do
38792
38788
  do
38793
38789
  if not collectibleHasTag(nil, collectibleType, itemConfigTag) then
38794
- goto __continue44
38790
+ goto __continue39
38795
38791
  end
38796
38792
  local collectibleTypesSet = self.tagToCollectibleTypesMap:get(itemConfigTag)
38797
38793
  if collectibleTypesSet == nil then
@@ -38800,14 +38796,11 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
38800
38796
  end
38801
38797
  collectibleTypesSet:add(collectibleType)
38802
38798
  end
38803
- ::__continue44::
38799
+ ::__continue39::
38804
38800
  end
38805
38801
  end
38806
38802
  end
38807
38803
  function ModdedElementSets.prototype.lazyInitCacheFlagToCollectibleTypesMap(self)
38808
- if self.cacheFlagToCollectibleTypesMap.size > 0 then
38809
- return
38810
- end
38811
38804
  for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
38812
38805
  local collectiblesSet = __TS__New(Set)
38813
38806
  for ____, collectibleType in ipairs(self:getCollectibleArray()) do
@@ -38819,9 +38812,6 @@ function ModdedElementSets.prototype.lazyInitCacheFlagToCollectibleTypesMap(self
38819
38812
  end
38820
38813
  end
38821
38814
  function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
38822
- if self.cacheFlagToTrinketTypesMap.size > 0 then
38823
- return
38824
- end
38825
38815
  for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
38826
38816
  local trinketsSet = __TS__New(Set)
38827
38817
  for ____, trinketType in ipairs(self:getTrinketArray()) do
@@ -38833,9 +38823,6 @@ function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
38833
38823
  end
38834
38824
  end
38835
38825
  function ModdedElementSets.prototype.lazyInitFlyingCollectibleTypesSet(self)
38836
- if self.flyingCollectibleTypesSet.size > 0 then
38837
- return
38838
- end
38839
38826
  self.flyingCollectibleTypesSet = copySet(
38840
38827
  nil,
38841
38828
  self:getCollectiblesWithCacheFlag(CacheFlag.FLYING)
@@ -38851,9 +38838,6 @@ function ModdedElementSets.prototype.lazyInitFlyingCollectibleTypesSet(self)
38851
38838
  end
38852
38839
  end
38853
38840
  function ModdedElementSets.prototype.lazyInitFlyingTrinketTypesSet(self)
38854
- if self.flyingTrinketTypesSet.size > 0 then
38855
- return
38856
- end
38857
38841
  self.flyingTrinketTypesSet = copySet(
38858
38842
  nil,
38859
38843
  self:getTrinketsWithCacheFlag(CacheFlag.FLYING)
@@ -38866,13 +38850,10 @@ function ModdedElementSets.prototype.lazyInitFlyingTrinketTypesSet(self)
38866
38850
  deleteSetsFromSet(nil, self.flyingTrinketTypesSet, trinketsWithAllCacheFlag)
38867
38851
  end
38868
38852
  function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
38869
- if self.edenActiveCollectibleTypesSet.size > 0 then
38870
- return
38871
- end
38872
38853
  for ____, collectibleType in ipairs(self:getCollectibleArray()) do
38873
38854
  do
38874
38855
  if isHiddenCollectible(nil, collectibleType) or collectibleHasTag(nil, collectibleType, ItemConfigTag.NO_EDEN) then
38875
- goto __continue73
38856
+ goto __continue63
38876
38857
  end
38877
38858
  if isActiveCollectible(nil, collectibleType) then
38878
38859
  self.edenActiveCollectibleTypesSet:add(collectibleType)
@@ -38881,13 +38862,10 @@ function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
38881
38862
  self.edenPassiveCollectibleTypesSet:add(collectibleType)
38882
38863
  end
38883
38864
  end
38884
- ::__continue73::
38865
+ ::__continue63::
38885
38866
  end
38886
38867
  end
38887
38868
  function ModdedElementSets.prototype.lazyInitCardTypes(self)
38888
- if self.itemConfigCardTypeToCardTypeMap.size > 0 then
38889
- return
38890
- end
38891
38869
  for ____, itemConfigCardType in ipairs(ITEM_CONFIG_CARD_TYPE_VALUES) do
38892
38870
  self.itemConfigCardTypeToCardTypeMap:set(
38893
38871
  itemConfigCardType,
@@ -38911,20 +38889,18 @@ function ModdedElementSets.prototype.lazyInitCardTypes(self)
38911
38889
  end
38912
38890
  end
38913
38891
  function ModdedElementSets.prototype.getCardArray(self)
38914
- self:lazyInitModdedCardTypes()
38892
+ self:lazyInit()
38915
38893
  return self.allCardTypesArray
38916
38894
  end
38917
38895
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCardArray", true)
38918
38896
  function ModdedElementSets.prototype.getCardSet(self)
38919
- self:lazyInitModdedCardTypes()
38897
+ self:lazyInit()
38920
38898
  return self.allCardTypesSet
38921
38899
  end
38922
38900
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCardSet", true)
38923
38901
  function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
38924
38902
  local itemConfigCardTypes = {...}
38925
- if self.itemConfigCardTypeToCardTypeMap.size == 0 then
38926
- self:lazyInitCardTypes()
38927
- end
38903
+ self:lazyInit()
38928
38904
  local matchingCardTypes = __TS__New(Set)
38929
38905
  for ____, itemConfigCardType in ipairs(itemConfigCardTypes) do
38930
38906
  local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
@@ -38941,12 +38917,12 @@ function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
38941
38917
  end
38942
38918
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCardTypesOfType", true)
38943
38919
  function ModdedElementSets.prototype.getCollectibleArray(self)
38944
- self:lazyInitModdedCollectibleTypes()
38920
+ self:lazyInit()
38945
38921
  return self.allCollectibleTypesArray
38946
38922
  end
38947
38923
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleArray", true)
38948
38924
  function ModdedElementSets.prototype.getCollectibleSet(self)
38949
- self:lazyInitModdedCollectibleTypes()
38925
+ self:lazyInit()
38950
38926
  return self.allCollectibleTypesSet
38951
38927
  end
38952
38928
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleSet", true)
@@ -38961,7 +38937,7 @@ function ModdedElementSets.prototype.getCollectiblesForTransformation(self, play
38961
38937
  end
38962
38938
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesForTransformation", true)
38963
38939
  function ModdedElementSets.prototype.getCollectiblesWithCacheFlag(self, cacheFlag)
38964
- self:lazyInitCacheFlagToCollectibleTypesMap()
38940
+ self:lazyInit()
38965
38941
  local collectiblesSet = self.cacheFlagToCollectibleTypesMap:get(cacheFlag)
38966
38942
  if collectiblesSet == nil then
38967
38943
  return __TS__New(ReadonlySet)
@@ -38970,7 +38946,7 @@ function ModdedElementSets.prototype.getCollectiblesWithCacheFlag(self, cacheFla
38970
38946
  end
38971
38947
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWithCacheFlag", true)
38972
38948
  function ModdedElementSets.prototype.getCollectiblesWithTag(self, itemConfigTag)
38973
- self:lazyInitTagToCollectibleTypesMap()
38949
+ self:lazyInit()
38974
38950
  local collectibleTypes = self.tagToCollectibleTypesMap:get(itemConfigTag)
38975
38951
  assertDefined(
38976
38952
  nil,
@@ -38981,52 +38957,52 @@ function ModdedElementSets.prototype.getCollectiblesWithTag(self, itemConfigTag)
38981
38957
  end
38982
38958
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWithTag", true)
38983
38959
  function ModdedElementSets.prototype.getEdenActiveCollectibles(self)
38984
- self:lazyInitEdenCollectibleTypesSet()
38960
+ self:lazyInit()
38985
38961
  return self.edenActiveCollectibleTypesSet
38986
38962
  end
38987
38963
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getEdenActiveCollectibles", true)
38988
38964
  function ModdedElementSets.prototype.getEdenPassiveCollectibles(self)
38989
- self:lazyInitEdenCollectibleTypesSet()
38965
+ self:lazyInit()
38990
38966
  return self.edenPassiveCollectibleTypesSet
38991
38967
  end
38992
38968
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getEdenPassiveCollectibles", true)
38993
38969
  function ModdedElementSets.prototype.getFlyingCollectibles(self, includeConditionalItems)
38994
- self:lazyInitFlyingCollectibleTypesSet()
38970
+ self:lazyInit()
38995
38971
  return includeConditionalItems and self.flyingCollectibleTypesSet or self.permanentFlyingCollectibleTypesSet
38996
38972
  end
38997
38973
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getFlyingCollectibles", true)
38998
38974
  function ModdedElementSets.prototype.getFlyingTrinkets(self)
38999
- self:lazyInitFlyingTrinketTypesSet()
38975
+ self:lazyInit()
39000
38976
  return self.flyingTrinketTypesSet
39001
38977
  end
39002
38978
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getFlyingTrinkets", true)
39003
38979
  function ModdedElementSets.prototype.getModdedCardArray(self)
39004
- self:lazyInitModdedCardTypes()
38980
+ self:lazyInit()
39005
38981
  return self.moddedCardTypesArray
39006
38982
  end
39007
38983
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedCardArray", true)
39008
38984
  function ModdedElementSets.prototype.getModdedCardSet(self)
39009
- self:lazyInitModdedCardTypes()
38985
+ self:lazyInit()
39010
38986
  return self.moddedCardTypesSet
39011
38987
  end
39012
38988
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedCardSet", true)
39013
38989
  function ModdedElementSets.prototype.getModdedCollectibleArray(self)
39014
- self:lazyInitModdedCollectibleTypes()
38990
+ self:lazyInit()
39015
38991
  return self.moddedCollectibleTypesArray
39016
38992
  end
39017
38993
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedCollectibleArray", true)
39018
38994
  function ModdedElementSets.prototype.getModdedCollectibleSet(self)
39019
- self:lazyInitModdedCollectibleTypes()
38995
+ self:lazyInit()
39020
38996
  return self.moddedCollectibleTypesSet
39021
38997
  end
39022
38998
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedCollectibleSet", true)
39023
38999
  function ModdedElementSets.prototype.getModdedTrinketArray(self)
39024
- self:lazyInitModdedTrinketTypes()
39000
+ self:lazyInit()
39025
39001
  return self.moddedTrinketTypesArray
39026
39002
  end
39027
39003
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedTrinketArray", true)
39028
39004
  function ModdedElementSets.prototype.getModdedTrinketSet(self)
39029
- self:lazyInitModdedTrinketTypes()
39005
+ self:lazyInit()
39030
39006
  return self.moddedTrinketTypesSet
39031
39007
  end
39032
39008
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedTrinketSet", true)
@@ -39125,7 +39101,7 @@ function ModdedElementSets.prototype.getRandomCard(self, seedOrRNG, exceptions)
39125
39101
  if exceptions == nil then
39126
39102
  exceptions = {}
39127
39103
  end
39128
- self:lazyInitCardTypes()
39104
+ self:lazyInit()
39129
39105
  return getRandomSetElement(nil, self.cardSet, seedOrRNG, exceptions)
39130
39106
  end
39131
39107
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomCard", true)
@@ -39159,7 +39135,7 @@ function ModdedElementSets.prototype.getRandomEdenActiveCollectible(self, seedOr
39159
39135
  if exceptions == nil then
39160
39136
  exceptions = {}
39161
39137
  end
39162
- self:lazyInitEdenCollectibleTypesSet()
39138
+ self:lazyInit()
39163
39139
  return getRandomSetElement(nil, self.edenPassiveCollectibleTypesSet, seedOrRNG, exceptions)
39164
39140
  end
39165
39141
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomEdenActiveCollectible", true)
@@ -39170,22 +39146,22 @@ function ModdedElementSets.prototype.getRandomEdenPassiveCollectible(self, seedO
39170
39146
  if exceptions == nil then
39171
39147
  exceptions = {}
39172
39148
  end
39173
- self:lazyInitEdenCollectibleTypesSet()
39149
+ self:lazyInit()
39174
39150
  return getRandomSetElement(nil, self.edenPassiveCollectibleTypesSet, seedOrRNG, exceptions)
39175
39151
  end
39176
39152
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomEdenPassiveCollectible", true)
39177
39153
  function ModdedElementSets.prototype.getTrinketArray(self)
39178
- self:lazyInitModdedTrinketTypes()
39154
+ self:lazyInit()
39179
39155
  return self.allTrinketTypesArray
39180
39156
  end
39181
39157
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getTrinketArray", true)
39182
39158
  function ModdedElementSets.prototype.getTrinketSet(self)
39183
- self:lazyInitModdedTrinketTypes()
39159
+ self:lazyInit()
39184
39160
  return self.allTrinketTypesSet
39185
39161
  end
39186
39162
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getTrinketSet", true)
39187
39163
  function ModdedElementSets.prototype.getTrinketsWithCacheFlag(self, cacheFlag)
39188
- self:lazyInitCacheFlagToTrinketTypesMap()
39164
+ self:lazyInit()
39189
39165
  local trinketsSet = self.cacheFlagToTrinketTypesMap:get(cacheFlag)
39190
39166
  if trinketsSet == nil then
39191
39167
  return __TS__New(ReadonlySet)
@@ -39194,32 +39170,32 @@ function ModdedElementSets.prototype.getTrinketsWithCacheFlag(self, cacheFlag)
39194
39170
  end
39195
39171
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getTrinketsWithCacheFlag", true)
39196
39172
  function ModdedElementSets.prototype.getVanillaCardArray(self)
39197
- self:lazyInitVanillaCardTypes()
39173
+ self:lazyInit()
39198
39174
  return self.vanillaCardTypesArray
39199
39175
  end
39200
39176
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaCardArray", true)
39201
39177
  function ModdedElementSets.prototype.getVanillaCardSet(self)
39202
- self:lazyInitVanillaCardTypes()
39178
+ self:lazyInit()
39203
39179
  return self.vanillaCardTypesSet
39204
39180
  end
39205
39181
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaCardSet", true)
39206
39182
  function ModdedElementSets.prototype.getVanillaCollectibleArray(self)
39207
- self:lazyInitVanillaCollectibleTypes()
39183
+ self:lazyInit()
39208
39184
  return self.vanillaCollectibleTypesArray
39209
39185
  end
39210
39186
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaCollectibleArray", true)
39211
39187
  function ModdedElementSets.prototype.getVanillaCollectibleSet(self)
39212
- self:lazyInitVanillaCollectibleTypes()
39188
+ self:lazyInit()
39213
39189
  return self.vanillaCollectibleTypesSet
39214
39190
  end
39215
39191
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaCollectibleSet", true)
39216
39192
  function ModdedElementSets.prototype.getVanillaTrinketArray(self)
39217
- self:lazyInitVanillaTrinketTypes()
39193
+ self:lazyInit()
39218
39194
  return self.vanillaTrinketTypesArray
39219
39195
  end
39220
39196
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaTrinketArray", true)
39221
39197
  function ModdedElementSets.prototype.getVanillaTrinketSet(self)
39222
- self:lazyInitVanillaTrinketTypes()
39198
+ self:lazyInit()
39223
39199
  return self.vanillaTrinketTypesSet
39224
39200
  end
39225
39201
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaTrinketSet", true)
@@ -1,6 +1,7 @@
1
1
  import { CacheFlag, CardType, CollectibleType, ItemConfigCardType, ItemConfigTag, PlayerForm, TrinketType } from "isaac-typescript-definitions";
2
2
  import { Feature } from "../../private/Feature";
3
3
  export declare class ModdedElementSets extends Feature {
4
+ private arraysInitialized;
4
5
  private readonly allCollectibleTypesArray;
5
6
  private readonly allCollectibleTypesSet;
6
7
  private readonly vanillaCollectibleTypesArray;
@@ -36,6 +37,7 @@ export declare class ModdedElementSets extends Feature {
36
37
  */
37
38
  private readonly cardSet;
38
39
  private readonly moddedElementDetection;
40
+ private lazyInit;
39
41
  private lazyInitVanillaCollectibleTypes;
40
42
  private lazyInitModdedCollectibleTypes;
41
43
  private lazyInitVanillaTrinketTypes;
@@ -1 +1 @@
1
- {"version":3,"file":"ModdedElementS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EACvC,UAAU,GAAE,eAAe,EAAE,GAAG,SAAS,eAAe,EAAO,GAC9D,eAAe;IASlB;;;;;;;;;;OAUG;IAEI,eAAe,IAAI,SAAS,WAAW,EAAE;IAKhD;;;;;;;;;;OAUG;IAEI,aAAa,IAAI,WAAW,CAAC,WAAW,CAAC;IAKhD;;;;;;;;OAQG;IAEI,wBAAwB,CAC7B,SAAS,EAAE,SAAS,GACnB,WAAW,CAAC,WAAW,CAAC;IAW3B;;;;;;;OAOG;IAEI,mBAAmB,IAAI,SAAS,QAAQ,EAAE;IAKjD;;;;;;;OAOG;IAEI,iBAAiB,IAAI,WAAW,CAAC,QAAQ,CAAC;IAKjD;;;;;;;OAOG;IAEI,0BAA0B,IAAI,SAAS,eAAe,EAAE;IAK/D;;;;;;;OAOG;IAEI,wBAAwB,IAAI,WAAW,CAAC,eAAe,CAAC;IAK/D;;;;;;;OAOG;IAEI,sBAAsB,IAAI,SAAS,WAAW,EAAE;IAKvD;;;;;;;OAOG;IAEI,oBAAoB,IAAI,WAAW,CAAC,WAAW,CAAC;CAIxD"}
@@ -82,6 +82,7 @@ ModdedElementSets.name = "ModdedElementSets"
82
82
  __TS__ClassExtends(ModdedElementSets, Feature)
83
83
  function ModdedElementSets.prototype.____constructor(self, moddedElementDetection)
84
84
  Feature.prototype.____constructor(self)
85
+ self.arraysInitialized = false
85
86
  self.allCollectibleTypesArray = {}
86
87
  self.allCollectibleTypesSet = __TS__New(Set)
87
88
  self.vanillaCollectibleTypesArray = {}
@@ -113,10 +114,26 @@ function ModdedElementSets.prototype.____constructor(self, moddedElementDetectio
113
114
  self.featuresUsed = {ISCFeature.MODDED_ELEMENT_DETECTION}
114
115
  self.moddedElementDetection = moddedElementDetection
115
116
  end
116
- function ModdedElementSets.prototype.lazyInitVanillaCollectibleTypes(self)
117
- if #self.vanillaCollectibleTypesArray > 0 then
117
+ function ModdedElementSets.prototype.lazyInit(self)
118
+ if self.arraysInitialized then
118
119
  return
119
120
  end
121
+ self.arraysInitialized = true
122
+ self:lazyInitVanillaCollectibleTypes()
123
+ self:lazyInitModdedCollectibleTypes()
124
+ self:lazyInitVanillaTrinketTypes()
125
+ self:lazyInitModdedTrinketTypes()
126
+ self:lazyInitVanillaCardTypes()
127
+ self:lazyInitModdedCardTypes()
128
+ self:lazyInitTagToCollectibleTypesMap()
129
+ self:lazyInitCacheFlagToCollectibleTypesMap()
130
+ self:lazyInitCacheFlagToTrinketTypesMap()
131
+ self:lazyInitFlyingCollectibleTypesSet()
132
+ self:lazyInitFlyingTrinketTypesSet()
133
+ self:lazyInitEdenCollectibleTypesSet()
134
+ self:lazyInitCardTypes()
135
+ end
136
+ function ModdedElementSets.prototype.lazyInitVanillaCollectibleTypes(self)
120
137
  local vanillaCollectibleTypeRange = getVanillaCollectibleTypeRange(nil)
121
138
  for ____, collectibleType in ipairs(vanillaCollectibleTypeRange) do
122
139
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
@@ -128,10 +145,6 @@ function ModdedElementSets.prototype.lazyInitVanillaCollectibleTypes(self)
128
145
  end
129
146
  end
130
147
  function ModdedElementSets.prototype.lazyInitModdedCollectibleTypes(self)
131
- if #self.moddedCollectibleTypesArray > 0 then
132
- return
133
- end
134
- self:lazyInitVanillaCollectibleTypes()
135
148
  for ____, collectibleType in ipairs(self.vanillaCollectibleTypesArray) do
136
149
  local ____self_allCollectibleTypesArray_1 = self.allCollectibleTypesArray
137
150
  ____self_allCollectibleTypesArray_1[#____self_allCollectibleTypesArray_1 + 1] = collectibleType
@@ -151,9 +164,6 @@ function ModdedElementSets.prototype.lazyInitModdedCollectibleTypes(self)
151
164
  end
152
165
  end
153
166
  function ModdedElementSets.prototype.lazyInitVanillaTrinketTypes(self)
154
- if #self.vanillaTrinketTypesArray > 0 then
155
- return
156
- end
157
167
  local vanillaTrinketTypeRange = getVanillaTrinketTypeRange(nil)
158
168
  for ____, trinketType in ipairs(vanillaTrinketTypeRange) do
159
169
  local itemConfigItem = itemConfig:GetTrinket(trinketType)
@@ -165,10 +175,6 @@ function ModdedElementSets.prototype.lazyInitVanillaTrinketTypes(self)
165
175
  end
166
176
  end
167
177
  function ModdedElementSets.prototype.lazyInitModdedTrinketTypes(self)
168
- if #self.moddedTrinketTypesArray > 0 then
169
- return
170
- end
171
- self:lazyInitVanillaTrinketTypes()
172
178
  for ____, trinketType in ipairs(self.vanillaTrinketTypesArray) do
173
179
  local ____self_allTrinketTypesArray_5 = self.allTrinketTypesArray
174
180
  ____self_allTrinketTypesArray_5[#____self_allTrinketTypesArray_5 + 1] = trinketType
@@ -188,9 +194,6 @@ function ModdedElementSets.prototype.lazyInitModdedTrinketTypes(self)
188
194
  end
189
195
  end
190
196
  function ModdedElementSets.prototype.lazyInitVanillaCardTypes(self)
191
- if #self.vanillaCardTypesArray > 0 then
192
- return
193
- end
194
197
  local vanillaCardTypes = getVanillaCardTypes(nil)
195
198
  for ____, cardType in ipairs(vanillaCardTypes) do
196
199
  local itemConfigCard = itemConfig:GetCard(cardType)
@@ -202,10 +205,6 @@ function ModdedElementSets.prototype.lazyInitVanillaCardTypes(self)
202
205
  end
203
206
  end
204
207
  function ModdedElementSets.prototype.lazyInitModdedCardTypes(self)
205
- if #self.moddedCardTypesArray > 0 then
206
- return
207
- end
208
- self:lazyInitVanillaCardTypes()
209
208
  for ____, cardType in ipairs(self.vanillaCardTypesArray) do
210
209
  local ____self_allCardTypesArray_9 = self.allCardTypesArray
211
210
  ____self_allCardTypesArray_9[#____self_allCardTypesArray_9 + 1] = cardType
@@ -225,9 +224,6 @@ function ModdedElementSets.prototype.lazyInitModdedCardTypes(self)
225
224
  end
226
225
  end
227
226
  function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
228
- if self.tagToCollectibleTypesMap.size > 0 then
229
- return
230
- end
231
227
  for ____, itemConfigTag in ipairs(ITEM_CONFIG_TAG_VALUES) do
232
228
  self.tagToCollectibleTypesMap:set(
233
229
  itemConfigTag,
@@ -238,7 +234,7 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
238
234
  for ____, itemConfigTag in ipairs(ITEM_CONFIG_TAG_VALUES) do
239
235
  do
240
236
  if not collectibleHasTag(nil, collectibleType, itemConfigTag) then
241
- goto __continue44
237
+ goto __continue39
242
238
  end
243
239
  local collectibleTypesSet = self.tagToCollectibleTypesMap:get(itemConfigTag)
244
240
  if collectibleTypesSet == nil then
@@ -247,14 +243,11 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
247
243
  end
248
244
  collectibleTypesSet:add(collectibleType)
249
245
  end
250
- ::__continue44::
246
+ ::__continue39::
251
247
  end
252
248
  end
253
249
  end
254
250
  function ModdedElementSets.prototype.lazyInitCacheFlagToCollectibleTypesMap(self)
255
- if self.cacheFlagToCollectibleTypesMap.size > 0 then
256
- return
257
- end
258
251
  for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
259
252
  local collectiblesSet = __TS__New(Set)
260
253
  for ____, collectibleType in ipairs(self:getCollectibleArray()) do
@@ -266,9 +259,6 @@ function ModdedElementSets.prototype.lazyInitCacheFlagToCollectibleTypesMap(self
266
259
  end
267
260
  end
268
261
  function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
269
- if self.cacheFlagToTrinketTypesMap.size > 0 then
270
- return
271
- end
272
262
  for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
273
263
  local trinketsSet = __TS__New(Set)
274
264
  for ____, trinketType in ipairs(self:getTrinketArray()) do
@@ -280,9 +270,6 @@ function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
280
270
  end
281
271
  end
282
272
  function ModdedElementSets.prototype.lazyInitFlyingCollectibleTypesSet(self)
283
- if self.flyingCollectibleTypesSet.size > 0 then
284
- return
285
- end
286
273
  self.flyingCollectibleTypesSet = copySet(
287
274
  nil,
288
275
  self:getCollectiblesWithCacheFlag(CacheFlag.FLYING)
@@ -298,9 +285,6 @@ function ModdedElementSets.prototype.lazyInitFlyingCollectibleTypesSet(self)
298
285
  end
299
286
  end
300
287
  function ModdedElementSets.prototype.lazyInitFlyingTrinketTypesSet(self)
301
- if self.flyingTrinketTypesSet.size > 0 then
302
- return
303
- end
304
288
  self.flyingTrinketTypesSet = copySet(
305
289
  nil,
306
290
  self:getTrinketsWithCacheFlag(CacheFlag.FLYING)
@@ -313,13 +297,10 @@ function ModdedElementSets.prototype.lazyInitFlyingTrinketTypesSet(self)
313
297
  deleteSetsFromSet(nil, self.flyingTrinketTypesSet, trinketsWithAllCacheFlag)
314
298
  end
315
299
  function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
316
- if self.edenActiveCollectibleTypesSet.size > 0 then
317
- return
318
- end
319
300
  for ____, collectibleType in ipairs(self:getCollectibleArray()) do
320
301
  do
321
302
  if isHiddenCollectible(nil, collectibleType) or collectibleHasTag(nil, collectibleType, ItemConfigTag.NO_EDEN) then
322
- goto __continue73
303
+ goto __continue63
323
304
  end
324
305
  if isActiveCollectible(nil, collectibleType) then
325
306
  self.edenActiveCollectibleTypesSet:add(collectibleType)
@@ -328,13 +309,10 @@ function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
328
309
  self.edenPassiveCollectibleTypesSet:add(collectibleType)
329
310
  end
330
311
  end
331
- ::__continue73::
312
+ ::__continue63::
332
313
  end
333
314
  end
334
315
  function ModdedElementSets.prototype.lazyInitCardTypes(self)
335
- if self.itemConfigCardTypeToCardTypeMap.size > 0 then
336
- return
337
- end
338
316
  for ____, itemConfigCardType in ipairs(ITEM_CONFIG_CARD_TYPE_VALUES) do
339
317
  self.itemConfigCardTypeToCardTypeMap:set(
340
318
  itemConfigCardType,
@@ -358,20 +336,18 @@ function ModdedElementSets.prototype.lazyInitCardTypes(self)
358
336
  end
359
337
  end
360
338
  function ModdedElementSets.prototype.getCardArray(self)
361
- self:lazyInitModdedCardTypes()
339
+ self:lazyInit()
362
340
  return self.allCardTypesArray
363
341
  end
364
342
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCardArray", true)
365
343
  function ModdedElementSets.prototype.getCardSet(self)
366
- self:lazyInitModdedCardTypes()
344
+ self:lazyInit()
367
345
  return self.allCardTypesSet
368
346
  end
369
347
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCardSet", true)
370
348
  function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
371
349
  local itemConfigCardTypes = {...}
372
- if self.itemConfigCardTypeToCardTypeMap.size == 0 then
373
- self:lazyInitCardTypes()
374
- end
350
+ self:lazyInit()
375
351
  local matchingCardTypes = __TS__New(Set)
376
352
  for ____, itemConfigCardType in ipairs(itemConfigCardTypes) do
377
353
  local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
@@ -388,12 +364,12 @@ function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
388
364
  end
389
365
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCardTypesOfType", true)
390
366
  function ModdedElementSets.prototype.getCollectibleArray(self)
391
- self:lazyInitModdedCollectibleTypes()
367
+ self:lazyInit()
392
368
  return self.allCollectibleTypesArray
393
369
  end
394
370
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleArray", true)
395
371
  function ModdedElementSets.prototype.getCollectibleSet(self)
396
- self:lazyInitModdedCollectibleTypes()
372
+ self:lazyInit()
397
373
  return self.allCollectibleTypesSet
398
374
  end
399
375
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleSet", true)
@@ -408,7 +384,7 @@ function ModdedElementSets.prototype.getCollectiblesForTransformation(self, play
408
384
  end
409
385
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesForTransformation", true)
410
386
  function ModdedElementSets.prototype.getCollectiblesWithCacheFlag(self, cacheFlag)
411
- self:lazyInitCacheFlagToCollectibleTypesMap()
387
+ self:lazyInit()
412
388
  local collectiblesSet = self.cacheFlagToCollectibleTypesMap:get(cacheFlag)
413
389
  if collectiblesSet == nil then
414
390
  return __TS__New(ReadonlySet)
@@ -417,7 +393,7 @@ function ModdedElementSets.prototype.getCollectiblesWithCacheFlag(self, cacheFla
417
393
  end
418
394
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWithCacheFlag", true)
419
395
  function ModdedElementSets.prototype.getCollectiblesWithTag(self, itemConfigTag)
420
- self:lazyInitTagToCollectibleTypesMap()
396
+ self:lazyInit()
421
397
  local collectibleTypes = self.tagToCollectibleTypesMap:get(itemConfigTag)
422
398
  assertDefined(
423
399
  nil,
@@ -428,52 +404,52 @@ function ModdedElementSets.prototype.getCollectiblesWithTag(self, itemConfigTag)
428
404
  end
429
405
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectiblesWithTag", true)
430
406
  function ModdedElementSets.prototype.getEdenActiveCollectibles(self)
431
- self:lazyInitEdenCollectibleTypesSet()
407
+ self:lazyInit()
432
408
  return self.edenActiveCollectibleTypesSet
433
409
  end
434
410
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getEdenActiveCollectibles", true)
435
411
  function ModdedElementSets.prototype.getEdenPassiveCollectibles(self)
436
- self:lazyInitEdenCollectibleTypesSet()
412
+ self:lazyInit()
437
413
  return self.edenPassiveCollectibleTypesSet
438
414
  end
439
415
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getEdenPassiveCollectibles", true)
440
416
  function ModdedElementSets.prototype.getFlyingCollectibles(self, includeConditionalItems)
441
- self:lazyInitFlyingCollectibleTypesSet()
417
+ self:lazyInit()
442
418
  return includeConditionalItems and self.flyingCollectibleTypesSet or self.permanentFlyingCollectibleTypesSet
443
419
  end
444
420
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getFlyingCollectibles", true)
445
421
  function ModdedElementSets.prototype.getFlyingTrinkets(self)
446
- self:lazyInitFlyingTrinketTypesSet()
422
+ self:lazyInit()
447
423
  return self.flyingTrinketTypesSet
448
424
  end
449
425
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getFlyingTrinkets", true)
450
426
  function ModdedElementSets.prototype.getModdedCardArray(self)
451
- self:lazyInitModdedCardTypes()
427
+ self:lazyInit()
452
428
  return self.moddedCardTypesArray
453
429
  end
454
430
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedCardArray", true)
455
431
  function ModdedElementSets.prototype.getModdedCardSet(self)
456
- self:lazyInitModdedCardTypes()
432
+ self:lazyInit()
457
433
  return self.moddedCardTypesSet
458
434
  end
459
435
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedCardSet", true)
460
436
  function ModdedElementSets.prototype.getModdedCollectibleArray(self)
461
- self:lazyInitModdedCollectibleTypes()
437
+ self:lazyInit()
462
438
  return self.moddedCollectibleTypesArray
463
439
  end
464
440
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedCollectibleArray", true)
465
441
  function ModdedElementSets.prototype.getModdedCollectibleSet(self)
466
- self:lazyInitModdedCollectibleTypes()
442
+ self:lazyInit()
467
443
  return self.moddedCollectibleTypesSet
468
444
  end
469
445
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedCollectibleSet", true)
470
446
  function ModdedElementSets.prototype.getModdedTrinketArray(self)
471
- self:lazyInitModdedTrinketTypes()
447
+ self:lazyInit()
472
448
  return self.moddedTrinketTypesArray
473
449
  end
474
450
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedTrinketArray", true)
475
451
  function ModdedElementSets.prototype.getModdedTrinketSet(self)
476
- self:lazyInitModdedTrinketTypes()
452
+ self:lazyInit()
477
453
  return self.moddedTrinketTypesSet
478
454
  end
479
455
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getModdedTrinketSet", true)
@@ -572,7 +548,7 @@ function ModdedElementSets.prototype.getRandomCard(self, seedOrRNG, exceptions)
572
548
  if exceptions == nil then
573
549
  exceptions = {}
574
550
  end
575
- self:lazyInitCardTypes()
551
+ self:lazyInit()
576
552
  return getRandomSetElement(nil, self.cardSet, seedOrRNG, exceptions)
577
553
  end
578
554
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomCard", true)
@@ -606,7 +582,7 @@ function ModdedElementSets.prototype.getRandomEdenActiveCollectible(self, seedOr
606
582
  if exceptions == nil then
607
583
  exceptions = {}
608
584
  end
609
- self:lazyInitEdenCollectibleTypesSet()
585
+ self:lazyInit()
610
586
  return getRandomSetElement(nil, self.edenPassiveCollectibleTypesSet, seedOrRNG, exceptions)
611
587
  end
612
588
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomEdenActiveCollectible", true)
@@ -617,22 +593,22 @@ function ModdedElementSets.prototype.getRandomEdenPassiveCollectible(self, seedO
617
593
  if exceptions == nil then
618
594
  exceptions = {}
619
595
  end
620
- self:lazyInitEdenCollectibleTypesSet()
596
+ self:lazyInit()
621
597
  return getRandomSetElement(nil, self.edenPassiveCollectibleTypesSet, seedOrRNG, exceptions)
622
598
  end
623
599
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomEdenPassiveCollectible", true)
624
600
  function ModdedElementSets.prototype.getTrinketArray(self)
625
- self:lazyInitModdedTrinketTypes()
601
+ self:lazyInit()
626
602
  return self.allTrinketTypesArray
627
603
  end
628
604
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getTrinketArray", true)
629
605
  function ModdedElementSets.prototype.getTrinketSet(self)
630
- self:lazyInitModdedTrinketTypes()
606
+ self:lazyInit()
631
607
  return self.allTrinketTypesSet
632
608
  end
633
609
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getTrinketSet", true)
634
610
  function ModdedElementSets.prototype.getTrinketsWithCacheFlag(self, cacheFlag)
635
- self:lazyInitCacheFlagToTrinketTypesMap()
611
+ self:lazyInit()
636
612
  local trinketsSet = self.cacheFlagToTrinketTypesMap:get(cacheFlag)
637
613
  if trinketsSet == nil then
638
614
  return __TS__New(ReadonlySet)
@@ -641,32 +617,32 @@ function ModdedElementSets.prototype.getTrinketsWithCacheFlag(self, cacheFlag)
641
617
  end
642
618
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getTrinketsWithCacheFlag", true)
643
619
  function ModdedElementSets.prototype.getVanillaCardArray(self)
644
- self:lazyInitVanillaCardTypes()
620
+ self:lazyInit()
645
621
  return self.vanillaCardTypesArray
646
622
  end
647
623
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaCardArray", true)
648
624
  function ModdedElementSets.prototype.getVanillaCardSet(self)
649
- self:lazyInitVanillaCardTypes()
625
+ self:lazyInit()
650
626
  return self.vanillaCardTypesSet
651
627
  end
652
628
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaCardSet", true)
653
629
  function ModdedElementSets.prototype.getVanillaCollectibleArray(self)
654
- self:lazyInitVanillaCollectibleTypes()
630
+ self:lazyInit()
655
631
  return self.vanillaCollectibleTypesArray
656
632
  end
657
633
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaCollectibleArray", true)
658
634
  function ModdedElementSets.prototype.getVanillaCollectibleSet(self)
659
- self:lazyInitVanillaCollectibleTypes()
635
+ self:lazyInit()
660
636
  return self.vanillaCollectibleTypesSet
661
637
  end
662
638
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaCollectibleSet", true)
663
639
  function ModdedElementSets.prototype.getVanillaTrinketArray(self)
664
- self:lazyInitVanillaTrinketTypes()
640
+ self:lazyInit()
665
641
  return self.vanillaTrinketTypesArray
666
642
  end
667
643
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaTrinketArray", true)
668
644
  function ModdedElementSets.prototype.getVanillaTrinketSet(self)
669
- self:lazyInitVanillaTrinketTypes()
645
+ self:lazyInit()
670
646
  return self.vanillaTrinketTypesSet
671
647
  end
672
648
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getVanillaTrinketSet", true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "39.0.0",
3
+ "version": "39.0.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -72,6 +72,8 @@ const TRANSFORMATION_TO_TAG_MAP = new ReadonlyMap<PlayerForm, ItemConfigTag>([
72
72
  ]);
73
73
 
74
74
  export class ModdedElementSets extends Feature {
75
+ private arraysInitialized = false;
76
+
75
77
  private readonly allCollectibleTypesArray: CollectibleType[] = [];
76
78
  private readonly allCollectibleTypesSet = new Set<CollectibleType>();
77
79
 
@@ -146,11 +148,28 @@ export class ModdedElementSets extends Feature {
146
148
  this.moddedElementDetection = moddedElementDetection;
147
149
  }
148
150
 
149
- private lazyInitVanillaCollectibleTypes() {
150
- if (this.vanillaCollectibleTypesArray.length > 0) {
151
+ private lazyInit() {
152
+ if (this.arraysInitialized) {
151
153
  return;
152
154
  }
155
+ this.arraysInitialized = true;
153
156
 
157
+ this.lazyInitVanillaCollectibleTypes();
158
+ this.lazyInitModdedCollectibleTypes();
159
+ this.lazyInitVanillaTrinketTypes();
160
+ this.lazyInitModdedTrinketTypes();
161
+ this.lazyInitVanillaCardTypes();
162
+ this.lazyInitModdedCardTypes();
163
+ this.lazyInitTagToCollectibleTypesMap();
164
+ this.lazyInitCacheFlagToCollectibleTypesMap();
165
+ this.lazyInitCacheFlagToTrinketTypesMap();
166
+ this.lazyInitFlyingCollectibleTypesSet();
167
+ this.lazyInitFlyingTrinketTypesSet();
168
+ this.lazyInitEdenCollectibleTypesSet();
169
+ this.lazyInitCardTypes();
170
+ }
171
+
172
+ private lazyInitVanillaCollectibleTypes() {
154
173
  const vanillaCollectibleTypeRange = getVanillaCollectibleTypeRange();
155
174
  for (const collectibleType of vanillaCollectibleTypeRange) {
156
175
  // Vanilla collectible types are not contiguous, so we must check every value. (There are
@@ -164,12 +183,6 @@ export class ModdedElementSets extends Feature {
164
183
  }
165
184
 
166
185
  private lazyInitModdedCollectibleTypes() {
167
- if (this.moddedCollectibleTypesArray.length > 0) {
168
- return;
169
- }
170
-
171
- this.lazyInitVanillaCollectibleTypes();
172
-
173
186
  for (const collectibleType of this.vanillaCollectibleTypesArray) {
174
187
  this.allCollectibleTypesArray.push(collectibleType);
175
188
  this.allCollectibleTypesSet.add(collectibleType);
@@ -191,10 +204,6 @@ export class ModdedElementSets extends Feature {
191
204
  }
192
205
 
193
206
  private lazyInitVanillaTrinketTypes() {
194
- if (this.vanillaTrinketTypesArray.length > 0) {
195
- return;
196
- }
197
-
198
207
  const vanillaTrinketTypeRange = getVanillaTrinketTypeRange();
199
208
  for (const trinketType of vanillaTrinketTypeRange) {
200
209
  // Vanilla trinket types are not contiguous, so we must check every value. (The only gap is 47
@@ -208,12 +217,6 @@ export class ModdedElementSets extends Feature {
208
217
  }
209
218
 
210
219
  private lazyInitModdedTrinketTypes() {
211
- if (this.moddedTrinketTypesArray.length > 0) {
212
- return;
213
- }
214
-
215
- this.lazyInitVanillaTrinketTypes();
216
-
217
220
  for (const trinketType of this.vanillaTrinketTypesArray) {
218
221
  this.allTrinketTypesArray.push(trinketType);
219
222
  this.allTrinketTypesSet.add(trinketType);
@@ -235,10 +238,6 @@ export class ModdedElementSets extends Feature {
235
238
  }
236
239
 
237
240
  private lazyInitVanillaCardTypes() {
238
- if (this.vanillaCardTypesArray.length > 0) {
239
- return;
240
- }
241
-
242
241
  const vanillaCardTypes = getVanillaCardTypes();
243
242
  for (const cardType of vanillaCardTypes) {
244
243
  // Vanilla card types are contiguous, but we check every value just to be safe (and so that
@@ -252,12 +251,6 @@ export class ModdedElementSets extends Feature {
252
251
  }
253
252
 
254
253
  private lazyInitModdedCardTypes() {
255
- if (this.moddedCardTypesArray.length > 0) {
256
- return;
257
- }
258
-
259
- this.lazyInitVanillaCardTypes();
260
-
261
254
  for (const cardType of this.vanillaCardTypesArray) {
262
255
  this.allCardTypesArray.push(cardType);
263
256
  this.allCardTypesSet.add(cardType);
@@ -265,7 +258,8 @@ export class ModdedElementSets extends Feature {
265
258
 
266
259
  const moddedCardTypes = this.moddedElementDetection.getModdedCardTypes();
267
260
  for (const cardType of moddedCardTypes) {
268
- // Modded card types are contiguous, but we check every value just in case.
261
+ // Modded card types are contiguous, but we check every value just to be safe (and so that the
262
+ // code is similar to the collectible and trinket functions above).
269
263
  const itemConfigCard = itemConfig.GetCard(cardType);
270
264
  if (itemConfigCard !== undefined) {
271
265
  this.moddedCardTypesArray.push(cardType);
@@ -278,10 +272,6 @@ export class ModdedElementSets extends Feature {
278
272
  }
279
273
 
280
274
  private lazyInitTagToCollectibleTypesMap() {
281
- if (this.tagToCollectibleTypesMap.size > 0) {
282
- return;
283
- }
284
-
285
275
  // The tag to collectible types map should be valid for every tag, so we initialize it with
286
276
  // empty sets.
287
277
  for (const itemConfigTag of ITEM_CONFIG_TAG_VALUES) {
@@ -308,10 +298,6 @@ export class ModdedElementSets extends Feature {
308
298
  }
309
299
 
310
300
  private lazyInitCacheFlagToCollectibleTypesMap() {
311
- if (this.cacheFlagToCollectibleTypesMap.size > 0) {
312
- return;
313
- }
314
-
315
301
  for (const cacheFlag of CACHE_FLAG_VALUES) {
316
302
  const collectiblesSet = new Set<CollectibleType>();
317
303
 
@@ -326,10 +312,6 @@ export class ModdedElementSets extends Feature {
326
312
  }
327
313
 
328
314
  private lazyInitCacheFlagToTrinketTypesMap() {
329
- if (this.cacheFlagToTrinketTypesMap.size > 0) {
330
- return;
331
- }
332
-
333
315
  for (const cacheFlag of CACHE_FLAG_VALUES) {
334
316
  const trinketsSet = new Set<TrinketType>();
335
317
 
@@ -344,10 +326,6 @@ export class ModdedElementSets extends Feature {
344
326
  }
345
327
 
346
328
  private lazyInitFlyingCollectibleTypesSet() {
347
- if (this.flyingCollectibleTypesSet.size > 0) {
348
- return;
349
- }
350
-
351
329
  // Instead of manually compiling a list of collectibles that grant flying, we can instead
352
330
  // dynamically look for collectibles that have `CacheFlag.FLYING`.
353
331
  this.flyingCollectibleTypesSet = copySet(
@@ -379,10 +357,6 @@ export class ModdedElementSets extends Feature {
379
357
  }
380
358
 
381
359
  private lazyInitFlyingTrinketTypesSet() {
382
- if (this.flyingTrinketTypesSet.size > 0) {
383
- return;
384
- }
385
-
386
360
  // Instead of manually compiling a list of trinkets that grant flying, we can instead
387
361
  // dynamically look for collectibles that have `CacheFlag.FLYING`.
388
362
  this.flyingTrinketTypesSet = copySet(
@@ -399,10 +373,6 @@ export class ModdedElementSets extends Feature {
399
373
  }
400
374
 
401
375
  private lazyInitEdenCollectibleTypesSet() {
402
- if (this.edenActiveCollectibleTypesSet.size > 0) {
403
- return;
404
- }
405
-
406
376
  for (const collectibleType of this.getCollectibleArray()) {
407
377
  if (
408
378
  isHiddenCollectible(collectibleType) ||
@@ -422,10 +392,6 @@ export class ModdedElementSets extends Feature {
422
392
  }
423
393
 
424
394
  private lazyInitCardTypes() {
425
- if (this.itemConfigCardTypeToCardTypeMap.size > 0) {
426
- return;
427
- }
428
-
429
395
  // The card type to cards map should be valid for every card type, so we initialize it with
430
396
  // empty sets.
431
397
  for (const itemConfigCardType of ITEM_CONFIG_CARD_TYPE_VALUES) {
@@ -471,7 +437,7 @@ export class ModdedElementSets extends Feature {
471
437
  */
472
438
  @Exported
473
439
  public getCardArray(): readonly CardType[] {
474
- this.lazyInitModdedCardTypes();
440
+ this.lazyInit();
475
441
  return this.allCardTypesArray;
476
442
  }
477
443
 
@@ -488,7 +454,7 @@ export class ModdedElementSets extends Feature {
488
454
  */
489
455
  @Exported
490
456
  public getCardSet(): ReadonlySet<CardType> {
491
- this.lazyInitModdedCardTypes();
457
+ this.lazyInit();
492
458
  return this.allCardTypesSet;
493
459
  }
494
460
 
@@ -507,9 +473,7 @@ export class ModdedElementSets extends Feature {
507
473
  public getCardTypesOfType(
508
474
  ...itemConfigCardTypes: ItemConfigCardType[]
509
475
  ): Set<CardType> {
510
- if (this.itemConfigCardTypeToCardTypeMap.size === 0) {
511
- this.lazyInitCardTypes();
512
- }
476
+ this.lazyInit();
513
477
 
514
478
  const matchingCardTypes = new Set<CardType>();
515
479
  for (const itemConfigCardType of itemConfigCardTypes) {
@@ -543,7 +507,7 @@ export class ModdedElementSets extends Feature {
543
507
  */
544
508
  @Exported
545
509
  public getCollectibleArray(): readonly CollectibleType[] {
546
- this.lazyInitModdedCollectibleTypes();
510
+ this.lazyInit();
547
511
  return this.allCollectibleTypesArray;
548
512
  }
549
513
 
@@ -562,7 +526,7 @@ export class ModdedElementSets extends Feature {
562
526
  */
563
527
  @Exported
564
528
  public getCollectibleSet(): ReadonlySet<CollectibleType> {
565
- this.lazyInitModdedCollectibleTypes();
529
+ this.lazyInit();
566
530
  return this.allCollectibleTypesSet;
567
531
  }
568
532
 
@@ -613,7 +577,7 @@ export class ModdedElementSets extends Feature {
613
577
  public getCollectiblesWithCacheFlag(
614
578
  cacheFlag: CacheFlag,
615
579
  ): ReadonlySet<CollectibleType> {
616
- this.lazyInitCacheFlagToCollectibleTypesMap();
580
+ this.lazyInit();
617
581
 
618
582
  const collectiblesSet = this.cacheFlagToCollectibleTypesMap.get(cacheFlag);
619
583
  if (collectiblesSet === undefined) {
@@ -643,7 +607,7 @@ export class ModdedElementSets extends Feature {
643
607
  public getCollectiblesWithTag(
644
608
  itemConfigTag: ItemConfigTag,
645
609
  ): ReadonlySet<CollectibleType> {
646
- this.lazyInitTagToCollectibleTypesMap();
610
+ this.lazyInit();
647
611
 
648
612
  const collectibleTypes = this.tagToCollectibleTypesMap.get(itemConfigTag);
649
613
  assertDefined(
@@ -666,7 +630,7 @@ export class ModdedElementSets extends Feature {
666
630
  */
667
631
  @Exported
668
632
  public getEdenActiveCollectibles(): ReadonlySet<CollectibleType> {
669
- this.lazyInitEdenCollectibleTypesSet();
633
+ this.lazyInit();
670
634
  return this.edenActiveCollectibleTypesSet;
671
635
  }
672
636
 
@@ -682,7 +646,7 @@ export class ModdedElementSets extends Feature {
682
646
  */
683
647
  @Exported
684
648
  public getEdenPassiveCollectibles(): ReadonlySet<CollectibleType> {
685
- this.lazyInitEdenCollectibleTypesSet();
649
+ this.lazyInit();
686
650
  return this.edenPassiveCollectibleTypesSet;
687
651
  }
688
652
 
@@ -706,7 +670,7 @@ export class ModdedElementSets extends Feature {
706
670
  public getFlyingCollectibles(
707
671
  includeConditionalItems: boolean,
708
672
  ): ReadonlySet<CollectibleType> {
709
- this.lazyInitFlyingCollectibleTypesSet();
673
+ this.lazyInit();
710
674
 
711
675
  return includeConditionalItems
712
676
  ? this.flyingCollectibleTypesSet
@@ -724,7 +688,7 @@ export class ModdedElementSets extends Feature {
724
688
  */
725
689
  @Exported
726
690
  public getFlyingTrinkets(): ReadonlySet<TrinketType> {
727
- this.lazyInitFlyingTrinketTypesSet();
691
+ this.lazyInit();
728
692
 
729
693
  return this.flyingTrinketTypesSet;
730
694
  }
@@ -742,7 +706,7 @@ export class ModdedElementSets extends Feature {
742
706
  */
743
707
  @Exported
744
708
  public getModdedCardArray(): readonly CardType[] {
745
- this.lazyInitModdedCardTypes();
709
+ this.lazyInit();
746
710
  return this.moddedCardTypesArray;
747
711
  }
748
712
 
@@ -759,7 +723,7 @@ export class ModdedElementSets extends Feature {
759
723
  */
760
724
  @Exported
761
725
  public getModdedCardSet(): ReadonlySet<CardType> {
762
- this.lazyInitModdedCardTypes();
726
+ this.lazyInit();
763
727
  return this.moddedCardTypesSet;
764
728
  }
765
729
 
@@ -777,7 +741,7 @@ export class ModdedElementSets extends Feature {
777
741
  */
778
742
  @Exported
779
743
  public getModdedCollectibleArray(): readonly CollectibleType[] {
780
- this.lazyInitModdedCollectibleTypes();
744
+ this.lazyInit();
781
745
  return this.moddedCollectibleTypesArray;
782
746
  }
783
747
 
@@ -795,7 +759,7 @@ export class ModdedElementSets extends Feature {
795
759
  */
796
760
  @Exported
797
761
  public getModdedCollectibleSet(): ReadonlySet<CollectibleType> {
798
- this.lazyInitModdedCollectibleTypes();
762
+ this.lazyInit();
799
763
  return this.moddedCollectibleTypesSet;
800
764
  }
801
765
 
@@ -812,7 +776,7 @@ export class ModdedElementSets extends Feature {
812
776
  */
813
777
  @Exported
814
778
  public getModdedTrinketArray(): readonly TrinketType[] {
815
- this.lazyInitModdedTrinketTypes();
779
+ this.lazyInit();
816
780
  return this.moddedTrinketTypesArray;
817
781
  }
818
782
 
@@ -829,7 +793,7 @@ export class ModdedElementSets extends Feature {
829
793
  */
830
794
  @Exported
831
795
  public getModdedTrinketSet(): ReadonlySet<TrinketType> {
832
- this.lazyInitModdedTrinketTypes();
796
+ this.lazyInit();
833
797
  return this.moddedTrinketTypesSet;
834
798
  }
835
799
 
@@ -1022,7 +986,7 @@ export class ModdedElementSets extends Feature {
1022
986
  seedOrRNG: Seed | RNG = getRandomSeed(),
1023
987
  exceptions: CardType[] = [],
1024
988
  ): CardType {
1025
- this.lazyInitCardTypes();
989
+ this.lazyInit();
1026
990
  return getRandomSetElement(this.cardSet, seedOrRNG, exceptions);
1027
991
  }
1028
992
 
@@ -1085,7 +1049,7 @@ export class ModdedElementSets extends Feature {
1085
1049
  seedOrRNG: Seed | RNG = getRandomSeed(),
1086
1050
  exceptions: CollectibleType[] | readonly CollectibleType[] = [],
1087
1051
  ): CollectibleType {
1088
- this.lazyInitEdenCollectibleTypesSet();
1052
+ this.lazyInit();
1089
1053
  return getRandomSetElement(
1090
1054
  this.edenPassiveCollectibleTypesSet,
1091
1055
  seedOrRNG,
@@ -1111,7 +1075,7 @@ export class ModdedElementSets extends Feature {
1111
1075
  seedOrRNG: Seed | RNG = getRandomSeed(),
1112
1076
  exceptions: CollectibleType[] | readonly CollectibleType[] = [],
1113
1077
  ): CollectibleType {
1114
- this.lazyInitEdenCollectibleTypesSet();
1078
+ this.lazyInit();
1115
1079
  return getRandomSetElement(
1116
1080
  this.edenPassiveCollectibleTypesSet,
1117
1081
  seedOrRNG,
@@ -1132,7 +1096,7 @@ export class ModdedElementSets extends Feature {
1132
1096
  */
1133
1097
  @Exported
1134
1098
  public getTrinketArray(): readonly TrinketType[] {
1135
- this.lazyInitModdedTrinketTypes();
1099
+ this.lazyInit();
1136
1100
  return this.allTrinketTypesArray;
1137
1101
  }
1138
1102
 
@@ -1149,7 +1113,7 @@ export class ModdedElementSets extends Feature {
1149
1113
  */
1150
1114
  @Exported
1151
1115
  public getTrinketSet(): ReadonlySet<TrinketType> {
1152
- this.lazyInitModdedTrinketTypes();
1116
+ this.lazyInit();
1153
1117
  return this.allTrinketTypesSet;
1154
1118
  }
1155
1119
 
@@ -1166,7 +1130,7 @@ export class ModdedElementSets extends Feature {
1166
1130
  public getTrinketsWithCacheFlag(
1167
1131
  cacheFlag: CacheFlag,
1168
1132
  ): ReadonlySet<TrinketType> {
1169
- this.lazyInitCacheFlagToTrinketTypesMap();
1133
+ this.lazyInit();
1170
1134
 
1171
1135
  const trinketsSet = this.cacheFlagToTrinketTypesMap.get(cacheFlag);
1172
1136
  if (trinketsSet === undefined) {
@@ -1186,7 +1150,7 @@ export class ModdedElementSets extends Feature {
1186
1150
  */
1187
1151
  @Exported
1188
1152
  public getVanillaCardArray(): readonly CardType[] {
1189
- this.lazyInitVanillaCardTypes();
1153
+ this.lazyInit();
1190
1154
  return this.vanillaCardTypesArray;
1191
1155
  }
1192
1156
 
@@ -1200,7 +1164,7 @@ export class ModdedElementSets extends Feature {
1200
1164
  */
1201
1165
  @Exported
1202
1166
  public getVanillaCardSet(): ReadonlySet<CardType> {
1203
- this.lazyInitVanillaCardTypes();
1167
+ this.lazyInit();
1204
1168
  return this.vanillaCardTypesSet;
1205
1169
  }
1206
1170
 
@@ -1214,7 +1178,7 @@ export class ModdedElementSets extends Feature {
1214
1178
  */
1215
1179
  @Exported
1216
1180
  public getVanillaCollectibleArray(): readonly CollectibleType[] {
1217
- this.lazyInitVanillaCollectibleTypes();
1181
+ this.lazyInit();
1218
1182
  return this.vanillaCollectibleTypesArray;
1219
1183
  }
1220
1184
 
@@ -1228,7 +1192,7 @@ export class ModdedElementSets extends Feature {
1228
1192
  */
1229
1193
  @Exported
1230
1194
  public getVanillaCollectibleSet(): ReadonlySet<CollectibleType> {
1231
- this.lazyInitVanillaCollectibleTypes();
1195
+ this.lazyInit();
1232
1196
  return this.vanillaCollectibleTypesSet;
1233
1197
  }
1234
1198
 
@@ -1242,7 +1206,7 @@ export class ModdedElementSets extends Feature {
1242
1206
  */
1243
1207
  @Exported
1244
1208
  public getVanillaTrinketArray(): readonly TrinketType[] {
1245
- this.lazyInitVanillaTrinketTypes();
1209
+ this.lazyInit();
1246
1210
  return this.vanillaTrinketTypesArray;
1247
1211
  }
1248
1212
 
@@ -1256,7 +1220,7 @@ export class ModdedElementSets extends Feature {
1256
1220
  */
1257
1221
  @Exported
1258
1222
  public getVanillaTrinketSet(): ReadonlySet<TrinketType> {
1259
- this.lazyInitVanillaTrinketTypes();
1223
+ this.lazyInit();
1260
1224
  return this.vanillaTrinketTypesSet;
1261
1225
  }
1262
1226
  }