isaacscript-common 1.0.519 → 1.0.523
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/callbacks/postKnifeInitLate.d.ts +1 -2
- package/dist/callbacks/subscriptions/postKnifeInitLate.d.ts +0 -3
- package/dist/functions/array.lua +3 -0
- package/dist/functions/stage.d.ts +9 -0
- package/dist/functions/stage.lua +54 -0
- package/dist/patchErrorFunctions.lua +19 -9
- package/package.json +3 -3
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function postKnifeInitLateCallbackInit(mod: Mod): void;
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare type PostKnifeInitLateCallbackType = (knife: EntityKnife) => void;
|
|
3
|
-
export declare function postKnifeInitLateHasSubscriptions(): boolean;
|
|
4
|
-
export declare function postKnifeInitLateRegister(callback: PostKnifeInitLateCallbackType, knifeVariant?: KnifeVariant | int): void;
|
|
5
|
-
export declare function postKnifeInitLateFire(knife: EntityKnife): void;
|
package/dist/functions/array.lua
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare function getEffectiveStage(): int;
|
|
3
|
+
/** Helper function to directly warp to a specific stage using the "stage" console command. */
|
|
4
|
+
export declare function goToStage(stage: LevelStage, stageType: StageType): void;
|
|
3
5
|
export declare function onCathedral(): boolean;
|
|
4
6
|
export declare function onChest(): boolean;
|
|
5
7
|
export declare function onDarkRoom(): boolean;
|
|
@@ -14,3 +16,10 @@ export declare function onDarkRoom(): boolean;
|
|
|
14
16
|
export declare function onFinalFloor(): boolean;
|
|
15
17
|
export declare function onRepentanceStage(): boolean;
|
|
16
18
|
export declare function onSheol(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Helper function to convert a numerical `StageType` into the letter suffix supplied to the "stage"
|
|
21
|
+
* console command. For example, `StageType.STAGETYPE_REPENTANCE` is the stage type for Downpour,
|
|
22
|
+
* and the console command to go to Downpour is "stage 1c", so this function converts
|
|
23
|
+
* `StageType.STAGETYPE_REPENTANCE` to "c".
|
|
24
|
+
*/
|
|
25
|
+
export declare function stageTypeToLetter(stageType: StageType): string;
|
package/dist/functions/stage.lua
CHANGED
|
@@ -1,11 +1,60 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
+
local ____util = require("functions.util")
|
|
4
|
+
local ensureAllCases = ____util.ensureAllCases
|
|
3
5
|
function ____exports.onRepentanceStage(self)
|
|
4
6
|
local game = Game()
|
|
5
7
|
local level = game:GetLevel()
|
|
6
8
|
local stageType = level:GetStageType()
|
|
7
9
|
return (stageType == StageType.STAGETYPE_REPENTANCE) or (stageType == StageType.STAGETYPE_REPENTANCE_B)
|
|
8
10
|
end
|
|
11
|
+
function ____exports.stageTypeToLetter(self, stageType)
|
|
12
|
+
repeat
|
|
13
|
+
local ____switch12 = stageType
|
|
14
|
+
local ____cond12 = ____switch12 == StageType.STAGETYPE_ORIGINAL
|
|
15
|
+
if ____cond12 then
|
|
16
|
+
do
|
|
17
|
+
return ""
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_WOTL)
|
|
21
|
+
if ____cond12 then
|
|
22
|
+
do
|
|
23
|
+
return "a"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_AFTERBIRTH)
|
|
27
|
+
if ____cond12 then
|
|
28
|
+
do
|
|
29
|
+
return "b"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_GREEDMODE)
|
|
33
|
+
if ____cond12 then
|
|
34
|
+
do
|
|
35
|
+
return ""
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_REPENTANCE)
|
|
39
|
+
if ____cond12 then
|
|
40
|
+
do
|
|
41
|
+
return "c"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_REPENTANCE_B)
|
|
45
|
+
if ____cond12 then
|
|
46
|
+
do
|
|
47
|
+
return "d"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
do
|
|
51
|
+
do
|
|
52
|
+
ensureAllCases(nil, stageType)
|
|
53
|
+
return ""
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
until true
|
|
57
|
+
end
|
|
9
58
|
function ____exports.getEffectiveStage(self)
|
|
10
59
|
local game = Game()
|
|
11
60
|
local level = game:GetLevel()
|
|
@@ -15,6 +64,11 @@ function ____exports.getEffectiveStage(self)
|
|
|
15
64
|
end
|
|
16
65
|
return stage
|
|
17
66
|
end
|
|
67
|
+
function ____exports.goToStage(self, stage, stageType)
|
|
68
|
+
local stageTypeLetterSuffix = ____exports.stageTypeToLetter(nil, stageType)
|
|
69
|
+
local command = ("stage " .. tostring(stage)) .. stageTypeLetterSuffix
|
|
70
|
+
Isaac.ExecuteCommand(command)
|
|
71
|
+
end
|
|
18
72
|
function ____exports.onCathedral(self)
|
|
19
73
|
local game = Game()
|
|
20
74
|
local level = game:GetLevel()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
local errorWithTraceback, slimTracebackOutput, vanillaError
|
|
4
|
+
local errorWithTraceback, slimTracebackOutput, removeAnyLineThatContains, LINE_SEPARATOR, USELESS_TRACEBACK_MESSAGES, vanillaError
|
|
5
5
|
local ____debug = require("functions.debug")
|
|
6
6
|
local getTraceback = ____debug.getTraceback
|
|
7
7
|
local ____util = require("functions.util")
|
|
@@ -19,17 +19,27 @@ function errorWithTraceback(message, level)
|
|
|
19
19
|
return vanillaError(message, level + 1)
|
|
20
20
|
end
|
|
21
21
|
function slimTracebackOutput(self, tracebackOutput)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if __TS__StringIncludes(lines[2], "in upvalue 'getTraceback'") or __TS__StringIncludes(lines[2], "in function 'sandboxGetTraceback'") then
|
|
25
|
-
__TS__ArraySplice(lines, 1, 1)
|
|
22
|
+
for ____, msg in ipairs(USELESS_TRACEBACK_MESSAGES) do
|
|
23
|
+
tracebackOutput = removeAnyLineThatContains(nil, tracebackOutput, msg)
|
|
26
24
|
end
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
return tracebackOutput
|
|
26
|
+
end
|
|
27
|
+
function removeAnyLineThatContains(self, msg, containsMsg)
|
|
28
|
+
local lines = __TS__StringSplit(msg, LINE_SEPARATOR)
|
|
29
|
+
do
|
|
30
|
+
local i = 0
|
|
31
|
+
while i < #lines do
|
|
32
|
+
local line = lines[i + 1]
|
|
33
|
+
if __TS__StringIncludes(line, containsMsg) then
|
|
34
|
+
__TS__ArraySplice(lines, i, 1)
|
|
35
|
+
end
|
|
36
|
+
i = i + 1
|
|
37
|
+
end
|
|
29
38
|
end
|
|
30
|
-
|
|
31
|
-
return slimmedTracebackOutput
|
|
39
|
+
return table.concat(lines, LINE_SEPARATOR or ",")
|
|
32
40
|
end
|
|
41
|
+
LINE_SEPARATOR = "\n"
|
|
42
|
+
USELESS_TRACEBACK_MESSAGES = {"in upvalue 'getTraceback'", "in function 'sandboxGetTraceback'", "in function 'error'"}
|
|
33
43
|
function ____exports.patchErrorFunction(self)
|
|
34
44
|
if not isLuaDebugEnabled(nil) then
|
|
35
45
|
return
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.523",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
29
|
-
"isaacscript-lint": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.296",
|
|
29
|
+
"isaacscript-lint": "^1.0.72",
|
|
30
30
|
"typedoc": "^0.22.10",
|
|
31
31
|
"typescript": "4.4.4",
|
|
32
32
|
"typescript-to-lua": "1.1.1"
|