isaacscript-common 47.3.0 → 47.4.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.
@@ -74,6 +74,7 @@ import { RoomShape } from 'isaac-typescript-definitions';
74
74
  import { RoomTransitionAnim } from 'isaac-typescript-definitions';
75
75
  import { RoomType } from 'isaac-typescript-definitions';
76
76
  import type { SackSubType } from 'isaac-typescript-definitions';
77
+ import { SeedEffect } from 'isaac-typescript-definitions';
77
78
  import type { SlotVariant } from 'isaac-typescript-definitions';
78
79
  import type { StageID } from 'isaac-typescript-definitions';
79
80
  import { StageType } from 'isaac-typescript-definitions';
@@ -1054,6 +1055,9 @@ export declare function anyPlayerHoldingItem(): boolean;
1054
1055
  */
1055
1056
  export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolean;
1056
1057
 
1058
+ /**
1059
+ * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
1060
+ */
1057
1061
  export declare function anySeedEffectEnabled(): boolean;
1058
1062
 
1059
1063
  declare type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr<N, [...T, unknown]>;
@@ -1352,6 +1356,9 @@ export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
1352
1356
  /**
1353
1357
  * Helper function to see if the current run can unlock achievements. For example, if playing on a
1354
1358
  * set seed or in a victory lap, achievements are disabled.
1359
+ *
1360
+ * Under the hood, this is determined by spawning a Greed Donation Machine and then seeing if it
1361
+ * exists before removing it.
1355
1362
  */
1356
1363
  export declare function canRunUnlockAchievements(): boolean;
1357
1364
 
@@ -7306,6 +7313,11 @@ export declare function getScreenTopLeftPos(): Readonly<Vector>;
7306
7313
 
7307
7314
  export declare function getScreenTopRightPos(): Readonly<Vector>;
7308
7315
 
7316
+ /**
7317
+ * Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
7318
+ */
7319
+ export declare function getSeedEffects(): SeedEffect[];
7320
+
7309
7321
  /**
7310
7322
  * Helper function to get all possible combinations of the given set. This includes the combination
7311
7323
  * of an empty set.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 47.3.0
3
+ isaacscript-common 47.4.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -22503,7 +22503,7 @@ return ____exports
22503
22503
  end,
22504
22504
  ["src.functions.run"] = function(...)
22505
22505
  local ____lualib = require("lualib_bundle")
22506
- local __TS__ArraySome = ____lualib.__TS__ArraySome
22506
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
22507
22507
  local ____exports = {}
22508
22508
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
22509
22509
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
@@ -22526,10 +22526,8 @@ local ____log = require("src.functions.log")
22526
22526
  local log = ____log.log
22527
22527
  function ____exports.anySeedEffectEnabled(self)
22528
22528
  local seeds = game:GetSeeds()
22529
- return __TS__ArraySome(
22530
- SEED_EFFECTS,
22531
- function(____, seedEffect) return seedEffect ~= SeedEffect.NORMAL and seeds:HasSeedEffect(seedEffect) end
22532
- )
22529
+ local numSeedEffects = seeds:CountSeedEffects()
22530
+ return numSeedEffects > 0
22533
22531
  end
22534
22532
  function ____exports.anyEasterEggEnabled(self)
22535
22533
  return ____exports.anySeedEffectEnabled(nil)
@@ -22540,6 +22538,13 @@ function ____exports.canRunUnlockAchievements(self)
22540
22538
  greedDonationMachine:Remove()
22541
22539
  return canUnlockAchievements
22542
22540
  end
22541
+ function ____exports.getSeedEffects(self)
22542
+ local seeds = game:GetSeeds()
22543
+ return __TS__ArrayFilter(
22544
+ SEED_EFFECTS,
22545
+ function(____, seedEffect) return seedEffect ~= SeedEffect.NORMAL and seeds:HasSeedEffect(seedEffect) end
22546
+ )
22547
+ end
22543
22548
  function ____exports.isGreedMode(self)
22544
22549
  return game.Difficulty == Difficulty.GREED or game.Difficulty == Difficulty.GREEDIER
22545
22550
  end
@@ -1,12 +1,23 @@
1
1
  import type { PlayerType } from "isaac-typescript-definitions";
2
+ import { SeedEffect } from "isaac-typescript-definitions";
2
3
  /** Alias for the `anySeedEffectEnabled` function. */
3
4
  export declare function anyEasterEggEnabled(): boolean;
5
+ /**
6
+ * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
7
+ */
4
8
  export declare function anySeedEffectEnabled(): boolean;
5
9
  /**
6
10
  * Helper function to see if the current run can unlock achievements. For example, if playing on a
7
11
  * set seed or in a victory lap, achievements are disabled.
12
+ *
13
+ * Under the hood, this is determined by spawning a Greed Donation Machine and then seeing if it
14
+ * exists before removing it.
8
15
  */
9
16
  export declare function canRunUnlockAchievements(): boolean;
17
+ /**
18
+ * Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
19
+ */
20
+ export declare function getSeedEffects(): SeedEffect[];
10
21
  /**
11
22
  * Helper function to check if the difficulty of the current run is equal to `Difficulty.GREED` or
12
23
  * `Difficulty.GREEDIER`.
@@ -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;AAe/D,qDAAqD;AACrD,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAO9C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAKrC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAkBpD;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,EAGL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAStC,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;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAKrC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAkBpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
@@ -1,5 +1,5 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local __TS__ArraySome = ____lualib.__TS__ArraySome
2
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
3
3
  local ____exports = {}
4
4
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
5
5
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
@@ -20,12 +20,11 @@ local ____entitiesSpecific = require("src.functions.entitiesSpecific")
20
20
  local spawnSlot = ____entitiesSpecific.spawnSlot
21
21
  local ____log = require("src.functions.log")
22
22
  local log = ____log.log
23
+ --- Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
23
24
  function ____exports.anySeedEffectEnabled(self)
24
25
  local seeds = game:GetSeeds()
25
- return __TS__ArraySome(
26
- SEED_EFFECTS,
27
- function(____, seedEffect) return seedEffect ~= SeedEffect.NORMAL and seeds:HasSeedEffect(seedEffect) end
28
- )
26
+ local numSeedEffects = seeds:CountSeedEffects()
27
+ return numSeedEffects > 0
29
28
  end
30
29
  --- Alias for the `anySeedEffectEnabled` function.
31
30
  function ____exports.anyEasterEggEnabled(self)
@@ -33,12 +32,23 @@ function ____exports.anyEasterEggEnabled(self)
33
32
  end
34
33
  --- Helper function to see if the current run can unlock achievements. For example, if playing on a
35
34
  -- set seed or in a victory lap, achievements are disabled.
35
+ --
36
+ -- Under the hood, this is determined by spawning a Greed Donation Machine and then seeing if it
37
+ -- exists before removing it.
36
38
  function ____exports.canRunUnlockAchievements(self)
37
39
  local greedDonationMachine = spawnSlot(nil, SlotVariant.GREED_DONATION_MACHINE, 0, VectorZero)
38
40
  local canUnlockAchievements = greedDonationMachine:Exists()
39
41
  greedDonationMachine:Remove()
40
42
  return canUnlockAchievements
41
43
  end
44
+ --- Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
45
+ function ____exports.getSeedEffects(self)
46
+ local seeds = game:GetSeeds()
47
+ return __TS__ArrayFilter(
48
+ SEED_EFFECTS,
49
+ function(____, seedEffect) return seedEffect ~= SeedEffect.NORMAL and seeds:HasSeedEffect(seedEffect) end
50
+ )
51
+ end
42
52
  --- Helper function to check if the difficulty of the current run is equal to `Difficulty.GREED` or
43
53
  -- `Difficulty.GREEDIER`.
44
54
  function ____exports.isGreedMode(self)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "47.3.0",
3
+ "version": "47.4.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -18,18 +18,22 @@ export function anyEasterEggEnabled(): boolean {
18
18
  return anySeedEffectEnabled();
19
19
  }
20
20
 
21
+ /**
22
+ * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
23
+ */
21
24
  export function anySeedEffectEnabled(): boolean {
22
25
  const seeds = game.GetSeeds();
26
+ const numSeedEffects = seeds.CountSeedEffects();
23
27
 
24
- return SEED_EFFECTS.some(
25
- (seedEffect) =>
26
- seedEffect !== SeedEffect.NORMAL && seeds.HasSeedEffect(seedEffect),
27
- );
28
+ return numSeedEffects > 0;
28
29
  }
29
30
 
30
31
  /**
31
32
  * Helper function to see if the current run can unlock achievements. For example, if playing on a
32
33
  * set seed or in a victory lap, achievements are disabled.
34
+ *
35
+ * Under the hood, this is determined by spawning a Greed Donation Machine and then seeing if it
36
+ * exists before removing it.
33
37
  */
34
38
  export function canRunUnlockAchievements(): boolean {
35
39
  const greedDonationMachine = spawnSlot(
@@ -43,6 +47,18 @@ export function canRunUnlockAchievements(): boolean {
43
47
  return canUnlockAchievements;
44
48
  }
45
49
 
50
+ /**
51
+ * Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
52
+ */
53
+ export function getSeedEffects(): SeedEffect[] {
54
+ const seeds = game.GetSeeds();
55
+
56
+ return SEED_EFFECTS.filter(
57
+ (seedEffect) =>
58
+ seedEffect !== SeedEffect.NORMAL && seeds.HasSeedEffect(seedEffect),
59
+ );
60
+ }
61
+
46
62
  /**
47
63
  * Helper function to check if the difficulty of the current run is equal to `Difficulty.GREED` or
48
64
  * `Difficulty.GREEDIER`.