isaacscript-common 20.10.0 → 20.11.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.
package/dist/index.d.ts CHANGED
@@ -2068,11 +2068,12 @@ export declare interface CustomStageTSConfig {
2068
2068
  * Mandatory. An arbitrarily chosen prefix in the range of 101-999 that will be unique to this
2069
2069
  * stage.
2070
2070
  *
2071
- * Make sure the chosen prefix does not conflict with any other mods. You can find a list of
2072
- * registered room variant prefixes on the IsaacScript website:
2071
+ * Use a value of 100 when testing locally. When publishing to the workshop or otherwise
2072
+ * distributing your mod, make sure that you have chosen a prefix that does not conflict with any
2073
+ * other mods. You can find a list of registered room variant prefixes on the IsaacScript website:
2073
2074
  * https://isaacscript.github.io/main/custom-stages
2074
2075
  *
2075
- * @minimum 101
2076
+ * @minimum 100
2076
2077
  * @maximum 999
2077
2078
  */
2078
2079
  roomVariantPrefix: number;
@@ -11462,8 +11463,7 @@ export declare class ModFeature {
11462
11463
  */
11463
11464
  protected shouldCallbackMethodsFire: (<T extends boolean>(vanilla: T, modCallback: T extends true ? ModCallback : ModCallbackCustom, ...callbackArgs: unknown[]) => boolean) | null;
11464
11465
  /**
11465
- * Whether or not the feature has registered its callbacks yet (and submitted its variables to the
11466
- * save data manager, if any).
11466
+ * Whether or not the feature has registered its callbacks yet.
11467
11467
  *
11468
11468
  * This will almost always be equal to true unless you explicitly passed `false` to the second
11469
11469
  * argument of the constructor.
@@ -11472,15 +11472,14 @@ export declare class ModFeature {
11472
11472
  constructor(mod: ModUpgradedBase, init?: boolean);
11473
11473
  /**
11474
11474
  * Runs the `Mod.AddCallback` and `ModUpgraded.AddCallbackCustom` methods for all of the decorated
11475
- * callbacks. Additionally, subscribes the `v` object to the save data manager, if present.
11475
+ * callbacks.
11476
11476
  *
11477
11477
  * @param init Optional. Whether to initialize or uninitialize. Default is true.
11478
11478
  */
11479
11479
  init(init?: boolean): void;
11480
11480
  /**
11481
11481
  * Runs the `Mod.RemoveCallback` and `ModUpgraded.RemoveCallbackCustom` methods for all of the
11482
- * decorated callbacks. Additionally, unsubscribes the `v` object from the save data manager, if
11483
- * present.
11482
+ * decorated callbacks.
11484
11483
  *
11485
11484
  * This is just an alias for `ModFeature.init(false)`.
11486
11485
  */
@@ -13172,12 +13171,12 @@ export declare function roomGridIndexToXY(roomGridIndex: int): [x: int, y: int];
13172
13171
  declare class RoomHistory extends Feature {
13173
13172
  private postNewRoomEarly;
13174
13173
  /**
13175
- * Helper function to get the total number of rooms that the player has visited thus far on the
13176
- * run.
13174
+ * Helper function to get the total number of rooms that the player has entered thus far on the
13175
+ * run. (Re-entering the same room will increment the number returned.)
13177
13176
  *
13178
13177
  * In order to use this function, you must upgrade your mod with `ISCFeature.ROOM_HISTORY`.
13179
13178
  */
13180
- getNumRoomsVisited(): ReadonlyArray<Readonly<RoomDescription>>;
13179
+ getNumRoomsEntered(): int;
13181
13180
  /**
13182
13181
  * Helper function to get information about all of the rooms that a player has visited thus far on
13183
13182
  * this run.
@@ -13246,6 +13245,7 @@ export declare function runDeepCopyTests(): void;
13246
13245
 
13247
13246
  declare class RunInNFrames extends Feature {
13248
13247
  vConditionalFunc: () => boolean;
13248
+ private roomHistory;
13249
13249
  private postUpdate;
13250
13250
  private postRender;
13251
13251
  /**
@@ -13269,8 +13269,13 @@ declare class RunInNFrames extends Feature {
13269
13269
  * deferred functions manually using serializable data.
13270
13270
  *
13271
13271
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13272
+ *
13273
+ * @param func The function to run.
13274
+ * @param gameFrames The amount of game frames to wait before running the function.
13275
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13276
+ * room is loaded in the interim. Default is false.
13272
13277
  */
13273
- runInNGameFrames(func: () => void, gameFrames: int): void;
13278
+ runInNGameFrames(func: () => void, gameFrames: int, cancelIfRoomChanges?: boolean): void;
13274
13279
  /**
13275
13280
  * Supply a function to run N render frames from now in the `POST_RENDER` callback.
13276
13281
  *
@@ -13282,8 +13287,13 @@ declare class RunInNFrames extends Feature {
13282
13287
  * deferred functions manually using serializable data.
13283
13288
  *
13284
13289
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13290
+ *
13291
+ * @param func The function to run.
13292
+ * @param renderFrames The amount of render frames to wait before running the function.
13293
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13294
+ * room is loaded in the interim. Default is false.
13285
13295
  */
13286
- runInNRenderFrames(func: () => void, renderFrames: int): void;
13296
+ runInNRenderFrames(func: () => void, renderFrames: int, cancelIfRoomChanges?: boolean): void;
13287
13297
  /**
13288
13298
  * Supply a function to run on the next `POST_UPDATE` callback.
13289
13299
  *
@@ -13313,8 +13323,12 @@ declare class RunInNFrames extends Feature {
13313
13323
  * deferred functions manually using serializable data.
13314
13324
  *
13315
13325
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13326
+ *
13327
+ * @param func The function to run.
13328
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13329
+ * room is loaded in the interim. Default is false.
13316
13330
  */
13317
- runNextGameFrame(func: () => void): void;
13331
+ runNextGameFrame(func: () => void, cancelIfRoomChanges?: boolean): void;
13318
13332
  /**
13319
13333
  * Supply a function to run on the next `POST_RENDER` callback.
13320
13334
  *
@@ -13324,8 +13338,12 @@ declare class RunInNFrames extends Feature {
13324
13338
  * Note that this function will not handle saving and quitting.
13325
13339
  *
13326
13340
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13341
+ *
13342
+ * @param func The function to run.
13343
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13344
+ * room is loaded in the interim. Default is false.
13327
13345
  */
13328
- runNextRenderFrame(func: () => void): void;
13346
+ runNextRenderFrame(func: () => void, cancelIfRoomChanges?: boolean): void;
13329
13347
  /**
13330
13348
  * Supply a function to be repeatedly run on an interval of N game frames in the `POST_UPDATE`
13331
13349
  * callback. The function will continue to be fired until `false` is returned from the function.
@@ -13343,8 +13361,10 @@ declare class RunInNFrames extends Feature {
13343
13361
  * @param gameFrames The amount of game frames to wait between each run.
13344
13362
  * @param runImmediately Whether or not to execute the function right now before waiting for the
13345
13363
  * interval.
13364
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13365
+ * room is loaded in the interim. Default is false.
13346
13366
  */
13347
- setIntervalGameFrames(func: () => boolean, gameFrames: int, runImmediately: boolean): void;
13367
+ setIntervalGameFrames(func: () => boolean, gameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13348
13368
  /**
13349
13369
  * Supply a function to be repeatedly run on an interval of N render frames in the `POST_RENDER`
13350
13370
  * callback. The function will continue to be fired until `false` is returned from the function.
@@ -13362,8 +13382,10 @@ declare class RunInNFrames extends Feature {
13362
13382
  * @param renderFrames The amount of game frames to wait between each run.
13363
13383
  * @param runImmediately Whether or not to execute the function right now before waiting for the
13364
13384
  * interval.
13385
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13386
+ * room is loaded in the interim. Default is false.
13365
13387
  */
13366
- setIntervalRenderFrames(func: () => boolean, renderFrames: int, runImmediately: boolean): void;
13388
+ setIntervalRenderFrames(func: () => boolean, renderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13367
13389
  }
13368
13390
 
13369
13391
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.10.0
3
+ isaacscript-common 20.11.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -31619,6 +31619,119 @@ return ____exports
31619
31619
  end,
31620
31620
  ["src.interfaces.GridEntityCustomData"] = function(...)
31621
31621
  local ____exports = {}
31622
+ return ____exports
31623
+ end,
31624
+ ["src.interfaces.RoomDescription"] = function(...)
31625
+ local ____exports = {}
31626
+ return ____exports
31627
+ end,
31628
+ ["src.classes.features.other.RoomHistory"] = function(...)
31629
+ local ____lualib = require("lualib_bundle")
31630
+ local __TS__Class = ____lualib.__TS__Class
31631
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
31632
+ local __TS__Decorate = ____lualib.__TS__Decorate
31633
+ local ____exports = {}
31634
+ local ____cachedClasses = require("src.core.cachedClasses")
31635
+ local game = ____cachedClasses.game
31636
+ local ____decorators = require("src.decorators")
31637
+ local Exported = ____decorators.Exported
31638
+ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
31639
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
31640
+ local ____array = require("src.functions.array")
31641
+ local getLastElement = ____array.getLastElement
31642
+ local ____dimensions = require("src.functions.dimensions")
31643
+ local getDimension = ____dimensions.getDimension
31644
+ local ____roomData = require("src.functions.roomData")
31645
+ local getRoomGridIndex = ____roomData.getRoomGridIndex
31646
+ local getRoomListIndex = ____roomData.getRoomListIndex
31647
+ local getRoomName = ____roomData.getRoomName
31648
+ local getRoomStageID = ____roomData.getRoomStageID
31649
+ local getRoomSubType = ____roomData.getRoomSubType
31650
+ local getRoomVariant = ____roomData.getRoomVariant
31651
+ local getRoomVisitedCount = ____roomData.getRoomVisitedCount
31652
+ local ____Feature = require("src.classes.private.Feature")
31653
+ local Feature = ____Feature.Feature
31654
+ ____exports.RoomHistory = __TS__Class()
31655
+ local RoomHistory = ____exports.RoomHistory
31656
+ RoomHistory.name = "RoomHistory"
31657
+ __TS__ClassExtends(RoomHistory, Feature)
31658
+ function RoomHistory.prototype.____constructor(self)
31659
+ Feature.prototype.____constructor(self)
31660
+ self.v = {run = {roomHistory = {}}}
31661
+ self.postNewRoomEarly = function()
31662
+ local level = game:GetLevel()
31663
+ local stage = level:GetStage()
31664
+ local stageType = level:GetStageType()
31665
+ local room = game:GetRoom()
31666
+ local roomType = room:GetType()
31667
+ local seeds = game:GetSeeds()
31668
+ local startSeedString = seeds:GetStartSeedString()
31669
+ local stageID = getRoomStageID(nil)
31670
+ local dimension = getDimension(nil)
31671
+ local roomVariant = getRoomVariant(nil)
31672
+ local roomSubType = getRoomSubType(nil)
31673
+ local roomName = getRoomName(nil)
31674
+ local roomGridIndex = getRoomGridIndex(nil)
31675
+ local roomListIndex = getRoomListIndex(nil)
31676
+ local roomVisitedCount = getRoomVisitedCount(nil)
31677
+ local roomDescription = {
31678
+ startSeedString = startSeedString,
31679
+ stage = stage,
31680
+ stageType = stageType,
31681
+ stageID = stageID,
31682
+ dimension = dimension,
31683
+ roomType = roomType,
31684
+ roomVariant = roomVariant,
31685
+ roomSubType = roomSubType,
31686
+ roomName = roomName,
31687
+ roomGridIndex = roomGridIndex,
31688
+ roomListIndex = roomListIndex,
31689
+ roomVisitedCount = roomVisitedCount
31690
+ }
31691
+ local ____self_v_run_roomHistory_0 = self.v.run.roomHistory
31692
+ ____self_v_run_roomHistory_0[#____self_v_run_roomHistory_0 + 1] = roomDescription
31693
+ end
31694
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_EARLY, self.postNewRoomEarly}}
31695
+ end
31696
+ function RoomHistory.prototype.getNumRoomsEntered(self)
31697
+ return #self.v.run.roomHistory
31698
+ end
31699
+ function RoomHistory.prototype.getRoomHistory(self)
31700
+ return self.v.run.roomHistory
31701
+ end
31702
+ function RoomHistory.prototype.getPreviousRoomDescription(self)
31703
+ local previousRoomDescription = self.v.run.roomHistory[#self.v.run.roomHistory - 2 + 1]
31704
+ if previousRoomDescription ~= nil then
31705
+ return previousRoomDescription
31706
+ end
31707
+ local startingRoomDescription = self.v.run.roomHistory[1]
31708
+ if startingRoomDescription ~= nil then
31709
+ return startingRoomDescription
31710
+ end
31711
+ error("Failed to find a room description for any rooms thus far on this run.")
31712
+ end
31713
+ function RoomHistory.prototype.getLatestRoomDescription(self)
31714
+ return getLastElement(nil, self.v.run.roomHistory)
31715
+ end
31716
+ function RoomHistory.prototype.isLeavingRoom(self)
31717
+ local level = game:GetLevel()
31718
+ local stage = level:GetStage()
31719
+ local stageType = level:GetStageType()
31720
+ local seeds = game:GetSeeds()
31721
+ local startSeedString = seeds:GetStartSeedString()
31722
+ local roomListIndex = getRoomListIndex(nil)
31723
+ local roomVisitedCount = getRoomVisitedCount(nil)
31724
+ local latestRoomDescription = self:getLatestRoomDescription()
31725
+ if latestRoomDescription == nil then
31726
+ return false
31727
+ end
31728
+ return startSeedString ~= latestRoomDescription.startSeedString or stage ~= latestRoomDescription.stage or stageType ~= latestRoomDescription.stageType or roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
31729
+ end
31730
+ __TS__Decorate({Exported}, RoomHistory.prototype, "getNumRoomsEntered", true)
31731
+ __TS__Decorate({Exported}, RoomHistory.prototype, "getRoomHistory", true)
31732
+ __TS__Decorate({Exported}, RoomHistory.prototype, "getPreviousRoomDescription", true)
31733
+ __TS__Decorate({Exported}, RoomHistory.prototype, "getLatestRoomDescription", true)
31734
+ __TS__Decorate({Exported}, RoomHistory.prototype, "isLeavingRoom", true)
31622
31735
  return ____exports
31623
31736
  end,
31624
31737
  ["src.classes.features.other.RunInNFrames"] = function(...)
@@ -31635,44 +31748,61 @@ local ____cachedClasses = require("src.core.cachedClasses")
31635
31748
  local game = ____cachedClasses.game
31636
31749
  local ____decorators = require("src.decorators")
31637
31750
  local Exported = ____decorators.Exported
31751
+ local ____ISCFeature = require("src.enums.ISCFeature")
31752
+ local ISCFeature = ____ISCFeature.ISCFeature
31638
31753
  local ____array = require("src.functions.array")
31639
31754
  local arrayRemoveInPlace = ____array.arrayRemoveInPlace
31640
31755
  local ____run = require("src.functions.run")
31641
31756
  local restart = ____run.restart
31642
31757
  local ____Feature = require("src.classes.private.Feature")
31643
31758
  local Feature = ____Feature.Feature
31644
- function checkExecuteQueuedFunctions(self, frameCount, functionTuples)
31759
+ function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
31645
31760
  local firingFunctions = __TS__ArrayFilter(
31646
31761
  functionTuples,
31647
31762
  function(____, ____bindingPattern0)
31648
31763
  local frameCountToFire
31649
- frameCountToFire = ____bindingPattern0[1]
31764
+ frameCountToFire = ____bindingPattern0.frameCountToFire
31650
31765
  return frameCount >= frameCountToFire
31651
31766
  end
31652
31767
  )
31653
- for ____, tuple in ipairs(firingFunctions) do
31654
- local _frameCountToFire, func = table.unpack(tuple)
31655
- func(nil)
31656
- arrayRemoveInPlace(nil, functionTuples, tuple)
31768
+ for ____, firingFunction in ipairs(firingFunctions) do
31769
+ local func = firingFunction.func
31770
+ local cancelIfRoomChanges = firingFunction.cancelIfRoomChanges
31771
+ local numRoomsEntered = firingFunction.numRoomsEntered
31772
+ if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
31773
+ func(nil)
31774
+ end
31775
+ arrayRemoveInPlace(nil, functionTuples, firingFunction)
31657
31776
  end
31658
31777
  end
31659
- function checkExecuteIntervalFunctions(self, frameCount, functionTuples)
31778
+ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
31660
31779
  local firingFunctions = __TS__ArrayFilter(
31661
31780
  functionTuples,
31662
31781
  function(____, ____bindingPattern0)
31663
31782
  local frameCountToFire
31664
- frameCountToFire = ____bindingPattern0[1]
31783
+ frameCountToFire = ____bindingPattern0.frameCountToFire
31665
31784
  return frameCount >= frameCountToFire
31666
31785
  end
31667
31786
  )
31668
- for ____, tuple in ipairs(firingFunctions) do
31669
- local _frameCountToFire, func, numIntervalFrames = table.unpack(tuple)
31670
- local returnValue = func(nil)
31671
- arrayRemoveInPlace(nil, functionTuples, tuple)
31787
+ for ____, firingFunction in ipairs(firingFunctions) do
31788
+ local func = firingFunction.func
31789
+ local cancelIfRoomChanges = firingFunction.cancelIfRoomChanges
31790
+ local numRoomsEntered = firingFunction.numRoomsEntered
31791
+ local numIntervalFrames = firingFunction.numIntervalFrames
31792
+ local returnValue = false
31793
+ if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
31794
+ returnValue = func(nil)
31795
+ end
31796
+ arrayRemoveInPlace(nil, functionTuples, firingFunction)
31672
31797
  if returnValue then
31673
- local nextFireFrame = frameCount + numIntervalFrames
31674
- local newTuple = {nextFireFrame, func, numIntervalFrames}
31675
- functionTuples[#functionTuples + 1] = newTuple
31798
+ local newIntervalFunction = {
31799
+ func = func,
31800
+ frameCountToFire = frameCount + numIntervalFrames,
31801
+ numRoomsEntered = numRoomsEntered,
31802
+ cancelIfRoomChanges = cancelIfRoomChanges,
31803
+ numIntervalFrames = numIntervalFrames
31804
+ }
31805
+ functionTuples[#functionTuples + 1] = newIntervalFunction
31676
31806
  end
31677
31807
  end
31678
31808
  end
@@ -31680,63 +31810,99 @@ ____exports.RunInNFrames = __TS__Class()
31680
31810
  local RunInNFrames = ____exports.RunInNFrames
31681
31811
  RunInNFrames.name = "RunInNFrames"
31682
31812
  __TS__ClassExtends(RunInNFrames, Feature)
31683
- function RunInNFrames.prototype.____constructor(self)
31813
+ function RunInNFrames.prototype.____constructor(self, roomHistory)
31684
31814
  Feature.prototype.____constructor(self)
31685
- self.v = {run = {queuedGameFunctionTuples = {}, queuedRenderFunctionTuples = {}, intervalGameFunctionTuples = {}, intervalRenderFunctionTuples = {}}}
31815
+ self.v = {run = {queuedGameFunctions = {}, queuedRenderFunctions = {}, intervalGameFunctions = {}, intervalRenderFunctions = {}}}
31686
31816
  self.vConditionalFunc = function() return false end
31687
31817
  self.postUpdate = function()
31688
31818
  local gameFrameCount = game:GetFrameCount()
31689
- checkExecuteQueuedFunctions(nil, gameFrameCount, self.v.run.queuedGameFunctionTuples)
31690
- checkExecuteIntervalFunctions(nil, gameFrameCount, self.v.run.intervalGameFunctionTuples)
31819
+ local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
31820
+ checkExecuteQueuedFunctions(nil, self.v.run.queuedGameFunctions, gameFrameCount, numRoomsEntered)
31821
+ checkExecuteIntervalFunctions(nil, self.v.run.intervalGameFunctions, gameFrameCount, numRoomsEntered)
31691
31822
  end
31692
31823
  self.postRender = function()
31693
31824
  local renderFrameCount = Isaac.GetFrameCount()
31694
- checkExecuteQueuedFunctions(nil, renderFrameCount, self.v.run.queuedRenderFunctionTuples)
31695
- checkExecuteIntervalFunctions(nil, renderFrameCount, self.v.run.intervalRenderFunctionTuples)
31825
+ local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
31826
+ checkExecuteQueuedFunctions(nil, self.v.run.queuedRenderFunctions, renderFrameCount, numRoomsEntered)
31827
+ checkExecuteIntervalFunctions(nil, self.v.run.intervalRenderFunctions, renderFrameCount, numRoomsEntered)
31696
31828
  end
31829
+ self.featuresUsed = {ISCFeature.ROOM_HISTORY}
31697
31830
  self.callbacksUsed = {{ModCallback.POST_UPDATE, self.postUpdate}, {ModCallback.POST_RENDER, self.postRender}}
31831
+ self.roomHistory = roomHistory
31698
31832
  end
31699
31833
  function RunInNFrames.prototype.restartNextRenderFrame(self, character)
31700
31834
  self:runNextRenderFrame(function()
31701
31835
  restart(nil, character)
31702
31836
  end)
31703
31837
  end
31704
- function RunInNFrames.prototype.runInNGameFrames(self, func, gameFrames)
31838
+ function RunInNFrames.prototype.runInNGameFrames(self, func, gameFrames, cancelIfRoomChanges)
31839
+ if cancelIfRoomChanges == nil then
31840
+ cancelIfRoomChanges = false
31841
+ end
31705
31842
  local gameFrameCount = game:GetFrameCount()
31706
- local functionFireFrame = gameFrameCount + gameFrames
31707
- local tuple = {functionFireFrame, func}
31708
- local ____self_v_run_queuedGameFunctionTuples_0 = self.v.run.queuedGameFunctionTuples
31709
- ____self_v_run_queuedGameFunctionTuples_0[#____self_v_run_queuedGameFunctionTuples_0 + 1] = tuple
31843
+ local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
31844
+ local frameCountToFire = gameFrameCount + gameFrames
31845
+ local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
31846
+ local ____self_v_run_queuedGameFunctions_0 = self.v.run.queuedGameFunctions
31847
+ ____self_v_run_queuedGameFunctions_0[#____self_v_run_queuedGameFunctions_0 + 1] = queuedFunction
31710
31848
  end
31711
- function RunInNFrames.prototype.runInNRenderFrames(self, func, renderFrames)
31849
+ function RunInNFrames.prototype.runInNRenderFrames(self, func, renderFrames, cancelIfRoomChanges)
31850
+ if cancelIfRoomChanges == nil then
31851
+ cancelIfRoomChanges = false
31852
+ end
31712
31853
  local renderFrameCount = Isaac.GetFrameCount()
31713
- local functionFireFrame = renderFrameCount + renderFrames
31714
- local tuple = {functionFireFrame, func}
31715
- local ____self_v_run_queuedRenderFunctionTuples_1 = self.v.run.queuedRenderFunctionTuples
31716
- ____self_v_run_queuedRenderFunctionTuples_1[#____self_v_run_queuedRenderFunctionTuples_1 + 1] = tuple
31854
+ local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
31855
+ local frameCountToFire = renderFrameCount + renderFrames
31856
+ local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
31857
+ local ____self_v_run_queuedRenderFunctions_1 = self.v.run.queuedRenderFunctions
31858
+ ____self_v_run_queuedRenderFunctions_1[#____self_v_run_queuedRenderFunctions_1 + 1] = queuedFunction
31717
31859
  end
31718
- function RunInNFrames.prototype.runNextGameFrame(self, func)
31719
- self:runInNGameFrames(func, 1)
31860
+ function RunInNFrames.prototype.runNextGameFrame(self, func, cancelIfRoomChanges)
31861
+ if cancelIfRoomChanges == nil then
31862
+ cancelIfRoomChanges = false
31863
+ end
31864
+ self:runInNGameFrames(func, 1, cancelIfRoomChanges)
31720
31865
  end
31721
- function RunInNFrames.prototype.runNextRenderFrame(self, func)
31722
- self:runInNRenderFrames(func, 1)
31866
+ function RunInNFrames.prototype.runNextRenderFrame(self, func, cancelIfRoomChanges)
31867
+ if cancelIfRoomChanges == nil then
31868
+ cancelIfRoomChanges = false
31869
+ end
31870
+ self:runInNRenderFrames(func, 1, cancelIfRoomChanges)
31723
31871
  end
31724
- function RunInNFrames.prototype.setIntervalGameFrames(self, func, gameFrames, runImmediately)
31872
+ function RunInNFrames.prototype.setIntervalGameFrames(self, func, gameFrames, runImmediately, cancelIfRoomChanges)
31873
+ if cancelIfRoomChanges == nil then
31874
+ cancelIfRoomChanges = false
31875
+ end
31725
31876
  local gameFrameCount = game:GetFrameCount()
31726
- local functionFireFrame = gameFrameCount + gameFrames
31727
- local tuple = {functionFireFrame, func, gameFrames}
31728
- local ____self_v_run_intervalGameFunctionTuples_2 = self.v.run.intervalGameFunctionTuples
31729
- ____self_v_run_intervalGameFunctionTuples_2[#____self_v_run_intervalGameFunctionTuples_2 + 1] = tuple
31877
+ local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
31878
+ local intervalFunction = {
31879
+ func = func,
31880
+ frameCountToFire = gameFrameCount + gameFrames,
31881
+ numRoomsEntered = numRoomsEntered,
31882
+ cancelIfRoomChanges = cancelIfRoomChanges,
31883
+ numIntervalFrames = gameFrames
31884
+ }
31885
+ local ____self_v_run_intervalGameFunctions_2 = self.v.run.intervalGameFunctions
31886
+ ____self_v_run_intervalGameFunctions_2[#____self_v_run_intervalGameFunctions_2 + 1] = intervalFunction
31730
31887
  if runImmediately then
31731
31888
  func(nil)
31732
31889
  end
31733
31890
  end
31734
- function RunInNFrames.prototype.setIntervalRenderFrames(self, func, renderFrames, runImmediately)
31891
+ function RunInNFrames.prototype.setIntervalRenderFrames(self, func, renderFrames, runImmediately, cancelIfRoomChanges)
31892
+ if cancelIfRoomChanges == nil then
31893
+ cancelIfRoomChanges = false
31894
+ end
31735
31895
  local renderFrameCount = Isaac.GetFrameCount()
31736
- local functionFireFrame = renderFrameCount + renderFrames
31737
- local tuple = {functionFireFrame, func, renderFrames}
31738
- local ____self_v_run_intervalGameFunctionTuples_3 = self.v.run.intervalGameFunctionTuples
31739
- ____self_v_run_intervalGameFunctionTuples_3[#____self_v_run_intervalGameFunctionTuples_3 + 1] = tuple
31896
+ local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
31897
+ local intervalFunction = {
31898
+ func = func,
31899
+ frameCountToFire = renderFrameCount + renderFrames,
31900
+ numRoomsEntered = numRoomsEntered,
31901
+ cancelIfRoomChanges = cancelIfRoomChanges,
31902
+ numIntervalFrames = renderFrames
31903
+ }
31904
+ local ____self_v_run_intervalGameFunctions_3 = self.v.run.intervalGameFunctions
31905
+ ____self_v_run_intervalGameFunctions_3[#____self_v_run_intervalGameFunctions_3 + 1] = intervalFunction
31740
31906
  if runImmediately then
31741
31907
  func(nil)
31742
31908
  end
@@ -34113,119 +34279,6 @@ function ____exports.isSlotMachine(self, entity)
34113
34279
  end
34114
34280
  return SLOT_MACHINE_VARIANTS:has(entity.Variant)
34115
34281
  end
34116
- return ____exports
34117
- end,
34118
- ["src.interfaces.RoomDescription"] = function(...)
34119
- local ____exports = {}
34120
- return ____exports
34121
- end,
34122
- ["src.classes.features.other.RoomHistory"] = function(...)
34123
- local ____lualib = require("lualib_bundle")
34124
- local __TS__Class = ____lualib.__TS__Class
34125
- local __TS__ClassExtends = ____lualib.__TS__ClassExtends
34126
- local __TS__Decorate = ____lualib.__TS__Decorate
34127
- local ____exports = {}
34128
- local ____cachedClasses = require("src.core.cachedClasses")
34129
- local game = ____cachedClasses.game
34130
- local ____decorators = require("src.decorators")
34131
- local Exported = ____decorators.Exported
34132
- local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
34133
- local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
34134
- local ____array = require("src.functions.array")
34135
- local getLastElement = ____array.getLastElement
34136
- local ____dimensions = require("src.functions.dimensions")
34137
- local getDimension = ____dimensions.getDimension
34138
- local ____roomData = require("src.functions.roomData")
34139
- local getRoomGridIndex = ____roomData.getRoomGridIndex
34140
- local getRoomListIndex = ____roomData.getRoomListIndex
34141
- local getRoomName = ____roomData.getRoomName
34142
- local getRoomStageID = ____roomData.getRoomStageID
34143
- local getRoomSubType = ____roomData.getRoomSubType
34144
- local getRoomVariant = ____roomData.getRoomVariant
34145
- local getRoomVisitedCount = ____roomData.getRoomVisitedCount
34146
- local ____Feature = require("src.classes.private.Feature")
34147
- local Feature = ____Feature.Feature
34148
- ____exports.RoomHistory = __TS__Class()
34149
- local RoomHistory = ____exports.RoomHistory
34150
- RoomHistory.name = "RoomHistory"
34151
- __TS__ClassExtends(RoomHistory, Feature)
34152
- function RoomHistory.prototype.____constructor(self)
34153
- Feature.prototype.____constructor(self)
34154
- self.v = {run = {roomHistory = {}}}
34155
- self.postNewRoomEarly = function()
34156
- local level = game:GetLevel()
34157
- local stage = level:GetStage()
34158
- local stageType = level:GetStageType()
34159
- local room = game:GetRoom()
34160
- local roomType = room:GetType()
34161
- local seeds = game:GetSeeds()
34162
- local startSeedString = seeds:GetStartSeedString()
34163
- local stageID = getRoomStageID(nil)
34164
- local dimension = getDimension(nil)
34165
- local roomVariant = getRoomVariant(nil)
34166
- local roomSubType = getRoomSubType(nil)
34167
- local roomName = getRoomName(nil)
34168
- local roomGridIndex = getRoomGridIndex(nil)
34169
- local roomListIndex = getRoomListIndex(nil)
34170
- local roomVisitedCount = getRoomVisitedCount(nil)
34171
- local roomDescription = {
34172
- startSeedString = startSeedString,
34173
- stage = stage,
34174
- stageType = stageType,
34175
- stageID = stageID,
34176
- dimension = dimension,
34177
- roomType = roomType,
34178
- roomVariant = roomVariant,
34179
- roomSubType = roomSubType,
34180
- roomName = roomName,
34181
- roomGridIndex = roomGridIndex,
34182
- roomListIndex = roomListIndex,
34183
- roomVisitedCount = roomVisitedCount
34184
- }
34185
- local ____self_v_run_roomHistory_0 = self.v.run.roomHistory
34186
- ____self_v_run_roomHistory_0[#____self_v_run_roomHistory_0 + 1] = roomDescription
34187
- end
34188
- self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_EARLY, self.postNewRoomEarly}}
34189
- end
34190
- function RoomHistory.prototype.getNumRoomsVisited(self)
34191
- return self.v.run.roomHistory
34192
- end
34193
- function RoomHistory.prototype.getRoomHistory(self)
34194
- return self.v.run.roomHistory
34195
- end
34196
- function RoomHistory.prototype.getPreviousRoomDescription(self)
34197
- local previousRoomDescription = self.v.run.roomHistory[#self.v.run.roomHistory - 2 + 1]
34198
- if previousRoomDescription ~= nil then
34199
- return previousRoomDescription
34200
- end
34201
- local startingRoomDescription = self.v.run.roomHistory[1]
34202
- if startingRoomDescription ~= nil then
34203
- return startingRoomDescription
34204
- end
34205
- error("Failed to find a room description for any rooms thus far on this run.")
34206
- end
34207
- function RoomHistory.prototype.getLatestRoomDescription(self)
34208
- return getLastElement(nil, self.v.run.roomHistory)
34209
- end
34210
- function RoomHistory.prototype.isLeavingRoom(self)
34211
- local level = game:GetLevel()
34212
- local stage = level:GetStage()
34213
- local stageType = level:GetStageType()
34214
- local seeds = game:GetSeeds()
34215
- local startSeedString = seeds:GetStartSeedString()
34216
- local roomListIndex = getRoomListIndex(nil)
34217
- local roomVisitedCount = getRoomVisitedCount(nil)
34218
- local latestRoomDescription = self:getLatestRoomDescription()
34219
- if latestRoomDescription == nil then
34220
- return false
34221
- end
34222
- return startSeedString ~= latestRoomDescription.startSeedString or stage ~= latestRoomDescription.stage or stageType ~= latestRoomDescription.stageType or roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
34223
- end
34224
- __TS__Decorate({Exported}, RoomHistory.prototype, "getNumRoomsVisited", true)
34225
- __TS__Decorate({Exported}, RoomHistory.prototype, "getRoomHistory", true)
34226
- __TS__Decorate({Exported}, RoomHistory.prototype, "getPreviousRoomDescription", true)
34227
- __TS__Decorate({Exported}, RoomHistory.prototype, "getLatestRoomDescription", true)
34228
- __TS__Decorate({Exported}, RoomHistory.prototype, "isLeavingRoom", true)
34229
34282
  return ____exports
34230
34283
  end,
34231
34284
  ["src.classes.features.callbackLogic.SlotDestroyedDetection"] = function(...)
@@ -34239,6 +34292,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
34239
34292
  local EntityGridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityGridCollisionClass
34240
34293
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
34241
34294
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
34295
+ local ____ISCFeature = require("src.enums.ISCFeature")
34296
+ local ISCFeature = ____ISCFeature.ISCFeature
34242
34297
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
34243
34298
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
34244
34299
  local ____SlotDestructionType = require("src.enums.SlotDestructionType")
@@ -34273,6 +34328,7 @@ function SlotDestroyedDetection.prototype.____constructor(self, postSlotDestroye
34273
34328
  end
34274
34329
  self:checkDestroyedFromCollisionClass(slot)
34275
34330
  end
34331
+ self.featuresUsed = {ISCFeature.ROOM_HISTORY}
34276
34332
  self.callbacksUsed = {{ModCallback.POST_ENTITY_REMOVE, self.postEntityRemoveSlot, {EntityType.SLOT}}}
34277
34333
  self.customCallbacksUsed = {{ModCallbackCustom.POST_SLOT_UPDATE, self.postSlotUpdate}}
34278
34334
  self.postSlotDestroyed = postSlotDestroyed
@@ -49383,10 +49439,10 @@ function ____exports.getFeatures(self, mod, callbacks)
49383
49439
  local preventCollectibleRotation = __TS__New(PreventCollectibleRotation)
49384
49440
  local roomClearFrame = __TS__New(RoomClearFrame)
49385
49441
  local roomHistory = __TS__New(RoomHistory)
49386
- local runInNFrames = __TS__New(RunInNFrames)
49387
49442
  local runNextRoom = __TS__New(RunNextRoom)
49388
49443
  local saveDataManager = __TS__New(SaveDataManager, mod)
49389
49444
  local stageHistory = __TS__New(StageHistory)
49445
+ local runInNFrames = __TS__New(RunInNFrames, roomHistory)
49390
49446
  local customGridEntities = __TS__New(CustomGridEntities, runInNFrames)
49391
49447
  local moddedElementSets = __TS__New(ModdedElementSets, moddedElementDetection)
49392
49448
  local itemPoolDetection = __TS__New(ItemPoolDetection, moddedElementSets)
@@ -48,8 +48,7 @@ export declare class ModFeature {
48
48
  */
49
49
  protected shouldCallbackMethodsFire: (<T extends boolean>(vanilla: T, modCallback: T extends true ? ModCallback : ModCallbackCustom, ...callbackArgs: unknown[]) => boolean) | null;
50
50
  /**
51
- * Whether or not the feature has registered its callbacks yet (and submitted its variables to the
52
- * save data manager, if any).
51
+ * Whether or not the feature has registered its callbacks yet.
53
52
  *
54
53
  * This will almost always be equal to true unless you explicitly passed `false` to the second
55
54
  * argument of the constructor.
@@ -58,15 +57,14 @@ export declare class ModFeature {
58
57
  constructor(mod: ModUpgradedBase, init?: boolean);
59
58
  /**
60
59
  * Runs the `Mod.AddCallback` and `ModUpgraded.AddCallbackCustom` methods for all of the decorated
61
- * callbacks. Additionally, subscribes the `v` object to the save data manager, if present.
60
+ * callbacks.
62
61
  *
63
62
  * @param init Optional. Whether to initialize or uninitialize. Default is true.
64
63
  */
65
64
  init(init?: boolean): void;
66
65
  /**
67
66
  * Runs the `Mod.RemoveCallback` and `ModUpgraded.RemoveCallbackCustom` methods for all of the
68
- * decorated callbacks. Additionally, unsubscribes the `v` object from the save data manager, if
69
- * present.
67
+ * decorated callbacks.
70
68
  *
71
69
  * This is just an alias for `ModFeature.init(false)`.
72
70
  */