isaacscript-common 47.3.0 → 47.5.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.
@@ -14021,9 +14033,9 @@ export declare function onFirstFloor(): boolean;
14021
14033
  export declare function onRepentanceStage(): boolean;
14022
14034
 
14023
14035
  /**
14024
- * Whether the player is playing on a set seed (i.e. that they entered in a specific seed by
14025
- * pressing tab on the character selection screen). When the player resets the game on a set seed,
14026
- * the game will not switch to a different seed.
14036
+ * Helper function to check whether the player is playing on a set seed (i.e. that they entered in a
14037
+ * specific seed by pressing tab on the character selection screen). When the player resets the game
14038
+ * on a set seed, the game will not switch to a different seed.
14027
14039
  *
14028
14040
  * Under the hood, this checks if the current challenge is `Challenge.NULL` and the
14029
14041
  * `Seeds.IsCustomRun` method.
@@ -14103,6 +14115,12 @@ export declare function onStageWithShovelTrapdoors(): boolean;
14103
14115
  */
14104
14116
  export declare function onStageWithStoryBoss(): boolean;
14105
14117
 
14118
+ /**
14119
+ * Helper function to check whether the player is on a Victory Lap (i.e. they answered "yes" to the
14120
+ * popup that happens after defeating The Lamb).
14121
+ */
14122
+ export declare function onVictoryLap(): boolean;
14123
+
14106
14124
  /**
14107
14125
  * For the purposes of this function, doors to Secret Rooms or Super Secret Rooms that have not been
14108
14126
  * discovered yet will not be opened.
@@ -16630,8 +16648,8 @@ export declare function setTrinketSprite(trinket: EntityPickup, pngPath: string
16630
16648
  /**
16631
16649
  * Helper function to change the run status to that of an unseeded run with a new random seed.
16632
16650
  *
16633
- * This is useful to revert the behavior where playing on a set and restarting the game will not
16634
- * take you to a new seed.
16651
+ * This is useful to revert the behavior where playing on a set seed and restarting the game will
16652
+ * not take you to a new seed.
16635
16653
  *
16636
16654
  * Under the hood, this function calls the `Seeds.Reset` method and the
16637
16655
  * `Seeds.Restart(Challenge.NULL)` method.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 47.3.0
3
+ isaacscript-common 47.5.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
@@ -22549,6 +22554,10 @@ function ____exports.onSetSeed(self)
22549
22554
  local challenge = Isaac.GetChallenge()
22550
22555
  return challenge == Challenge.NULL and customRun
22551
22556
  end
22557
+ function ____exports.onVictoryLap(self)
22558
+ local numVictoryLaps = game:GetVictoryLap()
22559
+ return numVictoryLaps > 0
22560
+ end
22552
22561
  function ____exports.restart(self, character)
22553
22562
  if character == nil then
22554
22563
  local command = "restart"
@@ -1,26 +1,42 @@
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`.
13
24
  */
14
25
  export declare function isGreedMode(): boolean;
15
26
  /**
16
- * Whether the player is playing on a set seed (i.e. that they entered in a specific seed by
17
- * pressing tab on the character selection screen). When the player resets the game on a set seed,
18
- * the game will not switch to a different seed.
27
+ * Helper function to check whether the player is playing on a set seed (i.e. that they entered in a
28
+ * specific seed by pressing tab on the character selection screen). When the player resets the game
29
+ * on a set seed, the game will not switch to a different seed.
19
30
  *
20
31
  * Under the hood, this checks if the current challenge is `Challenge.NULL` and the
21
32
  * `Seeds.IsCustomRun` method.
22
33
  */
23
34
  export declare function onSetSeed(): boolean;
35
+ /**
36
+ * Helper function to check whether the player is on a Victory Lap (i.e. they answered "yes" to the
37
+ * popup that happens after defeating The Lamb).
38
+ */
39
+ export declare function onVictoryLap(): boolean;
24
40
  /**
25
41
  * Helper function to restart the run using the console command of "restart". If the player is
26
42
  * playing a seeded run, then it will restart the game to the beginning of the seed. Otherwise, it
@@ -32,8 +48,8 @@ export declare function restart(character?: PlayerType): void;
32
48
  /**
33
49
  * Helper function to change the run status to that of an unseeded run with a new random seed.
34
50
  *
35
- * This is useful to revert the behavior where playing on a set and restarting the game will not
36
- * take you to a new seed.
51
+ * This is useful to revert the behavior where playing on a set seed and restarting the game will
52
+ * not take you to a new seed.
37
53
  *
38
54
  * Under the hood, this function calls the `Seeds.Reset` method and the
39
55
  * `Seeds.Restart(Challenge.NULL)` method.
@@ -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;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAGtC;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,20 +32,31 @@ 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)
45
55
  return game.Difficulty == Difficulty.GREED or game.Difficulty == Difficulty.GREEDIER
46
56
  end
47
- --- Whether the player is playing on a set seed (i.e. that they entered in a specific seed by
48
- -- pressing tab on the character selection screen). When the player resets the game on a set seed,
49
- -- the game will not switch to a different seed.
57
+ --- Helper function to check whether the player is playing on a set seed (i.e. that they entered in a
58
+ -- specific seed by pressing tab on the character selection screen). When the player resets the game
59
+ -- on a set seed, the game will not switch to a different seed.
50
60
  --
51
61
  -- Under the hood, this checks if the current challenge is `Challenge.NULL` and the
52
62
  -- `Seeds.IsCustomRun` method.
@@ -56,6 +66,12 @@ function ____exports.onSetSeed(self)
56
66
  local challenge = Isaac.GetChallenge()
57
67
  return challenge == Challenge.NULL and customRun
58
68
  end
69
+ --- Helper function to check whether the player is on a Victory Lap (i.e. they answered "yes" to the
70
+ -- popup that happens after defeating The Lamb).
71
+ function ____exports.onVictoryLap(self)
72
+ local numVictoryLaps = game:GetVictoryLap()
73
+ return numVictoryLaps > 0
74
+ end
59
75
  --- Helper function to restart the run using the console command of "restart". If the player is
60
76
  -- playing a seeded run, then it will restart the game to the beginning of the seed. Otherwise, it
61
77
  -- will put the player on a run with an entirely new seed.
@@ -78,8 +94,8 @@ function ____exports.restart(self, character)
78
94
  end
79
95
  --- Helper function to change the run status to that of an unseeded run with a new random seed.
80
96
  --
81
- -- This is useful to revert the behavior where playing on a set and restarting the game will not
82
- -- take you to a new seed.
97
+ -- This is useful to revert the behavior where playing on a set seed and restarting the game will
98
+ -- not take you to a new seed.
83
99
  --
84
100
  -- Under the hood, this function calls the `Seeds.Reset` method and the
85
101
  -- `Seeds.Restart(Challenge.NULL)` method.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "47.3.0",
3
+ "version": "47.5.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`.
@@ -55,9 +71,9 @@ export function isGreedMode(): boolean {
55
71
  }
56
72
 
57
73
  /**
58
- * Whether the player is playing on a set seed (i.e. that they entered in a specific seed by
59
- * pressing tab on the character selection screen). When the player resets the game on a set seed,
60
- * the game will not switch to a different seed.
74
+ * Helper function to check whether the player is playing on a set seed (i.e. that they entered in a
75
+ * specific seed by pressing tab on the character selection screen). When the player resets the game
76
+ * on a set seed, the game will not switch to a different seed.
61
77
  *
62
78
  * Under the hood, this checks if the current challenge is `Challenge.NULL` and the
63
79
  * `Seeds.IsCustomRun` method.
@@ -70,6 +86,15 @@ export function onSetSeed(): boolean {
70
86
  return challenge === Challenge.NULL && customRun;
71
87
  }
72
88
 
89
+ /**
90
+ * Helper function to check whether the player is on a Victory Lap (i.e. they answered "yes" to the
91
+ * popup that happens after defeating The Lamb).
92
+ */
93
+ export function onVictoryLap(): boolean {
94
+ const numVictoryLaps = game.GetVictoryLap();
95
+ return numVictoryLaps > 0;
96
+ }
97
+
73
98
  /**
74
99
  * Helper function to restart the run using the console command of "restart". If the player is
75
100
  * playing a seeded run, then it will restart the game to the beginning of the seed. Otherwise, it
@@ -100,8 +125,8 @@ export function restart(character?: PlayerType): void {
100
125
  /**
101
126
  * Helper function to change the run status to that of an unseeded run with a new random seed.
102
127
  *
103
- * This is useful to revert the behavior where playing on a set and restarting the game will not
104
- * take you to a new seed.
128
+ * This is useful to revert the behavior where playing on a set seed and restarting the game will
129
+ * not take you to a new seed.
105
130
  *
106
131
  * Under the hood, this function calls the `Seeds.Reset` method and the
107
132
  * `Seeds.Restart(Challenge.NULL)` method.