isaacscript-common 21.1.0 → 21.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -7619,6 +7619,12 @@ export declare function isFirstSlotPocketActiveItem(player: EntityPlayer): boole
7619
7619
 
7620
7620
  export declare function isFlyingCharacter(player: EntityPlayer): boolean;
7621
7621
 
7622
+ /**
7623
+ * Helper function to detect if a particular player is the Found Soul player provided by the
7624
+ * trinket.
7625
+ */
7626
+ export declare function isFoundSoul(player: EntityPlayer): boolean;
7627
+
7622
7628
  export declare function isFunction(variable: unknown): variable is Function;
7623
7629
 
7624
7630
  /**
@@ -12541,7 +12547,7 @@ export { ReadonlyMap_2 as ReadonlyMap }
12541
12547
 
12542
12548
  declare interface ReadonlyMapConstructor {
12543
12549
  new (): ReadonlyMap<any, any>;
12544
- new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): ReadonlyMap<K, V>;
12550
+ new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | Iterable<readonly [K, V]> | null): ReadonlyMap<K, V>;
12545
12551
  readonly prototype: ReadonlyMap<any, any>;
12546
12552
  }
12547
12553
 
@@ -12550,7 +12556,7 @@ declare const ReadonlySet_2: ReadonlySetConstructor;
12550
12556
  export { ReadonlySet_2 as ReadonlySet }
12551
12557
 
12552
12558
  declare interface ReadonlySetConstructor {
12553
- new <T = any>(values?: readonly T[] | null): ReadonlySet<T>;
12559
+ new <T = any>(values?: readonly T[] | Iterable<T> | null): ReadonlySet<T>;
12554
12560
  readonly prototype: ReadonlySet<any>;
12555
12561
  }
12556
12562
 
@@ -13838,9 +13844,6 @@ declare type SerializableSet<T> = Set<SerializableInsideArrayOrMap<T>>;
13838
13844
  /**
13839
13845
  * During serialization, we write an arbitrary string key to the object with a value of an empty
13840
13846
  * string. This is used during deserialization to instantiate the correct type of object.
13841
- *
13842
- * Note that we do not bother branding TSTL classes because we have no way to run the proper
13843
- * constructor during deserialization.
13844
13847
  */
13845
13848
  export declare enum SerializationBrand {
13846
13849
  DEFAULT_MAP = "__TSTL_DEFAULT_MAP",
@@ -14324,9 +14327,7 @@ export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seedO
14324
14327
  */
14325
14328
  export declare function shuffleArrayInPlace<T>(array: T[], seedOrRNG?: Seed | RNG): void;
14326
14329
 
14327
- /**
14328
- * @returns 1 if n is positive, -1 if n is negative, or 0 if n is 0.
14329
- */
14330
+ /** @returns 1 if n is positive, -1 if n is negative, or 0 if n is 0. */
14330
14331
  export declare function sign(n: number): int;
14331
14332
 
14332
14333
  declare class SlotDestroyedDetection extends Feature {
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 21.1.0
3
+ isaacscript-common 21.2.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -13972,6 +13972,16 @@ ____exports.BloodExplosionSubType.GIANT = 4
13972
13972
  ____exports.BloodExplosionSubType[____exports.BloodExplosionSubType.GIANT] = "GIANT"
13973
13973
  ____exports.BloodExplosionSubType.SWIRL = 5
13974
13974
  ____exports.BloodExplosionSubType[____exports.BloodExplosionSubType.SWIRL] = "SWIRL"
13975
+ --- For `EntityType.EFFECT` (1000), `EffectVariant.BLOOD_PARTICLE` (5).
13976
+ ____exports.GibSubType = {}
13977
+ ____exports.GibSubType.BLOOD = 0
13978
+ ____exports.GibSubType[____exports.GibSubType.BLOOD] = "BLOOD"
13979
+ ____exports.GibSubType.BONE = 1
13980
+ ____exports.GibSubType[____exports.GibSubType.BONE] = "BONE"
13981
+ ____exports.GibSubType.GUT = 2
13982
+ ____exports.GibSubType[____exports.GibSubType.GUT] = "GUT"
13983
+ ____exports.GibSubType.EYE = 3
13984
+ ____exports.GibSubType[____exports.GibSubType.EYE] = "EYE"
13975
13985
  --- For `EntityType.EFFECT` (1000), `EffectVariant.POOF_1` (15).
13976
13986
  ____exports.PoofSubType = {}
13977
13987
  ____exports.PoofSubType.NORMAL = 0
@@ -21488,8 +21498,10 @@ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
21488
21498
  local ____exports = {}
21489
21499
  local getPlayerIndexCollectibleType, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
21490
21500
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
21501
+ local BabySubType = ____isaac_2Dtypescript_2Ddefinitions.BabySubType
21491
21502
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
21492
21503
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
21504
+ local PlayerVariant = ____isaac_2Dtypescript_2Ddefinitions.PlayerVariant
21493
21505
  local ____cachedClasses = require("src.core.cachedClasses")
21494
21506
  local game = ____cachedClasses.game
21495
21507
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -21601,6 +21613,9 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
21601
21613
  end
21602
21614
  return nil
21603
21615
  end
21616
+ function ____exports.isFoundSoul(self, player)
21617
+ return ____exports.isChildPlayer(nil, player) and player.Variant == PlayerVariant.COOP_BABY and player.SubType == BabySubType.FOUND_SOUL
21618
+ end
21604
21619
  return ____exports
21605
21620
  end,
21606
21621
  ["src.functions.playerDataStructures"] = function(...)
@@ -46711,21 +46726,21 @@ function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
46711
46726
  msg = msg .. ":\n"
46712
46727
  local gridEntities = getGridEntities(nil)
46713
46728
  local numMatchedEntities = 0
46714
- __TS__ArrayForEach(
46715
- gridEntities,
46716
- function(____, gridEntity)
46729
+ for ____, gridEntity in ipairs(gridEntities) do
46730
+ do
46717
46731
  local gridEntityIndex = gridEntity:GetGridIndex()
46718
46732
  local gridEntityType = gridEntity:GetType()
46719
46733
  if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
46720
- return
46734
+ goto __continue15
46721
46735
  end
46722
46736
  if not includeWalls and gridEntityType == GridEntityType.WALL and gridEntityTypeFilter ~= GridEntityType.WALL then
46723
- return
46737
+ goto __continue15
46724
46738
  end
46725
46739
  msg = msg .. getGridEntityLogLine(gridEntity, gridEntityIndex)
46726
46740
  numMatchedEntities = numMatchedEntities + 1
46727
46741
  end
46728
- )
46742
+ ::__continue15::
46743
+ end
46729
46744
  if numMatchedEntities == 0 then
46730
46745
  msg = msg .. "(no grid entities matched)\n"
46731
46746
  else
@@ -1,9 +1,6 @@
1
1
  /**
2
2
  * During serialization, we write an arbitrary string key to the object with a value of an empty
3
3
  * string. This is used during deserialization to instantiate the correct type of object.
4
- *
5
- * Note that we do not bother branding TSTL classes because we have no way to run the proper
6
- * constructor during deserialization.
7
4
  */
8
5
  export declare enum SerializationBrand {
9
6
  DEFAULT_MAP = "__TSTL_DEFAULT_MAP",
@@ -1 +1 @@
1
- {"version":3,"file":"SerializationBrand.d.ts","sourceRoot":"","sources":["../../../src/enums/SerializationBrand.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,kBAAkB;IAE5B,WAAW,uBAAuB;IAClC,GAAG,eAAe;IAClB,GAAG,eAAe;IAGlB,WAAW,kBAAkB;IAC7B,KAAK,YAAY;IACjB,OAAO,cAAc;IACrB,GAAG,UAAU;IACb,MAAM,aAAa;IAEnB;;;OAGG;IACH,iBAAiB,6BAA6B;IAE9C;;;;;;;;;;OAUG;IACH,uBAAuB,mCAAmC;IAE1D;;;OAGG;IACH,UAAU,iBAAiB;CAC5B"}
1
+ {"version":3,"file":"SerializationBrand.d.ts","sourceRoot":"","sources":["../../../src/enums/SerializationBrand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,kBAAkB;IAE5B,WAAW,uBAAuB;IAClC,GAAG,eAAe;IAClB,GAAG,eAAe;IAGlB,WAAW,kBAAkB;IAC7B,KAAK,YAAY;IACjB,OAAO,cAAc;IACrB,GAAG,UAAU;IACb,MAAM,aAAa;IAEnB;;;OAGG;IACH,iBAAiB,6BAA6B;IAE9C;;;;;;;;;;OAUG;IACH,uBAAuB,mCAAmC;IAE1D;;;OAGG;IACH,UAAU,iBAAiB;CAC5B"}
@@ -1,9 +1,6 @@
1
1
  local ____exports = {}
2
2
  --- During serialization, we write an arbitrary string key to the object with a value of an empty
3
3
  -- string. This is used during deserialization to instantiate the correct type of object.
4
- --
5
- -- Note that we do not bother branding TSTL classes because we have no way to run the proper
6
- -- constructor during deserialization.
7
4
  ____exports.SerializationBrand = {}
8
5
  ____exports.SerializationBrand.DEFAULT_MAP = "__TSTL_DEFAULT_MAP"
9
6
  ____exports.SerializationBrand.MAP = "__TSTL_MAP"
@@ -207,21 +207,21 @@ function ____exports.logAllGridEntities(includeWalls, gridEntityTypeFilter)
207
207
  msg = msg .. ":\n"
208
208
  local gridEntities = getGridEntities(nil)
209
209
  local numMatchedEntities = 0
210
- __TS__ArrayForEach(
211
- gridEntities,
212
- function(____, gridEntity)
210
+ for ____, gridEntity in ipairs(gridEntities) do
211
+ do
213
212
  local gridEntityIndex = gridEntity:GetGridIndex()
214
213
  local gridEntityType = gridEntity:GetType()
215
214
  if gridEntityTypeFilter ~= nil and gridEntityType ~= gridEntityTypeFilter then
216
- return
215
+ goto __continue15
217
216
  end
218
217
  if not includeWalls and gridEntityType == GridEntityType.WALL and gridEntityTypeFilter ~= GridEntityType.WALL then
219
- return
218
+ goto __continue15
220
219
  end
221
220
  msg = msg .. getGridEntityLogLine(gridEntity, gridEntityIndex)
222
221
  numMatchedEntities = numMatchedEntities + 1
223
222
  end
224
- )
223
+ ::__continue15::
224
+ end
225
225
  if numMatchedEntities == 0 then
226
226
  msg = msg .. "(no grid entities matched)\n"
227
227
  else
@@ -43,9 +43,7 @@ export declare function lerpAngleDegrees(aStart: number, aEnd: number, percent:
43
43
  * @param numDecimalPlaces Optional. Default is 0.
44
44
  */
45
45
  export declare function round(num: float, numDecimalPlaces?: number): float;
46
- /**
47
- * @returns 1 if n is positive, -1 if n is negative, or 0 if n is 0.
48
- */
46
+ /** @returns 1 if n is positive, -1 if n is negative, or 0 if n is 0. */
49
47
  export declare function sign(n: number): int;
50
48
  export declare function tanh(x: number): number;
51
49
  //# sourceMappingURL=math.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/functions/math.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAErD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,KAAK,CAGtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,GAAG,EACd,WAAW,SAAI,EACf,WAAW,SAAI,EACf,gBAAgB,YAAe,GAC9B,MAAM,EAAE,CAaV;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,OAAO,CAOT;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,KAAK,EACnB,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CAgBT;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAGxC;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAGvC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM,CAE7D;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EAC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AGvC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM,CAE7D;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,KAAK,GACb,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,SAAI,GAAG,KAAK,CAG7D;AAED,wEAAwE;AACxE,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAUnC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC"}
@@ -81,4 +81,9 @@ export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPl
81
81
  * non-undefined `EntityPlayer.Parent` field. (For example, the Strawman Keeper.)
82
82
  */
83
83
  export declare function isChildPlayer(player: EntityPlayer): boolean;
84
+ /**
85
+ * Helper function to detect if a particular player is the Found Soul player provided by the
86
+ * trinket.
87
+ */
88
+ export declare function isFoundSoul(player: EntityPlayer): boolean;
84
89
  //# sourceMappingURL=playerIndex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"playerIndex.d.ts","sourceRoot":"","sources":["../../../src/functions/playerIndex.ts"],"names":[],"mappings":";;;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAUnD;;;;;;GAMG;AACH,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAU9C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,EAAE,CAMpE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,WAAW,GACvB,YAAY,GAAG,SAAS,CAG1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,Y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,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMzD"}
@@ -5,8 +5,10 @@ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
5
5
  local ____exports = {}
6
6
  local getPlayerIndexCollectibleType, DEFAULT_COLLECTIBLE_TYPE, EXCLUDED_CHARACTERS
7
7
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
8
+ local BabySubType = ____isaac_2Dtypescript_2Ddefinitions.BabySubType
8
9
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
9
10
  local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
11
+ local PlayerVariant = ____isaac_2Dtypescript_2Ddefinitions.PlayerVariant
10
12
  local ____cachedClasses = require("src.core.cachedClasses")
11
13
  local game = ____cachedClasses.game
12
14
  local ____ReadonlySet = require("src.types.ReadonlySet")
@@ -173,4 +175,9 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
173
175
  end
174
176
  return nil
175
177
  end
178
+ --- Helper function to detect if a particular player is the Found Soul player provided by the
179
+ -- trinket.
180
+ function ____exports.isFoundSoul(self, player)
181
+ return ____exports.isChildPlayer(nil, player) and player.Variant == PlayerVariant.COOP_BABY and player.SubType == BabySubType.FOUND_SOUL
182
+ end
176
183
  return ____exports
@@ -1,6 +1,6 @@
1
1
  interface ReadonlyMapConstructor {
2
2
  new (): ReadonlyMap<any, any>;
3
- new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): ReadonlyMap<K, V>;
3
+ new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | Iterable<readonly [K, V]> | null): ReadonlyMap<K, V>;
4
4
  readonly prototype: ReadonlyMap<any, any>;
5
5
  }
6
6
  /** An alias for the `Map` constructor that returns a read-only map. */
@@ -1 +1 @@
1
- {"version":3,"file":"ReadonlyMap.d.ts","sourceRoot":"","sources":["../../../src/types/ReadonlyMap.ts"],"names":[],"mappings":"AAEA,UAAU,sBAAsB;IAC9B,QAAQ,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,WAAW,CACtE,CAAC,EACD,CAAC,CACF,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CAC3C;AAED,uEAAuE;AACvE,eAAO,MAAM,WAAW,wBAAgC,CAAC"}
1
+ {"version":3,"file":"ReadonlyMap.d.ts","sourceRoot":"","sources":["../../../src/types/ReadonlyMap.ts"],"names":[],"mappings":"AAEA,UAAU,sBAAsB;IAC9B,QAAQ,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAC1E,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CAC3C;AAED,uEAAuE;AACvE,eAAO,MAAM,WAAW,wBAAgC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  interface ReadonlySetConstructor {
2
- new <T = any>(values?: readonly T[] | null): ReadonlySet<T>;
2
+ new <T = any>(values?: readonly T[] | Iterable<T> | null): ReadonlySet<T>;
3
3
  readonly prototype: ReadonlySet<any>;
4
4
  }
5
5
  /** An alias for the `Set` constructor that returns a read-only set. */
@@ -1 +1 @@
1
- {"version":3,"file":"ReadonlySet.d.ts","sourceRoot":"","sources":["../../../src/types/ReadonlySet.ts"],"names":[],"mappings":"AAEA,UAAU,sBAAsB;IAC9B,KAAK,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAC5D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;CACtC;AAED,uEAAuE;AACvE,eAAO,MAAM,WAAW,wBAAgC,CAAC"}
1
+ {"version":3,"file":"ReadonlySet.d.ts","sourceRoot":"","sources":["../../../src/types/ReadonlySet.ts"],"names":[],"mappings":"AAEA,UAAU,sBAAsB;IAC9B,KAAK,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAC1E,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;CACtC;AAED,uEAAuE;AACvE,eAAO,MAAM,WAAW,wBAAgC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "21.1.0",
3
+ "version": "21.2.0",
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/src/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^11.0.3"
25
+ "isaac-typescript-definitions": "^11.1.0"
26
26
  }
27
27
  }
@@ -1,9 +1,6 @@
1
1
  /**
2
2
  * During serialization, we write an arbitrary string key to the object with a value of an empty
3
3
  * string. This is used during deserialization to instantiate the correct type of object.
4
- *
5
- * Note that we do not bother branding TSTL classes because we have no way to run the proper
6
- * constructor during deserialization.
7
4
  */
8
5
  export enum SerializationBrand {
9
6
  // Specific TSTL class brands.
@@ -99,7 +99,7 @@ export function logAllGridEntities(
99
99
 
100
100
  const gridEntities = getGridEntities();
101
101
  let numMatchedEntities = 0;
102
- gridEntities.forEach((gridEntity) => {
102
+ for (const gridEntity of gridEntities) {
103
103
  const gridEntityIndex = gridEntity.GetGridIndex();
104
104
  const gridEntityType = gridEntity.GetType();
105
105
 
@@ -108,7 +108,7 @@ export function logAllGridEntities(
108
108
  gridEntityTypeFilter !== undefined &&
109
109
  gridEntityType !== gridEntityTypeFilter
110
110
  ) {
111
- return;
111
+ continue;
112
112
  }
113
113
 
114
114
  if (
@@ -116,13 +116,13 @@ export function logAllGridEntities(
116
116
  gridEntityType === GridEntityType.WALL &&
117
117
  gridEntityTypeFilter !== GridEntityType.WALL
118
118
  ) {
119
- return;
119
+ continue;
120
120
  }
121
121
 
122
122
  msg += getGridEntityLogLine(gridEntity, gridEntityIndex);
123
123
 
124
124
  numMatchedEntities++;
125
- });
125
+ }
126
126
 
127
127
  if (numMatchedEntities === 0) {
128
128
  msg += "(no grid entities matched)\n";
@@ -129,9 +129,7 @@ export function round(num: float, numDecimalPlaces = 0): float {
129
129
  return roundedNum === undefined ? 0 : roundedNum;
130
130
  }
131
131
 
132
- /**
133
- * @returns 1 if n is positive, -1 if n is negative, or 0 if n is 0.
134
- */
132
+ /** @returns 1 if n is positive, -1 if n is negative, or 0 if n is 0. */
135
133
  export function sign(n: number): int {
136
134
  if (n > 0) {
137
135
  return 1;
@@ -1,4 +1,9 @@
1
- import { CollectibleType, PlayerType } from "isaac-typescript-definitions";
1
+ import {
2
+ BabySubType,
3
+ CollectibleType,
4
+ PlayerType,
5
+ PlayerVariant,
6
+ } from "isaac-typescript-definitions";
2
7
  import { game } from "../core/cachedClasses";
3
8
  import { PlayerIndex } from "../types/PlayerIndex";
4
9
  import { ReadonlySet } from "../types/ReadonlySet";
@@ -206,3 +211,15 @@ export function getSubPlayerParent(
206
211
  export function isChildPlayer(player: EntityPlayer): boolean {
207
212
  return player.Parent !== undefined;
208
213
  }
214
+
215
+ /**
216
+ * Helper function to detect if a particular player is the Found Soul player provided by the
217
+ * trinket.
218
+ */
219
+ export function isFoundSoul(player: EntityPlayer): boolean {
220
+ return (
221
+ isChildPlayer(player) &&
222
+ player.Variant === PlayerVariant.COOP_BABY &&
223
+ player.SubType === (BabySubType.FOUND_SOUL as int)
224
+ );
225
+ }
@@ -2,10 +2,9 @@
2
2
 
3
3
  interface ReadonlyMapConstructor {
4
4
  new (): ReadonlyMap<any, any>;
5
- new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): ReadonlyMap<
6
- K,
7
- V
8
- >;
5
+ new <K, V>(
6
+ entries?: ReadonlyArray<readonly [K, V]> | Iterable<readonly [K, V]> | null,
7
+ ): ReadonlyMap<K, V>;
9
8
  readonly prototype: ReadonlyMap<any, any>;
10
9
  }
11
10
 
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
 
3
3
  interface ReadonlySetConstructor {
4
- new <T = any>(values?: readonly T[] | null): ReadonlySet<T>;
4
+ new <T = any>(values?: readonly T[] | Iterable<T> | null): ReadonlySet<T>;
5
5
  readonly prototype: ReadonlySet<any>;
6
6
  }
7
7