isaacscript-common 1.0.525 → 1.0.529

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,2 @@
1
+ /** Helper function to get the seed of the current run. */
2
+ export declare function getStartSeedString(): string;
@@ -0,0 +1,8 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ function ____exports.getStartSeedString(self)
4
+ local game = Game()
5
+ local seeds = game:GetSeeds()
6
+ return seeds:GetStartSeedString()
7
+ end
8
+ return ____exports
@@ -1,5 +1,14 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Helper function to account for Repentance floors being offset by 1. For example, Downpour 2 is
4
+ * the third level of the run, but the game considers it to have a stage of 2. This function will
5
+ * consider Downpour 2 to have a stage of 3.
6
+ */
2
7
  export declare function getEffectiveStage(): int;
8
+ /** Helper function to get the current stage. */
9
+ export declare function getStage(): LevelStage;
10
+ /** Helper function to get the current stage type. */
11
+ export declare function getStageType(): StageType;
3
12
  /** Helper function to directly warp to a specific stage using the "stage" console command. */
4
13
  export declare function goToStage(stage: LevelStage, stageType: StageType): void;
5
14
  export declare function onCathedral(): boolean;
@@ -10,39 +10,39 @@ function ____exports.onRepentanceStage(self)
10
10
  end
11
11
  function ____exports.stageTypeToLetter(self, stageType)
12
12
  repeat
13
- local ____switch12 = stageType
14
- local ____cond12 = ____switch12 == StageType.STAGETYPE_ORIGINAL
15
- if ____cond12 then
13
+ local ____switch14 = stageType
14
+ local ____cond14 = ____switch14 == StageType.STAGETYPE_ORIGINAL
15
+ if ____cond14 then
16
16
  do
17
17
  return ""
18
18
  end
19
19
  end
20
- ____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_WOTL)
21
- if ____cond12 then
20
+ ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_WOTL)
21
+ if ____cond14 then
22
22
  do
23
23
  return "a"
24
24
  end
25
25
  end
26
- ____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_AFTERBIRTH)
27
- if ____cond12 then
26
+ ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_AFTERBIRTH)
27
+ if ____cond14 then
28
28
  do
29
29
  return "b"
30
30
  end
31
31
  end
32
- ____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_GREEDMODE)
33
- if ____cond12 then
32
+ ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_GREEDMODE)
33
+ if ____cond14 then
34
34
  do
35
35
  return ""
36
36
  end
37
37
  end
38
- ____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_REPENTANCE)
39
- if ____cond12 then
38
+ ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_REPENTANCE)
39
+ if ____cond14 then
40
40
  do
41
41
  return "c"
42
42
  end
43
43
  end
44
- ____cond12 = ____cond12 or (____switch12 == StageType.STAGETYPE_REPENTANCE_B)
45
- if ____cond12 then
44
+ ____cond14 = ____cond14 or (____switch14 == StageType.STAGETYPE_REPENTANCE_B)
45
+ if ____cond14 then
46
46
  do
47
47
  return "d"
48
48
  end
@@ -64,6 +64,16 @@ function ____exports.getEffectiveStage(self)
64
64
  end
65
65
  return stage
66
66
  end
67
+ function ____exports.getStage(self)
68
+ local game = Game()
69
+ local level = game:GetLevel()
70
+ return level:GetStage()
71
+ end
72
+ function ____exports.getStageType(self)
73
+ local game = Game()
74
+ local level = game:GetLevel()
75
+ return level:GetStageType()
76
+ end
67
77
  function ____exports.goToStage(self, stage, stageType)
68
78
  local stageTypeLetterSuffix = ____exports.stageTypeToLetter(nil, stageType)
69
79
  local command = ("stage " .. tostring(stage)) .. stageTypeLetterSuffix
@@ -1,8 +1,13 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /// <reference types="typescript-to-lua/language-extensions" />
3
3
  /**
4
- * Using a Set constructor to copy a Set does not seem to work properly, so this helper function is
5
- * used instead.
4
+ * Using a Map constructor to copy a Map does not seem to work properly, so use this helper function
5
+ * instead.
6
+ */
7
+ export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
8
+ /**
9
+ * Using a Set constructor to copy a Set does not seem to work properly, so use this helper function
10
+ * instead.
6
11
  */
7
12
  export declare function copySet<T>(oldSet: Set<T>): Set<T>;
8
13
  /**
@@ -2,6 +2,19 @@
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local HEX_STRING_LENGTH = 6
5
+ function ____exports.copyMap(self, oldMap)
6
+ local newMap = __TS__New(Map)
7
+ for ____, ____value in __TS__Iterator(
8
+ oldMap:entries()
9
+ ) do
10
+ local key
11
+ key = ____value[1]
12
+ local value
13
+ value = ____value[2]
14
+ newMap:set(key, value)
15
+ end
16
+ return newMap
17
+ end
5
18
  function ____exports.copySet(self, oldSet)
6
19
  local newSet = __TS__New(Set)
7
20
  for ____, value in __TS__Iterator(
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export * from "./functions/position";
38
38
  export * from "./functions/random";
39
39
  export * from "./functions/revive";
40
40
  export * from "./functions/rooms";
41
+ export * from "./functions/seeds";
41
42
  export * from "./functions/spawnCollectible";
42
43
  export * from "./functions/sprite";
43
44
  export * from "./functions/stage";
package/dist/index.lua CHANGED
@@ -310,6 +310,14 @@ do
310
310
  end
311
311
  end
312
312
  end
313
+ do
314
+ local ____export = require("functions.seeds")
315
+ for ____exportKey, ____exportValue in pairs(____export) do
316
+ if ____exportKey ~= "default" then
317
+ ____exports[____exportKey] = ____exportValue
318
+ end
319
+ end
320
+ end
313
321
  do
314
322
  local ____export = require("functions.spawnCollectible")
315
323
  for ____exportKey, ____exportValue in pairs(____export) do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.525",
3
+ "version": "1.0.529",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",