isaacscript-common 6.8.0 → 6.9.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.
- package/dist/functions/run.d.ts +8 -0
- package/dist/functions/run.d.ts.map +1 -1
- package/dist/functions/run.lua +15 -0
- package/package.json +1 -1
- package/src/functions/run.ts +14 -0
package/dist/functions/run.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export declare function onSetSeed(): boolean;
|
|
|
13
13
|
* You can optionally specify a `PlayerType` to restart the game as that character.
|
|
14
14
|
*/
|
|
15
15
|
export declare function restart(character?: PlayerType): void;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to restart on the next render frame. Useful because it is impossible to restart
|
|
18
|
+
* the game inside of the `POST_NEW_ROOM`, `POST_NEW_LEVEL`, or `POST_GAME_STARTED` callbacks when a
|
|
19
|
+
* run is first starting.
|
|
20
|
+
*
|
|
21
|
+
* You can optionally specify a `PlayerType` to restart the game as that character.
|
|
22
|
+
*/
|
|
23
|
+
export declare function restartNextRenderFrame(character?: PlayerType): void;
|
|
16
24
|
/**
|
|
17
25
|
* Helper function to change the run status to that of an unseeded run with a new random seed.
|
|
18
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAMrE;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAiBpD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAInE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
|
package/dist/functions/run.lua
CHANGED
|
@@ -6,6 +6,8 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
6
6
|
local game = ____cachedClasses.game
|
|
7
7
|
local ____constantsFirstLast = require("constantsFirstLast")
|
|
8
8
|
local FIRST_CHARACTER = ____constantsFirstLast.FIRST_CHARACTER
|
|
9
|
+
local ____runInNFrames = require("features.runInNFrames")
|
|
10
|
+
local runNextRenderFrame = ____runInNFrames.runNextRenderFrame
|
|
9
11
|
local ____log = require("functions.log")
|
|
10
12
|
local log = ____log.log
|
|
11
13
|
--- Whether or not the player is playing on a set seed (i.e. that they entered in a specific seed by
|
|
@@ -36,6 +38,19 @@ function ____exports.restart(self, character)
|
|
|
36
38
|
log((((("Restarting the run as PlayerType." .. tostring(PlayerType[character])) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command)
|
|
37
39
|
Isaac.ExecuteCommand(command)
|
|
38
40
|
end
|
|
41
|
+
--- Helper function to restart on the next render frame. Useful because it is impossible to restart
|
|
42
|
+
-- the game inside of the `POST_NEW_ROOM`, `POST_NEW_LEVEL`, or `POST_GAME_STARTED` callbacks when a
|
|
43
|
+
-- run is first starting.
|
|
44
|
+
--
|
|
45
|
+
-- You can optionally specify a `PlayerType` to restart the game as that character.
|
|
46
|
+
function ____exports.restartNextRenderFrame(self, character)
|
|
47
|
+
runNextRenderFrame(
|
|
48
|
+
nil,
|
|
49
|
+
function()
|
|
50
|
+
____exports.restart(nil, character)
|
|
51
|
+
end
|
|
52
|
+
)
|
|
53
|
+
end
|
|
39
54
|
--- Helper function to change the run status to that of an unseeded run with a new random seed.
|
|
40
55
|
--
|
|
41
56
|
-- This is useful to revert the behavior where playing on a set and restarting the game will not
|
package/package.json
CHANGED
package/src/functions/run.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Challenge, PlayerType } from "isaac-typescript-definitions";
|
|
2
2
|
import { game } from "../cachedClasses";
|
|
3
3
|
import { FIRST_CHARACTER } from "../constantsFirstLast";
|
|
4
|
+
import { runNextRenderFrame } from "../features/runInNFrames";
|
|
4
5
|
import { log } from "./log";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -42,6 +43,19 @@ export function restart(character?: PlayerType): void {
|
|
|
42
43
|
Isaac.ExecuteCommand(command);
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Helper function to restart on the next render frame. Useful because it is impossible to restart
|
|
48
|
+
* the game inside of the `POST_NEW_ROOM`, `POST_NEW_LEVEL`, or `POST_GAME_STARTED` callbacks when a
|
|
49
|
+
* run is first starting.
|
|
50
|
+
*
|
|
51
|
+
* You can optionally specify a `PlayerType` to restart the game as that character.
|
|
52
|
+
*/
|
|
53
|
+
export function restartNextRenderFrame(character?: PlayerType): void {
|
|
54
|
+
runNextRenderFrame(() => {
|
|
55
|
+
restart(character);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
45
59
|
/**
|
|
46
60
|
* Helper function to change the run status to that of an unseeded run with a new random seed.
|
|
47
61
|
*
|