isaacscript-common 59.3.0 → 59.4.1

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.
@@ -17005,6 +17005,16 @@ export declare function setRoomDisplayFlags(roomGridIndex: int | undefined, disp
17005
17005
  */
17006
17006
  export declare function setRoomUncleared(): void;
17007
17007
 
17008
+ /**
17009
+ * Helper function to restart the run on a particular starting seed.
17010
+ *
17011
+ * Under the hood, this function executes the `seed` console command.
17012
+ *
17013
+ * @param startSeedOrStartSeedString Either the numerical start seed (e.g. 268365970) or the start
17014
+ * seed string (e.g. "AAJ2 8V9C").
17015
+ */
17016
+ export declare function setRunSeed(startSeedOrStartSeedString: Seed | string): void;
17017
+
17008
17018
  /** Helper function to set a seed to an RNG object using Blade's recommended shift index. */
17009
17019
  export declare function setSeed(rng: RNG, seed: Seed): void;
17010
17020
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 59.3.0
3
+ isaacscript-common 59.4.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -22636,6 +22636,8 @@ local ____entitiesSpecific = require("src.functions.entitiesSpecific")
22636
22636
  local spawnSlot = ____entitiesSpecific.spawnSlot
22637
22637
  local ____log = require("src.functions.log")
22638
22638
  local log = ____log.log
22639
+ local ____types = require("src.functions.types")
22640
+ local isString = ____types.isString
22639
22641
  function ____exports.anySeedEffectEnabled(self)
22640
22642
  local seeds = game:GetSeeds()
22641
22643
  local numSeedEffects = seeds:CountSeedEffects()
@@ -22685,6 +22687,12 @@ function ____exports.restart(self, character)
22685
22687
  log((((("Restarting the run as " .. characterName) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command)
22686
22688
  Isaac.ExecuteCommand(command)
22687
22689
  end
22690
+ function ____exports.setRunSeed(self, startSeedOrStartSeedString)
22691
+ local startSeedString = isString(nil, startSeedOrStartSeedString) and startSeedOrStartSeedString or Seeds.Seed2String(startSeedOrStartSeedString)
22692
+ local command = "seed " .. startSeedString
22693
+ log("Restarting the run to set a seed with a console command of: " .. command)
22694
+ Isaac.ExecuteCommand(command)
22695
+ end
22688
22696
  function ____exports.setUnseeded(self)
22689
22697
  local seeds = game:GetSeeds()
22690
22698
  seeds:Reset()
@@ -54628,13 +54636,17 @@ local DEFAULT_CHALLENGE_CHARACTER = ____challengeCharacters.DEFAULT_CHALLENGE_CH
54628
54636
  local ____challengeNames = require("src.objects.challengeNames")
54629
54637
  local CHALLENGE_NAMES = ____challengeNames.CHALLENGE_NAMES
54630
54638
  local DEFAULT_CHALLENGE_NAME = ____challengeNames.DEFAULT_CHALLENGE_NAME
54639
+ local ____log = require("src.functions.log")
54640
+ local log = ____log.log
54631
54641
  function ____exports.onAnyChallenge(self)
54632
54642
  local challenge = Isaac.GetChallenge()
54633
54643
  return challenge ~= Challenge.NULL
54634
54644
  end
54635
54645
  function ____exports.clearChallenge(self)
54636
54646
  if ____exports.onAnyChallenge(nil) then
54637
- Isaac.ExecuteCommand("challenge " .. tostring(Challenge.NULL))
54647
+ local command = "challenge " .. tostring(Challenge.NULL)
54648
+ log("Restarting the run to clear the current challenge with a console command of: " .. command)
54649
+ Isaac.ExecuteCommand(command)
54638
54650
  end
54639
54651
  end
54640
54652
  function ____exports.getChallengeBoss(self, challenge)
@@ -54656,7 +54668,9 @@ function ____exports.onChallenge(self, ...)
54656
54668
  end
54657
54669
  function ____exports.setChallenge(self, challenge)
54658
54670
  if not ____exports.onChallenge(nil, challenge) then
54659
- Isaac.ExecuteCommand("challenge " .. tostring(challenge))
54671
+ local command = "challenge " .. tostring(challenge)
54672
+ log("Restarting the run to set a challenge with a console command of: " .. command)
54673
+ Isaac.ExecuteCommand(command)
54660
54674
  end
54661
54675
  end
54662
54676
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"challenges.d.ts","sourceRoot":"","sources":["../../../src/functions/challenges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAA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/D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAQvD"}
@@ -12,6 +12,8 @@ local DEFAULT_CHALLENGE_CHARACTER = ____challengeCharacters.DEFAULT_CHALLENGE_CH
12
12
  local ____challengeNames = require("src.objects.challengeNames")
13
13
  local CHALLENGE_NAMES = ____challengeNames.CHALLENGE_NAMES
14
14
  local DEFAULT_CHALLENGE_NAME = ____challengeNames.DEFAULT_CHALLENGE_NAME
15
+ local ____log = require("src.functions.log")
16
+ local log = ____log.log
15
17
  --- Helper function to see if the player is playing any challenge.
16
18
  function ____exports.onAnyChallenge(self)
17
19
  local challenge = Isaac.GetChallenge()
@@ -25,7 +27,9 @@ end
25
27
  -- Under the hood, this function executes the `challenge 0` console command.
26
28
  function ____exports.clearChallenge(self)
27
29
  if ____exports.onAnyChallenge(nil) then
28
- Isaac.ExecuteCommand("challenge " .. tostring(Challenge.NULL))
30
+ local command = "challenge " .. tostring(Challenge.NULL)
31
+ log("Restarting the run to clear the current challenge with a console command of: " .. command)
32
+ Isaac.ExecuteCommand(command)
29
33
  end
30
34
  end
31
35
  --- Get the final boss of a challenge. This will only work for vanilla challenges.
@@ -68,7 +72,9 @@ end
68
72
  -- Under the hood, this function executes the `challenge 0` console command.
69
73
  function ____exports.setChallenge(self, challenge)
70
74
  if not ____exports.onChallenge(nil, challenge) then
71
- Isaac.ExecuteCommand("challenge " .. tostring(challenge))
75
+ local command = "challenge " .. tostring(challenge)
76
+ log("Restarting the run to set a challenge with a console command of: " .. command)
77
+ Isaac.ExecuteCommand(command)
72
78
  end
73
79
  end
74
80
  return ____exports
@@ -45,6 +45,15 @@ export declare function onVictoryLap(): boolean;
45
45
  * You can optionally specify a `PlayerType` to restart the game as that character.
46
46
  */
47
47
  export declare function restart(character?: PlayerType): void;
48
+ /**
49
+ * Helper function to restart the run on a particular starting seed.
50
+ *
51
+ * Under the hood, this function executes the `seed` console command.
52
+ *
53
+ * @param startSeedOrStartSeedString Either the numerical start seed (e.g. 268365970) or the start
54
+ * seed string (e.g. "AAJ2 8V9C").
55
+ */
56
+ export declare function setRunSeed(startSeedOrStartSeedString: Seed | string): void;
48
57
  /**
49
58
  * Helper function to change the run status to that of an unseeded run with a new random seed.
50
59
  *
@@ -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,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
+ {"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;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;;;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;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,0BAA0B,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAQ1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
@@ -20,6 +20,8 @@ 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
+ local ____types = require("src.functions.types")
24
+ local isString = ____types.isString
23
25
  --- Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
24
26
  function ____exports.anySeedEffectEnabled(self)
25
27
  local seeds = game:GetSeeds()
@@ -92,6 +94,18 @@ function ____exports.restart(self, character)
92
94
  log((((("Restarting the run as " .. characterName) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command)
93
95
  Isaac.ExecuteCommand(command)
94
96
  end
97
+ --- Helper function to restart the run on a particular starting seed.
98
+ --
99
+ -- Under the hood, this function executes the `seed` console command.
100
+ --
101
+ -- @param startSeedOrStartSeedString Either the numerical start seed (e.g. 268365970) or the start
102
+ -- seed string (e.g. "AAJ2 8V9C").
103
+ function ____exports.setRunSeed(self, startSeedOrStartSeedString)
104
+ local startSeedString = isString(nil, startSeedOrStartSeedString) and startSeedOrStartSeedString or Seeds.Seed2String(startSeedOrStartSeedString)
105
+ local command = "seed " .. startSeedString
106
+ log("Restarting the run to set a seed with a console command of: " .. command)
107
+ Isaac.ExecuteCommand(command)
108
+ end
95
109
  --- Helper function to change the run status to that of an unseeded run with a new random seed.
96
110
  --
97
111
  -- This is useful to revert the behavior where playing on a set seed and restarting the game will
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "59.3.0",
3
+ "version": "59.4.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -12,6 +12,7 @@ import {
12
12
  CHALLENGE_NAMES,
13
13
  DEFAULT_CHALLENGE_NAME,
14
14
  } from "../objects/challengeNames";
15
+ import { log } from "./log";
15
16
 
16
17
  /**
17
18
  * Helper function to clear the current challenge, which will restart the run on a new random
@@ -23,7 +24,11 @@ import {
23
24
  */
24
25
  export function clearChallenge(): void {
25
26
  if (onAnyChallenge()) {
26
- Isaac.ExecuteCommand(`challenge ${Challenge.NULL}`);
27
+ const command = `challenge ${Challenge.NULL}`;
28
+ log(
29
+ `Restarting the run to clear the current challenge with a console command of: ${command}`,
30
+ );
31
+ Isaac.ExecuteCommand(command);
27
32
  }
28
33
  }
29
34
 
@@ -92,6 +97,10 @@ export function onChallenge(...challenges: Challenge[]): boolean {
92
97
  */
93
98
  export function setChallenge(challenge: Challenge): void {
94
99
  if (!onChallenge(challenge)) {
95
- Isaac.ExecuteCommand(`challenge ${challenge}`);
100
+ const command = `challenge ${challenge}`;
101
+ log(
102
+ `Restarting the run to set a challenge with a console command of: ${command}`,
103
+ );
104
+ Isaac.ExecuteCommand(command);
96
105
  }
97
106
  }
@@ -12,6 +12,7 @@ import { FIRST_CHARACTER } from "../core/constantsFirstLast";
12
12
  import { getCharacterName } from "./characters";
13
13
  import { spawnSlot } from "./entitiesSpecific";
14
14
  import { log } from "./log";
15
+ import { isString } from "./types";
15
16
 
16
17
  /** Alias for the `anySeedEffectEnabled` function. */
17
18
  export function anyEasterEggEnabled(): boolean {
@@ -122,6 +123,24 @@ export function restart(character?: PlayerType): void {
122
123
  Isaac.ExecuteCommand(command);
123
124
  }
124
125
 
126
+ /**
127
+ * Helper function to restart the run on a particular starting seed.
128
+ *
129
+ * Under the hood, this function executes the `seed` console command.
130
+ *
131
+ * @param startSeedOrStartSeedString Either the numerical start seed (e.g. 268365970) or the start
132
+ * seed string (e.g. "AAJ2 8V9C").
133
+ */
134
+ export function setRunSeed(startSeedOrStartSeedString: Seed | string): void {
135
+ const startSeedString = isString(startSeedOrStartSeedString)
136
+ ? startSeedOrStartSeedString
137
+ : Seeds.Seed2String(startSeedOrStartSeedString);
138
+
139
+ const command = `seed ${startSeedString}`;
140
+ log(`Restarting the run to set a seed with a console command of: ${command}`);
141
+ Isaac.ExecuteCommand(command);
142
+ }
143
+
125
144
  /**
126
145
  * Helper function to change the run status to that of an unseeded run with a new random seed.
127
146
  *