isaacscript-common 20.9.1 → 20.11.0

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
@@ -13171,6 +13171,13 @@ export declare function roomGridIndexToXY(roomGridIndex: int): [x: int, y: int];
13171
13171
 
13172
13172
  declare class RoomHistory extends Feature {
13173
13173
  private postNewRoomEarly;
13174
+ /**
13175
+ * Helper function to get the total number of rooms that the player has entered thus far on the
13176
+ * run. (Re-entering the same room will increment the number returned.)
13177
+ *
13178
+ * In order to use this function, you must upgrade your mod with `ISCFeature.ROOM_HISTORY`.
13179
+ */
13180
+ getNumRoomsEntered(): int;
13174
13181
  /**
13175
13182
  * Helper function to get information about all of the rooms that a player has visited thus far on
13176
13183
  * this run.
@@ -13239,6 +13246,7 @@ export declare function runDeepCopyTests(): void;
13239
13246
 
13240
13247
  declare class RunInNFrames extends Feature {
13241
13248
  vConditionalFunc: () => boolean;
13249
+ private roomHistory;
13242
13250
  private postUpdate;
13243
13251
  private postRender;
13244
13252
  /**
@@ -13262,8 +13270,13 @@ declare class RunInNFrames extends Feature {
13262
13270
  * deferred functions manually using serializable data.
13263
13271
  *
13264
13272
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13273
+ *
13274
+ * @param func The function to run.
13275
+ * @param gameFrames The amount of game frames to wait before running the function.
13276
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13277
+ * room is loaded in the interim. Default is false.
13265
13278
  */
13266
- runInNGameFrames(func: () => void, gameFrames: int): void;
13279
+ runInNGameFrames(func: () => void, gameFrames: int, cancelIfRoomChanges?: boolean): void;
13267
13280
  /**
13268
13281
  * Supply a function to run N render frames from now in the `POST_RENDER` callback.
13269
13282
  *
@@ -13275,8 +13288,13 @@ declare class RunInNFrames extends Feature {
13275
13288
  * deferred functions manually using serializable data.
13276
13289
  *
13277
13290
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13291
+ *
13292
+ * @param func The function to run.
13293
+ * @param renderFrames The amount of render frames to wait before running the function.
13294
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13295
+ * room is loaded in the interim. Default is false.
13278
13296
  */
13279
- runInNRenderFrames(func: () => void, renderFrames: int): void;
13297
+ runInNRenderFrames(func: () => void, renderFrames: int, cancelIfRoomChanges?: boolean): void;
13280
13298
  /**
13281
13299
  * Supply a function to run on the next `POST_UPDATE` callback.
13282
13300
  *
@@ -13306,8 +13324,12 @@ declare class RunInNFrames extends Feature {
13306
13324
  * deferred functions manually using serializable data.
13307
13325
  *
13308
13326
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13327
+ *
13328
+ * @param func The function to run.
13329
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13330
+ * room is loaded in the interim. Default is false.
13309
13331
  */
13310
- runNextGameFrame(func: () => void): void;
13332
+ runNextGameFrame(func: () => void, cancelIfRoomChanges?: boolean): void;
13311
13333
  /**
13312
13334
  * Supply a function to run on the next `POST_RENDER` callback.
13313
13335
  *
@@ -13317,8 +13339,12 @@ declare class RunInNFrames extends Feature {
13317
13339
  * Note that this function will not handle saving and quitting.
13318
13340
  *
13319
13341
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13342
+ *
13343
+ * @param func The function to run.
13344
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13345
+ * room is loaded in the interim. Default is false.
13320
13346
  */
13321
- runNextRenderFrame(func: () => void): void;
13347
+ runNextRenderFrame(func: () => void, cancelIfRoomChanges?: boolean): void;
13322
13348
  /**
13323
13349
  * Supply a function to be repeatedly run on an interval of N game frames in the `POST_UPDATE`
13324
13350
  * callback. The function will continue to be fired until `false` is returned from the function.
@@ -13336,8 +13362,10 @@ declare class RunInNFrames extends Feature {
13336
13362
  * @param gameFrames The amount of game frames to wait between each run.
13337
13363
  * @param runImmediately Whether or not to execute the function right now before waiting for the
13338
13364
  * interval.
13365
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13366
+ * room is loaded in the interim. Default is false.
13339
13367
  */
13340
- setIntervalGameFrames(func: () => boolean, gameFrames: int, runImmediately: boolean): void;
13368
+ setIntervalGameFrames(func: () => boolean, gameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13341
13369
  /**
13342
13370
  * Supply a function to be repeatedly run on an interval of N render frames in the `POST_RENDER`
13343
13371
  * callback. The function will continue to be fired until `false` is returned from the function.
@@ -13355,8 +13383,10 @@ declare class RunInNFrames extends Feature {
13355
13383
  * @param renderFrames The amount of game frames to wait between each run.
13356
13384
  * @param runImmediately Whether or not to execute the function right now before waiting for the
13357
13385
  * interval.
13386
+ * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13387
+ * room is loaded in the interim. Default is false.
13358
13388
  */
13359
- setIntervalRenderFrames(func: () => boolean, renderFrames: int, runImmediately: boolean): void;
13389
+ setIntervalRenderFrames(func: () => boolean, renderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13360
13390
  }
13361
13391
 
13362
13392
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 20.9.1
3
+ isaacscript-common 20.11.0
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,115 +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.getRoomHistory(self)
34191
- return self.v.run.roomHistory
34192
- end
34193
- function RoomHistory.prototype.getPreviousRoomDescription(self)
34194
- local previousRoomDescription = self.v.run.roomHistory[#self.v.run.roomHistory - 2 + 1]
34195
- if previousRoomDescription ~= nil then
34196
- return previousRoomDescription
34197
- end
34198
- local startingRoomDescription = self.v.run.roomHistory[1]
34199
- if startingRoomDescription ~= nil then
34200
- return startingRoomDescription
34201
- end
34202
- error("Failed to find a room description for any rooms thus far on this run.")
34203
- end
34204
- function RoomHistory.prototype.getLatestRoomDescription(self)
34205
- return getLastElement(nil, self.v.run.roomHistory)
34206
- end
34207
- function RoomHistory.prototype.isLeavingRoom(self)
34208
- local level = game:GetLevel()
34209
- local stage = level:GetStage()
34210
- local stageType = level:GetStageType()
34211
- local seeds = game:GetSeeds()
34212
- local startSeedString = seeds:GetStartSeedString()
34213
- local roomListIndex = getRoomListIndex(nil)
34214
- local roomVisitedCount = getRoomVisitedCount(nil)
34215
- local latestRoomDescription = self:getLatestRoomDescription()
34216
- if latestRoomDescription == nil then
34217
- return false
34218
- end
34219
- return startSeedString ~= latestRoomDescription.startSeedString or stage ~= latestRoomDescription.stage or stageType ~= latestRoomDescription.stageType or roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
34220
- end
34221
- __TS__Decorate({Exported}, RoomHistory.prototype, "getRoomHistory", true)
34222
- __TS__Decorate({Exported}, RoomHistory.prototype, "getPreviousRoomDescription", true)
34223
- __TS__Decorate({Exported}, RoomHistory.prototype, "getLatestRoomDescription", true)
34224
- __TS__Decorate({Exported}, RoomHistory.prototype, "isLeavingRoom", true)
34225
34282
  return ____exports
34226
34283
  end,
34227
34284
  ["src.classes.features.callbackLogic.SlotDestroyedDetection"] = function(...)
@@ -34235,6 +34292,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
34235
34292
  local EntityGridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityGridCollisionClass
34236
34293
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
34237
34294
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
34295
+ local ____ISCFeature = require("src.enums.ISCFeature")
34296
+ local ISCFeature = ____ISCFeature.ISCFeature
34238
34297
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
34239
34298
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
34240
34299
  local ____SlotDestructionType = require("src.enums.SlotDestructionType")
@@ -34269,6 +34328,7 @@ function SlotDestroyedDetection.prototype.____constructor(self, postSlotDestroye
34269
34328
  end
34270
34329
  self:checkDestroyedFromCollisionClass(slot)
34271
34330
  end
34331
+ self.featuresUsed = {ISCFeature.ROOM_HISTORY}
34272
34332
  self.callbacksUsed = {{ModCallback.POST_ENTITY_REMOVE, self.postEntityRemoveSlot, {EntityType.SLOT}}}
34273
34333
  self.customCallbacksUsed = {{ModCallbackCustom.POST_SLOT_UPDATE, self.postSlotUpdate}}
34274
34334
  self.postSlotDestroyed = postSlotDestroyed
@@ -49379,10 +49439,10 @@ function ____exports.getFeatures(self, mod, callbacks)
49379
49439
  local preventCollectibleRotation = __TS__New(PreventCollectibleRotation)
49380
49440
  local roomClearFrame = __TS__New(RoomClearFrame)
49381
49441
  local roomHistory = __TS__New(RoomHistory)
49382
- local runInNFrames = __TS__New(RunInNFrames)
49383
49442
  local runNextRoom = __TS__New(RunNextRoom)
49384
49443
  local saveDataManager = __TS__New(SaveDataManager, mod)
49385
49444
  local stageHistory = __TS__New(StageHistory)
49445
+ local runInNFrames = __TS__New(RunInNFrames, roomHistory)
49386
49446
  local customGridEntities = __TS__New(CustomGridEntities, runInNFrames)
49387
49447
  local moddedElementSets = __TS__New(ModdedElementSets, moddedElementDetection)
49388
49448
  local itemPoolDetection = __TS__New(ItemPoolDetection, moddedElementSets)
@@ -1 +1 @@
1
- {"version":3,"file":"SlotDestroyedDetection.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/SlotDestroyedDetection.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,qBAAa,sBAAuB,SAAQ,OAAO;IACjC,CAAC;;;;MAIf;IAEF,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,WAAW,CAAc;gBAErB,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW;IAsB1E,OAAO,CAAC,oBAAoB,CAc1B;IAEF,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,cAAc,CASpB;IAEF;;;;;OAKG;IACH,OAAO,CAAC,gCAAgC;CAOzC"}
1
+ {"version":3,"file":"SlotDestroyedDetection.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/SlotDestroyedDetection.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,qBAAa,sBAAuB,SAAQ,OAAO;IACjC,CAAC;;;;MAIf;IAEF,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,WAAW,CAAc;gBAErB,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW;IAwB1E,OAAO,CAAC,oBAAoB,CAc1B;IAEF,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,cAAc,CASpB;IAEF;;;;;OAKG;IACH,OAAO,CAAC,gCAAgC;CAOzC"}
@@ -8,6 +8,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
8
8
  local EntityGridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityGridCollisionClass
9
9
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
10
10
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
11
+ local ____ISCFeature = require("src.enums.ISCFeature")
12
+ local ISCFeature = ____ISCFeature.ISCFeature
11
13
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
12
14
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
13
15
  local ____SlotDestructionType = require("src.enums.SlotDestructionType")
@@ -42,6 +44,7 @@ function SlotDestroyedDetection.prototype.____constructor(self, postSlotDestroye
42
44
  end
43
45
  self:checkDestroyedFromCollisionClass(slot)
44
46
  end
47
+ self.featuresUsed = {ISCFeature.ROOM_HISTORY}
45
48
  self.callbacksUsed = {{ModCallback.POST_ENTITY_REMOVE, self.postEntityRemoveSlot, {EntityType.SLOT}}}
46
49
  self.customCallbacksUsed = {{ModCallbackCustom.POST_SLOT_UPDATE, self.postSlotUpdate}}
47
50
  self.postSlotDestroyed = postSlotDestroyed
@@ -1,7 +1,15 @@
1
+ /// <reference types="isaac-typescript-definitions" />
1
2
  import { RoomDescription } from "../../../interfaces/RoomDescription";
2
3
  import { Feature } from "../../private/Feature";
3
4
  export declare class RoomHistory extends Feature {
4
5
  private postNewRoomEarly;
6
+ /**
7
+ * Helper function to get the total number of rooms that the player has entered thus far on the
8
+ * run. (Re-entering the same room will increment the number returned.)
9
+ *
10
+ * In order to use this function, you must upgrade your mod with `ISCFeature.ROOM_HISTORY`.
11
+ */
12
+ getNumRoomsEntered(): int;
5
13
  /**
6
14
  * Helper function to get information about all of the rooms that a player has visited thus far on
7
15
  * this run.
@@ -1 +1 @@
1
- {"version":3,"file":"RoomHistory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RoomHistory.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,OAAO;IAkBtC,OAAO,CAAC,gBAAgB,CAgCtB;IAEF;;;;;OAKG;IAEI,cAAc,IAAI,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAIjE;;;;;;;OAOG;IAEI,0BAA0B,IAAI,QAAQ,CAAC,eAAe,CAAC;IAiB9D;;;;;;;;;;OAUG;IAEI,wBAAwB,IAAI,QAAQ,CAAC,eAAe,CAAC,GAAG,SAAS;IAIxE;;;;;;;;;;OAUG;IAEI,aAAa,IAAI,OAAO;CAwBhC"}
1
+ {"version":3,"file":"RoomHistory.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RoomHistory.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,OAAO;IAkBtC,OAAO,CAAC,gBAAgB,CAgCtB;IAEF;;;;;OAKG;IAEI,kBAAkB,IAAI,GAAG;IAIhC;;;;;OAKG;IAEI,cAAc,IAAI,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAIjE;;;;;;;OAOG;IAEI,0BAA0B,IAAI,QAAQ,CAAC,eAAe,CAAC;IAiB9D;;;;;;;;;;OAUG;IAEI,wBAAwB,IAAI,QAAQ,CAAC,eAAe,CAAC,GAAG,SAAS;IAIxE;;;;;;;;;;OAUG;IAEI,aAAa,IAAI,OAAO;CAwBhC"}
@@ -65,6 +65,9 @@ function RoomHistory.prototype.____constructor(self)
65
65
  end
66
66
  self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_EARLY, self.postNewRoomEarly}}
67
67
  end
68
+ function RoomHistory.prototype.getNumRoomsEntered(self)
69
+ return #self.v.run.roomHistory
70
+ end
68
71
  function RoomHistory.prototype.getRoomHistory(self)
69
72
  return self.v.run.roomHistory
70
73
  end
@@ -96,6 +99,7 @@ function RoomHistory.prototype.isLeavingRoom(self)
96
99
  end
97
100
  return startSeedString ~= latestRoomDescription.startSeedString or stage ~= latestRoomDescription.stage or stageType ~= latestRoomDescription.stageType or roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
98
101
  end
102
+ __TS__Decorate({Exported}, RoomHistory.prototype, "getNumRoomsEntered", true)
99
103
  __TS__Decorate({Exported}, RoomHistory.prototype, "getRoomHistory", true)
100
104
  __TS__Decorate({Exported}, RoomHistory.prototype, "getPreviousRoomDescription", true)
101
105
  __TS__Decorate({Exported}, RoomHistory.prototype, "getLatestRoomDescription", true)