isaacscript-common 15.6.2 → 16.1.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.
Files changed (28) hide show
  1. package/dist/index.d.ts +26 -4
  2. package/dist/isaacscript-common.lua +93 -65
  3. package/dist/lualib_bundle.lua +20 -21
  4. package/dist/src/classes/ModUpgradedBase.d.ts +5 -0
  5. package/dist/src/classes/ModUpgradedBase.d.ts.map +1 -1
  6. package/dist/src/classes/ModUpgradedBase.lua +4 -0
  7. package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts +1 -1
  8. package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
  9. package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +30 -27
  10. package/dist/src/classes/features/callbackLogic/CustomRevive.d.ts +1 -1
  11. package/dist/src/classes/features/callbackLogic/CustomRevive.d.ts.map +1 -1
  12. package/dist/src/classes/features/callbackLogic/CustomRevive.lua +3 -3
  13. package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.d.ts +1 -1
  14. package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.d.ts.map +1 -1
  15. package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.lua +5 -2
  16. package/dist/src/core/upgradeMod.d.ts +10 -1
  17. package/dist/src/core/upgradeMod.d.ts.map +1 -1
  18. package/dist/src/core/upgradeMod.lua +19 -2
  19. package/dist/src/functions/players.d.ts +8 -0
  20. package/dist/src/functions/players.d.ts.map +1 -1
  21. package/dist/src/functions/players.lua +24 -9
  22. package/package.json +1 -1
  23. package/src/classes/ModUpgradedBase.ts +9 -0
  24. package/src/classes/features/callbackLogic/CustomGridEntities.ts +36 -32
  25. package/src/classes/features/callbackLogic/CustomRevive.ts +3 -3
  26. package/src/classes/features/callbackLogic/GridEntityUpdateDetection.ts +7 -3
  27. package/src/core/upgradeMod.ts +23 -0
  28. package/src/functions/players.ts +19 -0
package/dist/index.d.ts CHANGED
@@ -1501,8 +1501,8 @@ declare abstract class CustomCallback<T extends ModCallbackCustom> extends Featu
1501
1501
 
1502
1502
  declare class CustomGridEntities extends Feature {
1503
1503
  private runInNFrames;
1504
- private postNewRoom;
1505
1504
  private preUseItemWeNeedToGoDeeper;
1505
+ private postNewRoomReordered;
1506
1506
  /**
1507
1507
  * Helper function to spawn a custom grid entity. Custom grid entities are persistent in that they
1508
1508
  * will reappear if the player leaves and re-enters the room. (It will be manually respawned in
@@ -1804,7 +1804,7 @@ declare class CustomRevive extends Feature {
1804
1804
  private postRender;
1805
1805
  private postPEffectUpdate;
1806
1806
  private checkWaitingForItemAnimation;
1807
- private postNewRoom;
1807
+ private postNewRoomReordered;
1808
1808
  private postPlayerFatalDamage;
1809
1809
  private preBerserkDeath;
1810
1810
  /**
@@ -6613,7 +6613,7 @@ declare class GridEntityUpdateDetection extends Feature {
6613
6613
  private checkGridEntityStateChanged;
6614
6614
  private checkNewGridEntity;
6615
6615
  private updateTupleInMap;
6616
- private postNewRoom;
6616
+ private postNewRoomReordered;
6617
6617
  }
6618
6618
 
6619
6619
  /**
@@ -10974,6 +10974,11 @@ export declare class ModUpgradedBase implements Mod {
10974
10974
  * don't have access to it..
10975
10975
  */
10976
10976
  private initOptionalFeature;
10977
+ /**
10978
+ * This is mostly the same as the `AddCustomCallback` method, but we initialize the custom
10979
+ * callback without actually registering a subscription.
10980
+ */
10981
+ private initCustomCallbackEarly;
10977
10982
  }
10978
10983
 
10979
10984
  export declare const MOVEMENT_ACTIONS_SET: ReadonlySet<ButtonAction>;
@@ -12266,6 +12271,15 @@ export declare function removeCharactersBefore(string: string, substring: string
12266
12271
  */
12267
12272
  export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
12268
12273
 
12274
+ /**
12275
+ * Helper function to remove one or more collectibles from all players. If any player has more than
12276
+ * one copy of the item, then all copies of it will be removed.
12277
+ *
12278
+ * This function is variadic, meaning that you can specify as many collectibles as you want to
12279
+ * remove.
12280
+ */
12281
+ export declare function removeCollectibleFromAllPlayers(...collectibleTypes: CollectibleType[]): void;
12282
+
12269
12283
  /**
12270
12284
  * Helper function to put a message in the log.txt file to let the Rebirth Item Tracker know that it
12271
12285
  * should remove an item.
@@ -14434,6 +14448,14 @@ export declare type UnionToIntersection<U> = (U extends U ? (u: U) => 0 : never)
14434
14448
  * @param modVanilla The mod object returned by the `RegisterMod` function.
14435
14449
  * @param features Optional. An array containing the optional standard library features that you
14436
14450
  * want to enable, if any. Default is an empty array.
14451
+ * @param customCallbacksUsed Optional. An array containing the custom callbacks that you will be
14452
+ * subscribing to after you upgrade your mod. Specifying this will
14453
+ * immediately initialize the callbacks (as opposed to lazy-initializing
14454
+ * them when you first subscribe to the callback). This is only necessary
14455
+ * if you the order of callback firing is important for your mod. (For
14456
+ * example, you may want the `POST_NEW_ROOM` part of the
14457
+ * `POST_GRID_ENTITY_INIT` callback to fire before your own
14458
+ * `POST_NEW_ROOM` callbacks.)
14437
14459
  * @param debug Optional. Whether to log additional output when a callback is fired. Default is
14438
14460
  * false.
14439
14461
  * @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
@@ -14441,7 +14463,7 @@ export declare type UnionToIntersection<U> = (U extends U ? (u: U) => 0 : never)
14441
14463
  * or milliseconds (if the "--luadebug" launch flag is turned off).
14442
14464
  * @returns The upgraded mod object.
14443
14465
  */
14444
- export declare function upgradeMod<T extends readonly ISCFeature[] = never[]>(modVanilla: Mod, features?: ISCFeatureTuple<T>, debug?: boolean, timeThreshold?: float): ModUpgraded<T>;
14466
+ export declare function upgradeMod<T extends readonly ISCFeature[] = never[]>(modVanilla: Mod, features?: ISCFeatureTuple<T>, customCallbacksUsed?: ModCallbackCustom[] | readonly ModCallbackCustom[], debug?: boolean, timeThreshold?: float): ModUpgraded<T>;
14445
14467
 
14446
14468
  /** Helper type to match all of the uppercase keys of an object. */
14447
14469
  export declare type UppercaseKeys<T> = StartsWithUppercase<keyof T>;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 15.6.2
3
+ isaacscript-common 16.1.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -1031,8 +1031,7 @@ do
1031
1031
  if not rawget(metatable, "_descriptors") then
1032
1032
  metatable._descriptors = {}
1033
1033
  end
1034
- local descriptor = __TS__CloneDescriptor(desc)
1035
- metatable._descriptors[key] = descriptor
1034
+ metatable._descriptors[key] = __TS__CloneDescriptor(desc)
1036
1035
  metatable.__index = descriptorIndex
1037
1036
  metatable.__newindex = descriptorNewIndex
1038
1037
  end
@@ -1668,22 +1667,6 @@ local function __TS__ParseFloat(numberString)
1668
1667
  return ____number_1
1669
1668
  end
1670
1669
 
1671
- local function __TS__StringSubstr(self, from, length)
1672
- if from ~= from then
1673
- from = 0
1674
- end
1675
- if length ~= nil then
1676
- if length ~= length or length <= 0 then
1677
- return ""
1678
- end
1679
- length = length + from
1680
- end
1681
- if from >= 0 then
1682
- from = from + 1
1683
- end
1684
- return string.sub(self, from, length)
1685
- end
1686
-
1687
1670
  local function __TS__StringSubstring(self, start, ____end)
1688
1671
  if ____end ~= ____end then
1689
1672
  ____end = 0
@@ -1713,9 +1696,9 @@ do
1713
1696
  base = 16
1714
1697
  local ____TS__Match_result__0_0
1715
1698
  if __TS__Match(hexMatch, "-") then
1716
- ____TS__Match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
1699
+ ____TS__Match_result__0_0 = "-" .. __TS__StringSubstring(numberString, #hexMatch)
1717
1700
  else
1718
- ____TS__Match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
1701
+ ____TS__Match_result__0_0 = __TS__StringSubstring(numberString, #hexMatch)
1719
1702
  end
1720
1703
  numberString = ____TS__Match_result__0_0
1721
1704
  end
@@ -1727,7 +1710,7 @@ do
1727
1710
  if base <= 10 then
1728
1711
  ____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, base)
1729
1712
  else
1730
- ____temp_1 = __TS__StringSubstr(parseIntBasePattern, 0, 10 + 2 * (base - 10))
1713
+ ____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, 10 + 2 * (base - 10))
1731
1714
  end
1732
1715
  local allowedDigits = ____temp_1
1733
1716
  local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
@@ -2437,6 +2420,22 @@ local function __TS__StringStartsWith(self, searchString, position)
2437
2420
  return string.sub(self, position + 1, #searchString + position) == searchString
2438
2421
  end
2439
2422
 
2423
+ local function __TS__StringSubstr(self, from, length)
2424
+ if from ~= from then
2425
+ from = 0
2426
+ end
2427
+ if length ~= nil then
2428
+ if length ~= length or length <= 0 then
2429
+ return ""
2430
+ end
2431
+ length = length + from
2432
+ end
2433
+ if from >= 0 then
2434
+ from = from + 1
2435
+ end
2436
+ return string.sub(self, from, length)
2437
+ end
2438
+
2440
2439
  local function __TS__StringTrim(self)
2441
2440
  local result = string.gsub(self, "^[%s ]*(.-)[%s ]*$", "%1")
2442
2441
  return result
@@ -21768,6 +21767,16 @@ function ____exports.removeCollectibleCostume(self, player, collectibleType)
21768
21767
  end
21769
21768
  player:RemoveCostume(itemConfigItem)
21770
21769
  end
21770
+ function ____exports.removeCollectibleFromAllPlayers(self, ...)
21771
+ local collectibleTypes = {...}
21772
+ for ____, player in ipairs(getAllPlayers(nil)) do
21773
+ for ____, collectibleType in ipairs(collectibleTypes) do
21774
+ while player:HasCollectible(collectibleType, true) do
21775
+ player:RemoveCollectible(collectibleType)
21776
+ end
21777
+ end
21778
+ end
21779
+ end
21771
21780
  function ____exports.removeDeadEyeMultiplier(self, player)
21772
21781
  ____repeat(
21773
21782
  nil,
@@ -21802,9 +21811,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
21802
21811
  itemPool:RemoveCollectible(collectibleType)
21803
21812
  end
21804
21813
  repeat
21805
- local ____switch107 = activeSlot
21806
- local ____cond107 = ____switch107 == ActiveSlot.PRIMARY
21807
- if ____cond107 then
21814
+ local ____switch113 = activeSlot
21815
+ local ____cond113 = ____switch113 == ActiveSlot.PRIMARY
21816
+ if ____cond113 then
21808
21817
  do
21809
21818
  if primaryCollectibleType ~= CollectibleType.NULL then
21810
21819
  player:RemoveCollectible(primaryCollectibleType)
@@ -21813,8 +21822,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
21813
21822
  break
21814
21823
  end
21815
21824
  end
21816
- ____cond107 = ____cond107 or ____switch107 == ActiveSlot.SECONDARY
21817
- if ____cond107 then
21825
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.SECONDARY
21826
+ if ____cond113 then
21818
21827
  do
21819
21828
  if primaryCollectibleType ~= CollectibleType.NULL then
21820
21829
  player:RemoveCollectible(primaryCollectibleType)
@@ -21829,16 +21838,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
21829
21838
  break
21830
21839
  end
21831
21840
  end
21832
- ____cond107 = ____cond107 or ____switch107 == ActiveSlot.POCKET
21833
- if ____cond107 then
21841
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET
21842
+ if ____cond113 then
21834
21843
  do
21835
21844
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
21836
21845
  player:SetActiveCharge(charge, activeSlot)
21837
21846
  break
21838
21847
  end
21839
21848
  end
21840
- ____cond107 = ____cond107 or ____switch107 == ActiveSlot.POCKET_SINGLE_USE
21841
- if ____cond107 then
21849
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET_SINGLE_USE
21850
+ if ____cond113 then
21842
21851
  do
21843
21852
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
21844
21853
  break
@@ -31008,6 +31017,8 @@ local ____decorators = require("src.decorators")
31008
31017
  local Exported = ____decorators.Exported
31009
31018
  local ____ISCFeature = require("src.enums.ISCFeature")
31010
31019
  local ISCFeature = ____ISCFeature.ISCFeature
31020
+ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
31021
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
31011
31022
  local ____gridEntities = require("src.functions.gridEntities")
31012
31023
  local removeGridEntity = ____gridEntities.removeGridEntity
31013
31024
  local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
@@ -31039,32 +31050,6 @@ function CustomGridEntities.prototype.____constructor(self, runInNFrames)
31039
31050
  manuallyUsingShovel = false
31040
31051
  }
31041
31052
  }
31042
- self.postNewRoom = function()
31043
- local roomListIndex = getRoomListIndex(nil)
31044
- local roomCustomGridEntities = self.v.level.customGridEntities:get(roomListIndex)
31045
- if roomCustomGridEntities == nil then
31046
- return
31047
- end
31048
- local room = game:GetRoom()
31049
- for ____, ____value in __TS__Iterator(roomCustomGridEntities:entries()) do
31050
- local gridIndex = ____value[1]
31051
- local data = ____value[2]
31052
- do
31053
- local decoration = room:GetGridEntity(gridIndex)
31054
- if decoration == nil then
31055
- roomCustomGridEntities:delete(gridIndex)
31056
- goto __continue6
31057
- end
31058
- if data.anm2Path ~= nil then
31059
- local sprite = decoration:GetSprite()
31060
- sprite:Load(data.anm2Path, true)
31061
- local animationToPlay = data.defaultAnimation == nil and sprite:GetDefaultAnimation() or data.defaultAnimation
31062
- sprite:Play(animationToPlay, true)
31063
- end
31064
- end
31065
- ::__continue6::
31066
- end
31067
- end
31068
31053
  self.preUseItemWeNeedToGoDeeper = function(____, _collectibleType, _rng, player, _useFlags, _activeSlot, _customVarData)
31069
31054
  local room = game:GetRoom()
31070
31055
  local roomListIndex = getRoomListIndex(nil)
@@ -31093,8 +31078,35 @@ function CustomGridEntities.prototype.____constructor(self, runInNFrames)
31093
31078
  end)
31094
31079
  return true
31095
31080
  end
31081
+ self.postNewRoomReordered = function()
31082
+ local roomListIndex = getRoomListIndex(nil)
31083
+ local roomCustomGridEntities = self.v.level.customGridEntities:get(roomListIndex)
31084
+ if roomCustomGridEntities == nil then
31085
+ return
31086
+ end
31087
+ local room = game:GetRoom()
31088
+ for ____, ____value in __TS__Iterator(roomCustomGridEntities:entries()) do
31089
+ local gridIndex = ____value[1]
31090
+ local data = ____value[2]
31091
+ do
31092
+ local decoration = room:GetGridEntity(gridIndex)
31093
+ if decoration == nil then
31094
+ roomCustomGridEntities:delete(gridIndex)
31095
+ goto __continue12
31096
+ end
31097
+ if data.anm2Path ~= nil then
31098
+ local sprite = decoration:GetSprite()
31099
+ sprite:Load(data.anm2Path, true)
31100
+ local animationToPlay = data.defaultAnimation == nil and sprite:GetDefaultAnimation() or data.defaultAnimation
31101
+ sprite:Play(animationToPlay, true)
31102
+ end
31103
+ end
31104
+ ::__continue12::
31105
+ end
31106
+ end
31096
31107
  self.featuresUsed = {ISCFeature.RUN_IN_N_FRAMES}
31097
- self.callbacksUsed = {{ModCallback.POST_NEW_ROOM, {self.postNewRoom}}, {ModCallback.PRE_USE_ITEM, {self.preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER}}}
31108
+ self.callbacksUsed = {{ModCallback.PRE_USE_ITEM, {self.preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER}}}
31109
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
31098
31110
  self.runInNFrames = runInNFrames
31099
31111
  end
31100
31112
  function CustomGridEntities.prototype.spawnCustomGridEntity(self, gridEntityTypeCustom, gridIndexOrPosition, gridCollisionClass, anm2Path, defaultAnimation, baseGridEntityType, baseGridEntityVariant)
@@ -31270,7 +31282,7 @@ function CustomRevive.prototype.____constructor(self, preCustomRevive, postCusto
31270
31282
  self.postPEffectUpdate = function(____, player)
31271
31283
  self:checkWaitingForItemAnimation(player)
31272
31284
  end
31273
- self.postNewRoom = function()
31285
+ self.postNewRoomReordered = function()
31274
31286
  if self.v.run.state ~= CustomReviveState.WAITING_FOR_ROOM_TRANSITION then
31275
31287
  return
31276
31288
  end
@@ -31285,8 +31297,8 @@ function CustomRevive.prototype.____constructor(self, preCustomRevive, postCusto
31285
31297
  self:playerIsAboutToDie(player)
31286
31298
  end
31287
31299
  self.featuresUsed = {ISCFeature.RUN_IN_N_FRAMES}
31288
- self.callbacksUsed = {{ModCallback.POST_RENDER, {self.postRender}}, {ModCallback.POST_PEFFECT_UPDATE, {self.postPEffectUpdate}}, {ModCallback.POST_NEW_ROOM, {self.postNewRoom}}}
31289
- self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_FATAL_DAMAGE, {self.postPlayerFatalDamage}}, {ModCallbackCustom.PRE_BERSERK_DEATH, {self.preBerserkDeath}}}
31300
+ self.callbacksUsed = {{ModCallback.POST_RENDER, {self.postRender}}, {ModCallback.POST_PEFFECT_UPDATE, {self.postPEffectUpdate}}}
31301
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}, {ModCallbackCustom.POST_PLAYER_FATAL_DAMAGE, {self.postPlayerFatalDamage}}, {ModCallbackCustom.PRE_BERSERK_DEATH, {self.preBerserkDeath}}}
31290
31302
  self.preCustomRevive = preCustomRevive
31291
31303
  self.postCustomRevive = postCustomRevive
31292
31304
  self.runInNFrames = runInNFrames
@@ -31682,6 +31694,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
31682
31694
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
31683
31695
  local ____ISCFeature = require("src.enums.ISCFeature")
31684
31696
  local ISCFeature = ____ISCFeature.ISCFeature
31697
+ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
31698
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
31685
31699
  local ____gridEntities = require("src.functions.gridEntities")
31686
31700
  local getGridEntitiesMap = ____gridEntities.getGridEntitiesMap
31687
31701
  local isGridEntityBroken = ____gridEntities.isGridEntityBroken
@@ -31710,7 +31724,7 @@ function GridEntityUpdateDetection.prototype.____constructor(self, postGridEntit
31710
31724
  end
31711
31725
  end
31712
31726
  end
31713
- self.postNewRoom = function()
31727
+ self.postNewRoomReordered = function()
31714
31728
  local gridEntitiesMap = getGridEntitiesMap(nil)
31715
31729
  for ____, ____value in __TS__Iterator(gridEntitiesMap:entries()) do
31716
31730
  local gridIndex = ____value[1]
@@ -31719,7 +31733,8 @@ function GridEntityUpdateDetection.prototype.____constructor(self, postGridEntit
31719
31733
  end
31720
31734
  end
31721
31735
  self.featuresUsed = {ISCFeature.RUN_IN_N_FRAMES}
31722
- self.callbacksUsed = {{ModCallback.POST_UPDATE, {self.postUpdate}}, {ModCallback.POST_NEW_ROOM, {self.postNewRoom}}}
31736
+ self.callbacksUsed = {{ModCallback.POST_UPDATE, {self.postUpdate}}}
31737
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
31723
31738
  self.postGridEntityInit = postGridEntityInit
31724
31739
  self.postGridEntityCustomInit = postGridEntityCustomInit
31725
31740
  self.postGridEntityUpdate = postGridEntityUpdate
@@ -48942,6 +48957,10 @@ function ModUpgradedBase.prototype.initOptionalFeature(self, feature)
48942
48957
  self:initFeature(featureClass)
48943
48958
  return getExportedMethodsFromFeature(nil, featureClass)
48944
48959
  end
48960
+ function ModUpgradedBase.prototype.initCustomCallbackEarly(self, modCallbackCustom)
48961
+ local callbackClass = self.callbacks[modCallbackCustom]
48962
+ self:initFeature(callbackClass)
48963
+ end
48945
48964
  return ____exports
48946
48965
  end,
48947
48966
  ["src.classes.ModFeature"] = function(...)
@@ -49232,7 +49251,7 @@ return ____exports
49232
49251
  local ____lualib = require("lualib_bundle")
49233
49252
  local __TS__New = ____lualib.__TS__New
49234
49253
  local ____exports = {}
49235
- local initOptionalFeatures
49254
+ local initOptionalFeatures, initCallbacksEarly
49236
49255
  local ____ModUpgradedBase = require("src.classes.ModUpgradedBase")
49237
49256
  local ModUpgradedBase = ____ModUpgradedBase.ModUpgradedBase
49238
49257
  local ____patchErrorFunctions = require("src.patchErrorFunctions")
@@ -49250,10 +49269,18 @@ function initOptionalFeatures(self, mod, features)
49250
49269
  end
49251
49270
  end
49252
49271
  end
49253
- function ____exports.upgradeMod(self, modVanilla, features, ____debug, timeThreshold)
49272
+ function initCallbacksEarly(self, mod, callbacks)
49273
+ for ____, modCallbackCustom in ipairs(callbacks) do
49274
+ mod.initCustomCallbackEarly(mod, modCallbackCustom)
49275
+ end
49276
+ end
49277
+ function ____exports.upgradeMod(self, modVanilla, features, customCallbacksUsed, ____debug, timeThreshold)
49254
49278
  if features == nil then
49255
49279
  features = {}
49256
49280
  end
49281
+ if customCallbacksUsed == nil then
49282
+ customCallbacksUsed = {}
49283
+ end
49257
49284
  if ____debug == nil then
49258
49285
  ____debug = false
49259
49286
  end
@@ -49261,6 +49288,7 @@ function ____exports.upgradeMod(self, modVanilla, features, ____debug, timeThres
49261
49288
  local mod = __TS__New(ModUpgradedBase, modVanilla, ____debug, timeThreshold)
49262
49289
  applyShaderCrashFix(nil, mod)
49263
49290
  initOptionalFeatures(nil, mod, features)
49291
+ initCallbacksEarly(nil, mod, customCallbacksUsed)
49264
49292
  return mod
49265
49293
  end
49266
49294
  return ____exports
@@ -972,8 +972,7 @@ do
972
972
  if not rawget(metatable, "_descriptors") then
973
973
  metatable._descriptors = {}
974
974
  end
975
- local descriptor = __TS__CloneDescriptor(desc)
976
- metatable._descriptors[key] = descriptor
975
+ metatable._descriptors[key] = __TS__CloneDescriptor(desc)
977
976
  metatable.__index = descriptorIndex
978
977
  metatable.__newindex = descriptorNewIndex
979
978
  end
@@ -1609,22 +1608,6 @@ local function __TS__ParseFloat(numberString)
1609
1608
  return ____number_1
1610
1609
  end
1611
1610
 
1612
- local function __TS__StringSubstr(self, from, length)
1613
- if from ~= from then
1614
- from = 0
1615
- end
1616
- if length ~= nil then
1617
- if length ~= length or length <= 0 then
1618
- return ""
1619
- end
1620
- length = length + from
1621
- end
1622
- if from >= 0 then
1623
- from = from + 1
1624
- end
1625
- return string.sub(self, from, length)
1626
- end
1627
-
1628
1611
  local function __TS__StringSubstring(self, start, ____end)
1629
1612
  if ____end ~= ____end then
1630
1613
  ____end = 0
@@ -1654,9 +1637,9 @@ do
1654
1637
  base = 16
1655
1638
  local ____TS__Match_result__0_0
1656
1639
  if __TS__Match(hexMatch, "-") then
1657
- ____TS__Match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
1640
+ ____TS__Match_result__0_0 = "-" .. __TS__StringSubstring(numberString, #hexMatch)
1658
1641
  else
1659
- ____TS__Match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
1642
+ ____TS__Match_result__0_0 = __TS__StringSubstring(numberString, #hexMatch)
1660
1643
  end
1661
1644
  numberString = ____TS__Match_result__0_0
1662
1645
  end
@@ -1668,7 +1651,7 @@ do
1668
1651
  if base <= 10 then
1669
1652
  ____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, base)
1670
1653
  else
1671
- ____temp_1 = __TS__StringSubstr(parseIntBasePattern, 0, 10 + 2 * (base - 10))
1654
+ ____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, 10 + 2 * (base - 10))
1672
1655
  end
1673
1656
  local allowedDigits = ____temp_1
1674
1657
  local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
@@ -2378,6 +2361,22 @@ local function __TS__StringStartsWith(self, searchString, position)
2378
2361
  return string.sub(self, position + 1, #searchString + position) == searchString
2379
2362
  end
2380
2363
 
2364
+ local function __TS__StringSubstr(self, from, length)
2365
+ if from ~= from then
2366
+ from = 0
2367
+ end
2368
+ if length ~= nil then
2369
+ if length ~= length or length <= 0 then
2370
+ return ""
2371
+ end
2372
+ length = length + from
2373
+ end
2374
+ if from >= 0 then
2375
+ from = from + 1
2376
+ end
2377
+ return string.sub(self, from, length)
2378
+ end
2379
+
2381
2380
  local function __TS__StringTrim(self)
2382
2381
  local result = string.gsub(self, "^[%s ]*(.-)[%s ]*$", "%1")
2383
2382
  return result
@@ -82,5 +82,10 @@ export declare class ModUpgradedBase implements Mod {
82
82
  * don't have access to it..
83
83
  */
84
84
  private initOptionalFeature;
85
+ /**
86
+ * This is mostly the same as the `AddCustomCallback` method, but we initialize the custom
87
+ * callback without actually registering a subscription.
88
+ */
89
+ private initCustomCallbackEarly;
85
90
  }
86
91
  //# sourceMappingURL=ModUpgradedBase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModUpgradedBase.d.ts","sourceRoot":"","sources":["../../../src/classes/ModUpgradedBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAI3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAQ/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAMhG;;;;;;;;;GASG;AACH,qBAAa,eAAgB,YAAW,GAAG;IAKlC,IAAI,EAAE,MAAM,CAAC;IAMpB,4FAA4F;IAC5F,OAAO,CAAC,GAAG,CAAM;IAEjB,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,aAAa,CAAoB;IAEzC,OAAO,CAAC,SAAS,CAAC;IAGlB,OAAO,CAAC,QAAQ,CAAC;gBAML,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,KAAK;IAgB3D;;;;OAIG;IACI,WAAW,CAAC,CAAC,SAAS,WAAW,EACtC,WAAW,EAAE,CAAC,EACd,GAAG,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAChC,IAAI;IAkDP,0FAA0F;IACnF,OAAO,IAAI,OAAO;IAIzB;;;OAGG;IACI,QAAQ,IAAI,MAAM;IAIzB;;;;;OAKG;IACI,cAAc,CAAC,CAAC,SAAS,WAAW,EACzC,WAAW,EAAE,CAAC,EACd,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACpC,IAAI;IAIP,6EAA6E;IACtE,UAAU,IAAI,IAAI;IAIzB;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQnC;;;;OAIG;IACI,iBAAiB,CAAC,CAAC,SAAS,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;IAIzB;;;;;OAKG;IACI,cAAc,CAAC,CAAC,SAAS,WAAW,EACzC,WAAW,EAAE,CAAC,EACd,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACpC,IAAI;IAIP,6EAA6E;IACtE,UAAU,IAAI,IAAI;IAIzB;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQnC;;;;OAIG;IACI,iBAAiB,CAAC,CAAC,SAAS,iBAAiB,EAClD,iBAAiB,EAAE,CAAC,EACpB,GAAG,IAAI,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACtC,IAAI;IAOP;;;;;OAKG;IACI,oBAAoB,CAAC,CAAC,SAAS,iBAAiB,EACrD,iBAAiB,EAAE,CAAC,EACpB,QAAQ,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1C,IAAI;IAOP;;;OAGG;IACI,eAAe,IAAI,IAAI;IA0C9B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAqDnB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAwDrB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;CAIhC"}
@@ -259,4 +259,8 @@ function ModUpgradedBase.prototype.initOptionalFeature(self, feature)
259
259
  self:initFeature(featureClass)
260
260
  return getExportedMethodsFromFeature(nil, featureClass)
261
261
  end
262
+ function ModUpgradedBase.prototype.initCustomCallbackEarly(self, modCallbackCustom)
263
+ local callbackClass = self.callbacks[modCallbackCustom]
264
+ self:initFeature(callbackClass)
265
+ end
262
266
  return ____exports
@@ -3,8 +3,8 @@ import { GridEntityCustomData } from "../../../interfaces/GridEntityCustomData";
3
3
  import { Feature } from "../../private/Feature";
4
4
  export declare class CustomGridEntities extends Feature {
5
5
  private runInNFrames;
6
- private postNewRoom;
7
6
  private preUseItemWeNeedToGoDeeper;
7
+ private postNewRoomReordered;
8
8
  /**
9
9
  * Helper function to spawn a custom grid entity. Custom grid entities are persistent in that they
10
10
  * will reappear if the player leaves and re-enters the room. (It will be manually respawned in
@@ -1 +1 @@
1
- {"version":3,"file":"CustomGridEntities.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/CustomGridEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,cAAc,EAGf,MAAM,8BAA8B,CAAC;AAYtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,qBAAa,kBAAmB,SAAQ,OAAO;IAgB7C,OAAO,CAAC,YAAY,CAAe;IAoBnC,OAAO,CAAC,WAAW,CA4BjB;IAIF,OAAO,CAAC,0BAA0B,CA+ChC;IAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+EG;IAEI,qBAAqB,CAC1B,oBAAoB,EAAE,cAAc,EACpC,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,kBAAkB,CAAC,EAAE,kBAAkB,EACvC,QAAQ,CAAC,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,MAAM,EACzB,kBAAkB,iBAA4B,EAC9C,qBAAqB,SAAI,GACxB,UAAU;IA8Cb;;;;;;;;;;;;;;;;;OAiBG;IAEI,sBAAsB,CAC3B,+BAA+B,EAAE,GAAG,GAAG,MAAM,GAAG,UAAU,EAC1D,UAAU,UAAO,GAChB,UAAU,GAAG,SAAS;IAuCzB;;;;;;OAMG;IAEI,qBAAqB,IAAI,KAAK,CACnC;QAAC,UAAU,EAAE,UAAU;QAAE,IAAI,EAAE,oBAAoB;KAAC,CACrD;IAoBD;;;;;;;OAOG;IAEI,uBAAuB,CAC5B,qBAAqB,EAAE,UAAU,GAAG,GAAG,GACtC,cAAc,GAAG,SAAS;IAyB7B;;;;;;OAMG;IAEI,k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AE,UAAU,GAAG,GAAG,GAAG,OAAO;CAM5E"}
@@ -18,6 +18,8 @@ local ____decorators = require("src.decorators")
18
18
  local Exported = ____decorators.Exported
19
19
  local ____ISCFeature = require("src.enums.ISCFeature")
20
20
  local ISCFeature = ____ISCFeature.ISCFeature
21
+ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
22
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
21
23
  local ____gridEntities = require("src.functions.gridEntities")
22
24
  local removeGridEntity = ____gridEntities.removeGridEntity
23
25
  local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
@@ -49,32 +51,6 @@ function CustomGridEntities.prototype.____constructor(self, runInNFrames)
49
51
  manuallyUsingShovel = false
50
52
  }
51
53
  }
52
- self.postNewRoom = function()
53
- local roomListIndex = getRoomListIndex(nil)
54
- local roomCustomGridEntities = self.v.level.customGridEntities:get(roomListIndex)
55
- if roomCustomGridEntities == nil then
56
- return
57
- end
58
- local room = game:GetRoom()
59
- for ____, ____value in __TS__Iterator(roomCustomGridEntities:entries()) do
60
- local gridIndex = ____value[1]
61
- local data = ____value[2]
62
- do
63
- local decoration = room:GetGridEntity(gridIndex)
64
- if decoration == nil then
65
- roomCustomGridEntities:delete(gridIndex)
66
- goto __continue6
67
- end
68
- if data.anm2Path ~= nil then
69
- local sprite = decoration:GetSprite()
70
- sprite:Load(data.anm2Path, true)
71
- local animationToPlay = data.defaultAnimation == nil and sprite:GetDefaultAnimation() or data.defaultAnimation
72
- sprite:Play(animationToPlay, true)
73
- end
74
- end
75
- ::__continue6::
76
- end
77
- end
78
54
  self.preUseItemWeNeedToGoDeeper = function(____, _collectibleType, _rng, player, _useFlags, _activeSlot, _customVarData)
79
55
  local room = game:GetRoom()
80
56
  local roomListIndex = getRoomListIndex(nil)
@@ -103,8 +79,35 @@ function CustomGridEntities.prototype.____constructor(self, runInNFrames)
103
79
  end)
104
80
  return true
105
81
  end
82
+ self.postNewRoomReordered = function()
83
+ local roomListIndex = getRoomListIndex(nil)
84
+ local roomCustomGridEntities = self.v.level.customGridEntities:get(roomListIndex)
85
+ if roomCustomGridEntities == nil then
86
+ return
87
+ end
88
+ local room = game:GetRoom()
89
+ for ____, ____value in __TS__Iterator(roomCustomGridEntities:entries()) do
90
+ local gridIndex = ____value[1]
91
+ local data = ____value[2]
92
+ do
93
+ local decoration = room:GetGridEntity(gridIndex)
94
+ if decoration == nil then
95
+ roomCustomGridEntities:delete(gridIndex)
96
+ goto __continue12
97
+ end
98
+ if data.anm2Path ~= nil then
99
+ local sprite = decoration:GetSprite()
100
+ sprite:Load(data.anm2Path, true)
101
+ local animationToPlay = data.defaultAnimation == nil and sprite:GetDefaultAnimation() or data.defaultAnimation
102
+ sprite:Play(animationToPlay, true)
103
+ end
104
+ end
105
+ ::__continue12::
106
+ end
107
+ end
106
108
  self.featuresUsed = {ISCFeature.RUN_IN_N_FRAMES}
107
- self.callbacksUsed = {{ModCallback.POST_NEW_ROOM, {self.postNewRoom}}, {ModCallback.PRE_USE_ITEM, {self.preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER}}}
109
+ self.callbacksUsed = {{ModCallback.PRE_USE_ITEM, {self.preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER}}}
110
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
108
111
  self.runInNFrames = runInNFrames
109
112
  end
110
113
  function CustomGridEntities.prototype.spawnCustomGridEntity(self, gridEntityTypeCustom, gridIndexOrPosition, gridCollisionClass, anm2Path, defaultAnimation, baseGridEntityType, baseGridEntityVariant)
@@ -27,7 +27,7 @@ export declare class CustomRevive extends Feature {
27
27
  private postRender;
28
28
  private postPEffectUpdate;
29
29
  private checkWaitingForItemAnimation;
30
- private postNewRoom;
30
+ private postNewRoomReordered;
31
31
  private postPlayerFatalDamage;
32
32
  private preBerserkDeath;
33
33
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CustomRevive.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/CustomRevive.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,aAAK,iBAAiB;IACpB,QAAQ,IAAA;IAER;;;OAGG;IACH,2BAA2B,IAAA;IAE3B,0BAA0B,IAAA;CAC3B;AAED,qBAAa,YAAa,SAAQ,OAAO;IACvB,CAAC;;;;;;MAMf;IAEF,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAe;gBAGjC,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,YAAY;IA0B5B,OAAO,CAAC,UAAU,CAQhB;IAGF,OAAO,CAAC,iBAAiB,CAEvB;IAEF,OAAO,CAAC,4BAA4B;IA6CpC,OAAO,CAAC,WAAW,CAOjB;IAGF,OAAO,CAAC,qBAAqB,CAK3B;IAGF,OAAO,CAAC,eAAe,CAErB;IAEF;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAoC1B,OAAO,CAAC,eAAe;CASxB"}
1
+ {"version":3,"file":"CustomRevive.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/CustomRevive.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,aAAK,iBAAiB;IACpB,QAAQ,IAAA;IAER;;;OAGG;IACH,2BAA2B,IAAA;IAE3B,0BAA0B,IAAA;CAC3B;AAED,qBAAa,YAAa,SAAQ,OAAO;IACvB,CAAC;;;;;;MAMf;IAEF,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAe;gBAGjC,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,YAAY;IA0B5B,OAAO,CAAC,UAAU,CAQhB;IAGF,OAAO,CAAC,iBAAiB,CAEvB;IAEF,OAAO,CAAC,4BAA4B;IA6CpC,OAAO,CAAC,oBAAoB,CAO1B;IAGF,OAAO,CAAC,qBAAqB,CAK3B;IAGF,OAAO,CAAC,eAAe,CAErB;IAEF;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAoC1B,OAAO,CAAC,eAAe;CASxB"}
@@ -53,7 +53,7 @@ function CustomRevive.prototype.____constructor(self, preCustomRevive, postCusto
53
53
  self.postPEffectUpdate = function(____, player)
54
54
  self:checkWaitingForItemAnimation(player)
55
55
  end
56
- self.postNewRoom = function()
56
+ self.postNewRoomReordered = function()
57
57
  if self.v.run.state ~= CustomReviveState.WAITING_FOR_ROOM_TRANSITION then
58
58
  return
59
59
  end
@@ -68,8 +68,8 @@ function CustomRevive.prototype.____constructor(self, preCustomRevive, postCusto
68
68
  self:playerIsAboutToDie(player)
69
69
  end
70
70
  self.featuresUsed = {ISCFeature.RUN_IN_N_FRAMES}
71
- self.callbacksUsed = {{ModCallback.POST_RENDER, {self.postRender}}, {ModCallback.POST_PEFFECT_UPDATE, {self.postPEffectUpdate}}, {ModCallback.POST_NEW_ROOM, {self.postNewRoom}}}
72
- self.customCallbacksUsed = {{ModCallbackCustom.POST_PLAYER_FATAL_DAMAGE, {self.postPlayerFatalDamage}}, {ModCallbackCustom.PRE_BERSERK_DEATH, {self.preBerserkDeath}}}
71
+ self.callbacksUsed = {{ModCallback.POST_RENDER, {self.postRender}}, {ModCallback.POST_PEFFECT_UPDATE, {self.postPEffectUpdate}}}
72
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}, {ModCallbackCustom.POST_PLAYER_FATAL_DAMAGE, {self.postPlayerFatalDamage}}, {ModCallbackCustom.PRE_BERSERK_DEATH, {self.preBerserkDeath}}}
73
73
  self.preCustomRevive = preCustomRevive
74
74
  self.postCustomRevive = postCustomRevive
75
75
  self.runInNFrames = runInNFrames
@@ -40,7 +40,7 @@ export declare class GridEntityUpdateDetection extends Feature {
40
40
  private checkGridEntityStateChanged;
41
41
  private checkNewGridEntity;
42
42
  private updateTupleInMap;
43
- private postNewRoom;
43
+ private postNewRoomReordered;
44
44
  }
45
45
  export {};
46
46
  //# sourceMappingURL=GridEntityUpdateDetection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GridEntityUpdateDetection.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/GridEntityUpdateDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,8BAA8B,CAAC;AAM3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;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AC,gBAAgB;IAaxB,OAAO,CAAC,WAAW,CAMjB;CACH"}
1
+ {"version":3,"file":"GridEntityUpdateDetection.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/callbackLogic/GridEntityUpdateDetection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,8BAA8B,CAAC;AAO3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,KAAK,eAAe,GAAG;IACrB,cAAc,EAAE,cAAc;IAC9B,OAAO,EAAE,GAAG;IACZ,KAAK,EAAE,GAAG;CACX,CAAC;AAEF,qBAAa,yBAA0B,SAAQ,OAAO;IACpC,CAAC;;YAEb,6BAA6B;;;MAG/B;IAEF,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,wBAAwB,CAA2B;IAC3D,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,gCAAgC,CAAmC;IAC3E,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,kBAAkB,CAAqB;gBAG7C,kBAAkB,EAAE,kBAAkB,EACtC,wBAAwB,EAAE,wBAAwB,EAClD,oBAAoB,EAAE,oBAAoB,EAC1C,0BAA0B,EAAE,0BAA0B,EACtD,oBAAoB,EAAE,oBAAoB,EAC1C,0BAA0B,EAAE,0BAA0B,EACtD,0BAA0B,EAAE,0BAA0B,EACtD,gCAAgC,EAAE,gCAAgC,EAClE,oBAAoB,EAAE,oBAAoB,EAC1C,0BAA0B,EAAE,0BAA0B,EACtD,kBAAkB,EAAE,kBAAkB;IA4BxC,OAAO,CAAC,UAAU,CAmBhB;IAEF,OAAO,CAAC,wBAAwB;IA8BhC,OAAO,CAAC,2BAA2B;IA0CnC,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,oBAAoB,CAM1B;CACH"}
@@ -9,6 +9,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
9
9
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
10
10
  local ____ISCFeature = require("src.enums.ISCFeature")
11
11
  local ISCFeature = ____ISCFeature.ISCFeature
12
+ local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
13
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
12
14
  local ____gridEntities = require("src.functions.gridEntities")
13
15
  local getGridEntitiesMap = ____gridEntities.getGridEntitiesMap
14
16
  local isGridEntityBroken = ____gridEntities.isGridEntityBroken
@@ -37,7 +39,7 @@ function GridEntityUpdateDetection.prototype.____constructor(self, postGridEntit
37
39
  end
38
40
  end
39
41
  end
40
- self.postNewRoom = function()
42
+ self.postNewRoomReordered = function()
41
43
  local gridEntitiesMap = getGridEntitiesMap(nil)
42
44
  for ____, ____value in __TS__Iterator(gridEntitiesMap:entries()) do
43
45
  local gridIndex = ____value[1]
@@ -46,7 +48,8 @@ function GridEntityUpdateDetection.prototype.____constructor(self, postGridEntit
46
48
  end
47
49
  end
48
50
  self.featuresUsed = {ISCFeature.RUN_IN_N_FRAMES}
49
- self.callbacksUsed = {{ModCallback.POST_UPDATE, {self.postUpdate}}, {ModCallback.POST_NEW_ROOM, {self.postNewRoom}}}
51
+ self.callbacksUsed = {{ModCallback.POST_UPDATE, {self.postUpdate}}}
52
+ self.customCallbacksUsed = {{ModCallbackCustom.POST_NEW_ROOM_REORDERED, {self.postNewRoomReordered}}}
50
53
  self.postGridEntityInit = postGridEntityInit
51
54
  self.postGridEntityCustomInit = postGridEntityCustomInit
52
55
  self.postGridEntityUpdate = postGridEntityUpdate
@@ -1,6 +1,7 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /// <reference types="isaac-typescript-definitions" />
3
3
  import { ISCFeature } from "../enums/ISCFeature";
4
+ import { ModCallbackCustom } from "../enums/ModCallbackCustom";
4
5
  import { ModUpgraded } from "../types/ModUpgraded";
5
6
  type ISCFeatureTuple<T extends readonly ISCFeature[]> = ISCFeature extends T["length"] ? 'The list of features must be a tuple. Use the "as const" assertion when declaring the array.' : T;
6
7
  /**
@@ -23,6 +24,14 @@ type ISCFeatureTuple<T extends readonly ISCFeature[]> = ISCFeature extends T["le
23
24
  * @param modVanilla The mod object returned by the `RegisterMod` function.
24
25
  * @param features Optional. An array containing the optional standard library features that you
25
26
  * want to enable, if any. Default is an empty array.
27
+ * @param customCallbacksUsed Optional. An array containing the custom callbacks that you will be
28
+ * subscribing to after you upgrade your mod. Specifying this will
29
+ * immediately initialize the callbacks (as opposed to lazy-initializing
30
+ * them when you first subscribe to the callback). This is only necessary
31
+ * if you the order of callback firing is important for your mod. (For
32
+ * example, you may want the `POST_NEW_ROOM` part of the
33
+ * `POST_GRID_ENTITY_INIT` callback to fire before your own
34
+ * `POST_NEW_ROOM` callbacks.)
26
35
  * @param debug Optional. Whether to log additional output when a callback is fired. Default is
27
36
  * false.
28
37
  * @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
@@ -30,6 +39,6 @@ type ISCFeatureTuple<T extends readonly ISCFeature[]> = ISCFeature extends T["le
30
39
  * or milliseconds (if the "--luadebug" launch flag is turned off).
31
40
  * @returns The upgraded mod object.
32
41
  */
33
- export declare function upgradeMod<T extends readonly ISCFeature[] = never[]>(modVanilla: Mod, features?: ISCFeatureTuple<T>, debug?: boolean, timeThreshold?: float): ModUpgraded<T>;
42
+ export declare function upgradeMod<T extends readonly ISCFeature[] = never[]>(modVanilla: Mod, features?: ISCFeatureTuple<T>, customCallbacksUsed?: ModCallbackCustom[] | readonly ModCallbackCustom[], debug?: boolean, timeThreshold?: float): ModUpgraded<T>;
34
43
  export {};
35
44
  //# sourceMappingURL=upgradeMod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,IAClD,UAAU,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC1B,8FAA8F,GAC9F,CAAC,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,KAAK,EAAE,EAClE,UAAU,EAAE,GAAG,EACf,QAAQ,GAAE,eAAe,CAAC,CAAC,CAAuC,EAClE,KAAK,UAAQ,EACb,aAAa,CAAC,EAAE,KAAK,GACpB,WAAW,CAAC,CAAC,CAAC,CAQhB"}
1
+ {"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,IAClD,UAAU,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC1B,8FAA8F,GAC9F,CAAC,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,KAAK,EAAE,EAClE,UAAU,EAAE,GAAG,EACf,QAAQ,GAAE,eAAe,CAAC,CAAC,CAAuC,EAClE,mBAAmB,GAAE,iBAAiB,EAAE,GAAG,SAAS,iBAAiB,EAAO,EAC5E,KAAK,UAAQ,EACb,aAAa,CAAC,EAAE,KAAK,GACpB,WAAW,CAAC,CAAC,CAAC,CAShB"}
@@ -1,7 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__New = ____lualib.__TS__New
3
3
  local ____exports = {}
4
- local initOptionalFeatures
4
+ local initOptionalFeatures, initCallbacksEarly
5
5
  local ____ModUpgradedBase = require("src.classes.ModUpgradedBase")
6
6
  local ModUpgradedBase = ____ModUpgradedBase.ModUpgradedBase
7
7
  local ____patchErrorFunctions = require("src.patchErrorFunctions")
@@ -19,6 +19,11 @@ function initOptionalFeatures(self, mod, features)
19
19
  end
20
20
  end
21
21
  end
22
+ function initCallbacksEarly(self, mod, callbacks)
23
+ for ____, modCallbackCustom in ipairs(callbacks) do
24
+ mod.initCustomCallbackEarly(mod, modCallbackCustom)
25
+ end
26
+ end
22
27
  --- Use this function to enable the custom callbacks and other optional features provided by
23
28
  -- `isaacscript-common`.
24
29
  --
@@ -38,16 +43,27 @@ end
38
43
  -- @param modVanilla The mod object returned by the `RegisterMod` function.
39
44
  -- @param features Optional. An array containing the optional standard library features that you
40
45
  -- want to enable, if any. Default is an empty array.
46
+ -- @param customCallbacksUsed Optional. An array containing the custom callbacks that you will be
47
+ -- subscribing to after you upgrade your mod. Specifying this will
48
+ -- immediately initialize the callbacks (as opposed to lazy-initializing
49
+ -- them when you first subscribe to the callback). This is only necessary
50
+ -- if you the order of callback firing is important for your mod. (For
51
+ -- example, you may want the `POST_NEW_ROOM` part of the
52
+ -- `POST_GRID_ENTITY_INIT` callback to fire before your own
53
+ -- `POST_NEW_ROOM` callbacks.)
41
54
  -- @param debug Optional. Whether to log additional output when a callback is fired. Default is
42
55
  -- false.
43
56
  -- @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
44
57
  -- specified number of seconds (if the "--luadebug" launch flag is turned on)
45
58
  -- or milliseconds (if the "--luadebug" launch flag is turned off).
46
59
  -- @returns The upgraded mod object.
47
- function ____exports.upgradeMod(self, modVanilla, features, ____debug, timeThreshold)
60
+ function ____exports.upgradeMod(self, modVanilla, features, customCallbacksUsed, ____debug, timeThreshold)
48
61
  if features == nil then
49
62
  features = {}
50
63
  end
64
+ if customCallbacksUsed == nil then
65
+ customCallbacksUsed = {}
66
+ end
51
67
  if ____debug == nil then
52
68
  ____debug = false
53
69
  end
@@ -55,6 +71,7 @@ function ____exports.upgradeMod(self, modVanilla, features, ____debug, timeThres
55
71
  local mod = __TS__New(ModUpgradedBase, modVanilla, ____debug, timeThreshold)
56
72
  applyShaderCrashFix(nil, mod)
57
73
  initOptionalFeatures(nil, mod, features)
74
+ initCallbacksEarly(nil, mod, customCallbacksUsed)
58
75
  return mod
59
76
  end
60
77
  return ____exports
@@ -238,6 +238,14 @@ export declare function removeAllPlayerTrinkets(player: EntityPlayer): void;
238
238
  * having to request the collectible from the item config.
239
239
  */
240
240
  export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
241
+ /**
242
+ * Helper function to remove one or more collectibles from all players. If any player has more than
243
+ * one copy of the item, then all copies of it will be removed.
244
+ *
245
+ * This function is variadic, meaning that you can specify as many collectibles as you want to
246
+ * remove.
247
+ */
248
+ export declare function removeCollectibleFromAllPlayers(...collectibleTypes: CollectibleType[]): void;
241
249
  /**
242
250
  * Helper function to remove the Dead Eye multiplier from a player.
243
251
  *
@@ -1 +1 @@
1
- {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAGf,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AActC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAGT;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,kBAAkB,EAAE,UAAU,EAAE,GAAG,OAAO,CAIxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CASjE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,UAAU,GAAG,SAAS,CAMxB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,kBAAkB,EAAE,YAAY,GAAG,KAAK,GACvC,KAAK,CAMP;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,IAAI,UAAU,EAAE,CAG5C;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAiB/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,G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eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,OAAO,CAIT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAalE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAIlE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,aAAqB,EAC/B,MAAM,CAAC,EAAE,GAAG,EACZ,WAAW,UAAQ,GAClB,IAAI,CA6DN;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
1
+ {"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAA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CAIT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAalE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAIlE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,aAAqB,EAC/B,MAAM,CAAC,EAAE,GAAG,EACZ,WAAW,UAAQ,GAClB,IAAI,CA6DN;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,EAChB,aAAa,UAAO,GACnB,IAAI,CAsBN;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAEN"}
@@ -540,6 +540,21 @@ function ____exports.removeCollectibleCostume(self, player, collectibleType)
540
540
  end
541
541
  player:RemoveCostume(itemConfigItem)
542
542
  end
543
+ --- Helper function to remove one or more collectibles from all players. If any player has more than
544
+ -- one copy of the item, then all copies of it will be removed.
545
+ --
546
+ -- This function is variadic, meaning that you can specify as many collectibles as you want to
547
+ -- remove.
548
+ function ____exports.removeCollectibleFromAllPlayers(self, ...)
549
+ local collectibleTypes = {...}
550
+ for ____, player in ipairs(getAllPlayers(nil)) do
551
+ for ____, collectibleType in ipairs(collectibleTypes) do
552
+ while player:HasCollectible(collectibleType, true) do
553
+ player:RemoveCollectible(collectibleType)
554
+ end
555
+ end
556
+ end
557
+ end
543
558
  --- Helper function to remove the Dead Eye multiplier from a player.
544
559
  --
545
560
  -- Note that each time the `EntityPlayer.ClearDeadEyeCharge` method is called, it only has a chance
@@ -594,9 +609,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
594
609
  itemPool:RemoveCollectible(collectibleType)
595
610
  end
596
611
  repeat
597
- local ____switch107 = activeSlot
598
- local ____cond107 = ____switch107 == ActiveSlot.PRIMARY
599
- if ____cond107 then
612
+ local ____switch113 = activeSlot
613
+ local ____cond113 = ____switch113 == ActiveSlot.PRIMARY
614
+ if ____cond113 then
600
615
  do
601
616
  if primaryCollectibleType ~= CollectibleType.NULL then
602
617
  player:RemoveCollectible(primaryCollectibleType)
@@ -605,8 +620,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
605
620
  break
606
621
  end
607
622
  end
608
- ____cond107 = ____cond107 or ____switch107 == ActiveSlot.SECONDARY
609
- if ____cond107 then
623
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.SECONDARY
624
+ if ____cond113 then
610
625
  do
611
626
  if primaryCollectibleType ~= CollectibleType.NULL then
612
627
  player:RemoveCollectible(primaryCollectibleType)
@@ -621,16 +636,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
621
636
  break
622
637
  end
623
638
  end
624
- ____cond107 = ____cond107 or ____switch107 == ActiveSlot.POCKET
625
- if ____cond107 then
639
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET
640
+ if ____cond113 then
626
641
  do
627
642
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
628
643
  player:SetActiveCharge(charge, activeSlot)
629
644
  break
630
645
  end
631
646
  end
632
- ____cond107 = ____cond107 or ____switch107 == ActiveSlot.POCKET_SINGLE_USE
633
- if ____cond107 then
647
+ ____cond113 = ____cond113 or ____switch113 == ActiveSlot.POCKET_SINGLE_USE
648
+ if ____cond113 then
634
649
  do
635
650
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
636
651
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "15.6.2",
3
+ "version": "16.1.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -375,6 +375,15 @@ export class ModUpgradedBase implements Mod {
375
375
 
376
376
  return getExportedMethodsFromFeature(featureClass);
377
377
  }
378
+
379
+ /**
380
+ * This is mostly the same as the `AddCustomCallback` method, but we initialize the custom
381
+ * callback without actually registering a subscription.
382
+ */
383
+ private initCustomCallbackEarly(modCallbackCustom: ModCallbackCustom) {
384
+ const callbackClass = this.callbacks[modCallbackCustom];
385
+ this.initFeature(callbackClass);
386
+ }
378
387
  }
379
388
 
380
389
  /**
@@ -9,6 +9,7 @@ import {
9
9
  import { game } from "../../../core/cachedClasses";
10
10
  import { Exported } from "../../../decorators";
11
11
  import { ISCFeature } from "../../../enums/ISCFeature";
12
+ import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
12
13
  import {
13
14
  removeGridEntity,
14
15
  spawnGridEntityWithVariant,
@@ -47,47 +48,19 @@ export class CustomGridEntities extends Feature {
47
48
  this.featuresUsed = [ISCFeature.RUN_IN_N_FRAMES];
48
49
 
49
50
  this.callbacksUsed = [
50
- [ModCallback.POST_NEW_ROOM, [this.postNewRoom]], // 19
51
51
  [
52
52
  ModCallback.PRE_USE_ITEM,
53
53
  [this.preUseItemWeNeedToGoDeeper, CollectibleType.WE_NEED_TO_GO_DEEPER],
54
54
  ], // 23
55
55
  ];
56
56
 
57
+ this.customCallbacksUsed = [
58
+ [ModCallbackCustom.POST_NEW_ROOM_REORDERED, [this.postNewRoomReordered]],
59
+ ];
60
+
57
61
  this.runInNFrames = runInNFrames;
58
62
  }
59
63
 
60
- // ModCallback.POST_NEW_ROOM (19)
61
- private postNewRoom = (): void => {
62
- // When we re-enter a room, the graphics for any custom entities will be reverted back to that
63
- // of a normal decoration. Thus, we must re-apply the anm2.
64
- const roomListIndex = getRoomListIndex();
65
- const roomCustomGridEntities =
66
- this.v.level.customGridEntities.get(roomListIndex);
67
- if (roomCustomGridEntities === undefined) {
68
- return;
69
- }
70
-
71
- const room = game.GetRoom();
72
- for (const [gridIndex, data] of roomCustomGridEntities.entries()) {
73
- const decoration = room.GetGridEntity(gridIndex);
74
- if (decoration === undefined) {
75
- roomCustomGridEntities.delete(gridIndex);
76
- continue;
77
- }
78
-
79
- if (data.anm2Path !== undefined) {
80
- const sprite = decoration.GetSprite();
81
- sprite.Load(data.anm2Path, true);
82
- const animationToPlay =
83
- data.defaultAnimation === undefined
84
- ? sprite.GetDefaultAnimation()
85
- : data.defaultAnimation;
86
- sprite.Play(animationToPlay, true);
87
- }
88
- }
89
- };
90
-
91
64
  // ModCallback.PRE_USE_ITEM (23)
92
65
  // CollectibleType.WE_NEED_TO_GO_DEEPER (84)
93
66
  private preUseItemWeNeedToGoDeeper = (
@@ -139,6 +112,37 @@ export class CustomGridEntities extends Feature {
139
112
  return true;
140
113
  };
141
114
 
115
+ // ModCallbackCustom.POST_NEW_ROOM_REORDERED
116
+ private postNewRoomReordered = (): void => {
117
+ // When we re-enter a room, the graphics for any custom entities will be reverted back to that
118
+ // of a normal decoration. Thus, we must re-apply the anm2.
119
+ const roomListIndex = getRoomListIndex();
120
+ const roomCustomGridEntities =
121
+ this.v.level.customGridEntities.get(roomListIndex);
122
+ if (roomCustomGridEntities === undefined) {
123
+ return;
124
+ }
125
+
126
+ const room = game.GetRoom();
127
+ for (const [gridIndex, data] of roomCustomGridEntities.entries()) {
128
+ const decoration = room.GetGridEntity(gridIndex);
129
+ if (decoration === undefined) {
130
+ roomCustomGridEntities.delete(gridIndex);
131
+ continue;
132
+ }
133
+
134
+ if (data.anm2Path !== undefined) {
135
+ const sprite = decoration.GetSprite();
136
+ sprite.Load(data.anm2Path, true);
137
+ const animationToPlay =
138
+ data.defaultAnimation === undefined
139
+ ? sprite.GetDefaultAnimation()
140
+ : data.defaultAnimation;
141
+ sprite.Play(animationToPlay, true);
142
+ }
143
+ }
144
+ };
145
+
142
146
  /**
143
147
  * Helper function to spawn a custom grid entity. Custom grid entities are persistent in that they
144
148
  * will reappear if the player leaves and re-enters the room. (It will be manually respawned in
@@ -62,10 +62,10 @@ export class CustomRevive extends Feature {
62
62
  this.callbacksUsed = [
63
63
  [ModCallback.POST_RENDER, [this.postRender]], // 2
64
64
  [ModCallback.POST_PEFFECT_UPDATE, [this.postPEffectUpdate]], // 4
65
- [ModCallback.POST_NEW_ROOM, [this.postNewRoom]], // 19
66
65
  ];
67
66
 
68
67
  this.customCallbacksUsed = [
68
+ [ModCallbackCustom.POST_NEW_ROOM_REORDERED, [this.postNewRoomReordered]],
69
69
  [
70
70
  ModCallbackCustom.POST_PLAYER_FATAL_DAMAGE,
71
71
  [this.postPlayerFatalDamage],
@@ -138,8 +138,8 @@ export class CustomRevive extends Feature {
138
138
  this.logStateChanged();
139
139
  }
140
140
 
141
- // ModCallback.POST_NEW_ROOM (19)
142
- private postNewRoom = (): void => {
141
+ // ModCallbackCustom.POST_NEW_ROOM_REORDERED
142
+ private postNewRoomReordered = (): void => {
143
143
  if (this.v.run.state !== CustomReviveState.WAITING_FOR_ROOM_TRANSITION) {
144
144
  return;
145
145
  }
@@ -1,5 +1,6 @@
1
1
  import { GridEntityType, ModCallback } from "isaac-typescript-definitions";
2
2
  import { ISCFeature } from "../../../enums/ISCFeature";
3
+ import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
3
4
  import {
4
5
  getGridEntitiesMap,
5
6
  isGridEntityBroken,
@@ -62,7 +63,10 @@ export class GridEntityUpdateDetection extends Feature {
62
63
 
63
64
  this.callbacksUsed = [
64
65
  [ModCallback.POST_UPDATE, [this.postUpdate]], // 1
65
- [ModCallback.POST_NEW_ROOM, [this.postNewRoom]], // 19
66
+ ];
67
+
68
+ this.customCallbacksUsed = [
69
+ [ModCallbackCustom.POST_NEW_ROOM_REORDERED, [this.postNewRoomReordered]],
66
70
  ];
67
71
 
68
72
  this.postGridEntityInit = postGridEntityInit;
@@ -204,8 +208,8 @@ export class GridEntityUpdateDetection extends Feature {
204
208
  this.v.room.initializedGridEntities.set(gridIndex, newTuple);
205
209
  }
206
210
 
207
- // ModCallback.POST_NEW_ROOM (19)
208
- private postNewRoom = (): void => {
211
+ // ModCallbackCustom.POST_NEW_ROOM_REORDERED
212
+ private postNewRoomReordered = (): void => {
209
213
  const gridEntitiesMap = getGridEntitiesMap();
210
214
 
211
215
  for (const [gridIndex, gridEntity] of gridEntitiesMap.entries()) {
@@ -1,5 +1,6 @@
1
1
  import { ModUpgradedBase } from "../classes/ModUpgradedBase";
2
2
  import { ISCFeature } from "../enums/ISCFeature";
3
+ import { ModCallbackCustom } from "../enums/ModCallbackCustom";
3
4
  import { patchErrorFunction } from "../patchErrorFunctions";
4
5
  import { applyShaderCrashFix } from "../shaderCrashFix";
5
6
  import { AnyFunction } from "../types/AnyFunction";
@@ -30,6 +31,14 @@ type ISCFeatureTuple<T extends readonly ISCFeature[]> =
30
31
  * @param modVanilla The mod object returned by the `RegisterMod` function.
31
32
  * @param features Optional. An array containing the optional standard library features that you
32
33
  * want to enable, if any. Default is an empty array.
34
+ * @param customCallbacksUsed Optional. An array containing the custom callbacks that you will be
35
+ * subscribing to after you upgrade your mod. Specifying this will
36
+ * immediately initialize the callbacks (as opposed to lazy-initializing
37
+ * them when you first subscribe to the callback). This is only necessary
38
+ * if you the order of callback firing is important for your mod. (For
39
+ * example, you may want the `POST_NEW_ROOM` part of the
40
+ * `POST_GRID_ENTITY_INIT` callback to fire before your own
41
+ * `POST_NEW_ROOM` callbacks.)
33
42
  * @param debug Optional. Whether to log additional output when a callback is fired. Default is
34
43
  * false.
35
44
  * @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
@@ -40,6 +49,7 @@ type ISCFeatureTuple<T extends readonly ISCFeature[]> =
40
49
  export function upgradeMod<T extends readonly ISCFeature[] = never[]>(
41
50
  modVanilla: Mod,
42
51
  features: ISCFeatureTuple<T> = [] as unknown as ISCFeatureTuple<T>,
52
+ customCallbacksUsed: ModCallbackCustom[] | readonly ModCallbackCustom[] = [],
43
53
  debug = false,
44
54
  timeThreshold?: float,
45
55
  ): ModUpgraded<T> {
@@ -48,6 +58,7 @@ export function upgradeMod<T extends readonly ISCFeature[] = never[]>(
48
58
  const mod = new ModUpgradedBase(modVanilla, debug, timeThreshold);
49
59
  applyShaderCrashFix(mod);
50
60
  initOptionalFeatures(mod, features as ISCFeature[]);
61
+ initCallbacksEarly(mod, customCallbacksUsed);
51
62
 
52
63
  return mod as ModUpgraded<T>;
53
64
  }
@@ -68,3 +79,15 @@ function initOptionalFeatures(mod: ModUpgradedBase, features: ISCFeature[]) {
68
79
  }
69
80
  }
70
81
  }
82
+
83
+ function initCallbacksEarly(
84
+ mod: ModUpgradedBase,
85
+ callbacks: ModCallbackCustom[] | readonly ModCallbackCustom[],
86
+ ) {
87
+ for (const modCallbackCustom of callbacks) {
88
+ // We intentionally access the private method here, so we use the string index escape hatch:
89
+ // https://github.com/microsoft/TypeScript/issues/19335
90
+ // eslint-disable-next-line @typescript-eslint/dot-notation
91
+ mod["initCustomCallbackEarly"](modCallbackCustom);
92
+ }
93
+ }
@@ -677,6 +677,25 @@ export function removeCollectibleCostume(
677
677
  player.RemoveCostume(itemConfigItem);
678
678
  }
679
679
 
680
+ /**
681
+ * Helper function to remove one or more collectibles from all players. If any player has more than
682
+ * one copy of the item, then all copies of it will be removed.
683
+ *
684
+ * This function is variadic, meaning that you can specify as many collectibles as you want to
685
+ * remove.
686
+ */
687
+ export function removeCollectibleFromAllPlayers(
688
+ ...collectibleTypes: CollectibleType[]
689
+ ): void {
690
+ for (const player of getAllPlayers()) {
691
+ for (const collectibleType of collectibleTypes) {
692
+ while (player.HasCollectible(collectibleType, true)) {
693
+ player.RemoveCollectible(collectibleType);
694
+ }
695
+ }
696
+ }
697
+ }
698
+
680
699
  /**
681
700
  * Helper function to remove the Dead Eye multiplier from a player.
682
701
  *