isaacscript-common 4.4.0 → 4.5.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.
@@ -36,6 +36,16 @@ export declare function onDarkRoom(): boolean;
36
36
  export declare function onFinalFloor(): boolean;
37
37
  export declare function onRepentanceStage(): boolean;
38
38
  export declare function onSheol(): boolean;
39
+ /**
40
+ * Helper function to warp to a new stage/level.
41
+ *
42
+ * @param stage The stage number to warp to.
43
+ * @param stageType The stage type to warp to.
44
+ * @param reseed Optional. Whether or not to reseed the floor upon arrival. Default is false. Set
45
+ * this to true if you are warping to the same stage but a different stage type (or
46
+ * else the floor layout will be identical to the old floor).
47
+ */
48
+ export declare function setStage(stage: LevelStage, stageType: StageType, reseed?: boolean): void;
39
49
  /**
40
50
  * Helper function to convert a numerical `StageType` into the letter suffix supplied to the "stage"
41
51
  * console command. For example, `StageType.REPENTANCE` is the stage type for Downpour, and the
@@ -4,6 +4,8 @@ local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
4
4
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
5
5
  local ____cachedClasses = require("cachedClasses")
6
6
  local game = ____cachedClasses.game
7
+ local ____stageTypeSuffixes = require("objects.stageTypeSuffixes")
8
+ local STAGE_TYPE_SUFFIXES = ____stageTypeSuffixes.STAGE_TYPE_SUFFIXES
7
9
  local ____stageTypeToLetter = require("objects.stageTypeToLetter")
8
10
  local STAGE_TYPE_TO_LETTER = ____stageTypeToLetter.STAGE_TYPE_TO_LETTER
9
11
  function ____exports.isRepentanceStage(self, stageType)
@@ -111,4 +113,22 @@ function ____exports.onSheol(self)
111
113
  local stageType = level:GetStageType()
112
114
  return stage == LevelStage.SHEOL_CATHEDRAL and stageType == StageType.ORIGINAL
113
115
  end
116
+ --- Helper function to warp to a new stage/level.
117
+ --
118
+ -- @param stage The stage number to warp to.
119
+ -- @param stageType The stage type to warp to.
120
+ -- @param reseed Optional. Whether or not to reseed the floor upon arrival. Default is false. Set
121
+ -- this to true if you are warping to the same stage but a different stage type (or
122
+ -- else the floor layout will be identical to the old floor).
123
+ function ____exports.setStage(self, stage, stageType, reseed)
124
+ if reseed == nil then
125
+ reseed = false
126
+ end
127
+ local stageTypeSuffix = STAGE_TYPE_SUFFIXES[stageType]
128
+ local command = ("stage " .. tostring(stage)) .. stageTypeSuffix
129
+ Isaac.ExecuteCommand(command)
130
+ if reseed then
131
+ Isaac.ExecuteCommand("reseed")
132
+ end
133
+ end
114
134
  return ____exports
@@ -0,0 +1,4 @@
1
+ import { StageType } from "isaac-typescript-definitions";
2
+ export declare const STAGE_TYPE_SUFFIXES: {
3
+ readonly [key in StageType]: string;
4
+ };
@@ -0,0 +1,12 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
4
+ ____exports.STAGE_TYPE_SUFFIXES = {
5
+ [StageType.ORIGINAL] = "",
6
+ [StageType.WRATH_OF_THE_LAMB] = "a",
7
+ [StageType.AFTERBIRTH] = "b",
8
+ [StageType.GREED_MODE] = "",
9
+ [StageType.REPENTANCE] = "c",
10
+ [StageType.REPENTANCE_B] = "d"
11
+ }
12
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",