isaacscript-common 1.2.182 → 1.2.185

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
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/dep
16
16
  export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, disableShootingInputs, enableAllInputs, enableAllInputsExceptFor, } from "./features/disableInputs";
17
17
  export { disableAllSound, enableAllSound } from "./features/disableSound";
18
18
  export { addConsoleCommand, enableExtraConsoleCommands, removeConsoleCommand, } from "./features/extraConsoleCommands/init";
19
+ export { disableFastReset, enableFastReset } from "./features/fastReset";
19
20
  export { forgottenSwitch } from "./features/forgottenSwitch";
20
21
  export { getCollectibleItemPoolType } from "./features/getCollectibleItemPoolType";
21
22
  export * from "./features/isPonyActive";
package/dist/index.lua CHANGED
@@ -150,6 +150,13 @@ do
150
150
  ____exports.enableExtraConsoleCommands = enableExtraConsoleCommands
151
151
  ____exports.removeConsoleCommand = removeConsoleCommand
152
152
  end
153
+ do
154
+ local ____fastReset = require("features.fastReset")
155
+ local disableFastReset = ____fastReset.disableFastReset
156
+ local enableFastReset = ____fastReset.enableFastReset
157
+ ____exports.disableFastReset = disableFastReset
158
+ ____exports.enableFastReset = enableFastReset
159
+ end
153
160
  do
154
161
  local ____forgottenSwitch = require("features.forgottenSwitch")
155
162
  local forgottenSwitch = ____forgottenSwitch.forgottenSwitch
@@ -84,6 +84,8 @@ local ____disableInputs = require("features.disableInputs")
84
84
  local disableInputsInit = ____disableInputs.disableInputsInit
85
85
  local ____disableSound = require("features.disableSound")
86
86
  local disableSoundsInit = ____disableSound.disableSoundsInit
87
+ local ____fastReset = require("features.fastReset")
88
+ local fastResetInit = ____fastReset.fastResetInit
87
89
  local ____forgottenSwitch = require("features.forgottenSwitch")
88
90
  local forgottenSwitchInit = ____forgottenSwitch.forgottenSwitchInit
89
91
  local ____getCollectibleItemPoolType = require("features.getCollectibleItemPoolType")
@@ -157,6 +159,7 @@ function initFeatures(self, mod)
157
159
  isPonyActiveInit(nil, mod)
158
160
  playerInventoryInit(nil, mod)
159
161
  taintedLazarusPlayersInit(nil, mod)
162
+ fastResetInit(nil, mod)
160
163
  end
161
164
  function ____exports.upgradeMod(self, modVanilla, verbose)
162
165
  if verbose == nil then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.182",
3
+ "version": "1.2.185",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",