isaacscript-common 59.3.0 → 59.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.
@@ -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.0
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,10 @@ 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
+ Isaac.ExecuteCommand("seed " .. startSeedString)
22693
+ end
22688
22694
  function ____exports.setUnseeded(self)
22689
22695
  local seeds = game:GetSeeds()
22690
22696
  seeds:Reset()
@@ -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,CAM1E;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,16 @@ 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
+ Isaac.ExecuteCommand("seed " .. startSeedString)
106
+ end
95
107
  --- Helper function to change the run status to that of an unseeded run with a new random seed.
96
108
  --
97
109
  -- 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.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -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,22 @@ 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
+ Isaac.ExecuteCommand(`seed ${startSeedString}`);
140
+ }
141
+
125
142
  /**
126
143
  * Helper function to change the run status to that of an unseeded run with a new random seed.
127
144
  *