isaacscript-common 21.8.1 → 21.8.2

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.
@@ -1560,6 +1560,7 @@ declare abstract class CustomCallback<T extends ModCallbackCustom> extends Featu
1560
1560
  * See "shouldFire.ts" for methods tailored to specific kinds of callbacks.
1561
1561
  */
1562
1562
  protected shouldFire: (fireArgs: FireArgs<T>, optionalArgs: OptionalArgs<T>) => boolean;
1563
+ logSubscriptions(): void;
1563
1564
  }
1564
1565
 
1565
1566
  declare class CustomGridEntities extends Feature {
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 21.8.1
3
+ isaacscript-common 21.8.2
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -15469,6 +15469,43 @@ function ____exports.shouldFireTrinketType(self, fireArgs, optionalArgs)
15469
15469
  local callbackTrinketType = table.unpack(optionalArgs)
15470
15470
  return callbackTrinketType == nil or callbackTrinketType == trinketType
15471
15471
  end
15472
+ return ____exports
15473
+ end,
15474
+ ["src.functions.log"] = function(...)
15475
+ local ____exports = {}
15476
+ function ____exports.getParentFunctionDescription(levels)
15477
+ if levels == nil then
15478
+ levels = 3
15479
+ end
15480
+ if debug ~= nil then
15481
+ local debugTable = debug.getinfo(levels)
15482
+ if debugTable ~= nil then
15483
+ return (tostring(debugTable.name) .. ":") .. tostring(debugTable.linedefined)
15484
+ end
15485
+ end
15486
+ if SandboxGetParentFunctionDescription ~= nil then
15487
+ return SandboxGetParentFunctionDescription(levels)
15488
+ end
15489
+ return nil
15490
+ end
15491
+ function ____exports.log(msg, includeParentFunction)
15492
+ if includeParentFunction == nil then
15493
+ includeParentFunction = true
15494
+ end
15495
+ local ____includeParentFunction_0
15496
+ if includeParentFunction then
15497
+ ____includeParentFunction_0 = ____exports.getParentFunctionDescription()
15498
+ else
15499
+ ____includeParentFunction_0 = nil
15500
+ end
15501
+ local parentFunctionDescription = ____includeParentFunction_0
15502
+ local debugMsg = parentFunctionDescription == nil and msg or (parentFunctionDescription .. " - ") .. msg
15503
+ Isaac.DebugString(debugMsg)
15504
+ end
15505
+ function ____exports.logAndPrint(self, msg)
15506
+ ____exports.log(msg)
15507
+ print(msg)
15508
+ end
15472
15509
  return ____exports
15473
15510
  end,
15474
15511
  ["src.functions.types"] = function(...)
@@ -15591,6 +15628,158 @@ function ____exports.sortTwoDimensionalArray(self, a, b)
15591
15628
  end
15592
15629
  return sortNormal(nil, firstElement1, firstElement2)
15593
15630
  end
15631
+ return ____exports
15632
+ end,
15633
+ ["src.classes.DefaultMap"] = function(...)
15634
+ local ____lualib = require("lualib_bundle")
15635
+ local __TS__Class = ____lualib.__TS__Class
15636
+ local Map = ____lualib.Map
15637
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
15638
+ local __TS__TypeOf = ____lualib.__TS__TypeOf
15639
+ local __TS__New = ____lualib.__TS__New
15640
+ local ____exports = {}
15641
+ local ____types = require("src.functions.types")
15642
+ local isFunction = ____types.isFunction
15643
+ local isPrimitive = ____types.isPrimitive
15644
+ ____exports.DefaultMap = __TS__Class()
15645
+ local DefaultMap = ____exports.DefaultMap
15646
+ DefaultMap.name = "DefaultMap"
15647
+ __TS__ClassExtends(DefaultMap, Map)
15648
+ function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
15649
+ local argIsPrimitive = isPrimitive(nil, defaultValueOrFactoryFunction)
15650
+ local argIsFunction = isFunction(nil, defaultValueOrFactoryFunction)
15651
+ if not argIsPrimitive and not argIsFunction then
15652
+ error(("Failed to instantiate a DefaultMap since the provided default value was of type \"" .. __TS__TypeOf(defaultValueOrFactoryFunction)) .. "\". This error usually means that you are trying to use an array (or some other non-primitive data structure that is passed by reference) as the default value. Instead, return the data structure in a factory function, like \"() => []\". See the DefaultMap documentation for more details.")
15653
+ end
15654
+ Map.prototype.____constructor(self, initializerArray)
15655
+ if argIsFunction then
15656
+ self.defaultValue = nil
15657
+ self.defaultValueFactory = defaultValueOrFactoryFunction
15658
+ else
15659
+ self.defaultValue = defaultValueOrFactoryFunction
15660
+ self.defaultValueFactory = nil
15661
+ end
15662
+ end
15663
+ function DefaultMap.prototype.getAndSetDefault(self, key, ...)
15664
+ local value = Map.prototype.get(self, key)
15665
+ if value ~= nil then
15666
+ return value
15667
+ end
15668
+ local defaultValue = self:getDefaultValue(...)
15669
+ self:set(key, defaultValue)
15670
+ return defaultValue
15671
+ end
15672
+ function DefaultMap.prototype.getDefaultValue(self, ...)
15673
+ if self.defaultValue ~= nil then
15674
+ return self.defaultValue
15675
+ end
15676
+ if self.defaultValueFactory ~= nil then
15677
+ return self:defaultValueFactory(...)
15678
+ end
15679
+ error("A DefaultMap was incorrectly instantiated.")
15680
+ end
15681
+ function DefaultMap.prototype.getConstructorArg(self)
15682
+ if self.defaultValue ~= nil then
15683
+ return self.defaultValue
15684
+ end
15685
+ if self.defaultValueFactory ~= nil then
15686
+ return self.defaultValueFactory
15687
+ end
15688
+ error("A DefaultMap was incorrectly instantiated.")
15689
+ end
15690
+ local function test(self)
15691
+ local myDefaultMapBoolean = __TS__New(____exports.DefaultMap, false)
15692
+ local myDefaultMapBooleanFactory = __TS__New(
15693
+ ____exports.DefaultMap,
15694
+ function() return false end
15695
+ )
15696
+ local myDefaultMapBooleanWithoutParams = __TS__New(____exports.DefaultMap, false)
15697
+ local myDefaultMapNumber = __TS__New(____exports.DefaultMap, 123)
15698
+ local myDefaultMapNumberFactory = __TS__New(
15699
+ ____exports.DefaultMap,
15700
+ function() return 123 end
15701
+ )
15702
+ local myDefaultMapNumberWithoutParams = __TS__New(____exports.DefaultMap, 123)
15703
+ local myDefaultMapString = __TS__New(____exports.DefaultMap, "foo")
15704
+ local myDefaultMapStringFactory = __TS__New(
15705
+ ____exports.DefaultMap,
15706
+ function() return "foo" end
15707
+ )
15708
+ local myDefaultMapStringWithoutParams = __TS__New(____exports.DefaultMap, "foo")
15709
+ local myDefaultMapArray = __TS__New(
15710
+ ____exports.DefaultMap,
15711
+ function() return {} end
15712
+ )
15713
+ local myDefaultMapArrayWithoutParams = __TS__New(
15714
+ ____exports.DefaultMap,
15715
+ function() return {} end
15716
+ )
15717
+ local myDefaultMapMap = __TS__New(
15718
+ ____exports.DefaultMap,
15719
+ function() return __TS__New(Map) end
15720
+ )
15721
+ local myDefaultMapMapWithoutParams = __TS__New(
15722
+ ____exports.DefaultMap,
15723
+ function() return __TS__New(Map) end
15724
+ )
15725
+ end
15726
+ return ____exports
15727
+ end,
15728
+ ["src.interfaces.TSTLClassMetatable"] = function(...)
15729
+ local ____exports = {}
15730
+ return ____exports
15731
+ end,
15732
+ ["src.types.TSTLClass"] = function(...)
15733
+ local ____exports = {}
15734
+ return ____exports
15735
+ end,
15736
+ ["src.functions.tstlClass"] = function(...)
15737
+ local ____exports = {}
15738
+ local ____types = require("src.functions.types")
15739
+ local isTable = ____types.isTable
15740
+ function ____exports.getTSTLClassConstructor(self, object)
15741
+ if not isTable(nil, object) then
15742
+ return nil
15743
+ end
15744
+ local metatable = getmetatable(object)
15745
+ if metatable == nil then
15746
+ return nil
15747
+ end
15748
+ return metatable.constructor
15749
+ end
15750
+ function ____exports.getTSTLClassName(self, object)
15751
+ local constructor = ____exports.getTSTLClassConstructor(nil, object)
15752
+ if constructor == nil then
15753
+ return nil
15754
+ end
15755
+ return constructor.name
15756
+ end
15757
+ function ____exports.isDefaultMap(self, object)
15758
+ local className = ____exports.getTSTLClassName(nil, object)
15759
+ return className == "DefaultMap"
15760
+ end
15761
+ function ____exports.isTSTLClass(self, object)
15762
+ local tstlClassName = ____exports.getTSTLClassName(nil, object)
15763
+ return tstlClassName ~= nil
15764
+ end
15765
+ function ____exports.isTSTLMap(self, object)
15766
+ local className = ____exports.getTSTLClassName(nil, object)
15767
+ return className == "Map"
15768
+ end
15769
+ function ____exports.isTSTLSet(self, object)
15770
+ local className = ____exports.getTSTLClassName(nil, object)
15771
+ return className == "Set"
15772
+ end
15773
+ function ____exports.newTSTLClass(self, oldClass)
15774
+ local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
15775
+ if constructor == nil then
15776
+ error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
15777
+ end
15778
+ local newClass = {}
15779
+ local newClassMetatable = setmetatable(newClass, constructor.prototype)
15780
+ newClassMetatable:____constructor()
15781
+ return newClass
15782
+ end
15594
15783
  return ____exports
15595
15784
  end,
15596
15785
  ["src.core.cachedClasses"] = function(...)
@@ -17591,9 +17780,14 @@ local __TS__Spread = ____lualib.__TS__Spread
17591
17780
  local __TS__ArraySort = ____lualib.__TS__ArraySort
17592
17781
  local __TS__ArrayFindIndex = ____lualib.__TS__ArrayFindIndex
17593
17782
  local __TS__ArraySplice = ____lualib.__TS__ArraySplice
17783
+ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
17594
17784
  local ____exports = {}
17785
+ local ____log = require("src.functions.log")
17786
+ local log = ____log.log
17595
17787
  local ____sort = require("src.functions.sort")
17596
17788
  local sortObjectArrayByKey = ____sort.sortObjectArrayByKey
17789
+ local ____tstlClass = require("src.functions.tstlClass")
17790
+ local getTSTLClassName = ____tstlClass.getTSTLClassName
17597
17791
  local ____Feature = require("src.classes.private.Feature")
17598
17792
  local Feature = ____Feature.Feature
17599
17793
  ____exports.CustomCallback = __TS__Class()
@@ -17644,6 +17838,20 @@ function CustomCallback.prototype.removeSubscriber(self, callback)
17644
17838
  __TS__ArraySplice(self.subscriptions, subscriptionIndexMatchingCallback, 1)
17645
17839
  end
17646
17840
  end
17841
+ function CustomCallback.prototype.logSubscriptions(self)
17842
+ local tstlClassName = getTSTLClassName(nil, self)
17843
+ log("Logging subscriptions for custom callback: " .. tostring(tstlClassName))
17844
+ if #self.subscriptions == 0 then
17845
+ log("- n/a (no subscriptions)")
17846
+ else
17847
+ __TS__ArrayForEach(
17848
+ self.subscriptions,
17849
+ function(____, subscription, i)
17850
+ log((("- " .. tostring(i + 1)) .. " - priority: ") .. tostring(subscription.priority))
17851
+ end
17852
+ )
17853
+ end
17854
+ end
17647
17855
  return ____exports
17648
17856
  end,
17649
17857
  ["src.classes.callbacks.EntityTakeDmgFilter"] = function(...)
@@ -19715,158 +19923,6 @@ function ____exports.spriteEquals(self, sprite1, sprite2, layerID, xStart, xFini
19715
19923
  end
19716
19924
  return true
19717
19925
  end
19718
- return ____exports
19719
- end,
19720
- ["src.classes.DefaultMap"] = function(...)
19721
- local ____lualib = require("lualib_bundle")
19722
- local __TS__Class = ____lualib.__TS__Class
19723
- local Map = ____lualib.Map
19724
- local __TS__ClassExtends = ____lualib.__TS__ClassExtends
19725
- local __TS__TypeOf = ____lualib.__TS__TypeOf
19726
- local __TS__New = ____lualib.__TS__New
19727
- local ____exports = {}
19728
- local ____types = require("src.functions.types")
19729
- local isFunction = ____types.isFunction
19730
- local isPrimitive = ____types.isPrimitive
19731
- ____exports.DefaultMap = __TS__Class()
19732
- local DefaultMap = ____exports.DefaultMap
19733
- DefaultMap.name = "DefaultMap"
19734
- __TS__ClassExtends(DefaultMap, Map)
19735
- function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
19736
- local argIsPrimitive = isPrimitive(nil, defaultValueOrFactoryFunction)
19737
- local argIsFunction = isFunction(nil, defaultValueOrFactoryFunction)
19738
- if not argIsPrimitive and not argIsFunction then
19739
- error(("Failed to instantiate a DefaultMap since the provided default value was of type \"" .. __TS__TypeOf(defaultValueOrFactoryFunction)) .. "\". This error usually means that you are trying to use an array (or some other non-primitive data structure that is passed by reference) as the default value. Instead, return the data structure in a factory function, like \"() => []\". See the DefaultMap documentation for more details.")
19740
- end
19741
- Map.prototype.____constructor(self, initializerArray)
19742
- if argIsFunction then
19743
- self.defaultValue = nil
19744
- self.defaultValueFactory = defaultValueOrFactoryFunction
19745
- else
19746
- self.defaultValue = defaultValueOrFactoryFunction
19747
- self.defaultValueFactory = nil
19748
- end
19749
- end
19750
- function DefaultMap.prototype.getAndSetDefault(self, key, ...)
19751
- local value = Map.prototype.get(self, key)
19752
- if value ~= nil then
19753
- return value
19754
- end
19755
- local defaultValue = self:getDefaultValue(...)
19756
- self:set(key, defaultValue)
19757
- return defaultValue
19758
- end
19759
- function DefaultMap.prototype.getDefaultValue(self, ...)
19760
- if self.defaultValue ~= nil then
19761
- return self.defaultValue
19762
- end
19763
- if self.defaultValueFactory ~= nil then
19764
- return self:defaultValueFactory(...)
19765
- end
19766
- error("A DefaultMap was incorrectly instantiated.")
19767
- end
19768
- function DefaultMap.prototype.getConstructorArg(self)
19769
- if self.defaultValue ~= nil then
19770
- return self.defaultValue
19771
- end
19772
- if self.defaultValueFactory ~= nil then
19773
- return self.defaultValueFactory
19774
- end
19775
- error("A DefaultMap was incorrectly instantiated.")
19776
- end
19777
- local function test(self)
19778
- local myDefaultMapBoolean = __TS__New(____exports.DefaultMap, false)
19779
- local myDefaultMapBooleanFactory = __TS__New(
19780
- ____exports.DefaultMap,
19781
- function() return false end
19782
- )
19783
- local myDefaultMapBooleanWithoutParams = __TS__New(____exports.DefaultMap, false)
19784
- local myDefaultMapNumber = __TS__New(____exports.DefaultMap, 123)
19785
- local myDefaultMapNumberFactory = __TS__New(
19786
- ____exports.DefaultMap,
19787
- function() return 123 end
19788
- )
19789
- local myDefaultMapNumberWithoutParams = __TS__New(____exports.DefaultMap, 123)
19790
- local myDefaultMapString = __TS__New(____exports.DefaultMap, "foo")
19791
- local myDefaultMapStringFactory = __TS__New(
19792
- ____exports.DefaultMap,
19793
- function() return "foo" end
19794
- )
19795
- local myDefaultMapStringWithoutParams = __TS__New(____exports.DefaultMap, "foo")
19796
- local myDefaultMapArray = __TS__New(
19797
- ____exports.DefaultMap,
19798
- function() return {} end
19799
- )
19800
- local myDefaultMapArrayWithoutParams = __TS__New(
19801
- ____exports.DefaultMap,
19802
- function() return {} end
19803
- )
19804
- local myDefaultMapMap = __TS__New(
19805
- ____exports.DefaultMap,
19806
- function() return __TS__New(Map) end
19807
- )
19808
- local myDefaultMapMapWithoutParams = __TS__New(
19809
- ____exports.DefaultMap,
19810
- function() return __TS__New(Map) end
19811
- )
19812
- end
19813
- return ____exports
19814
- end,
19815
- ["src.interfaces.TSTLClassMetatable"] = function(...)
19816
- local ____exports = {}
19817
- return ____exports
19818
- end,
19819
- ["src.types.TSTLClass"] = function(...)
19820
- local ____exports = {}
19821
- return ____exports
19822
- end,
19823
- ["src.functions.tstlClass"] = function(...)
19824
- local ____exports = {}
19825
- local ____types = require("src.functions.types")
19826
- local isTable = ____types.isTable
19827
- function ____exports.getTSTLClassConstructor(self, object)
19828
- if not isTable(nil, object) then
19829
- return nil
19830
- end
19831
- local metatable = getmetatable(object)
19832
- if metatable == nil then
19833
- return nil
19834
- end
19835
- return metatable.constructor
19836
- end
19837
- function ____exports.getTSTLClassName(self, object)
19838
- local constructor = ____exports.getTSTLClassConstructor(nil, object)
19839
- if constructor == nil then
19840
- return nil
19841
- end
19842
- return constructor.name
19843
- end
19844
- function ____exports.isDefaultMap(self, object)
19845
- local className = ____exports.getTSTLClassName(nil, object)
19846
- return className == "DefaultMap"
19847
- end
19848
- function ____exports.isTSTLClass(self, object)
19849
- local tstlClassName = ____exports.getTSTLClassName(nil, object)
19850
- return tstlClassName ~= nil
19851
- end
19852
- function ____exports.isTSTLMap(self, object)
19853
- local className = ____exports.getTSTLClassName(nil, object)
19854
- return className == "Map"
19855
- end
19856
- function ____exports.isTSTLSet(self, object)
19857
- local className = ____exports.getTSTLClassName(nil, object)
19858
- return className == "Set"
19859
- end
19860
- function ____exports.newTSTLClass(self, oldClass)
19861
- local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
19862
- if constructor == nil then
19863
- error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
19864
- end
19865
- local newClass = {}
19866
- local newClassMetatable = setmetatable(newClass, constructor.prototype)
19867
- newClassMetatable:____constructor()
19868
- return newClass
19869
- end
19870
19926
  return ____exports
19871
19927
  end,
19872
19928
  ["src.functions.entities"] = function(...)
@@ -23815,43 +23871,6 @@ function ____exports.spawnTearWithSeed(self, tearVariant, subType, positionOrGri
23815
23871
  seedOrRNG
23816
23872
  )
23817
23873
  end
23818
- return ____exports
23819
- end,
23820
- ["src.functions.log"] = function(...)
23821
- local ____exports = {}
23822
- function ____exports.getParentFunctionDescription(levels)
23823
- if levels == nil then
23824
- levels = 3
23825
- end
23826
- if debug ~= nil then
23827
- local debugTable = debug.getinfo(levels)
23828
- if debugTable ~= nil then
23829
- return (tostring(debugTable.name) .. ":") .. tostring(debugTable.linedefined)
23830
- end
23831
- end
23832
- if SandboxGetParentFunctionDescription ~= nil then
23833
- return SandboxGetParentFunctionDescription(levels)
23834
- end
23835
- return nil
23836
- end
23837
- function ____exports.log(msg, includeParentFunction)
23838
- if includeParentFunction == nil then
23839
- includeParentFunction = true
23840
- end
23841
- local ____includeParentFunction_0
23842
- if includeParentFunction then
23843
- ____includeParentFunction_0 = ____exports.getParentFunctionDescription()
23844
- else
23845
- ____includeParentFunction_0 = nil
23846
- end
23847
- local parentFunctionDescription = ____includeParentFunction_0
23848
- local debugMsg = parentFunctionDescription == nil and msg or (parentFunctionDescription .. " - ") .. msg
23849
- Isaac.DebugString(debugMsg)
23850
- end
23851
- function ____exports.logAndPrint(self, msg)
23852
- ____exports.log(msg)
23853
- print(msg)
23854
- end
23855
23874
  return ____exports
23856
23875
  end,
23857
23876
  ["src.functions.run"] = function(...)
@@ -50369,8 +50388,9 @@ function ModUpgraded.prototype.initFeature(self, feature)
50369
50388
  if feature.customCallbacksUsed ~= nil then
50370
50389
  for ____, callbackTuple in ipairs(feature.customCallbacksUsed) do
50371
50390
  local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple)
50372
- self:AddCallbackCustom(
50391
+ self:AddPriorityCallbackCustom(
50373
50392
  modCallback,
50393
+ CallbackPriority.IMPORTANT,
50374
50394
  callbackFunc,
50375
50395
  table.unpack(optionalArgs or ({}))
50376
50396
  )
@@ -1 +1 @@
1
- {"version":3,"file":"ModUpgraded.d.ts","source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CAAC,CAAC,GAC1C,IAAI;IAOP;;;OAGG;IACI,eAAe,IAAI,IAAI;IA0C9B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAiEnB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAsDrB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAM5B"}
@@ -204,8 +204,9 @@ function ModUpgraded.prototype.initFeature(self, feature)
204
204
  if feature.customCallbacksUsed ~= nil then
205
205
  for ____, callbackTuple in ipairs(feature.customCallbacksUsed) do
206
206
  local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple)
207
- self:AddCallbackCustom(
207
+ self:AddPriorityCallbackCustom(
208
208
  modCallback,
209
+ CallbackPriority.IMPORTANT,
209
210
  callbackFunc,
210
211
  table.unpack(optionalArgs or ({}))
211
212
  )
@@ -24,5 +24,6 @@ export declare abstract class CustomCallback<T extends ModCallbackCustom> extend
24
24
  * See "shouldFire.ts" for methods tailored to specific kinds of callbacks.
25
25
  */
26
26
  protected shouldFire: (fireArgs: FireArgs<T>, optionalArgs: OptionalArgs<T>) => boolean;
27
+ logSubscriptions(): void;
27
28
  }
28
29
  //# sourceMappingURL=CustomCallback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCallback.d.ts","sourceRoot":"","sources":["../../../../src/classes/private/CustomCallback.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,iBAAiB,IAAI,UAAU,CAC5D,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAClC,CAAC;AAEF,MAA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C,CAAC,CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAAI,WAAW,CACjE,2BAA2B,CAAC,CAAC,CAAC,CAC/B,CAAC;AAQF;;;GAGG;AACH,8BAAsB,cAAc,CAClC,CAAC,SAAS,iBAAiB,CAC3B,SAAQ,OAAO;IACf,OAAO,CAAC,aAAa,CAA8B;IAE5C,aAAa,CAClB,QAAQ,EAAE,gBAAgB,GAAG,GAAG,EAChC,YAAY,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/C,GAAG,YAAY,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,GAC3D,IAAI;IAUP;;;OAGG;IACI,gBAAgB,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAYnE,IAAI,gBACI,SAAS,CAAC,CAAC,KACvB,WAAW,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAc9C;IAEF;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,CACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,KAC1B,OAAO,CAAc;IAEnB,gBAAgB,IAAI,IAAI;CAYhC"}
@@ -5,9 +5,14 @@ local __TS__Spread = ____lualib.__TS__Spread
5
5
  local __TS__ArraySort = ____lualib.__TS__ArraySort
6
6
  local __TS__ArrayFindIndex = ____lualib.__TS__ArrayFindIndex
7
7
  local __TS__ArraySplice = ____lualib.__TS__ArraySplice
8
+ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
8
9
  local ____exports = {}
10
+ local ____log = require("src.functions.log")
11
+ local log = ____log.log
9
12
  local ____sort = require("src.functions.sort")
10
13
  local sortObjectArrayByKey = ____sort.sortObjectArrayByKey
14
+ local ____tstlClass = require("src.functions.tstlClass")
15
+ local getTSTLClassName = ____tstlClass.getTSTLClassName
11
16
  local ____Feature = require("src.classes.private.Feature")
12
17
  local Feature = ____Feature.Feature
13
18
  --- The base class for a custom callback. Individual custom callbacks (and validation callbacks) will
@@ -60,4 +65,18 @@ function CustomCallback.prototype.removeSubscriber(self, callback)
60
65
  __TS__ArraySplice(self.subscriptions, subscriptionIndexMatchingCallback, 1)
61
66
  end
62
67
  end
68
+ function CustomCallback.prototype.logSubscriptions(self)
69
+ local tstlClassName = getTSTLClassName(nil, self)
70
+ log("Logging subscriptions for custom callback: " .. tostring(tstlClassName))
71
+ if #self.subscriptions == 0 then
72
+ log("- n/a (no subscriptions)")
73
+ else
74
+ __TS__ArrayForEach(
75
+ self.subscriptions,
76
+ function(____, subscription, i)
77
+ log((("- " .. tostring(i + 1)) .. " - priority: ") .. tostring(subscription.priority))
78
+ end
79
+ )
80
+ end
81
+ end
63
82
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "21.8.1",
3
+ "version": "21.8.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -311,8 +311,9 @@ export class ModUpgraded implements Mod {
311
311
  for (const callbackTuple of feature.customCallbacksUsed) {
312
312
  const [modCallback, callbackFunc, optionalArgs] = callbackTuple;
313
313
  // TypeScript is not smart enough to know that the arguments match the function.
314
- (this.AddCallbackCustom as AnyFunction)(
314
+ (this.AddPriorityCallbackCustom as AnyFunction)(
315
315
  modCallback,
316
+ CallbackPriority.IMPORTANT,
316
317
  callbackFunc,
317
318
  ...(optionalArgs ?? []),
318
319
  );
@@ -1,6 +1,8 @@
1
1
  import { CallbackPriority } from "isaac-typescript-definitions/dist/src/enums/CallbackPriority";
2
2
  import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
3
+ import { log } from "../../functions/log";
3
4
  import { sortObjectArrayByKey } from "../../functions/sort";
5
+ import { getTSTLClassName } from "../../functions/tstlClass";
4
6
  import { AddCallbackParametersCustom } from "../../interfaces/private/AddCallbackParametersCustom";
5
7
  import { AllButFirst } from "../../types/AllButFirst";
6
8
  import { AnyFunction } from "../../types/AnyFunction";
@@ -85,4 +87,17 @@ export abstract class CustomCallback<
85
87
  fireArgs: FireArgs<T>,
86
88
  optionalArgs: OptionalArgs<T>,
87
89
  ) => boolean = () => true;
90
+
91
+ public logSubscriptions(): void {
92
+ const tstlClassName = getTSTLClassName(this);
93
+ log(`Logging subscriptions for custom callback: ${tstlClassName}`);
94
+
95
+ if (this.subscriptions.length === 0) {
96
+ log("- n/a (no subscriptions)");
97
+ } else {
98
+ this.subscriptions.forEach((subscription, i) => {
99
+ log(`- ${i + 1} - priority: ${subscription.priority}`);
100
+ });
101
+ }
102
+ }
88
103
  }