isaacscript-common 1.2.180 → 1.2.183
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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function postRender(): void;
|
|
2
|
+
/**
|
|
3
|
+
* Enables the fast-reset feature, which allows you to restart the game instantaneously.
|
|
4
|
+
*
|
|
5
|
+
* This is useful for debugging, when you are resetting the game often.
|
|
6
|
+
*
|
|
7
|
+
* You can disable the fast-reset feature with the `disableFastReset` function.
|
|
8
|
+
*/
|
|
9
|
+
export declare function enableFastReset(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Disables the fast-reset feature. Only useful if you have previously called the `enableFastReset`
|
|
12
|
+
* function.
|
|
13
|
+
*/
|
|
14
|
+
export declare function disableFastReset(): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local checkResetInput, enabled
|
|
4
|
+
local ____cachedClasses = require("cachedClasses")
|
|
5
|
+
local game = ____cachedClasses.game
|
|
6
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
7
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
8
|
+
local ____input = require("functions.input")
|
|
9
|
+
local isActionTriggeredOnAnyInput = ____input.isActionTriggeredOnAnyInput
|
|
10
|
+
local isKeyboardPressed = ____input.isKeyboardPressed
|
|
11
|
+
local ____run = require("functions.run")
|
|
12
|
+
local restart = ____run.restart
|
|
13
|
+
function ____exports.postRender(self)
|
|
14
|
+
if not enabled then
|
|
15
|
+
return
|
|
16
|
+
end
|
|
17
|
+
checkResetInput(nil)
|
|
18
|
+
end
|
|
19
|
+
function checkResetInput(self)
|
|
20
|
+
local isPaused = game:IsPaused()
|
|
21
|
+
if isPaused then
|
|
22
|
+
return
|
|
23
|
+
end
|
|
24
|
+
if AwaitingTextInput then
|
|
25
|
+
return
|
|
26
|
+
end
|
|
27
|
+
if isKeyboardPressed(nil, Keyboard.KEY_LEFT_SHIFT) or isKeyboardPressed(nil, Keyboard.KEY_LEFT_CONTROL) or isKeyboardPressed(nil, Keyboard.KEY_LEFT_ALT) or isKeyboardPressed(nil, Keyboard.KEY_LEFT_SUPER) or isKeyboardPressed(nil, Keyboard.KEY_RIGHT_SHIFT) or isKeyboardPressed(nil, Keyboard.KEY_RIGHT_CONTROL) or isKeyboardPressed(nil, Keyboard.KEY_RIGHT_ALT) or isKeyboardPressed(nil, Keyboard.KEY_RIGHT_SUPER) then
|
|
28
|
+
return
|
|
29
|
+
end
|
|
30
|
+
if isActionTriggeredOnAnyInput(nil, ButtonAction.ACTION_RESTART) then
|
|
31
|
+
restart(nil)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
local FEATURE_NAME = "fast reset"
|
|
35
|
+
enabled = false
|
|
36
|
+
function ____exports.fastResetInit(self, mod)
|
|
37
|
+
mod:AddCallback(ModCallbacks.MC_POST_RENDER, ____exports.postRender)
|
|
38
|
+
end
|
|
39
|
+
function ____exports.enableFastReset(self)
|
|
40
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
41
|
+
enabled = true
|
|
42
|
+
end
|
|
43
|
+
function ____exports.disableFastReset(self)
|
|
44
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
45
|
+
enabled = false
|
|
46
|
+
end
|
|
47
|
+
return ____exports
|
|
@@ -12,8 +12,6 @@ local ____SerializationType = require("enums.SerializationType")
|
|
|
12
12
|
local SerializationType = ____SerializationType.SerializationType
|
|
13
13
|
local ____deepCopy = require("functions.deepCopy")
|
|
14
14
|
local deepCopy = ____deepCopy.deepCopy
|
|
15
|
-
local ____log = require("functions.log")
|
|
16
|
-
local log = ____log.log
|
|
17
15
|
local ____table = require("functions.table")
|
|
18
16
|
local clearTable = ____table.clearTable
|
|
19
17
|
local ____constants = require("features.saveDataManager.constants")
|
|
@@ -64,7 +62,6 @@ function restoreDefaults(self, childTableName)
|
|
|
64
62
|
if childTableName ~= SaveDataKeys.Run and childTableName ~= SaveDataKeys.Level and childTableName ~= SaveDataKeys.Room then
|
|
65
63
|
error("Unknown child table name of: " .. childTableName)
|
|
66
64
|
end
|
|
67
|
-
log("Resetting data for type: " .. childTableName)
|
|
68
65
|
for subscriberName, saveData in pairs(saveDataMap) do
|
|
69
66
|
do
|
|
70
67
|
local childTable = saveData[childTableName]
|