isaacscript-common 1.0.520 → 1.0.521

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.
@@ -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;
@@ -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()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.520",
3
+ "version": "1.0.521",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.295",
28
+ "isaac-typescript-definitions": "^1.0.296",
29
29
  "isaacscript-lint": "^1.0.71",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",