isaacscript-common 72.0.1 → 72.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.
@@ -1057,8 +1057,10 @@ export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolea
1057
1057
 
1058
1058
  /**
1059
1059
  * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
1060
+ *
1061
+ * @param exceptions Optional. An array of seed effects to ignore.
1060
1062
  */
1061
- export declare function anySeedEffectEnabled(): boolean;
1063
+ export declare function anySeedEffectEnabled(exceptions?: SeedEffect[]): boolean;
1062
1064
 
1063
1065
  declare type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr<N, [...T, unknown]>;
1064
1066
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 72.0.1
3
+ isaacscript-common 72.1.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -34951,6 +34951,9 @@ return ____exports
34951
34951
  end,
34952
34952
  ["src.functions.run"] = function(...)
34953
34953
  local ____lualib = require("lualib_bundle")
34954
+ local Set = ____lualib.Set
34955
+ local __TS__New = ____lualib.__TS__New
34956
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
34954
34957
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
34955
34958
  local ____exports = {}
34956
34959
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
@@ -34973,10 +34976,17 @@ local ____log = require("src.functions.log")
34973
34976
  local log = ____log.log
34974
34977
  local ____types = require("src.functions.types")
34975
34978
  local isString = ____types.isString
34976
- function ____exports.anySeedEffectEnabled(self)
34979
+ function ____exports.anySeedEffectEnabled(self, exceptions)
34977
34980
  local seeds = game:GetSeeds()
34978
- local numSeedEffects = seeds:CountSeedEffects()
34979
- return numSeedEffects > 0
34981
+ if exceptions == nil then
34982
+ local numSeedEffects = seeds:CountSeedEffects()
34983
+ return numSeedEffects > 0
34984
+ end
34985
+ local exceptionsSet = __TS__New(Set, exceptions)
34986
+ return __TS__ArraySome(
34987
+ SEED_EFFECTS,
34988
+ function(____, seedEffect) return seeds:HasSeedEffect(seedEffect) and not exceptionsSet:has(seedEffect) end
34989
+ )
34980
34990
  end
34981
34991
  function ____exports.anyEasterEggEnabled(self)
34982
34992
  return ____exports.anySeedEffectEnabled(nil)
@@ -4,8 +4,10 @@ import { SeedEffect } from "isaac-typescript-definitions";
4
4
  export declare function anyEasterEggEnabled(): boolean;
5
5
  /**
6
6
  * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
7
+ *
8
+ * @param exceptions Optional. An array of seed effects to ignore.
7
9
  */
8
- export declare function anySeedEffectEnabled(): boolean;
10
+ export declare function anySeedEffectEnabled(exceptions?: SeedEffect[]): boolean;
9
11
  /**
10
12
  * Helper function to see if the current run can unlock achievements. For example, if playing on a
11
13
  * set seed or in a victory lap, achievements are disabled.
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAUtC,qDAAqD;AACrD,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAK9C;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,UAAU,EAAE,CAO7C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAkBpD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,0BAA0B,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAQ1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAUtC,qDAAqD;AACrD,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,CAavE;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,UAAU,EAAE,CAO7C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAkBpD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,0BAA0B,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAQ1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
@@ -1,4 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
2
5
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
3
6
  local ____exports = {}
4
7
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
@@ -22,10 +25,19 @@ local log = ____log.log
22
25
  local ____types = require("src.functions.types")
23
26
  local isString = ____types.isString
24
27
  --- Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
25
- function ____exports.anySeedEffectEnabled(self)
28
+ --
29
+ -- @param exceptions Optional. An array of seed effects to ignore.
30
+ function ____exports.anySeedEffectEnabled(self, exceptions)
26
31
  local seeds = game:GetSeeds()
27
- local numSeedEffects = seeds:CountSeedEffects()
28
- return numSeedEffects > 0
32
+ if exceptions == nil then
33
+ local numSeedEffects = seeds:CountSeedEffects()
34
+ return numSeedEffects > 0
35
+ end
36
+ local exceptionsSet = __TS__New(Set, exceptions)
37
+ return __TS__ArraySome(
38
+ SEED_EFFECTS,
39
+ function(____, seedEffect) return seeds:HasSeedEffect(seedEffect) and not exceptionsSet:has(seedEffect) end
40
+ )
29
41
  end
30
42
  --- Alias for the `anySeedEffectEnabled` function.
31
43
  function ____exports.anyEasterEggEnabled(self)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "72.0.1",
3
+ "version": "72.1.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -20,12 +20,22 @@ export function anyEasterEggEnabled(): boolean {
20
20
 
21
21
  /**
22
22
  * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
23
+ *
24
+ * @param exceptions Optional. An array of seed effects to ignore.
23
25
  */
24
- export function anySeedEffectEnabled(): boolean {
26
+ export function anySeedEffectEnabled(exceptions?: SeedEffect[]): boolean {
25
27
  const seeds = game.GetSeeds();
26
- const numSeedEffects = seeds.CountSeedEffects();
27
28
 
28
- return numSeedEffects > 0;
29
+ if (exceptions === undefined) {
30
+ const numSeedEffects = seeds.CountSeedEffects();
31
+ return numSeedEffects > 0;
32
+ }
33
+
34
+ const exceptionsSet = new Set(exceptions);
35
+ return SEED_EFFECTS.some(
36
+ (seedEffect) =>
37
+ seeds.HasSeedEffect(seedEffect) && !exceptionsSet.has(seedEffect),
38
+ );
29
39
  }
30
40
 
31
41
  /**