isaacscript-common 21.8.0 → 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 {
@@ -5922,9 +5923,9 @@ export declare function getRandomIndexFromWeightedArray<T>(weightedArray: Weight
5922
5923
  export declare function getRandomInt(min: int, max: int, seedOrRNG?: Seed | RNG, exceptions?: int[] | readonly int[]): int;
5923
5924
 
5924
5925
  /**
5925
- * Helper function to get a random item pool. This is as simple as getting a random value from the
5926
- * `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the Greed
5927
- * Mode item pools should be excluded if not playing in Greed Mode.
5926
+ * Helper function to get a random item pool. This is not as simple as getting a random value from
5927
+ * the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
5928
+ * Greed Mode item pools should be excluded if not playing in Greed Mode.
5928
5929
  */
5929
5930
  export declare function getRandomItemPool(): ItemPoolType;
5930
5931
 
@@ -13553,11 +13554,11 @@ declare class RunInNFrames extends Feature {
13553
13554
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13554
13555
  *
13555
13556
  * @param func The function to run.
13556
- * @param gameFrames The amount of game frames to wait before running the function.
13557
+ * @param numGameFrames The amount of game frames to wait before running the function.
13557
13558
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13558
13559
  * room is loaded in the interim. Default is false.
13559
13560
  */
13560
- runInNGameFrames(func: () => void, gameFrames: int, cancelIfRoomChanges?: boolean): void;
13561
+ runInNGameFrames(func: () => void, numGameFrames: int, cancelIfRoomChanges?: boolean): void;
13561
13562
  /**
13562
13563
  * Supply a function to run N render frames from now in the `POST_RENDER` callback.
13563
13564
  *
@@ -13571,11 +13572,11 @@ declare class RunInNFrames extends Feature {
13571
13572
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13572
13573
  *
13573
13574
  * @param func The function to run.
13574
- * @param renderFrames The amount of render frames to wait before running the function.
13575
+ * @param numRenderFrames The amount of render frames to wait before running the function.
13575
13576
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13576
13577
  * room is loaded in the interim. Default is false.
13577
13578
  */
13578
- runInNRenderFrames(func: () => void, renderFrames: int, cancelIfRoomChanges?: boolean): void;
13579
+ runInNRenderFrames(func: () => void, numRenderFrames: int, cancelIfRoomChanges?: boolean): void;
13579
13580
  /**
13580
13581
  * Supply a function to run on the next `POST_UPDATE` callback.
13581
13582
  *
@@ -13640,13 +13641,13 @@ declare class RunInNFrames extends Feature {
13640
13641
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13641
13642
  *
13642
13643
  * @param func The function to repeatedly run on an interval.
13643
- * @param gameFrames The amount of game frames to wait between each run.
13644
+ * @param numGameFrames The amount of game frames to wait between each run.
13644
13645
  * @param runImmediately Whether or not to execute the function right now before waiting for the
13645
13646
  * interval.
13646
13647
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13647
13648
  * room is loaded in the interim. Default is false.
13648
13649
  */
13649
- setIntervalGameFrames(func: () => boolean, gameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13650
+ setIntervalGameFrames(func: () => boolean, numGameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13650
13651
  /**
13651
13652
  * Supply a function to be repeatedly run on an interval of N render frames in the `POST_RENDER`
13652
13653
  * callback. The function will continue to be fired until `false` is returned from the function.
@@ -13661,13 +13662,13 @@ declare class RunInNFrames extends Feature {
13661
13662
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13662
13663
  *
13663
13664
  * @param func The function to repeatedly run on an interval.
13664
- * @param renderFrames The amount of game frames to wait between each run.
13665
+ * @param numRenderFrames The amount of game frames to wait between each run.
13665
13666
  * @param runImmediately Whether or not to execute the function right now before waiting for the
13666
13667
  * interval.
13667
13668
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13668
13669
  * room is loaded in the interim. Default is false.
13669
13670
  */
13670
- setIntervalRenderFrames(func: () => boolean, renderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13671
+ setIntervalRenderFrames(func: () => boolean, numRenderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13671
13672
  }
13672
13673
 
13673
13674
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 21.8.0
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(...)
@@ -32294,9 +32313,9 @@ local ____run = require("src.functions.run")
32294
32313
  local restart = ____run.restart
32295
32314
  local ____Feature = require("src.classes.private.Feature")
32296
32315
  local Feature = ____Feature.Feature
32297
- function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
32316
+ function checkExecuteQueuedFunctions(self, queuedFunctions, frameCount, newNumRoomsEntered)
32298
32317
  local firingFunctions = __TS__ArrayFilter(
32299
- functionTuples,
32318
+ queuedFunctions,
32300
32319
  function(____, ____bindingPattern0)
32301
32320
  local frameCountToFire
32302
32321
  frameCountToFire = ____bindingPattern0.frameCountToFire
@@ -32310,12 +32329,12 @@ function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoo
32310
32329
  if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
32311
32330
  func(nil)
32312
32331
  end
32313
- arrayRemoveInPlace(nil, functionTuples, firingFunction)
32332
+ arrayRemoveInPlace(nil, queuedFunctions, firingFunction)
32314
32333
  end
32315
32334
  end
32316
- function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
32335
+ function checkExecuteIntervalFunctions(self, intervalFunctions, frameCount, newNumRoomsEntered)
32317
32336
  local firingFunctions = __TS__ArrayFilter(
32318
- functionTuples,
32337
+ intervalFunctions,
32319
32338
  function(____, ____bindingPattern0)
32320
32339
  local frameCountToFire
32321
32340
  frameCountToFire = ____bindingPattern0.frameCountToFire
@@ -32331,7 +32350,7 @@ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumR
32331
32350
  if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
32332
32351
  returnValue = func(nil)
32333
32352
  end
32334
- arrayRemoveInPlace(nil, functionTuples, firingFunction)
32353
+ arrayRemoveInPlace(nil, intervalFunctions, firingFunction)
32335
32354
  if returnValue then
32336
32355
  local newIntervalFunction = {
32337
32356
  func = func,
@@ -32340,7 +32359,7 @@ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumR
32340
32359
  cancelIfRoomChanges = cancelIfRoomChanges,
32341
32360
  numIntervalFrames = numIntervalFrames
32342
32361
  }
32343
- functionTuples[#functionTuples + 1] = newIntervalFunction
32362
+ intervalFunctions[#intervalFunctions + 1] = newIntervalFunction
32344
32363
  end
32345
32364
  end
32346
32365
  end
@@ -32373,24 +32392,24 @@ function RunInNFrames.prototype.restartNextRenderFrame(self, character)
32373
32392
  restart(nil, character)
32374
32393
  end)
32375
32394
  end
32376
- function RunInNFrames.prototype.runInNGameFrames(self, func, gameFrames, cancelIfRoomChanges)
32395
+ function RunInNFrames.prototype.runInNGameFrames(self, func, numGameFrames, cancelIfRoomChanges)
32377
32396
  if cancelIfRoomChanges == nil then
32378
32397
  cancelIfRoomChanges = false
32379
32398
  end
32380
32399
  local gameFrameCount = game:GetFrameCount()
32381
32400
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
32382
- local frameCountToFire = gameFrameCount + gameFrames
32401
+ local frameCountToFire = gameFrameCount + numGameFrames
32383
32402
  local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
32384
32403
  local ____self_v_run_queuedGameFunctions_0 = self.v.run.queuedGameFunctions
32385
32404
  ____self_v_run_queuedGameFunctions_0[#____self_v_run_queuedGameFunctions_0 + 1] = queuedFunction
32386
32405
  end
32387
- function RunInNFrames.prototype.runInNRenderFrames(self, func, renderFrames, cancelIfRoomChanges)
32406
+ function RunInNFrames.prototype.runInNRenderFrames(self, func, numRenderFrames, cancelIfRoomChanges)
32388
32407
  if cancelIfRoomChanges == nil then
32389
32408
  cancelIfRoomChanges = false
32390
32409
  end
32391
32410
  local renderFrameCount = Isaac.GetFrameCount()
32392
32411
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
32393
- local frameCountToFire = renderFrameCount + renderFrames
32412
+ local frameCountToFire = renderFrameCount + numRenderFrames
32394
32413
  local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
32395
32414
  local ____self_v_run_queuedRenderFunctions_1 = self.v.run.queuedRenderFunctions
32396
32415
  ____self_v_run_queuedRenderFunctions_1[#____self_v_run_queuedRenderFunctions_1 + 1] = queuedFunction
@@ -32407,43 +32426,49 @@ function RunInNFrames.prototype.runNextRenderFrame(self, func, cancelIfRoomChang
32407
32426
  end
32408
32427
  self:runInNRenderFrames(func, 1, cancelIfRoomChanges)
32409
32428
  end
32410
- function RunInNFrames.prototype.setIntervalGameFrames(self, func, gameFrames, runImmediately, cancelIfRoomChanges)
32429
+ function RunInNFrames.prototype.setIntervalGameFrames(self, func, numGameFrames, runImmediately, cancelIfRoomChanges)
32411
32430
  if cancelIfRoomChanges == nil then
32412
32431
  cancelIfRoomChanges = false
32413
32432
  end
32433
+ if runImmediately then
32434
+ local returnValue = func(nil)
32435
+ if not returnValue then
32436
+ return
32437
+ end
32438
+ end
32414
32439
  local gameFrameCount = game:GetFrameCount()
32415
32440
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
32416
32441
  local intervalFunction = {
32417
32442
  func = func,
32418
- frameCountToFire = gameFrameCount + gameFrames,
32443
+ frameCountToFire = gameFrameCount + numGameFrames,
32419
32444
  numRoomsEntered = numRoomsEntered,
32420
32445
  cancelIfRoomChanges = cancelIfRoomChanges,
32421
- numIntervalFrames = gameFrames
32446
+ numIntervalFrames = numGameFrames
32422
32447
  }
32423
32448
  local ____self_v_run_intervalGameFunctions_2 = self.v.run.intervalGameFunctions
32424
32449
  ____self_v_run_intervalGameFunctions_2[#____self_v_run_intervalGameFunctions_2 + 1] = intervalFunction
32425
- if runImmediately then
32426
- func(nil)
32427
- end
32428
32450
  end
32429
- function RunInNFrames.prototype.setIntervalRenderFrames(self, func, renderFrames, runImmediately, cancelIfRoomChanges)
32451
+ function RunInNFrames.prototype.setIntervalRenderFrames(self, func, numRenderFrames, runImmediately, cancelIfRoomChanges)
32430
32452
  if cancelIfRoomChanges == nil then
32431
32453
  cancelIfRoomChanges = false
32432
32454
  end
32455
+ if runImmediately then
32456
+ local returnValue = func(nil)
32457
+ if not returnValue then
32458
+ return
32459
+ end
32460
+ end
32433
32461
  local renderFrameCount = Isaac.GetFrameCount()
32434
32462
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
32435
32463
  local intervalFunction = {
32436
32464
  func = func,
32437
- frameCountToFire = renderFrameCount + renderFrames,
32465
+ frameCountToFire = renderFrameCount + numRenderFrames,
32438
32466
  numRoomsEntered = numRoomsEntered,
32439
32467
  cancelIfRoomChanges = cancelIfRoomChanges,
32440
- numIntervalFrames = renderFrames
32468
+ numIntervalFrames = numRenderFrames
32441
32469
  }
32442
- local ____self_v_run_intervalGameFunctions_3 = self.v.run.intervalGameFunctions
32443
- ____self_v_run_intervalGameFunctions_3[#____self_v_run_intervalGameFunctions_3 + 1] = intervalFunction
32444
- if runImmediately then
32445
- func(nil)
32446
- end
32470
+ local ____self_v_run_intervalRenderFunctions_3 = self.v.run.intervalRenderFunctions
32471
+ ____self_v_run_intervalRenderFunctions_3[#____self_v_run_intervalRenderFunctions_3 + 1] = intervalFunction
32447
32472
  end
32448
32473
  __TS__Decorate({Exported}, RunInNFrames.prototype, "restartNextRenderFrame", true)
32449
32474
  __TS__Decorate({Exported}, RunInNFrames.prototype, "runInNGameFrames", true)
@@ -50363,8 +50388,9 @@ function ModUpgraded.prototype.initFeature(self, feature)
50363
50388
  if feature.customCallbacksUsed ~= nil then
50364
50389
  for ____, callbackTuple in ipairs(feature.customCallbacksUsed) do
50365
50390
  local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple)
50366
- self:AddCallbackCustom(
50391
+ self:AddPriorityCallbackCustom(
50367
50392
  modCallback,
50393
+ CallbackPriority.IMPORTANT,
50368
50394
  callbackFunc,
50369
50395
  table.unpack(optionalArgs or ({}))
50370
50396
  )
@@ -1 +1 @@
1
- {"version":3,"file":"ModUpgraded.d.ts","sourceRoot":"","sources":["../../../src/classes/ModUpgraded.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAIhG,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAQ/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAMhG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= 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
  )
@@ -28,11 +28,11 @@ export declare class RunInNFrames extends Feature {
28
28
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
29
29
  *
30
30
  * @param func The function to run.
31
- * @param gameFrames The amount of game frames to wait before running the function.
31
+ * @param numGameFrames The amount of game frames to wait before running the function.
32
32
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
33
33
  * room is loaded in the interim. Default is false.
34
34
  */
35
- runInNGameFrames(func: () => void, gameFrames: int, cancelIfRoomChanges?: boolean): void;
35
+ runInNGameFrames(func: () => void, numGameFrames: int, cancelIfRoomChanges?: boolean): void;
36
36
  /**
37
37
  * Supply a function to run N render frames from now in the `POST_RENDER` callback.
38
38
  *
@@ -46,11 +46,11 @@ export declare class RunInNFrames extends Feature {
46
46
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
47
47
  *
48
48
  * @param func The function to run.
49
- * @param renderFrames The amount of render frames to wait before running the function.
49
+ * @param numRenderFrames The amount of render frames to wait before running the function.
50
50
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
51
51
  * room is loaded in the interim. Default is false.
52
52
  */
53
- runInNRenderFrames(func: () => void, renderFrames: int, cancelIfRoomChanges?: boolean): void;
53
+ runInNRenderFrames(func: () => void, numRenderFrames: int, cancelIfRoomChanges?: boolean): void;
54
54
  /**
55
55
  * Supply a function to run on the next `POST_UPDATE` callback.
56
56
  *
@@ -115,13 +115,13 @@ export declare class RunInNFrames extends Feature {
115
115
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
116
116
  *
117
117
  * @param func The function to repeatedly run on an interval.
118
- * @param gameFrames The amount of game frames to wait between each run.
118
+ * @param numGameFrames The amount of game frames to wait between each run.
119
119
  * @param runImmediately Whether or not to execute the function right now before waiting for the
120
120
  * interval.
121
121
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
122
122
  * room is loaded in the interim. Default is false.
123
123
  */
124
- setIntervalGameFrames(func: () => boolean, gameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
124
+ setIntervalGameFrames(func: () => boolean, numGameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
125
125
  /**
126
126
  * Supply a function to be repeatedly run on an interval of N render frames in the `POST_RENDER`
127
127
  * callback. The function will continue to be fired until `false` is returned from the function.
@@ -136,12 +136,12 @@ export declare class RunInNFrames extends Feature {
136
136
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
137
137
  *
138
138
  * @param func The function to repeatedly run on an interval.
139
- * @param renderFrames The amount of game frames to wait between each run.
139
+ * @param numRenderFrames The amount of game frames to wait between each run.
140
140
  * @param runImmediately Whether or not to execute the function right now before waiting for the
141
141
  * interval.
142
142
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
143
143
  * room is loaded in the interim. Default is false.
144
144
  */
145
- setIntervalRenderFrames(func: () => boolean, renderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
145
+ setIntervalRenderFrames(func: () => boolean, numRenderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
146
146
  }
147
147
  //# sourceMappingURL=RunInNFrames.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RunInNFrames.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RunInNFrames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAMvE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAwBhD,qBAAa,YAAa,SAAQ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M,uBAAuB,CAAC;AAqBhD,qBAAa,YAAa,SAAQ,OAAO;IAYvB,gBAAgB,QAAO,OAAO,CAAU;IAExD,OAAO,CAAC,WAAW,CAAc;IAoBjC,OAAO,CAAC,UAAU,CAchB;IAGF,OAAO,CAAC,UAAU,CAchB;IAEF;;;;;;;;OAQG;IAEI,sBAAsB,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI;IAM3D;;;;;;;;;;;;;;;;OAgBG;IAEI,gBAAgB,CACrB,IAAI,EAAE,MAAM,IAAI,EAChB,aAAa,EAAE,GAAG,EAClB,mBAAmB,UAAQ,GAC1B,IAAI;IAcP;;;;;;;;;;;;;;;;OAgBG;IAEI,kBAAkB,CACvB,IAAI,EAAE,MAAM,IAAI,EAChB,eAAe,EAAE,GAAG,EACpB,mBAAmB,UAAQ,GAC1B,IAAI;IAcP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IAEI,gBAAgB,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,mBAAmB,UAAQ,GAAG,IAAI;IAI5E;;;;;;;;;;;;;OAaG;IAEI,kBAAkB,CACvB,IAAI,EAAE,MAAM,IAAI,EAChB,mBAAmB,UAAQ,GAC1B,IAAI;IAIP;;;;;;;;;;;;;;;;;;;OAmBG;IAEI,qBAAqB,CAC1B,IAAI,EAAE,MAAM,OAAO,EACnB,aAAa,EAAE,GAAG,EAClB,cAAc,EAAE,OAAO,EACvB,mBAAmB,UAAQ,GAC1B,IAAI;IAqBP;;;;;;;;;;;;;;;;;;;OAmBG;IAEI,uBAAuB,CAC5B,IAAI,EAAE,MAAM,OAAO,EACnB,eAAe,EAAE,GAAG,EACpB,cAAc,EAAE,OAAO,EACvB,mBAAmB,UAAQ,GAC1B,IAAI;CAoBR"}
@@ -19,9 +19,9 @@ local ____run = require("src.functions.run")
19
19
  local restart = ____run.restart
20
20
  local ____Feature = require("src.classes.private.Feature")
21
21
  local Feature = ____Feature.Feature
22
- function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
22
+ function checkExecuteQueuedFunctions(self, queuedFunctions, frameCount, newNumRoomsEntered)
23
23
  local firingFunctions = __TS__ArrayFilter(
24
- functionTuples,
24
+ queuedFunctions,
25
25
  function(____, ____bindingPattern0)
26
26
  local frameCountToFire
27
27
  frameCountToFire = ____bindingPattern0.frameCountToFire
@@ -35,12 +35,12 @@ function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoo
35
35
  if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
36
36
  func(nil)
37
37
  end
38
- arrayRemoveInPlace(nil, functionTuples, firingFunction)
38
+ arrayRemoveInPlace(nil, queuedFunctions, firingFunction)
39
39
  end
40
40
  end
41
- function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
41
+ function checkExecuteIntervalFunctions(self, intervalFunctions, frameCount, newNumRoomsEntered)
42
42
  local firingFunctions = __TS__ArrayFilter(
43
- functionTuples,
43
+ intervalFunctions,
44
44
  function(____, ____bindingPattern0)
45
45
  local frameCountToFire
46
46
  frameCountToFire = ____bindingPattern0.frameCountToFire
@@ -56,7 +56,7 @@ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumR
56
56
  if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
57
57
  returnValue = func(nil)
58
58
  end
59
- arrayRemoveInPlace(nil, functionTuples, firingFunction)
59
+ arrayRemoveInPlace(nil, intervalFunctions, firingFunction)
60
60
  if returnValue then
61
61
  local newIntervalFunction = {
62
62
  func = func,
@@ -65,7 +65,7 @@ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumR
65
65
  cancelIfRoomChanges = cancelIfRoomChanges,
66
66
  numIntervalFrames = numIntervalFrames
67
67
  }
68
- functionTuples[#functionTuples + 1] = newIntervalFunction
68
+ intervalFunctions[#intervalFunctions + 1] = newIntervalFunction
69
69
  end
70
70
  end
71
71
  end
@@ -98,24 +98,24 @@ function RunInNFrames.prototype.restartNextRenderFrame(self, character)
98
98
  restart(nil, character)
99
99
  end)
100
100
  end
101
- function RunInNFrames.prototype.runInNGameFrames(self, func, gameFrames, cancelIfRoomChanges)
101
+ function RunInNFrames.prototype.runInNGameFrames(self, func, numGameFrames, cancelIfRoomChanges)
102
102
  if cancelIfRoomChanges == nil then
103
103
  cancelIfRoomChanges = false
104
104
  end
105
105
  local gameFrameCount = game:GetFrameCount()
106
106
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
107
- local frameCountToFire = gameFrameCount + gameFrames
107
+ local frameCountToFire = gameFrameCount + numGameFrames
108
108
  local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
109
109
  local ____self_v_run_queuedGameFunctions_0 = self.v.run.queuedGameFunctions
110
110
  ____self_v_run_queuedGameFunctions_0[#____self_v_run_queuedGameFunctions_0 + 1] = queuedFunction
111
111
  end
112
- function RunInNFrames.prototype.runInNRenderFrames(self, func, renderFrames, cancelIfRoomChanges)
112
+ function RunInNFrames.prototype.runInNRenderFrames(self, func, numRenderFrames, cancelIfRoomChanges)
113
113
  if cancelIfRoomChanges == nil then
114
114
  cancelIfRoomChanges = false
115
115
  end
116
116
  local renderFrameCount = Isaac.GetFrameCount()
117
117
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
118
- local frameCountToFire = renderFrameCount + renderFrames
118
+ local frameCountToFire = renderFrameCount + numRenderFrames
119
119
  local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
120
120
  local ____self_v_run_queuedRenderFunctions_1 = self.v.run.queuedRenderFunctions
121
121
  ____self_v_run_queuedRenderFunctions_1[#____self_v_run_queuedRenderFunctions_1 + 1] = queuedFunction
@@ -132,43 +132,49 @@ function RunInNFrames.prototype.runNextRenderFrame(self, func, cancelIfRoomChang
132
132
  end
133
133
  self:runInNRenderFrames(func, 1, cancelIfRoomChanges)
134
134
  end
135
- function RunInNFrames.prototype.setIntervalGameFrames(self, func, gameFrames, runImmediately, cancelIfRoomChanges)
135
+ function RunInNFrames.prototype.setIntervalGameFrames(self, func, numGameFrames, runImmediately, cancelIfRoomChanges)
136
136
  if cancelIfRoomChanges == nil then
137
137
  cancelIfRoomChanges = false
138
138
  end
139
+ if runImmediately then
140
+ local returnValue = func(nil)
141
+ if not returnValue then
142
+ return
143
+ end
144
+ end
139
145
  local gameFrameCount = game:GetFrameCount()
140
146
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
141
147
  local intervalFunction = {
142
148
  func = func,
143
- frameCountToFire = gameFrameCount + gameFrames,
149
+ frameCountToFire = gameFrameCount + numGameFrames,
144
150
  numRoomsEntered = numRoomsEntered,
145
151
  cancelIfRoomChanges = cancelIfRoomChanges,
146
- numIntervalFrames = gameFrames
152
+ numIntervalFrames = numGameFrames
147
153
  }
148
154
  local ____self_v_run_intervalGameFunctions_2 = self.v.run.intervalGameFunctions
149
155
  ____self_v_run_intervalGameFunctions_2[#____self_v_run_intervalGameFunctions_2 + 1] = intervalFunction
150
- if runImmediately then
151
- func(nil)
152
- end
153
156
  end
154
- function RunInNFrames.prototype.setIntervalRenderFrames(self, func, renderFrames, runImmediately, cancelIfRoomChanges)
157
+ function RunInNFrames.prototype.setIntervalRenderFrames(self, func, numRenderFrames, runImmediately, cancelIfRoomChanges)
155
158
  if cancelIfRoomChanges == nil then
156
159
  cancelIfRoomChanges = false
157
160
  end
161
+ if runImmediately then
162
+ local returnValue = func(nil)
163
+ if not returnValue then
164
+ return
165
+ end
166
+ end
158
167
  local renderFrameCount = Isaac.GetFrameCount()
159
168
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
160
169
  local intervalFunction = {
161
170
  func = func,
162
- frameCountToFire = renderFrameCount + renderFrames,
171
+ frameCountToFire = renderFrameCount + numRenderFrames,
163
172
  numRoomsEntered = numRoomsEntered,
164
173
  cancelIfRoomChanges = cancelIfRoomChanges,
165
- numIntervalFrames = renderFrames
174
+ numIntervalFrames = numRenderFrames
166
175
  }
167
- local ____self_v_run_intervalGameFunctions_3 = self.v.run.intervalGameFunctions
168
- ____self_v_run_intervalGameFunctions_3[#____self_v_run_intervalGameFunctions_3 + 1] = intervalFunction
169
- if runImmediately then
170
- func(nil)
171
- end
176
+ local ____self_v_run_intervalRenderFunctions_3 = self.v.run.intervalRenderFunctions
177
+ ____self_v_run_intervalRenderFunctions_3[#____self_v_run_intervalRenderFunctions_3 + 1] = intervalFunction
172
178
  end
173
179
  __TS__Decorate({Exported}, RunInNFrames.prototype, "restartNextRenderFrame", true)
174
180
  __TS__Decorate({Exported}, RunInNFrames.prototype, "runInNGameFrames", true)
@@ -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,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAAI,WAAW,CACjE,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AS,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
@@ -1,8 +1,8 @@
1
1
  import { ItemPoolType } from "isaac-typescript-definitions";
2
2
  /**
3
- * Helper function to get a random item pool. This is as simple as getting a random value from the
4
- * `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the Greed
5
- * Mode item pools should be excluded if not playing in Greed Mode.
3
+ * Helper function to get a random item pool. This is not as simple as getting a random value from
4
+ * the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
5
+ * Greed Mode item pools should be excluded if not playing in Greed Mode.
6
6
  */
7
7
  export declare function getRandomItemPool(): ItemPoolType;
8
8
  //# sourceMappingURL=itemPool.d.ts.map
@@ -53,9 +53,9 @@ __TS__SparseArrayPush(
53
53
  table.unpack(FAKE_ITEM_POOL_TYPES)
54
54
  )
55
55
  local GREED_MODE_ITEM_POOL_TYPES = ____arrayRemove_3(__TS__SparseArraySpread(____array_2))
56
- --- Helper function to get a random item pool. This is as simple as getting a random value from the
57
- -- `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the Greed
58
- -- Mode item pools should be excluded if not playing in Greed Mode.
56
+ --- Helper function to get a random item pool. This is not as simple as getting a random value from
57
+ -- the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
58
+ -- Greed Mode item pools should be excluded if not playing in Greed Mode.
59
59
  function ____exports.getRandomItemPool(self)
60
60
  local itemPoolTypes = isGreedMode(nil) and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
61
61
  return getRandomArrayElement(nil, itemPoolTypes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "21.8.0",
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
  );
@@ -20,11 +20,8 @@ interface QueuedFunction {
20
20
  *
21
21
  * The return value is whether or not to continue the function from firing.
22
22
  */
23
- interface IntervalFunction {
23
+ interface IntervalFunction extends QueuedFunction {
24
24
  func: () => boolean;
25
- frameCountToFire: int;
26
- numRoomsEntered: int;
27
- cancelIfRoomChanges: boolean;
28
25
  numIntervalFrames: int;
29
26
  }
30
27
 
@@ -124,20 +121,20 @@ export class RunInNFrames extends Feature {
124
121
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
125
122
  *
126
123
  * @param func The function to run.
127
- * @param gameFrames The amount of game frames to wait before running the function.
124
+ * @param numGameFrames The amount of game frames to wait before running the function.
128
125
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
129
126
  * room is loaded in the interim. Default is false.
130
127
  */
131
128
  @Exported
132
129
  public runInNGameFrames(
133
130
  func: () => void,
134
- gameFrames: int,
131
+ numGameFrames: int,
135
132
  cancelIfRoomChanges = false,
136
133
  ): void {
137
134
  const gameFrameCount = game.GetFrameCount();
138
135
  const numRoomsEntered = this.roomHistory.getNumRoomsEntered();
139
136
 
140
- const frameCountToFire = gameFrameCount + gameFrames;
137
+ const frameCountToFire = gameFrameCount + numGameFrames;
141
138
  const queuedFunction: QueuedFunction = {
142
139
  func,
143
140
  frameCountToFire,
@@ -160,20 +157,20 @@ export class RunInNFrames extends Feature {
160
157
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
161
158
  *
162
159
  * @param func The function to run.
163
- * @param renderFrames The amount of render frames to wait before running the function.
160
+ * @param numRenderFrames The amount of render frames to wait before running the function.
164
161
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
165
162
  * room is loaded in the interim. Default is false.
166
163
  */
167
164
  @Exported
168
165
  public runInNRenderFrames(
169
166
  func: () => void,
170
- renderFrames: int,
167
+ numRenderFrames: int,
171
168
  cancelIfRoomChanges = false,
172
169
  ): void {
173
170
  const renderFrameCount = Isaac.GetFrameCount();
174
171
  const numRoomsEntered = this.roomHistory.getNumRoomsEntered();
175
172
 
176
- const frameCountToFire = renderFrameCount + renderFrames;
173
+ const frameCountToFire = renderFrameCount + numRenderFrames;
177
174
  const queuedFunction: QueuedFunction = {
178
175
  func,
179
176
  frameCountToFire,
@@ -258,7 +255,7 @@ export class RunInNFrames extends Feature {
258
255
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
259
256
  *
260
257
  * @param func The function to repeatedly run on an interval.
261
- * @param gameFrames The amount of game frames to wait between each run.
258
+ * @param numGameFrames The amount of game frames to wait between each run.
262
259
  * @param runImmediately Whether or not to execute the function right now before waiting for the
263
260
  * interval.
264
261
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
@@ -267,25 +264,28 @@ export class RunInNFrames extends Feature {
267
264
  @Exported
268
265
  public setIntervalGameFrames(
269
266
  func: () => boolean,
270
- gameFrames: int,
267
+ numGameFrames: int,
271
268
  runImmediately: boolean,
272
269
  cancelIfRoomChanges = false,
273
270
  ): void {
271
+ if (runImmediately) {
272
+ const returnValue = func();
273
+ if (!returnValue) {
274
+ return;
275
+ }
276
+ }
277
+
274
278
  const gameFrameCount = game.GetFrameCount();
275
279
  const numRoomsEntered = this.roomHistory.getNumRoomsEntered();
276
280
 
277
281
  const intervalFunction: IntervalFunction = {
278
282
  func,
279
- frameCountToFire: gameFrameCount + gameFrames,
283
+ frameCountToFire: gameFrameCount + numGameFrames,
280
284
  numRoomsEntered,
281
285
  cancelIfRoomChanges,
282
- numIntervalFrames: gameFrames,
286
+ numIntervalFrames: numGameFrames,
283
287
  };
284
288
  this.v.run.intervalGameFunctions.push(intervalFunction);
285
-
286
- if (runImmediately) {
287
- func();
288
- }
289
289
  }
290
290
 
291
291
  /**
@@ -302,7 +302,7 @@ export class RunInNFrames extends Feature {
302
302
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
303
303
  *
304
304
  * @param func The function to repeatedly run on an interval.
305
- * @param renderFrames The amount of game frames to wait between each run.
305
+ * @param numRenderFrames The amount of game frames to wait between each run.
306
306
  * @param runImmediately Whether or not to execute the function right now before waiting for the
307
307
  * interval.
308
308
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
@@ -311,34 +311,37 @@ export class RunInNFrames extends Feature {
311
311
  @Exported
312
312
  public setIntervalRenderFrames(
313
313
  func: () => boolean,
314
- renderFrames: int,
314
+ numRenderFrames: int,
315
315
  runImmediately: boolean,
316
316
  cancelIfRoomChanges = false,
317
317
  ): void {
318
+ if (runImmediately) {
319
+ const returnValue = func();
320
+ if (!returnValue) {
321
+ return;
322
+ }
323
+ }
324
+
318
325
  const renderFrameCount = Isaac.GetFrameCount();
319
326
  const numRoomsEntered = this.roomHistory.getNumRoomsEntered();
320
327
 
321
328
  const intervalFunction: IntervalFunction = {
322
329
  func,
323
- frameCountToFire: renderFrameCount + renderFrames,
330
+ frameCountToFire: renderFrameCount + numRenderFrames,
324
331
  numRoomsEntered,
325
332
  cancelIfRoomChanges,
326
- numIntervalFrames: renderFrames,
333
+ numIntervalFrames: numRenderFrames,
327
334
  };
328
- this.v.run.intervalGameFunctions.push(intervalFunction);
329
-
330
- if (runImmediately) {
331
- func();
332
- }
335
+ this.v.run.intervalRenderFunctions.push(intervalFunction);
333
336
  }
334
337
  }
335
338
 
336
339
  function checkExecuteQueuedFunctions(
337
- functionTuples: QueuedFunction[],
340
+ queuedFunctions: QueuedFunction[],
338
341
  frameCount: int,
339
342
  newNumRoomsEntered: int,
340
343
  ) {
341
- const firingFunctions = functionTuples.filter(
344
+ const firingFunctions = queuedFunctions.filter(
342
345
  ({ frameCountToFire }) => frameCount >= frameCountToFire,
343
346
  );
344
347
 
@@ -349,16 +352,16 @@ function checkExecuteQueuedFunctions(
349
352
  func();
350
353
  }
351
354
 
352
- arrayRemoveInPlace(functionTuples, firingFunction);
355
+ arrayRemoveInPlace(queuedFunctions, firingFunction);
353
356
  }
354
357
  }
355
358
 
356
359
  function checkExecuteIntervalFunctions(
357
- functionTuples: IntervalFunction[],
360
+ intervalFunctions: IntervalFunction[],
358
361
  frameCount: int,
359
362
  newNumRoomsEntered: int,
360
363
  ) {
361
- const firingFunctions = functionTuples.filter(
364
+ const firingFunctions = intervalFunctions.filter(
362
365
  ({ frameCountToFire }) => frameCount >= frameCountToFire,
363
366
  );
364
367
 
@@ -371,7 +374,7 @@ function checkExecuteIntervalFunctions(
371
374
  returnValue = func();
372
375
  }
373
376
 
374
- arrayRemoveInPlace(functionTuples, firingFunction);
377
+ arrayRemoveInPlace(intervalFunctions, firingFunction);
375
378
 
376
379
  // Queue the next interval (as long as the function did not return false).
377
380
  if (returnValue) {
@@ -382,7 +385,7 @@ function checkExecuteIntervalFunctions(
382
385
  cancelIfRoomChanges,
383
386
  numIntervalFrames,
384
387
  };
385
- functionTuples.push(newIntervalFunction);
388
+ intervalFunctions.push(newIntervalFunction);
386
389
  }
387
390
  }
388
391
  }
@@ -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
  }
@@ -38,9 +38,9 @@ const GREED_MODE_ITEM_POOL_TYPES: readonly ItemPoolType[] = arrayRemove(
38
38
  );
39
39
 
40
40
  /**
41
- * Helper function to get a random item pool. This is as simple as getting a random value from the
42
- * `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the Greed
43
- * Mode item pools should be excluded if not playing in Greed Mode.
41
+ * Helper function to get a random item pool. This is not as simple as getting a random value from
42
+ * the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
43
+ * Greed Mode item pools should be excluded if not playing in Greed Mode.
44
44
  */
45
45
  export function getRandomItemPool(): ItemPoolType {
46
46
  const itemPoolTypes = isGreedMode()