isaacscript-common 21.8.1 → 21.8.3

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.
@@ -1285,6 +1285,8 @@ export declare function clearCollectibleSprite(collectible: EntityPickup): void;
1285
1285
  /**
1286
1286
  * Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
1287
1287
  *
1288
+ * This function automatically accounts for whether or not MinimapAPI is being used.
1289
+ *
1288
1290
  * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
1289
1291
  * the changes will be immediately visible.
1290
1292
  */
@@ -1560,6 +1562,7 @@ declare abstract class CustomCallback<T extends ModCallbackCustom> extends Featu
1560
1562
  * See "shouldFire.ts" for methods tailored to specific kinds of callbacks.
1561
1563
  */
1562
1564
  protected shouldFire: (fireArgs: FireArgs<T>, optionalArgs: OptionalArgs<T>) => boolean;
1565
+ logSubscriptions(): void;
1563
1566
  }
1564
1567
 
1565
1568
  declare class CustomGridEntities extends Feature {
@@ -4956,6 +4959,8 @@ export declare function getFlagName<T extends BitFlag | BitFlag128>(flag: BitFla
4956
4959
  /**
4957
4960
  * Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
4958
4961
  * that is indexed by the room's safe grid index.
4962
+ *
4963
+ * This function automatically accounts for whether or not MinimapAPI is being used.
4959
4964
  */
4960
4965
  export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
4961
4966
 
@@ -6144,6 +6149,8 @@ export declare function getRoomDescriptorReadOnly(): Readonly<RoomDescriptor>;
6144
6149
  * Helper function to get a particular room's minimap display flags (e.g. whether or not it is
6145
6150
  * visible and so on).
6146
6151
  *
6152
+ * This function automatically accounts for whether or not MinimapAPI is being used.
6153
+ *
6147
6154
  * @param roomGridIndex Optional. Default is the current room index.
6148
6155
  */
6149
6156
  export declare function getRoomDisplayFlags(roomGridIndex?: int): BitFlags<DisplayFlag>;
@@ -14149,6 +14156,16 @@ export declare function setAdd<T>(set: Set<T>, ...elements: T[]): void;
14149
14156
  */
14150
14157
  export declare function setAddPlayer(set: Set<PlayerIndex>, player: EntityPlayer): Set<PlayerIndex>;
14151
14158
 
14159
+ /**
14160
+ * Helper function to set the minimap `DisplayFlag` value for every room on the floor at once.
14161
+ *
14162
+ * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
14163
+ * the changes will be immediately visible.
14164
+ *
14165
+ * This function automatically accounts for whether or not MinimapAPI is being used.
14166
+ */
14167
+ export declare function setAllDisplayFlags(displayFlags: BitFlags<DisplayFlag>): void;
14168
+
14152
14169
  /**
14153
14170
  * Helper function to iterate over the provided object and set the seed for all of the values that
14154
14171
  * are RNG objects equal to a particular seed.
@@ -14235,18 +14252,6 @@ export declare function setCollectibleSubType(collectible: EntityPickup, newColl
14235
14252
  */
14236
14253
  export declare function setDeletePlayer(set: Set<PlayerIndex>, player: EntityPlayer): boolean;
14237
14254
 
14238
- /**
14239
- * Helper function to set the minimap `DisplayFlag` value for multiple rooms at once.
14240
- *
14241
- * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
14242
- * the changes will be immediately visible.
14243
- *
14244
- * This function automatically accounts for whether or not MinimapAPI is being used.
14245
- *
14246
- * @param displayFlagsMap A map of the display flags that is indexed by the room's safe grid index.
14247
- */
14248
- export declare function setDisplayFlags(displayFlagsMap: Map<int, BitFlags<DisplayFlag>>): void;
14249
-
14250
14255
  /**
14251
14256
  * Helper function to make an entity flash red like it is taking damage. This is useful when you
14252
14257
  * want to make it appear as if an entity is taking damage without actually dealing any damage to
@@ -14295,7 +14300,16 @@ export declare function setEntityRandomColor(entity: Entity): void;
14295
14300
  */
14296
14301
  export declare function setEntityVelocities(entityVelocities: Map<PtrHash, Vector>, entities?: Entity[]): void;
14297
14302
 
14298
- /** Alias for the `setDisplayFlags` function. */
14303
+ /**
14304
+ * Helper function to set the minimap `DisplayFlag` value for multiple rooms at once.
14305
+ *
14306
+ * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
14307
+ * the changes will be immediately visible.
14308
+ *
14309
+ * This function automatically accounts for whether or not MinimapAPI is being used.
14310
+ *
14311
+ * @param displayFlagsMap A map of the display flags that is indexed by the room's safe grid index.
14312
+ */
14299
14313
  export declare function setFloorDisplayFlags(displayFlagsMap: Map<int, BitFlags<DisplayFlag>>): void;
14300
14314
 
14301
14315
  /**
@@ -14346,10 +14360,14 @@ export declare function setRoomData(roomGridIndex: int, roomData: RoomConfig): v
14346
14360
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
14347
14361
  * visible and so on).
14348
14362
  *
14363
+ * This function automatically accounts for whether or not MinimapAPI is being used.
14364
+ *
14349
14365
  * @param roomGridIndex Set to undefined to use the current room index.
14350
14366
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
14351
14367
  * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
14352
- * make the changes immediately visible. Default is true.
14368
+ * make the changes immediately visible. Default is true. Set this to false
14369
+ * if you are doing a bunch of display flag setting and then manually call
14370
+ * the `Level.UpdateVisibility` method after you are done.
14353
14371
  */
14354
14372
  export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, displayFlags: BitFlags<DisplayFlag>, updateVisibility?: boolean): void;
14355
14373
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 21.8.1
3
+ isaacscript-common 21.8.3
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -10569,7 +10569,7 @@ ____exports.CanaryVariant.CANARY = 0
10569
10569
  ____exports.CanaryVariant[____exports.CanaryVariant.CANARY] = "CANARY"
10570
10570
  ____exports.CanaryVariant.FOREIGNER = 1
10571
10571
  ____exports.CanaryVariant[____exports.CanaryVariant.FOREIGNER] = "FOREIGNER"
10572
- --- For `EntityType.GAPER_L2` (850).
10572
+ --- For `EntityType.GAPER_LVL_2` (850).
10573
10573
  ____exports.Gaper2Variant = {}
10574
10574
  ____exports.Gaper2Variant.GAPER = 0
10575
10575
  ____exports.Gaper2Variant[____exports.Gaper2Variant.GAPER] = "GAPER"
@@ -10577,7 +10577,7 @@ ____exports.Gaper2Variant.HORF = 1
10577
10577
  ____exports.Gaper2Variant[____exports.Gaper2Variant.HORF] = "HORF"
10578
10578
  ____exports.Gaper2Variant.GUSHER = 2
10579
10579
  ____exports.Gaper2Variant[____exports.Gaper2Variant.GUSHER] = "GUSHER"
10580
- --- For `EntityType.CHARGER_L2` (855).
10580
+ --- For `EntityType.CHARGER_LVL_2` (855).
10581
10581
  ____exports.Charger2Variant = {}
10582
10582
  ____exports.Charger2Variant.CHARGER = 0
10583
10583
  ____exports.Charger2Variant[____exports.Charger2Variant.CHARGER] = "CHARGER"
@@ -15469,6 +15469,43 @@ function ____exports.shouldFireTrinketType(self, fireArgs, optionalArgs)
15469
15469
  local callbackTrinketType = table.unpack(optionalArgs)
15470
15470
  return callbackTrinketType == nil or callbackTrinketType == trinketType
15471
15471
  end
15472
+ return ____exports
15473
+ end,
15474
+ ["src.functions.log"] = function(...)
15475
+ local ____exports = {}
15476
+ function ____exports.getParentFunctionDescription(levels)
15477
+ if levels == nil then
15478
+ levels = 3
15479
+ end
15480
+ if debug ~= nil then
15481
+ local debugTable = debug.getinfo(levels)
15482
+ if debugTable ~= nil then
15483
+ return (tostring(debugTable.name) .. ":") .. tostring(debugTable.linedefined)
15484
+ end
15485
+ end
15486
+ if SandboxGetParentFunctionDescription ~= nil then
15487
+ return SandboxGetParentFunctionDescription(levels)
15488
+ end
15489
+ return nil
15490
+ end
15491
+ function ____exports.log(msg, includeParentFunction)
15492
+ if includeParentFunction == nil then
15493
+ includeParentFunction = true
15494
+ end
15495
+ local ____includeParentFunction_0
15496
+ if includeParentFunction then
15497
+ ____includeParentFunction_0 = ____exports.getParentFunctionDescription()
15498
+ else
15499
+ ____includeParentFunction_0 = nil
15500
+ end
15501
+ local parentFunctionDescription = ____includeParentFunction_0
15502
+ local debugMsg = parentFunctionDescription == nil and msg or (parentFunctionDescription .. " - ") .. msg
15503
+ Isaac.DebugString(debugMsg)
15504
+ end
15505
+ function ____exports.logAndPrint(self, msg)
15506
+ ____exports.log(msg)
15507
+ print(msg)
15508
+ end
15472
15509
  return ____exports
15473
15510
  end,
15474
15511
  ["src.functions.types"] = function(...)
@@ -15591,6 +15628,158 @@ function ____exports.sortTwoDimensionalArray(self, a, b)
15591
15628
  end
15592
15629
  return sortNormal(nil, firstElement1, firstElement2)
15593
15630
  end
15631
+ return ____exports
15632
+ end,
15633
+ ["src.classes.DefaultMap"] = function(...)
15634
+ local ____lualib = require("lualib_bundle")
15635
+ local __TS__Class = ____lualib.__TS__Class
15636
+ local Map = ____lualib.Map
15637
+ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
15638
+ local __TS__TypeOf = ____lualib.__TS__TypeOf
15639
+ local __TS__New = ____lualib.__TS__New
15640
+ local ____exports = {}
15641
+ local ____types = require("src.functions.types")
15642
+ local isFunction = ____types.isFunction
15643
+ local isPrimitive = ____types.isPrimitive
15644
+ ____exports.DefaultMap = __TS__Class()
15645
+ local DefaultMap = ____exports.DefaultMap
15646
+ DefaultMap.name = "DefaultMap"
15647
+ __TS__ClassExtends(DefaultMap, Map)
15648
+ function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
15649
+ local argIsPrimitive = isPrimitive(nil, defaultValueOrFactoryFunction)
15650
+ local argIsFunction = isFunction(nil, defaultValueOrFactoryFunction)
15651
+ if not argIsPrimitive and not argIsFunction then
15652
+ error(("Failed to instantiate a DefaultMap since the provided default value was of type \"" .. __TS__TypeOf(defaultValueOrFactoryFunction)) .. "\". This error usually means that you are trying to use an array (or some other non-primitive data structure that is passed by reference) as the default value. Instead, return the data structure in a factory function, like \"() => []\". See the DefaultMap documentation for more details.")
15653
+ end
15654
+ Map.prototype.____constructor(self, initializerArray)
15655
+ if argIsFunction then
15656
+ self.defaultValue = nil
15657
+ self.defaultValueFactory = defaultValueOrFactoryFunction
15658
+ else
15659
+ self.defaultValue = defaultValueOrFactoryFunction
15660
+ self.defaultValueFactory = nil
15661
+ end
15662
+ end
15663
+ function DefaultMap.prototype.getAndSetDefault(self, key, ...)
15664
+ local value = Map.prototype.get(self, key)
15665
+ if value ~= nil then
15666
+ return value
15667
+ end
15668
+ local defaultValue = self:getDefaultValue(...)
15669
+ self:set(key, defaultValue)
15670
+ return defaultValue
15671
+ end
15672
+ function DefaultMap.prototype.getDefaultValue(self, ...)
15673
+ if self.defaultValue ~= nil then
15674
+ return self.defaultValue
15675
+ end
15676
+ if self.defaultValueFactory ~= nil then
15677
+ return self:defaultValueFactory(...)
15678
+ end
15679
+ error("A DefaultMap was incorrectly instantiated.")
15680
+ end
15681
+ function DefaultMap.prototype.getConstructorArg(self)
15682
+ if self.defaultValue ~= nil then
15683
+ return self.defaultValue
15684
+ end
15685
+ if self.defaultValueFactory ~= nil then
15686
+ return self.defaultValueFactory
15687
+ end
15688
+ error("A DefaultMap was incorrectly instantiated.")
15689
+ end
15690
+ local function test(self)
15691
+ local myDefaultMapBoolean = __TS__New(____exports.DefaultMap, false)
15692
+ local myDefaultMapBooleanFactory = __TS__New(
15693
+ ____exports.DefaultMap,
15694
+ function() return false end
15695
+ )
15696
+ local myDefaultMapBooleanWithoutParams = __TS__New(____exports.DefaultMap, false)
15697
+ local myDefaultMapNumber = __TS__New(____exports.DefaultMap, 123)
15698
+ local myDefaultMapNumberFactory = __TS__New(
15699
+ ____exports.DefaultMap,
15700
+ function() return 123 end
15701
+ )
15702
+ local myDefaultMapNumberWithoutParams = __TS__New(____exports.DefaultMap, 123)
15703
+ local myDefaultMapString = __TS__New(____exports.DefaultMap, "foo")
15704
+ local myDefaultMapStringFactory = __TS__New(
15705
+ ____exports.DefaultMap,
15706
+ function() return "foo" end
15707
+ )
15708
+ local myDefaultMapStringWithoutParams = __TS__New(____exports.DefaultMap, "foo")
15709
+ local myDefaultMapArray = __TS__New(
15710
+ ____exports.DefaultMap,
15711
+ function() return {} end
15712
+ )
15713
+ local myDefaultMapArrayWithoutParams = __TS__New(
15714
+ ____exports.DefaultMap,
15715
+ function() return {} end
15716
+ )
15717
+ local myDefaultMapMap = __TS__New(
15718
+ ____exports.DefaultMap,
15719
+ function() return __TS__New(Map) end
15720
+ )
15721
+ local myDefaultMapMapWithoutParams = __TS__New(
15722
+ ____exports.DefaultMap,
15723
+ function() return __TS__New(Map) end
15724
+ )
15725
+ end
15726
+ return ____exports
15727
+ end,
15728
+ ["src.interfaces.TSTLClassMetatable"] = function(...)
15729
+ local ____exports = {}
15730
+ return ____exports
15731
+ end,
15732
+ ["src.types.TSTLClass"] = function(...)
15733
+ local ____exports = {}
15734
+ return ____exports
15735
+ end,
15736
+ ["src.functions.tstlClass"] = function(...)
15737
+ local ____exports = {}
15738
+ local ____types = require("src.functions.types")
15739
+ local isTable = ____types.isTable
15740
+ function ____exports.getTSTLClassConstructor(self, object)
15741
+ if not isTable(nil, object) then
15742
+ return nil
15743
+ end
15744
+ local metatable = getmetatable(object)
15745
+ if metatable == nil then
15746
+ return nil
15747
+ end
15748
+ return metatable.constructor
15749
+ end
15750
+ function ____exports.getTSTLClassName(self, object)
15751
+ local constructor = ____exports.getTSTLClassConstructor(nil, object)
15752
+ if constructor == nil then
15753
+ return nil
15754
+ end
15755
+ return constructor.name
15756
+ end
15757
+ function ____exports.isDefaultMap(self, object)
15758
+ local className = ____exports.getTSTLClassName(nil, object)
15759
+ return className == "DefaultMap"
15760
+ end
15761
+ function ____exports.isTSTLClass(self, object)
15762
+ local tstlClassName = ____exports.getTSTLClassName(nil, object)
15763
+ return tstlClassName ~= nil
15764
+ end
15765
+ function ____exports.isTSTLMap(self, object)
15766
+ local className = ____exports.getTSTLClassName(nil, object)
15767
+ return className == "Map"
15768
+ end
15769
+ function ____exports.isTSTLSet(self, object)
15770
+ local className = ____exports.getTSTLClassName(nil, object)
15771
+ return className == "Set"
15772
+ end
15773
+ function ____exports.newTSTLClass(self, oldClass)
15774
+ local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
15775
+ if constructor == nil then
15776
+ error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
15777
+ end
15778
+ local newClass = {}
15779
+ local newClassMetatable = setmetatable(newClass, constructor.prototype)
15780
+ newClassMetatable:____constructor()
15781
+ return newClass
15782
+ end
15594
15783
  return ____exports
15595
15784
  end,
15596
15785
  ["src.core.cachedClasses"] = function(...)
@@ -17591,9 +17780,14 @@ local __TS__Spread = ____lualib.__TS__Spread
17591
17780
  local __TS__ArraySort = ____lualib.__TS__ArraySort
17592
17781
  local __TS__ArrayFindIndex = ____lualib.__TS__ArrayFindIndex
17593
17782
  local __TS__ArraySplice = ____lualib.__TS__ArraySplice
17783
+ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
17594
17784
  local ____exports = {}
17785
+ local ____log = require("src.functions.log")
17786
+ local log = ____log.log
17595
17787
  local ____sort = require("src.functions.sort")
17596
17788
  local sortObjectArrayByKey = ____sort.sortObjectArrayByKey
17789
+ local ____tstlClass = require("src.functions.tstlClass")
17790
+ local getTSTLClassName = ____tstlClass.getTSTLClassName
17597
17791
  local ____Feature = require("src.classes.private.Feature")
17598
17792
  local Feature = ____Feature.Feature
17599
17793
  ____exports.CustomCallback = __TS__Class()
@@ -17644,6 +17838,20 @@ function CustomCallback.prototype.removeSubscriber(self, callback)
17644
17838
  __TS__ArraySplice(self.subscriptions, subscriptionIndexMatchingCallback, 1)
17645
17839
  end
17646
17840
  end
17841
+ function CustomCallback.prototype.logSubscriptions(self)
17842
+ local tstlClassName = getTSTLClassName(nil, self)
17843
+ log("Logging subscriptions for custom callback: " .. tostring(tstlClassName))
17844
+ if #self.subscriptions == 0 then
17845
+ log("- n/a (no subscriptions)")
17846
+ else
17847
+ __TS__ArrayForEach(
17848
+ self.subscriptions,
17849
+ function(____, subscription, i)
17850
+ log((("- " .. tostring(i + 1)) .. " - priority: ") .. tostring(subscription.priority))
17851
+ end
17852
+ )
17853
+ end
17854
+ end
17647
17855
  return ____exports
17648
17856
  end,
17649
17857
  ["src.classes.callbacks.EntityTakeDmgFilter"] = function(...)
@@ -19715,158 +19923,6 @@ function ____exports.spriteEquals(self, sprite1, sprite2, layerID, xStart, xFini
19715
19923
  end
19716
19924
  return true
19717
19925
  end
19718
- return ____exports
19719
- end,
19720
- ["src.classes.DefaultMap"] = function(...)
19721
- local ____lualib = require("lualib_bundle")
19722
- local __TS__Class = ____lualib.__TS__Class
19723
- local Map = ____lualib.Map
19724
- local __TS__ClassExtends = ____lualib.__TS__ClassExtends
19725
- local __TS__TypeOf = ____lualib.__TS__TypeOf
19726
- local __TS__New = ____lualib.__TS__New
19727
- local ____exports = {}
19728
- local ____types = require("src.functions.types")
19729
- local isFunction = ____types.isFunction
19730
- local isPrimitive = ____types.isPrimitive
19731
- ____exports.DefaultMap = __TS__Class()
19732
- local DefaultMap = ____exports.DefaultMap
19733
- DefaultMap.name = "DefaultMap"
19734
- __TS__ClassExtends(DefaultMap, Map)
19735
- function DefaultMap.prototype.____constructor(self, defaultValueOrFactoryFunction, initializerArray)
19736
- local argIsPrimitive = isPrimitive(nil, defaultValueOrFactoryFunction)
19737
- local argIsFunction = isFunction(nil, defaultValueOrFactoryFunction)
19738
- if not argIsPrimitive and not argIsFunction then
19739
- error(("Failed to instantiate a DefaultMap since the provided default value was of type \"" .. __TS__TypeOf(defaultValueOrFactoryFunction)) .. "\". This error usually means that you are trying to use an array (or some other non-primitive data structure that is passed by reference) as the default value. Instead, return the data structure in a factory function, like \"() => []\". See the DefaultMap documentation for more details.")
19740
- end
19741
- Map.prototype.____constructor(self, initializerArray)
19742
- if argIsFunction then
19743
- self.defaultValue = nil
19744
- self.defaultValueFactory = defaultValueOrFactoryFunction
19745
- else
19746
- self.defaultValue = defaultValueOrFactoryFunction
19747
- self.defaultValueFactory = nil
19748
- end
19749
- end
19750
- function DefaultMap.prototype.getAndSetDefault(self, key, ...)
19751
- local value = Map.prototype.get(self, key)
19752
- if value ~= nil then
19753
- return value
19754
- end
19755
- local defaultValue = self:getDefaultValue(...)
19756
- self:set(key, defaultValue)
19757
- return defaultValue
19758
- end
19759
- function DefaultMap.prototype.getDefaultValue(self, ...)
19760
- if self.defaultValue ~= nil then
19761
- return self.defaultValue
19762
- end
19763
- if self.defaultValueFactory ~= nil then
19764
- return self:defaultValueFactory(...)
19765
- end
19766
- error("A DefaultMap was incorrectly instantiated.")
19767
- end
19768
- function DefaultMap.prototype.getConstructorArg(self)
19769
- if self.defaultValue ~= nil then
19770
- return self.defaultValue
19771
- end
19772
- if self.defaultValueFactory ~= nil then
19773
- return self.defaultValueFactory
19774
- end
19775
- error("A DefaultMap was incorrectly instantiated.")
19776
- end
19777
- local function test(self)
19778
- local myDefaultMapBoolean = __TS__New(____exports.DefaultMap, false)
19779
- local myDefaultMapBooleanFactory = __TS__New(
19780
- ____exports.DefaultMap,
19781
- function() return false end
19782
- )
19783
- local myDefaultMapBooleanWithoutParams = __TS__New(____exports.DefaultMap, false)
19784
- local myDefaultMapNumber = __TS__New(____exports.DefaultMap, 123)
19785
- local myDefaultMapNumberFactory = __TS__New(
19786
- ____exports.DefaultMap,
19787
- function() return 123 end
19788
- )
19789
- local myDefaultMapNumberWithoutParams = __TS__New(____exports.DefaultMap, 123)
19790
- local myDefaultMapString = __TS__New(____exports.DefaultMap, "foo")
19791
- local myDefaultMapStringFactory = __TS__New(
19792
- ____exports.DefaultMap,
19793
- function() return "foo" end
19794
- )
19795
- local myDefaultMapStringWithoutParams = __TS__New(____exports.DefaultMap, "foo")
19796
- local myDefaultMapArray = __TS__New(
19797
- ____exports.DefaultMap,
19798
- function() return {} end
19799
- )
19800
- local myDefaultMapArrayWithoutParams = __TS__New(
19801
- ____exports.DefaultMap,
19802
- function() return {} end
19803
- )
19804
- local myDefaultMapMap = __TS__New(
19805
- ____exports.DefaultMap,
19806
- function() return __TS__New(Map) end
19807
- )
19808
- local myDefaultMapMapWithoutParams = __TS__New(
19809
- ____exports.DefaultMap,
19810
- function() return __TS__New(Map) end
19811
- )
19812
- end
19813
- return ____exports
19814
- end,
19815
- ["src.interfaces.TSTLClassMetatable"] = function(...)
19816
- local ____exports = {}
19817
- return ____exports
19818
- end,
19819
- ["src.types.TSTLClass"] = function(...)
19820
- local ____exports = {}
19821
- return ____exports
19822
- end,
19823
- ["src.functions.tstlClass"] = function(...)
19824
- local ____exports = {}
19825
- local ____types = require("src.functions.types")
19826
- local isTable = ____types.isTable
19827
- function ____exports.getTSTLClassConstructor(self, object)
19828
- if not isTable(nil, object) then
19829
- return nil
19830
- end
19831
- local metatable = getmetatable(object)
19832
- if metatable == nil then
19833
- return nil
19834
- end
19835
- return metatable.constructor
19836
- end
19837
- function ____exports.getTSTLClassName(self, object)
19838
- local constructor = ____exports.getTSTLClassConstructor(nil, object)
19839
- if constructor == nil then
19840
- return nil
19841
- end
19842
- return constructor.name
19843
- end
19844
- function ____exports.isDefaultMap(self, object)
19845
- local className = ____exports.getTSTLClassName(nil, object)
19846
- return className == "DefaultMap"
19847
- end
19848
- function ____exports.isTSTLClass(self, object)
19849
- local tstlClassName = ____exports.getTSTLClassName(nil, object)
19850
- return tstlClassName ~= nil
19851
- end
19852
- function ____exports.isTSTLMap(self, object)
19853
- local className = ____exports.getTSTLClassName(nil, object)
19854
- return className == "Map"
19855
- end
19856
- function ____exports.isTSTLSet(self, object)
19857
- local className = ____exports.getTSTLClassName(nil, object)
19858
- return className == "Set"
19859
- end
19860
- function ____exports.newTSTLClass(self, oldClass)
19861
- local constructor = ____exports.getTSTLClassConstructor(nil, oldClass)
19862
- if constructor == nil then
19863
- error("Failed to instantiate a new TypeScriptToLua class since the provided old class does not have a metatable/constructor.")
19864
- end
19865
- local newClass = {}
19866
- local newClassMetatable = setmetatable(newClass, constructor.prototype)
19867
- newClassMetatable:____constructor()
19868
- return newClass
19869
- end
19870
19926
  return ____exports
19871
19927
  end,
19872
19928
  ["src.functions.entities"] = function(...)
@@ -23815,43 +23871,6 @@ function ____exports.spawnTearWithSeed(self, tearVariant, subType, positionOrGri
23815
23871
  seedOrRNG
23816
23872
  )
23817
23873
  end
23818
- return ____exports
23819
- end,
23820
- ["src.functions.log"] = function(...)
23821
- local ____exports = {}
23822
- function ____exports.getParentFunctionDescription(levels)
23823
- if levels == nil then
23824
- levels = 3
23825
- end
23826
- if debug ~= nil then
23827
- local debugTable = debug.getinfo(levels)
23828
- if debugTable ~= nil then
23829
- return (tostring(debugTable.name) .. ":") .. tostring(debugTable.linedefined)
23830
- end
23831
- end
23832
- if SandboxGetParentFunctionDescription ~= nil then
23833
- return SandboxGetParentFunctionDescription(levels)
23834
- end
23835
- return nil
23836
- end
23837
- function ____exports.log(msg, includeParentFunction)
23838
- if includeParentFunction == nil then
23839
- includeParentFunction = true
23840
- end
23841
- local ____includeParentFunction_0
23842
- if includeParentFunction then
23843
- ____includeParentFunction_0 = ____exports.getParentFunctionDescription()
23844
- else
23845
- ____includeParentFunction_0 = nil
23846
- end
23847
- local parentFunctionDescription = ____includeParentFunction_0
23848
- local debugMsg = parentFunctionDescription == nil and msg or (parentFunctionDescription .. " - ") .. msg
23849
- Isaac.DebugString(debugMsg)
23850
- end
23851
- function ____exports.logAndPrint(self, msg)
23852
- ____exports.log(msg)
23853
- print(msg)
23854
- end
23855
23874
  return ____exports
23856
23875
  end,
23857
23876
  ["src.functions.run"] = function(...)
@@ -50369,8 +50388,9 @@ function ModUpgraded.prototype.initFeature(self, feature)
50369
50388
  if feature.customCallbacksUsed ~= nil then
50370
50389
  for ____, callbackTuple in ipairs(feature.customCallbacksUsed) do
50371
50390
  local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple)
50372
- self:AddCallbackCustom(
50391
+ self:AddPriorityCallbackCustom(
50373
50392
  modCallback,
50393
+ CallbackPriority.IMPORTANT,
50374
50394
  callbackFunc,
50375
50395
  table.unpack(optionalArgs or ({}))
50376
50396
  )
@@ -51527,85 +51547,81 @@ local getRoomDescriptor = ____roomData.getRoomDescriptor
51527
51547
  local getRoomGridIndex = ____roomData.getRoomGridIndex
51528
51548
  local ____rooms = require("src.functions.rooms")
51529
51549
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
51530
- function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, updateVisibility)
51531
- if updateVisibility == nil then
51532
- updateVisibility = true
51550
+ function ____exports.getRoomDisplayFlags(self, roomGridIndex)
51551
+ if roomGridIndex == nil then
51552
+ roomGridIndex = getRoomGridIndex(nil)
51533
51553
  end
51534
51554
  if MinimapAPI == nil then
51535
51555
  local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
51536
- roomDescriptor.DisplayFlags = displayFlags
51537
- else
51538
- if roomGridIndex == nil then
51539
- roomGridIndex = getRoomGridIndex(nil)
51540
- end
51541
- local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
51542
- if roomDescriptor ~= nil then
51543
- roomDescriptor.DisplayFlags = displayFlags
51544
- end
51556
+ return roomDescriptor.DisplayFlags
51545
51557
  end
51546
- if updateVisibility then
51558
+ local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
51559
+ if minimapAPIRoomDescriptor == nil then
51560
+ error("Failed to get the MinimapAPI room descriptor for the room at index: " .. tostring(roomGridIndex))
51561
+ end
51562
+ return minimapAPIRoomDescriptor:GetDisplayFlags()
51563
+ end
51564
+ function ____exports.setAllDisplayFlags(self, displayFlags)
51565
+ for ____, room in ipairs(getRoomsInsideGrid(nil)) do
51566
+ ____exports.setRoomDisplayFlags(nil, room.SafeGridIndex, displayFlags, false)
51567
+ end
51568
+ if MinimapAPI == nil then
51547
51569
  local level = game:GetLevel()
51548
51570
  level:UpdateVisibility()
51549
51571
  end
51550
51572
  end
51551
- function ____exports.addRoomDisplayFlag(self, roomGridIndex, displayFlag, updateVisibility)
51573
+ function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, updateVisibility)
51552
51574
  if updateVisibility == nil then
51553
51575
  updateVisibility = true
51554
51576
  end
51577
+ if roomGridIndex == nil then
51578
+ roomGridIndex = getRoomGridIndex(nil)
51579
+ end
51555
51580
  if MinimapAPI == nil then
51556
51581
  local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
51557
- roomDescriptor.DisplayFlags = addFlag(nil, roomDescriptor.DisplayFlags, displayFlag)
51558
- else
51559
- if roomGridIndex == nil then
51560
- roomGridIndex = getRoomGridIndex(nil)
51582
+ roomDescriptor.DisplayFlags = displayFlags
51583
+ if updateVisibility then
51584
+ local level = game:GetLevel()
51585
+ level:UpdateVisibility()
51561
51586
  end
51562
- local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
51563
- if roomDescriptor ~= nil then
51564
- roomDescriptor.DisplayFlags = addFlag(nil, roomDescriptor.DisplayFlags, displayFlag)
51587
+ else
51588
+ local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
51589
+ if minimapAPIRoomDescriptor == nil then
51590
+ error("Failed to get the MinimapAPI room descriptor for the room at index: " .. tostring(roomGridIndex))
51565
51591
  end
51592
+ minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
51566
51593
  end
51567
- if updateVisibility then
51568
- local level = game:GetLevel()
51569
- level:UpdateVisibility()
51594
+ end
51595
+ function ____exports.addRoomDisplayFlag(self, roomGridIndex, displayFlag, updateVisibility)
51596
+ if updateVisibility == nil then
51597
+ updateVisibility = true
51570
51598
  end
51599
+ local oldDisplayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex)
51600
+ local newDisplayFlags = addFlag(nil, oldDisplayFlags, displayFlag)
51601
+ ____exports.setRoomDisplayFlags(nil, roomGridIndex, newDisplayFlags, updateVisibility)
51571
51602
  end
51572
51603
  function ____exports.clearFloorDisplayFlags(self)
51573
- local level = game:GetLevel()
51574
- for ____, room in ipairs(getRoomsInsideGrid(nil)) do
51575
- room.DisplayFlags = DisplayFlagZero
51576
- end
51577
- level:UpdateVisibility()
51604
+ ____exports.setAllDisplayFlags(nil, DisplayFlagZero)
51578
51605
  end
51579
51606
  function ____exports.getFloorDisplayFlags(self)
51580
51607
  local displayFlagsMap = __TS__New(Map)
51581
- local roomsInGrid = getRoomsInsideGrid(nil)
51582
- for ____, roomDescriptor in ipairs(roomsInGrid) do
51583
- displayFlagsMap:set(roomDescriptor.SafeGridIndex, roomDescriptor.DisplayFlags)
51608
+ for ____, roomDescriptor in ipairs(getRoomsInsideGrid(nil)) do
51609
+ local roomGridIndex = roomDescriptor.SafeGridIndex
51610
+ local displayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex)
51611
+ displayFlagsMap:set(roomGridIndex, displayFlags)
51584
51612
  end
51585
51613
  return displayFlagsMap
51586
51614
  end
51587
- function ____exports.getRoomDisplayFlags(self, roomGridIndex)
51588
- local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
51589
- return roomDescriptor.DisplayFlags
51590
- end
51591
- function ____exports.setDisplayFlags(self, displayFlagsMap)
51592
- local level = game:GetLevel()
51615
+ function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
51593
51616
  for ____, ____value in __TS__Iterator(displayFlagsMap) do
51594
51617
  local roomGridIndex = ____value[1]
51595
51618
  local displayFlags = ____value[2]
51596
- if MinimapAPI == nil then
51597
- ____exports.setRoomDisplayFlags(nil, roomGridIndex, displayFlags, false)
51598
- else
51599
- local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
51600
- if roomDescriptor ~= nil then
51601
- roomDescriptor.DisplayFlags = displayFlags
51602
- end
51603
- end
51619
+ ____exports.setRoomDisplayFlags(nil, roomGridIndex, displayFlags, false)
51620
+ end
51621
+ if MinimapAPI == nil then
51622
+ local level = game:GetLevel()
51623
+ level:UpdateVisibility()
51604
51624
  end
51605
- level:UpdateVisibility()
51606
- end
51607
- function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
51608
- ____exports.setDisplayFlags(nil, displayFlagsMap)
51609
51625
  end
51610
51626
  function ____exports.setRoomVisible(self, roomGridIndex, updateVisibility)
51611
51627
  if updateVisibility == nil then
@@ -1 +1 @@
1
- {"version":3,"file":"ModUpgraded.d.ts","sour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,CAAC,CAAC,GAC1C,IAAI;IAOP;;;OAGG;IACI,eAAe,IAAI,IAAI;IA0C9B;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAiEnB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAsDrB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAM5B"}
@@ -204,8 +204,9 @@ function ModUpgraded.prototype.initFeature(self, feature)
204
204
  if feature.customCallbacksUsed ~= nil then
205
205
  for ____, callbackTuple in ipairs(feature.customCallbacksUsed) do
206
206
  local modCallback, callbackFunc, optionalArgs = table.unpack(callbackTuple)
207
- self:AddCallbackCustom(
207
+ self:AddPriorityCallbackCustom(
208
208
  modCallback,
209
+ CallbackPriority.IMPORTANT,
209
210
  callbackFunc,
210
211
  table.unpack(optionalArgs or ({}))
211
212
  )
@@ -24,5 +24,6 @@ export declare abstract class CustomCallback<T extends ModCallbackCustom> extend
24
24
  * See "shouldFire.ts" for methods tailored to specific kinds of callbacks.
25
25
  */
26
26
  protected shouldFire: (fireArgs: FireArgs<T>, optionalArgs: OptionalArgs<T>) => boolean;
27
+ logSubscriptions(): void;
27
28
  }
28
29
  //# sourceMappingURL=CustomCallback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCallback.d.ts","sourceRoot":"","sources":["../../../../src/classes/private/CustomCallback.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,iBAAiB,IAAI,UAAU,CAC5D,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAClC,CAAC;AAEF,MA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AC,CAAC,CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAAI,WAAW,CACjE,2BAA2B,CAAC,CAAC,CAAC,CAC/B,CAAC;AAQF;;;GAGG;AACH,8BAAsB,cAAc,CAClC,CAAC,SAAS,iBAAiB,CAC3B,SAAQ,OAAO;IACf,OAAO,CAAC,aAAa,CAA8B;IAE5C,aAAa,CAClB,QAAQ,EAAE,gBAAgB,GAAG,GAAG,EAChC,YAAY,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/C,GAAG,YAAY,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,GAC3D,IAAI;IAUP;;;OAGG;IACI,gBAAgB,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAYnE,IAAI,gBACI,SAAS,CAAC,CAAC,KACvB,WAAW,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAc9C;IAEF;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,CACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,KAC1B,OAAO,CAAc;IAEnB,gBAAgB,IAAI,IAAI;CAYhC"}
@@ -5,9 +5,14 @@ local __TS__Spread = ____lualib.__TS__Spread
5
5
  local __TS__ArraySort = ____lualib.__TS__ArraySort
6
6
  local __TS__ArrayFindIndex = ____lualib.__TS__ArrayFindIndex
7
7
  local __TS__ArraySplice = ____lualib.__TS__ArraySplice
8
+ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
8
9
  local ____exports = {}
10
+ local ____log = require("src.functions.log")
11
+ local log = ____log.log
9
12
  local ____sort = require("src.functions.sort")
10
13
  local sortObjectArrayByKey = ____sort.sortObjectArrayByKey
14
+ local ____tstlClass = require("src.functions.tstlClass")
15
+ local getTSTLClassName = ____tstlClass.getTSTLClassName
11
16
  local ____Feature = require("src.classes.private.Feature")
12
17
  local Feature = ____Feature.Feature
13
18
  --- The base class for a custom callback. Individual custom callbacks (and validation callbacks) will
@@ -60,4 +65,18 @@ function CustomCallback.prototype.removeSubscriber(self, callback)
60
65
  __TS__ArraySplice(self.subscriptions, subscriptionIndexMatchingCallback, 1)
61
66
  end
62
67
  end
68
+ function CustomCallback.prototype.logSubscriptions(self)
69
+ local tstlClassName = getTSTLClassName(nil, self)
70
+ log("Logging subscriptions for custom callback: " .. tostring(tstlClassName))
71
+ if #self.subscriptions == 0 then
72
+ log("- n/a (no subscriptions)")
73
+ else
74
+ __TS__ArrayForEach(
75
+ self.subscriptions,
76
+ function(____, subscription, i)
77
+ log((("- " .. tostring(i + 1)) .. " - priority: ") .. tostring(subscription.priority))
78
+ end
79
+ )
80
+ end
81
+ end
63
82
  return ____exports
@@ -14,6 +14,8 @@ export declare function addRoomDisplayFlag(roomGridIndex: int | undefined, displ
14
14
  /**
15
15
  * Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
16
16
  *
17
+ * This function automatically accounts for whether or not MinimapAPI is being used.
18
+ *
17
19
  * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
18
20
  * the changes will be immediately visible.
19
21
  */
@@ -21,15 +23,28 @@ export declare function clearFloorDisplayFlags(): void;
21
23
  /**
22
24
  * Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
23
25
  * that is indexed by the room's safe grid index.
26
+ *
27
+ * This function automatically accounts for whether or not MinimapAPI is being used.
24
28
  */
25
29
  export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
26
30
  /**
27
31
  * Helper function to get a particular room's minimap display flags (e.g. whether or not it is
28
32
  * visible and so on).
29
33
  *
34
+ * This function automatically accounts for whether or not MinimapAPI is being used.
35
+ *
30
36
  * @param roomGridIndex Optional. Default is the current room index.
31
37
  */
32
38
  export declare function getRoomDisplayFlags(roomGridIndex?: int): BitFlags<DisplayFlag>;
39
+ /**
40
+ * Helper function to set the minimap `DisplayFlag` value for every room on the floor at once.
41
+ *
42
+ * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
43
+ * the changes will be immediately visible.
44
+ *
45
+ * This function automatically accounts for whether or not MinimapAPI is being used.
46
+ */
47
+ export declare function setAllDisplayFlags(displayFlags: BitFlags<DisplayFlag>): void;
33
48
  /**
34
49
  * Helper function to set the minimap `DisplayFlag` value for multiple rooms at once.
35
50
  *
@@ -40,17 +55,19 @@ export declare function getRoomDisplayFlags(roomGridIndex?: int): BitFlags<Displ
40
55
  *
41
56
  * @param displayFlagsMap A map of the display flags that is indexed by the room's safe grid index.
42
57
  */
43
- export declare function setDisplayFlags(displayFlagsMap: Map<int, BitFlags<DisplayFlag>>): void;
44
- /** Alias for the `setDisplayFlags` function. */
45
58
  export declare function setFloorDisplayFlags(displayFlagsMap: Map<int, BitFlags<DisplayFlag>>): void;
46
59
  /**
47
60
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
48
61
  * visible and so on).
49
62
  *
63
+ * This function automatically accounts for whether or not MinimapAPI is being used.
64
+ *
50
65
  * @param roomGridIndex Set to undefined to use the current room index.
51
66
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
52
67
  * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
53
- * make the changes immediately visible. Default is true.
68
+ * make the changes immediately visible. Default is true. Set this to false
69
+ * if you are doing a bunch of display flag setting and then manually call
70
+ * the `Level.UpdateVisibility` method after you are done.
54
71
  */
55
72
  export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, displayFlags: BitFlags<DisplayFlag>, updateVisibility?: boolean): void;
56
73
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"minimap.d.ts","sourceRoot":"","sources":["../../../src/functions/minimap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,8BAA8B,CAAC;AAM5E;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACh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7C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAUtE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,GAAG,GAClB,QAAQ,CAAC,WAAW,CAAC,CAiBvB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAW5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAWN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,EACnC,gBAAgB,UAAO,GACtB,IAAI,CAsBN;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,gBAAgB,UAAO,GACtB,IAAI,CAEN"}
@@ -15,32 +15,72 @@ local getRoomDescriptor = ____roomData.getRoomDescriptor
15
15
  local getRoomGridIndex = ____roomData.getRoomGridIndex
16
16
  local ____rooms = require("src.functions.rooms")
17
17
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
18
+ --- Helper function to get a particular room's minimap display flags (e.g. whether or not it is
19
+ -- visible and so on).
20
+ --
21
+ -- This function automatically accounts for whether or not MinimapAPI is being used.
22
+ --
23
+ -- @param roomGridIndex Optional. Default is the current room index.
24
+ function ____exports.getRoomDisplayFlags(self, roomGridIndex)
25
+ if roomGridIndex == nil then
26
+ roomGridIndex = getRoomGridIndex(nil)
27
+ end
28
+ if MinimapAPI == nil then
29
+ local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
30
+ return roomDescriptor.DisplayFlags
31
+ end
32
+ local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
33
+ if minimapAPIRoomDescriptor == nil then
34
+ error("Failed to get the MinimapAPI room descriptor for the room at index: " .. tostring(roomGridIndex))
35
+ end
36
+ return minimapAPIRoomDescriptor:GetDisplayFlags()
37
+ end
38
+ --- Helper function to set the minimap `DisplayFlag` value for every room on the floor at once.
39
+ --
40
+ -- This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
41
+ -- the changes will be immediately visible.
42
+ --
43
+ -- This function automatically accounts for whether or not MinimapAPI is being used.
44
+ function ____exports.setAllDisplayFlags(self, displayFlags)
45
+ for ____, room in ipairs(getRoomsInsideGrid(nil)) do
46
+ ____exports.setRoomDisplayFlags(nil, room.SafeGridIndex, displayFlags, false)
47
+ end
48
+ if MinimapAPI == nil then
49
+ local level = game:GetLevel()
50
+ level:UpdateVisibility()
51
+ end
52
+ end
18
53
  --- Helper function to set a particular room's minimap display flags (e.g. whether or not it is
19
54
  -- visible and so on).
20
55
  --
56
+ -- This function automatically accounts for whether or not MinimapAPI is being used.
57
+ --
21
58
  -- @param roomGridIndex Set to undefined to use the current room index.
22
59
  -- @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
23
60
  -- @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
24
- -- make the changes immediately visible. Default is true.
61
+ -- make the changes immediately visible. Default is true. Set this to false
62
+ -- if you are doing a bunch of display flag setting and then manually call
63
+ -- the `Level.UpdateVisibility` method after you are done.
25
64
  function ____exports.setRoomDisplayFlags(self, roomGridIndex, displayFlags, updateVisibility)
26
65
  if updateVisibility == nil then
27
66
  updateVisibility = true
28
67
  end
68
+ if roomGridIndex == nil then
69
+ roomGridIndex = getRoomGridIndex(nil)
70
+ end
29
71
  if MinimapAPI == nil then
30
72
  local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
31
73
  roomDescriptor.DisplayFlags = displayFlags
32
- else
33
- if roomGridIndex == nil then
34
- roomGridIndex = getRoomGridIndex(nil)
74
+ if updateVisibility then
75
+ local level = game:GetLevel()
76
+ level:UpdateVisibility()
35
77
  end
36
- local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
37
- if roomDescriptor ~= nil then
38
- roomDescriptor.DisplayFlags = displayFlags
78
+ else
79
+ local minimapAPIRoomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
80
+ if minimapAPIRoomDescriptor == nil then
81
+ error("Failed to get the MinimapAPI room descriptor for the room at index: " .. tostring(roomGridIndex))
39
82
  end
40
- end
41
- if updateVisibility then
42
- local level = game:GetLevel()
43
- level:UpdateVisibility()
83
+ minimapAPIRoomDescriptor:SetDisplayFlags(displayFlags)
44
84
  end
45
85
  end
46
86
  --- Helper function to add a `DisplayFlag` to a particular room's minimap display flags (e.g. whether
@@ -56,52 +96,32 @@ function ____exports.addRoomDisplayFlag(self, roomGridIndex, displayFlag, update
56
96
  if updateVisibility == nil then
57
97
  updateVisibility = true
58
98
  end
59
- if MinimapAPI == nil then
60
- local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
61
- roomDescriptor.DisplayFlags = addFlag(nil, roomDescriptor.DisplayFlags, displayFlag)
62
- else
63
- if roomGridIndex == nil then
64
- roomGridIndex = getRoomGridIndex(nil)
65
- end
66
- local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
67
- if roomDescriptor ~= nil then
68
- roomDescriptor.DisplayFlags = addFlag(nil, roomDescriptor.DisplayFlags, displayFlag)
69
- end
70
- end
71
- if updateVisibility then
72
- local level = game:GetLevel()
73
- level:UpdateVisibility()
74
- end
99
+ local oldDisplayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex)
100
+ local newDisplayFlags = addFlag(nil, oldDisplayFlags, displayFlag)
101
+ ____exports.setRoomDisplayFlags(nil, roomGridIndex, newDisplayFlags, updateVisibility)
75
102
  end
76
103
  --- Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
77
104
  --
105
+ -- This function automatically accounts for whether or not MinimapAPI is being used.
106
+ --
78
107
  -- This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
79
108
  -- the changes will be immediately visible.
80
109
  function ____exports.clearFloorDisplayFlags(self)
81
- local level = game:GetLevel()
82
- for ____, room in ipairs(getRoomsInsideGrid(nil)) do
83
- room.DisplayFlags = DisplayFlagZero
84
- end
85
- level:UpdateVisibility()
110
+ ____exports.setAllDisplayFlags(nil, DisplayFlagZero)
86
111
  end
87
112
  --- Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
88
113
  -- that is indexed by the room's safe grid index.
114
+ --
115
+ -- This function automatically accounts for whether or not MinimapAPI is being used.
89
116
  function ____exports.getFloorDisplayFlags(self)
90
117
  local displayFlagsMap = __TS__New(Map)
91
- local roomsInGrid = getRoomsInsideGrid(nil)
92
- for ____, roomDescriptor in ipairs(roomsInGrid) do
93
- displayFlagsMap:set(roomDescriptor.SafeGridIndex, roomDescriptor.DisplayFlags)
118
+ for ____, roomDescriptor in ipairs(getRoomsInsideGrid(nil)) do
119
+ local roomGridIndex = roomDescriptor.SafeGridIndex
120
+ local displayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex)
121
+ displayFlagsMap:set(roomGridIndex, displayFlags)
94
122
  end
95
123
  return displayFlagsMap
96
124
  end
97
- --- Helper function to get a particular room's minimap display flags (e.g. whether or not it is
98
- -- visible and so on).
99
- --
100
- -- @param roomGridIndex Optional. Default is the current room index.
101
- function ____exports.getRoomDisplayFlags(self, roomGridIndex)
102
- local roomDescriptor = getRoomDescriptor(nil, roomGridIndex)
103
- return roomDescriptor.DisplayFlags
104
- end
105
125
  --- Helper function to set the minimap `DisplayFlag` value for multiple rooms at once.
106
126
  --
107
127
  -- This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
@@ -110,25 +130,16 @@ end
110
130
  -- This function automatically accounts for whether or not MinimapAPI is being used.
111
131
  --
112
132
  -- @param displayFlagsMap A map of the display flags that is indexed by the room's safe grid index.
113
- function ____exports.setDisplayFlags(self, displayFlagsMap)
114
- local level = game:GetLevel()
133
+ function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
115
134
  for ____, ____value in __TS__Iterator(displayFlagsMap) do
116
135
  local roomGridIndex = ____value[1]
117
136
  local displayFlags = ____value[2]
118
- if MinimapAPI == nil then
119
- ____exports.setRoomDisplayFlags(nil, roomGridIndex, displayFlags, false)
120
- else
121
- local roomDescriptor = MinimapAPI:GetRoomByIdx(roomGridIndex)
122
- if roomDescriptor ~= nil then
123
- roomDescriptor.DisplayFlags = displayFlags
124
- end
125
- end
137
+ ____exports.setRoomDisplayFlags(nil, roomGridIndex, displayFlags, false)
138
+ end
139
+ if MinimapAPI == nil then
140
+ local level = game:GetLevel()
141
+ level:UpdateVisibility()
126
142
  end
127
- level:UpdateVisibility()
128
- end
129
- --- Alias for the `setDisplayFlags` function.
130
- function ____exports.setFloorDisplayFlags(self, displayFlagsMap)
131
- ____exports.setDisplayFlags(nil, displayFlagsMap)
132
143
  end
133
144
  --- Helper function to make a single room visible in a similar way to how the Compass makes a Boss
134
145
  -- Room visible (e.g. by adding `DisplayFlag.SHOW_ICON`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "21.8.1",
3
+ "version": "21.8.3",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/src/index",
23
23
  "types": "dist/index.rollup.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^11.1.3"
25
+ "isaac-typescript-definitions": "^11.1.4"
26
26
  }
27
27
  }
@@ -311,8 +311,9 @@ export class ModUpgraded implements Mod {
311
311
  for (const callbackTuple of feature.customCallbacksUsed) {
312
312
  const [modCallback, callbackFunc, optionalArgs] = callbackTuple;
313
313
  // TypeScript is not smart enough to know that the arguments match the function.
314
- (this.AddCallbackCustom as AnyFunction)(
314
+ (this.AddPriorityCallbackCustom as AnyFunction)(
315
315
  modCallback,
316
+ CallbackPriority.IMPORTANT,
316
317
  callbackFunc,
317
318
  ...(optionalArgs ?? []),
318
319
  );
@@ -1,6 +1,8 @@
1
1
  import { CallbackPriority } from "isaac-typescript-definitions/dist/src/enums/CallbackPriority";
2
2
  import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
3
+ import { log } from "../../functions/log";
3
4
  import { sortObjectArrayByKey } from "../../functions/sort";
5
+ import { getTSTLClassName } from "../../functions/tstlClass";
4
6
  import { AddCallbackParametersCustom } from "../../interfaces/private/AddCallbackParametersCustom";
5
7
  import { AllButFirst } from "../../types/AllButFirst";
6
8
  import { AnyFunction } from "../../types/AnyFunction";
@@ -85,4 +87,17 @@ export abstract class CustomCallback<
85
87
  fireArgs: FireArgs<T>,
86
88
  optionalArgs: OptionalArgs<T>,
87
89
  ) => boolean = () => true;
90
+
91
+ public logSubscriptions(): void {
92
+ const tstlClassName = getTSTLClassName(this);
93
+ log(`Logging subscriptions for custom callback: ${tstlClassName}`);
94
+
95
+ if (this.subscriptions.length === 0) {
96
+ log("- n/a (no subscriptions)");
97
+ } else {
98
+ this.subscriptions.forEach((subscription, i) => {
99
+ log(`- ${i + 1} - priority: ${subscription.priority}`);
100
+ });
101
+ }
102
+ }
88
103
  }
@@ -20,61 +20,36 @@ export function addRoomDisplayFlag(
20
20
  displayFlag: DisplayFlag,
21
21
  updateVisibility = true,
22
22
  ): void {
23
- if (MinimapAPI === undefined) {
24
- const roomDescriptor = getRoomDescriptor(roomGridIndex);
25
- roomDescriptor.DisplayFlags = addFlag(
26
- roomDescriptor.DisplayFlags,
27
- displayFlag,
28
- );
29
- } else {
30
- if (roomGridIndex === undefined) {
31
- roomGridIndex = getRoomGridIndex();
32
- }
33
- const roomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
34
- if (roomDescriptor !== undefined) {
35
- roomDescriptor.DisplayFlags = addFlag(
36
- roomDescriptor.DisplayFlags,
37
- displayFlag,
38
- );
39
- }
40
- }
41
-
42
- if (updateVisibility) {
43
- const level = game.GetLevel();
44
- level.UpdateVisibility();
45
- }
23
+ const oldDisplayFlags = getRoomDisplayFlags(roomGridIndex);
24
+ const newDisplayFlags = addFlag(oldDisplayFlags, displayFlag);
25
+ setRoomDisplayFlags(roomGridIndex, newDisplayFlags, updateVisibility);
46
26
  }
47
27
 
48
28
  /**
49
29
  * Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
50
30
  *
31
+ * This function automatically accounts for whether or not MinimapAPI is being used.
32
+ *
51
33
  * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
52
34
  * the changes will be immediately visible.
53
35
  */
54
36
  export function clearFloorDisplayFlags(): void {
55
- const level = game.GetLevel();
56
-
57
- for (const room of getRoomsInsideGrid()) {
58
- room.DisplayFlags = DisplayFlagZero;
59
- }
60
-
61
- // We must call the "Level.UpdateVisibility" method for the changes to be visible.
62
- level.UpdateVisibility();
37
+ setAllDisplayFlags(DisplayFlagZero);
63
38
  }
64
39
 
65
40
  /**
66
41
  * Helper function to get the minimap `DisplayFlag` value for every room on the floor. Returns a map
67
42
  * that is indexed by the room's safe grid index.
43
+ *
44
+ * This function automatically accounts for whether or not MinimapAPI is being used.
68
45
  */
69
46
  export function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>> {
70
47
  const displayFlagsMap = new Map<int, BitFlags<DisplayFlag>>();
71
48
 
72
- const roomsInGrid = getRoomsInsideGrid();
73
- for (const roomDescriptor of roomsInGrid) {
74
- displayFlagsMap.set(
75
- roomDescriptor.SafeGridIndex,
76
- roomDescriptor.DisplayFlags,
77
- );
49
+ for (const roomDescriptor of getRoomsInsideGrid()) {
50
+ const roomGridIndex = roomDescriptor.SafeGridIndex;
51
+ const displayFlags = getRoomDisplayFlags(roomGridIndex);
52
+ displayFlagsMap.set(roomGridIndex, displayFlags);
78
53
  }
79
54
 
80
55
  return displayFlagsMap;
@@ -84,13 +59,50 @@ export function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>> {
84
59
  * Helper function to get a particular room's minimap display flags (e.g. whether or not it is
85
60
  * visible and so on).
86
61
  *
62
+ * This function automatically accounts for whether or not MinimapAPI is being used.
63
+ *
87
64
  * @param roomGridIndex Optional. Default is the current room index.
88
65
  */
89
66
  export function getRoomDisplayFlags(
90
67
  roomGridIndex?: int,
91
68
  ): BitFlags<DisplayFlag> {
92
- const roomDescriptor = getRoomDescriptor(roomGridIndex);
93
- return roomDescriptor.DisplayFlags;
69
+ if (roomGridIndex === undefined) {
70
+ roomGridIndex = getRoomGridIndex();
71
+ }
72
+
73
+ if (MinimapAPI === undefined) {
74
+ const roomDescriptor = getRoomDescriptor(roomGridIndex);
75
+ return roomDescriptor.DisplayFlags;
76
+ }
77
+
78
+ const minimapAPIRoomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
79
+ if (minimapAPIRoomDescriptor === undefined) {
80
+ error(
81
+ `Failed to get the MinimapAPI room descriptor for the room at index: ${roomGridIndex}`,
82
+ );
83
+ }
84
+ return minimapAPIRoomDescriptor.GetDisplayFlags();
85
+ }
86
+
87
+ /**
88
+ * Helper function to set the minimap `DisplayFlag` value for every room on the floor at once.
89
+ *
90
+ * This function automatically calls the `Level.UpdateVisibility` after setting the flags so that
91
+ * the changes will be immediately visible.
92
+ *
93
+ * This function automatically accounts for whether or not MinimapAPI is being used.
94
+ */
95
+ export function setAllDisplayFlags(displayFlags: BitFlags<DisplayFlag>): void {
96
+ for (const room of getRoomsInsideGrid()) {
97
+ // We pass false to the `updateVisibility` argument as a small optimization.
98
+ setRoomDisplayFlags(room.SafeGridIndex, displayFlags, false);
99
+ }
100
+
101
+ // In vanilla, we must call the "Level.UpdateVisibility" method for the changes to be visible.
102
+ if (MinimapAPI === undefined) {
103
+ const level = game.GetLevel();
104
+ level.UpdateVisibility();
105
+ }
94
106
  }
95
107
 
96
108
  /**
@@ -103,64 +115,59 @@ export function getRoomDisplayFlags(
103
115
  *
104
116
  * @param displayFlagsMap A map of the display flags that is indexed by the room's safe grid index.
105
117
  */
106
- export function setDisplayFlags(
118
+ export function setFloorDisplayFlags(
107
119
  displayFlagsMap: Map<int, BitFlags<DisplayFlag>>,
108
120
  ): void {
109
- const level = game.GetLevel();
110
-
111
121
  for (const [roomGridIndex, displayFlags] of displayFlagsMap) {
112
- if (MinimapAPI === undefined) {
113
- // We pass false to the `updateVisibility` argument as a small optimization.
114
- setRoomDisplayFlags(roomGridIndex, displayFlags, false);
115
- } else {
116
- const roomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
117
- if (roomDescriptor !== undefined) {
118
- roomDescriptor.DisplayFlags = displayFlags;
119
- }
120
- }
122
+ // We pass false to the `updateVisibility` argument as a small optimization.
123
+ setRoomDisplayFlags(roomGridIndex, displayFlags, false);
121
124
  }
122
125
 
123
- // We must call the "Level.UpdateVisibility" method for the changes to be visible.
124
- level.UpdateVisibility();
125
- }
126
-
127
- /** Alias for the `setDisplayFlags` function. */
128
- export function setFloorDisplayFlags(
129
- displayFlagsMap: Map<int, BitFlags<DisplayFlag>>,
130
- ): void {
131
- setDisplayFlags(displayFlagsMap);
126
+ // In vanilla, we must call the "Level.UpdateVisibility" method for the changes to be visible.
127
+ if (MinimapAPI === undefined) {
128
+ const level = game.GetLevel();
129
+ level.UpdateVisibility();
130
+ }
132
131
  }
133
132
 
134
133
  /**
135
134
  * Helper function to set a particular room's minimap display flags (e.g. whether or not it is
136
135
  * visible and so on).
137
136
  *
137
+ * This function automatically accounts for whether or not MinimapAPI is being used.
138
+ *
138
139
  * @param roomGridIndex Set to undefined to use the current room index.
139
140
  * @param displayFlags The bit flags value to set. (See the `DisplayFlag` enum.)
140
141
  * @param updateVisibility Optional. Whether to call the `Level.UpdateVisibility` method in order to
141
- * make the changes immediately visible. Default is true.
142
+ * make the changes immediately visible. Default is true. Set this to false
143
+ * if you are doing a bunch of display flag setting and then manually call
144
+ * the `Level.UpdateVisibility` method after you are done.
142
145
  */
143
146
  export function setRoomDisplayFlags(
144
147
  roomGridIndex: int | undefined,
145
148
  displayFlags: BitFlags<DisplayFlag>,
146
149
  updateVisibility = true,
147
150
  ): void {
151
+ if (roomGridIndex === undefined) {
152
+ roomGridIndex = getRoomGridIndex();
153
+ }
154
+
148
155
  if (MinimapAPI === undefined) {
149
156
  const roomDescriptor = getRoomDescriptor(roomGridIndex);
150
157
  roomDescriptor.DisplayFlags = displayFlags;
151
- } else {
152
- if (roomGridIndex === undefined) {
153
- roomGridIndex = getRoomGridIndex();
158
+
159
+ if (updateVisibility) {
160
+ const level = game.GetLevel();
161
+ level.UpdateVisibility();
154
162
  }
155
- const roomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
156
- if (roomDescriptor !== undefined) {
157
- roomDescriptor.DisplayFlags = displayFlags;
163
+ } else {
164
+ const minimapAPIRoomDescriptor = MinimapAPI.GetRoomByIdx(roomGridIndex);
165
+ if (minimapAPIRoomDescriptor === undefined) {
166
+ error(
167
+ `Failed to get the MinimapAPI room descriptor for the room at index: ${roomGridIndex}`,
168
+ );
158
169
  }
159
- }
160
-
161
- if (updateVisibility) {
162
- const level = game.GetLevel();
163
- level.UpdateVisibility();
170
+ minimapAPIRoomDescriptor.SetDisplayFlags(displayFlags);
164
171
  }
165
172
  }
166
173