isaacscript-common 71.2.0 → 72.0.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.
- package/dist/index.rollup.d.ts +229 -96
- package/dist/isaacscript-common.lua +40 -154
- package/dist/src/classes/features/other/CustomItemPools.d.ts +7 -3
- package/dist/src/classes/features/other/CustomItemPools.d.ts.map +1 -1
- package/dist/src/classes/features/other/CustomItemPools.lua +1 -6
- package/dist/src/classes/features/other/DeployJSONRoom.d.ts +7 -3
- package/dist/src/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
- package/dist/src/classes/features/other/DeployJSONRoom.lua +1 -5
- package/dist/src/classes/features/other/ModdedElementSets.d.ts +35 -15
- package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
- package/dist/src/classes/features/other/ModdedElementSets.lua +0 -17
- package/dist/src/classes/features/other/SpawnCollectible.d.ts +14 -6
- package/dist/src/classes/features/other/SpawnCollectible.d.ts.map +1 -1
- package/dist/src/classes/features/other/SpawnCollectible.lua +0 -8
- package/dist/src/classes/features/other/SpawnRockAltRewards.d.ts +8 -4
- package/dist/src/classes/features/other/SpawnRockAltRewards.d.ts.map +1 -1
- package/dist/src/classes/features/other/SpawnRockAltRewards.lua +0 -4
- package/dist/src/classes/features/other/customStages/utils.d.ts +2 -2
- package/dist/src/classes/features/other/customStages/utils.d.ts.map +1 -1
- package/dist/src/classes/features/other/customStages/utils.lua +0 -8
- package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +2 -2
- package/dist/src/functions/array.d.ts +35 -15
- package/dist/src/functions/array.d.ts.map +1 -1
- package/dist/src/functions/array.lua +30 -26
- package/dist/src/functions/color.d.ts +8 -4
- package/dist/src/functions/color.d.ts.map +1 -1
- package/dist/src/functions/color.lua +7 -7
- package/dist/src/functions/enums.d.ts +6 -3
- package/dist/src/functions/enums.d.ts.map +1 -1
- package/dist/src/functions/enums.lua +5 -7
- package/dist/src/functions/itemPool.d.ts +8 -1
- package/dist/src/functions/itemPool.d.ts.map +1 -1
- package/dist/src/functions/itemPool.lua +9 -2
- package/dist/src/functions/jsonRoom.d.ts +13 -6
- package/dist/src/functions/jsonRoom.d.ts.map +1 -1
- package/dist/src/functions/jsonRoom.lua +11 -12
- package/dist/src/functions/kColor.d.ts +8 -4
- package/dist/src/functions/kColor.d.ts.map +1 -1
- package/dist/src/functions/kColor.lua +7 -7
- package/dist/src/functions/levelGrid.d.ts +12 -5
- package/dist/src/functions/levelGrid.d.ts.map +1 -1
- package/dist/src/functions/levelGrid.lua +10 -7
- package/dist/src/functions/nextStage.d.ts.map +1 -1
- package/dist/src/functions/nextStage.lua +4 -1
- package/dist/src/functions/random.d.ts +22 -13
- package/dist/src/functions/random.d.ts.map +1 -1
- package/dist/src/functions/random.lua +19 -20
- package/dist/src/functions/rng.d.ts +1 -1
- package/dist/src/functions/rng.lua +1 -1
- package/dist/src/functions/set.d.ts +7 -3
- package/dist/src/functions/set.d.ts.map +1 -1
- package/dist/src/functions/set.lua +6 -7
- package/dist/src/functions/spawnCollectible.d.ts +13 -5
- package/dist/src/functions/spawnCollectible.d.ts.map +1 -1
- package/dist/src/functions/spawnCollectible.lua +14 -9
- package/dist/src/functions/vector.d.ts +7 -3
- package/dist/src/functions/vector.d.ts.map +1 -1
- package/dist/src/functions/vector.lua +6 -6
- package/dist/src/functions/weighted.d.ts +18 -2
- package/dist/src/functions/weighted.d.ts.map +1 -1
- package/dist/src/functions/weighted.lua +16 -8
- package/package.json +1 -1
- package/src/classes/features/other/CustomItemPools.ts +7 -4
- package/src/classes/features/other/DeployJSONRoom.ts +9 -5
- package/src/classes/features/other/ModdedElementSets.ts +37 -16
- package/src/classes/features/other/SpawnCollectible.ts +14 -7
- package/src/classes/features/other/SpawnRockAltRewards.ts +9 -5
- package/src/classes/features/other/customStages/utils.ts +2 -3
- package/src/classes/features/other/extraConsoleCommands/commands.ts +2 -2
- package/src/functions/array.ts +36 -16
- package/src/functions/color.ts +9 -5
- package/src/functions/enums.ts +6 -4
- package/src/functions/itemPool.ts +11 -2
- package/src/functions/jsonRoom.ts +13 -7
- package/src/functions/kColor.ts +9 -5
- package/src/functions/levelGrid.ts +13 -6
- package/src/functions/nextStage.ts +6 -1
- package/src/functions/random.ts +23 -14
- package/src/functions/rng.ts +1 -1
- package/src/functions/set.ts +7 -4
- package/src/functions/spawnCollectible.ts +17 -5
- package/src/functions/vector.ts +8 -4
- package/src/functions/weighted.ts +18 -3
|
@@ -24,7 +24,6 @@ local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
|
24
24
|
local ____random = require("src.functions.random")
|
|
25
25
|
local getRandomInt = ____random.getRandomInt
|
|
26
26
|
local ____rng = require("src.functions.rng")
|
|
27
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
28
27
|
local isRNG = ____rng.isRNG
|
|
29
28
|
local newRNG = ____rng.newRNG
|
|
30
29
|
local ____types = require("src.functions.types")
|
|
@@ -127,15 +126,16 @@ function addCombinations(self, n, src, got, all)
|
|
|
127
126
|
end
|
|
128
127
|
--- Helper function to get a random index from the provided array.
|
|
129
128
|
--
|
|
129
|
+
-- If you want to get an unseeded index, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
130
|
+
-- parameter.
|
|
131
|
+
--
|
|
130
132
|
-- @param array The array to get the index from.
|
|
131
|
-
-- @param seedOrRNG
|
|
132
|
-
-- `RNG.Next` method will be called.
|
|
133
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
134
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
135
|
+
-- a random seed.
|
|
133
136
|
-- @param exceptions Optional. An array of indexes that will be skipped over when getting the random
|
|
134
137
|
-- index. Default is an empty array.
|
|
135
138
|
function ____exports.getRandomArrayIndex(self, array, seedOrRNG, exceptions)
|
|
136
|
-
if seedOrRNG == nil then
|
|
137
|
-
seedOrRNG = getRandomSeed(nil)
|
|
138
|
-
end
|
|
139
139
|
if exceptions == nil then
|
|
140
140
|
exceptions = {}
|
|
141
141
|
end
|
|
@@ -152,15 +152,16 @@ function ____exports.getRandomArrayIndex(self, array, seedOrRNG, exceptions)
|
|
|
152
152
|
end
|
|
153
153
|
--- Shuffles the provided array in-place using the Fisher-Yates algorithm.
|
|
154
154
|
--
|
|
155
|
+
-- If you want an unseeded shuffle, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
156
|
+
-- parameter.
|
|
157
|
+
--
|
|
155
158
|
-- From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
156
159
|
--
|
|
157
160
|
-- @param array The array to shuffle.
|
|
158
|
-
-- @param seedOrRNG
|
|
159
|
-
-- `RNG.Next` method will be called.
|
|
161
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
162
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
163
|
+
-- a random seed.
|
|
160
164
|
function ____exports.shuffleArrayInPlace(self, array, seedOrRNG)
|
|
161
|
-
if seedOrRNG == nil then
|
|
162
|
-
seedOrRNG = getRandomSeed(nil)
|
|
163
|
-
end
|
|
164
165
|
local currentIndex = #array
|
|
165
166
|
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
166
167
|
while currentIndex > 0 do
|
|
@@ -405,14 +406,15 @@ function ____exports.getLowestArrayElement(self, array)
|
|
|
405
406
|
end
|
|
406
407
|
--- Helper function to get a random element from the provided array.
|
|
407
408
|
--
|
|
409
|
+
-- If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
410
|
+
-- parameter.
|
|
411
|
+
--
|
|
408
412
|
-- @param array The array to get an element from.
|
|
409
|
-
-- @param seedOrRNG
|
|
410
|
-
-- `RNG.Next` method will be called.
|
|
413
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
414
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
415
|
+
-- a random seed.
|
|
411
416
|
-- @param exceptions Optional. An array of elements to skip over if selected.
|
|
412
417
|
function ____exports.getRandomArrayElement(self, array, seedOrRNG, exceptions)
|
|
413
|
-
if seedOrRNG == nil then
|
|
414
|
-
seedOrRNG = getRandomSeed(nil)
|
|
415
|
-
end
|
|
416
418
|
if exceptions == nil then
|
|
417
419
|
exceptions = {}
|
|
418
420
|
end
|
|
@@ -436,14 +438,15 @@ end
|
|
|
436
438
|
--- Helper function to get a random element from the provided array. Once the random element is
|
|
437
439
|
-- decided, it is then removed from the array (in-place).
|
|
438
440
|
--
|
|
441
|
+
-- If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
442
|
+
-- parameter.
|
|
443
|
+
--
|
|
439
444
|
-- @param array The array to get an element from.
|
|
440
|
-
-- @param seedOrRNG
|
|
441
|
-
-- `RNG.Next` method will be called.
|
|
445
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
446
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
447
|
+
-- a random seed.
|
|
442
448
|
-- @param exceptions Optional. An array of elements to skip over if selected.
|
|
443
449
|
function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exceptions)
|
|
444
|
-
if seedOrRNG == nil then
|
|
445
|
-
seedOrRNG = getRandomSeed(nil)
|
|
446
|
-
end
|
|
447
450
|
if exceptions == nil then
|
|
448
451
|
exceptions = {}
|
|
449
452
|
end
|
|
@@ -538,15 +541,16 @@ function ____exports.setAllArrayElements(self, array, value)
|
|
|
538
541
|
end
|
|
539
542
|
--- Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
|
|
540
543
|
--
|
|
544
|
+
-- If you want an unseeded shuffle, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
545
|
+
-- parameter.
|
|
546
|
+
--
|
|
541
547
|
-- From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
542
548
|
--
|
|
543
549
|
-- @param originalArray The array to shuffle.
|
|
544
|
-
-- @param seedOrRNG
|
|
545
|
-
-- `RNG.Next` method will be called.
|
|
550
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
551
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
552
|
+
-- a random seed.
|
|
546
553
|
function ____exports.shuffleArray(self, originalArray, seedOrRNG)
|
|
547
|
-
if seedOrRNG == nil then
|
|
548
|
-
seedOrRNG = getRandomSeed(nil)
|
|
549
|
-
end
|
|
550
554
|
local array = ____exports.copyArray(nil, originalArray)
|
|
551
555
|
____exports.shuffleArrayInPlace(nil, array, seedOrRNG)
|
|
552
556
|
return array
|
|
@@ -13,13 +13,17 @@ export declare function copyColor(color: Color): Color;
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function deserializeColor(color: SerializedColor): Color;
|
|
15
15
|
/**
|
|
16
|
-
* Helper function to get a random
|
|
16
|
+
* Helper function to get a random `Color` object.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* If you want to generate an unseeded object, you must explicitly pass `undefined` to the
|
|
19
|
+
* `seedOrRNG` parameter.
|
|
20
|
+
*
|
|
21
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
22
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
23
|
+
* a random seed.
|
|
20
24
|
* @param alpha Optional. The alpha value to use. Default is 1.
|
|
21
25
|
*/
|
|
22
|
-
export declare function getRandomColor(seedOrRNG
|
|
26
|
+
export declare function getRandomColor(seedOrRNG: Seed | RNG | undefined, alpha?: number): Readonly<Color>;
|
|
23
27
|
/** Helper function to check if something is an instantiated `Color` object. */
|
|
24
28
|
export declare function isColor(object: unknown): object is Color;
|
|
25
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/functions/color.ts"],"names":[],"mapp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AAC/E,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,KAAK,CAExD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,eAAe,CAM5E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,eAAe,CAW5D"}
|
|
@@ -8,7 +8,6 @@ local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
|
|
|
8
8
|
local ____random = require("src.functions.random")
|
|
9
9
|
local getRandom = ____random.getRandom
|
|
10
10
|
local ____rng = require("src.functions.rng")
|
|
11
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
12
11
|
local isRNG = ____rng.isRNG
|
|
13
12
|
local newRNG = ____rng.newRNG
|
|
14
13
|
local ____table = require("src.functions.table")
|
|
@@ -76,15 +75,16 @@ function ____exports.deserializeColor(self, color)
|
|
|
76
75
|
bo
|
|
77
76
|
)
|
|
78
77
|
end
|
|
79
|
-
--- Helper function to get a random
|
|
78
|
+
--- Helper function to get a random `Color` object.
|
|
80
79
|
--
|
|
81
|
-
--
|
|
82
|
-
-- `
|
|
80
|
+
-- If you want to generate an unseeded object, you must explicitly pass `undefined` to the
|
|
81
|
+
-- `seedOrRNG` parameter.
|
|
82
|
+
--
|
|
83
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
84
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
85
|
+
-- a random seed.
|
|
83
86
|
-- @param alpha Optional. The alpha value to use. Default is 1.
|
|
84
87
|
function ____exports.getRandomColor(self, seedOrRNG, alpha)
|
|
85
|
-
if seedOrRNG == nil then
|
|
86
|
-
seedOrRNG = getRandomSeed(nil)
|
|
87
|
-
end
|
|
88
88
|
if alpha == nil then
|
|
89
89
|
alpha = 1
|
|
90
90
|
end
|
|
@@ -97,12 +97,15 @@ export declare function getLowestEnumValue<T>(transpiledEnum: T): T[keyof T];
|
|
|
97
97
|
/**
|
|
98
98
|
* Helper function to get a random value from the provided enum.
|
|
99
99
|
*
|
|
100
|
+
* If you want an unseeded value, you must explicitly pass `undefined` to the `seedOrRNG` parameter.
|
|
101
|
+
*
|
|
100
102
|
* @param transpiledEnum The enum to get the value from.
|
|
101
|
-
* @param seedOrRNG
|
|
102
|
-
* `RNG.Next` method will be called.
|
|
103
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
104
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
105
|
+
* a random seed.
|
|
103
106
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
104
107
|
*/
|
|
105
|
-
export declare function getRandomEnumValue<T>(transpiledEnum: T, seedOrRNG
|
|
108
|
+
export declare function getRandomEnumValue<T>(transpiledEnum: T, seedOrRNG: Seed | RNG | undefined, exceptions?: Array<T[keyof T]> | ReadonlyArray<T[keyof T]>): T[keyof T];
|
|
106
109
|
/** Helper function to validate that a particular value exists inside of an enum. */
|
|
107
110
|
export declare function isEnumValue<T extends Record<string, number | string>>(value: number | string, transpiledEnum: T): value is T[keyof T];
|
|
108
111
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/functions/enums.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/functions/enums.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC9B,cAAc,EAAE,CAAC,GAChB,KAAK,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAmBzC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CACzB,cAAc,EAAE,MAAM,CAAC,MAAM,GAAG,MAA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;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,OAAO,GACtB,IAAI,CAQN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,kBAAkB,EAAE,MAAM,EAC1B,cAAc,EAAE,CAAC,GAChB,IAAI,CAsBN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAE1C,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,KACzB,IAAI,CAAG"}
|
|
@@ -9,8 +9,6 @@ local ____ReadonlySet = require("src.types.ReadonlySet")
|
|
|
9
9
|
local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
10
10
|
local ____array = require("src.functions.array")
|
|
11
11
|
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
12
|
-
local ____rng = require("src.functions.rng")
|
|
13
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
14
12
|
local ____types = require("src.functions.types")
|
|
15
13
|
local isNumber = ____types.isNumber
|
|
16
14
|
local isString = ____types.isString
|
|
@@ -164,14 +162,14 @@ function ____exports.getLowestEnumValue(self, transpiledEnum)
|
|
|
164
162
|
end
|
|
165
163
|
--- Helper function to get a random value from the provided enum.
|
|
166
164
|
--
|
|
165
|
+
-- If you want an unseeded value, you must explicitly pass `undefined` to the `seedOrRNG` parameter.
|
|
166
|
+
--
|
|
167
167
|
-- @param transpiledEnum The enum to get the value from.
|
|
168
|
-
-- @param seedOrRNG
|
|
169
|
-
-- `RNG.Next` method will be called.
|
|
168
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
169
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
170
|
+
-- a random seed.
|
|
170
171
|
-- @param exceptions Optional. An array of elements to skip over if selected.
|
|
171
172
|
function ____exports.getRandomEnumValue(self, transpiledEnum, seedOrRNG, exceptions)
|
|
172
|
-
if seedOrRNG == nil then
|
|
173
|
-
seedOrRNG = getRandomSeed(nil)
|
|
174
|
-
end
|
|
175
173
|
if exceptions == nil then
|
|
176
174
|
exceptions = {}
|
|
177
175
|
end
|
|
@@ -4,8 +4,15 @@ import { ItemPoolType } from "isaac-typescript-definitions";
|
|
|
4
4
|
* Helper function to get a random item pool. This is not as simple as getting a random value from
|
|
5
5
|
* the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
|
|
6
6
|
* Greed Mode item pools should be excluded if not playing in Greed Mode.
|
|
7
|
+
*
|
|
8
|
+
* If you want to get an unseeded item pool, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
9
|
+
* parameter.
|
|
10
|
+
*
|
|
11
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
12
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
13
|
+
* a random seed.
|
|
7
14
|
*/
|
|
8
|
-
export declare function getRandomItemPool(): ItemPoolType;
|
|
15
|
+
export declare function getRandomItemPool(seedOrRNG: Seed | RNG | undefined): ItemPoolType;
|
|
9
16
|
/**
|
|
10
17
|
* Helper function to remove one or more collectibles from all item pools.
|
|
11
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAuC5D
|
|
1
|
+
{"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAuC5D;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,YAAY,CAKd;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,YAAY,EAAE,WAAW,EAAE,GAAG,IAAI,CAM3E"}
|
|
@@ -56,9 +56,16 @@ local GREED_MODE_ITEM_POOL_TYPES = ____arrayRemove_3(__TS__SparseArraySpread(___
|
|
|
56
56
|
--- Helper function to get a random item pool. This is not as simple as getting a random value from
|
|
57
57
|
-- the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
|
|
58
58
|
-- Greed Mode item pools should be excluded if not playing in Greed Mode.
|
|
59
|
-
|
|
59
|
+
--
|
|
60
|
+
-- If you want to get an unseeded item pool, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
61
|
+
-- parameter.
|
|
62
|
+
--
|
|
63
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
64
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
65
|
+
-- a random seed.
|
|
66
|
+
function ____exports.getRandomItemPool(self, seedOrRNG)
|
|
60
67
|
local itemPoolTypes = game:IsGreedMode() and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
|
|
61
|
-
return getRandomArrayElement(nil, itemPoolTypes)
|
|
68
|
+
return getRandomArrayElement(nil, itemPoolTypes, seedOrRNG)
|
|
62
69
|
end
|
|
63
70
|
--- Helper function to remove one or more collectibles from all item pools.
|
|
64
71
|
--
|
|
@@ -36,13 +36,17 @@ export declare function getJSONRoomsOfSubType(jsonRooms: JSONRoom[] | readonly J
|
|
|
36
36
|
* properly account for each room weight using the algorithm from:
|
|
37
37
|
* https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
38
38
|
*
|
|
39
|
+
* If you want an unseeded entity, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
40
|
+
* parameter.
|
|
41
|
+
*
|
|
39
42
|
* @param jsonEntities The array of entities to randomly choose between.
|
|
40
|
-
* @param seedOrRNG
|
|
41
|
-
* `RNG.Next` method will be called.
|
|
43
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
44
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
45
|
+
* a random seed.
|
|
42
46
|
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
43
47
|
* what the function is doing. Default is false.
|
|
44
48
|
*/
|
|
45
|
-
export declare function getRandomJSONEntity(jsonEntities: JSONEntity[], seedOrRNG
|
|
49
|
+
export declare function getRandomJSONEntity(jsonEntities: JSONEntity[], seedOrRNG: Seed | RNG | undefined, verbose?: boolean): JSONEntity;
|
|
46
50
|
/**
|
|
47
51
|
* Helper function to get a random JSON room from an array of JSON rooms.
|
|
48
52
|
*
|
|
@@ -52,11 +56,14 @@ export declare function getRandomJSONEntity(jsonEntities: JSONEntity[], seedOrRN
|
|
|
52
56
|
* properly account for each room weight using the algorithm from:
|
|
53
57
|
* https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
54
58
|
*
|
|
59
|
+
* If you want an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG` parameter.
|
|
60
|
+
*
|
|
55
61
|
* @param jsonRooms The array of rooms to randomly choose between.
|
|
56
|
-
* @param seedOrRNG
|
|
57
|
-
* `RNG.Next` method will be called.
|
|
62
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
63
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
64
|
+
* a random seed.
|
|
58
65
|
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
59
66
|
* what the function is doing. Default is false.
|
|
60
67
|
*/
|
|
61
|
-
export declare function getRandomJSONRoom(jsonRooms: JSONRoom[], seedOrRNG
|
|
68
|
+
export declare function getRandomJSONRoom(jsonRooms: JSONRoom[], seedOrRNG: Seed | RNG | undefined, verbose?: boolean): JSONRoom;
|
|
62
69
|
//# sourceMappingURL=jsonRoom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonRoom.d.ts","sourceRoot":"","sources":["../../../src/functions/jsonRoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"jsonRoom.d.ts","sourceRoot":"","sources":["../../../src/functions/jsonRoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAcxE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,QAAQ,GACjB,QAAQ,CAAC,YAAY,CAAC,CAqDxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,QAAQ,EAAE,EAC3C,OAAO,EAAE,GAAG,GACX,QAAQ,GAAG,SAAS,CAoBtB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,QAAQ,EAAE,EAC3C,OAAO,EAAE,GAAG,GACX,QAAQ,EAAE,CAMZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,UAAU,EAAE,EAC1B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,EACjC,OAAO,UAAQ,GACd,UAAU,CAqBZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,QAAQ,EAAE,EACrB,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,EACjC,OAAO,UAAQ,GACd,QAAQ,CAkBV"}
|
|
@@ -19,8 +19,6 @@ local ____log = require("src.functions.log")
|
|
|
19
19
|
local log = ____log.log
|
|
20
20
|
local ____random = require("src.functions.random")
|
|
21
21
|
local getRandomFloat = ____random.getRandomFloat
|
|
22
|
-
local ____rng = require("src.functions.rng")
|
|
23
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
24
22
|
local ____utils = require("src.functions.utils")
|
|
25
23
|
local assertDefined = ____utils.assertDefined
|
|
26
24
|
function getTotalWeightOfJSONObject(self, jsonOjectArray)
|
|
@@ -145,15 +143,16 @@ end
|
|
|
145
143
|
-- properly account for each room weight using the algorithm from:
|
|
146
144
|
-- https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
147
145
|
--
|
|
146
|
+
-- If you want an unseeded entity, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
147
|
+
-- parameter.
|
|
148
|
+
--
|
|
148
149
|
-- @param jsonEntities The array of entities to randomly choose between.
|
|
149
|
-
-- @param seedOrRNG
|
|
150
|
-
-- `RNG.Next` method will be called.
|
|
150
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
151
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
152
|
+
-- a random seed.
|
|
151
153
|
-- @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
152
154
|
-- what the function is doing. Default is false.
|
|
153
155
|
function ____exports.getRandomJSONEntity(self, jsonEntities, seedOrRNG, verbose)
|
|
154
|
-
if seedOrRNG == nil then
|
|
155
|
-
seedOrRNG = getRandomSeed(nil)
|
|
156
|
-
end
|
|
157
156
|
if verbose == nil then
|
|
158
157
|
verbose = false
|
|
159
158
|
end
|
|
@@ -181,15 +180,15 @@ end
|
|
|
181
180
|
-- properly account for each room weight using the algorithm from:
|
|
182
181
|
-- https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
183
182
|
--
|
|
183
|
+
-- If you want an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG` parameter.
|
|
184
|
+
--
|
|
184
185
|
-- @param jsonRooms The array of rooms to randomly choose between.
|
|
185
|
-
-- @param seedOrRNG
|
|
186
|
-
-- `RNG.Next` method will be called.
|
|
186
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
187
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
188
|
+
-- a random seed.
|
|
187
189
|
-- @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
188
190
|
-- what the function is doing. Default is false.
|
|
189
191
|
function ____exports.getRandomJSONRoom(self, jsonRooms, seedOrRNG, verbose)
|
|
190
|
-
if seedOrRNG == nil then
|
|
191
|
-
seedOrRNG = getRandomSeed(nil)
|
|
192
|
-
end
|
|
193
192
|
if verbose == nil then
|
|
194
193
|
verbose = false
|
|
195
194
|
end
|
|
@@ -12,13 +12,17 @@ export declare function copyKColor(kColor: KColor): KColor;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function deserializeKColor(kColor: SerializedKColor): KColor;
|
|
14
14
|
/**
|
|
15
|
-
* Helper function to get a random
|
|
15
|
+
* Helper function to get a random `KColor` object (for use in fonts).
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* If you want to generate an unseeded object, you must explicitly pass `undefined` to the
|
|
18
|
+
* `seedOrRNG` parameter.
|
|
19
|
+
*
|
|
20
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
21
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
22
|
+
* a random seed.
|
|
19
23
|
* @param alpha Optional. The alpha value to use. Default is 1.
|
|
20
24
|
*/
|
|
21
|
-
export declare function getRandomKColor(seedOrRNG
|
|
25
|
+
export declare function getRandomKColor(seedOrRNG: Seed | RNG | undefined, alpha?: number): Readonly<KColor>;
|
|
22
26
|
/** Helper function to check if something is an instantiated `KColor` object. */
|
|
23
27
|
export declare function isKColor(object: unknown): object is KColor;
|
|
24
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kColor.d.ts","sourceRoot":"","sources":["../../../src/functions/kColor.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAa9E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC;CACpD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA2BlE;AAED
|
|
1
|
+
{"version":3,"file":"kColor.d.ts","sourceRoot":"","sources":["../../../src/functions/kColor.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAa9E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC;CACpD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA2BlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,EACjC,KAAK,SAAI,GACR,QAAQ,CAAC,MAAM,CAAC,CAQlB;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAQ5B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE"}
|
|
@@ -8,7 +8,6 @@ local isIsaacAPIClassOfType = ____isaacAPIClass.isIsaacAPIClassOfType
|
|
|
8
8
|
local ____random = require("src.functions.random")
|
|
9
9
|
local getRandom = ____random.getRandom
|
|
10
10
|
local ____rng = require("src.functions.rng")
|
|
11
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
12
11
|
local isRNG = ____rng.isRNG
|
|
13
12
|
local newRNG = ____rng.newRNG
|
|
14
13
|
local ____table = require("src.functions.table")
|
|
@@ -50,15 +49,16 @@ function ____exports.deserializeKColor(self, kColor)
|
|
|
50
49
|
assertDefined(nil, a, ("Failed to deserialize a " .. OBJECT_NAME) .. " object since the provided object did not have a value for: Alpha")
|
|
51
50
|
return KColor(r, g, b, a)
|
|
52
51
|
end
|
|
53
|
-
--- Helper function to get a random
|
|
52
|
+
--- Helper function to get a random `KColor` object (for use in fonts).
|
|
54
53
|
--
|
|
55
|
-
--
|
|
56
|
-
-- `
|
|
54
|
+
-- If you want to generate an unseeded object, you must explicitly pass `undefined` to the
|
|
55
|
+
-- `seedOrRNG` parameter.
|
|
56
|
+
--
|
|
57
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
58
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
59
|
+
-- a random seed.
|
|
57
60
|
-- @param alpha Optional. The alpha value to use. Default is 1.
|
|
58
61
|
function ____exports.getRandomKColor(self, seedOrRNG, alpha)
|
|
59
|
-
if seedOrRNG == nil then
|
|
60
|
-
seedOrRNG = getRandomSeed(nil)
|
|
61
|
-
end
|
|
62
62
|
if alpha == nil then
|
|
63
63
|
alpha = 1
|
|
64
64
|
end
|
|
@@ -48,15 +48,19 @@ export declare function getAllRoomGridIndexes(): readonly int[];
|
|
|
48
48
|
* some floors will not have any valid spots. If this is the case, this function will return
|
|
49
49
|
* undefined.
|
|
50
50
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
51
|
+
* If you want to get an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
52
|
+
* parameter.
|
|
53
|
+
*
|
|
54
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
55
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
56
|
+
* a random seed.
|
|
53
57
|
* @param ensureDeadEnd Optional. Whether to pick a valid dead end attached to a normal room. If
|
|
54
58
|
* false, the function will randomly pick from any valid location that would
|
|
55
59
|
* have a red door.
|
|
56
60
|
* @returns Either a tuple of adjacent room grid index, `DoorSlot`, and new room grid index, or
|
|
57
61
|
* undefined.
|
|
58
62
|
*/
|
|
59
|
-
export declare function getNewRoomCandidate(seedOrRNG
|
|
63
|
+
export declare function getNewRoomCandidate(seedOrRNG: Seed | RNG | undefined, ensureDeadEnd?: boolean): {
|
|
60
64
|
readonly adjacentRoomGridIndex: int;
|
|
61
65
|
readonly doorSlot: DoorSlot;
|
|
62
66
|
readonly newRoomGridIndex: int;
|
|
@@ -195,9 +199,12 @@ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
|
|
|
195
199
|
/**
|
|
196
200
|
* Helper function to generate a new room on the floor.
|
|
197
201
|
*
|
|
202
|
+
* If you want to generate an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
203
|
+
* parameter.
|
|
204
|
+
*
|
|
198
205
|
* Under the hood, this function uses the `Level.MakeRedRoomDoor` method to create the room.
|
|
199
206
|
*
|
|
200
|
-
* @param seedOrRNG
|
|
207
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
201
208
|
* `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
202
209
|
* Note that the RNG is only used to select the random location to put the room on
|
|
203
210
|
* the floor; it does not influence the randomly chosen room contents. (That is
|
|
@@ -211,7 +218,7 @@ export declare function isRoomInsideGrid(roomGridIndex?: int): boolean;
|
|
|
211
218
|
* @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
212
219
|
* place a room.
|
|
213
220
|
*/
|
|
214
|
-
export declare function newRoom(seedOrRNG
|
|
221
|
+
export declare function newRoom(seedOrRNG: Seed | RNG | undefined, ensureDeadEnd?: boolean, customRoomData?: RoomConfig): int | undefined;
|
|
215
222
|
/**
|
|
216
223
|
* Helper function to check if a room exists at the given room grid index. (A room will exist if it
|
|
217
224
|
* has non-undefined data in the room descriptor.)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../../src/functions/levelGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAIL,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAoCtC;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,aAAa,CAAC,EAAE,GAAG,GAClB,SAAS,GAAG,EAAE,CAKhB;AAED;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,aAAa,CAAC,EAAE,GAAG,GAClB,SAAS,GAAG,EAAE,CAKhB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CACxC,aAA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G,GAAG,OAAO,CAKtD;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAGT;AAED,wBAAgB,oCAAoC,CAClD,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,GACjB,OAAO,CAqBT;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAGxD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAM7D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CACrB,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,EACjC,aAAa,UAAO,EACpB,cAAc,CAAC,EAAE,UAAU,GAC1B,GAAG,GAAG,SAAS,CAuDjB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAGtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,CAK1E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAE7D"}
|
|
@@ -31,7 +31,6 @@ local removeFlag = ____flag.removeFlag
|
|
|
31
31
|
local ____map = require("src.functions.map")
|
|
32
32
|
local copyMap = ____map.copyMap
|
|
33
33
|
local ____rng = require("src.functions.rng")
|
|
34
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
35
34
|
local isRNG = ____rng.isRNG
|
|
36
35
|
local newRNG = ____rng.newRNG
|
|
37
36
|
local ____roomData = require("src.functions.roomData")
|
|
@@ -293,17 +292,18 @@ end
|
|
|
293
292
|
-- some floors will not have any valid spots. If this is the case, this function will return
|
|
294
293
|
-- undefined.
|
|
295
294
|
--
|
|
296
|
-
--
|
|
297
|
-
--
|
|
295
|
+
-- If you want to get an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
296
|
+
-- parameter.
|
|
297
|
+
--
|
|
298
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
299
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
300
|
+
-- a random seed.
|
|
298
301
|
-- @param ensureDeadEnd Optional. Whether to pick a valid dead end attached to a normal room. If
|
|
299
302
|
-- false, the function will randomly pick from any valid location that would
|
|
300
303
|
-- have a red door.
|
|
301
304
|
-- @returns Either a tuple of adjacent room grid index, `DoorSlot`, and new room grid index, or
|
|
302
305
|
-- undefined.
|
|
303
306
|
function ____exports.getNewRoomCandidate(self, seedOrRNG, ensureDeadEnd)
|
|
304
|
-
if seedOrRNG == nil then
|
|
305
|
-
seedOrRNG = getRandomSeed(nil)
|
|
306
|
-
end
|
|
307
307
|
if ensureDeadEnd == nil then
|
|
308
308
|
ensureDeadEnd = true
|
|
309
309
|
end
|
|
@@ -391,9 +391,12 @@ function ____exports.isDoorSlotValidAtGridIndexForRedRoom(self, doorSlot, roomGr
|
|
|
391
391
|
end
|
|
392
392
|
--- Helper function to generate a new room on the floor.
|
|
393
393
|
--
|
|
394
|
+
-- If you want to generate an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
395
|
+
-- parameter.
|
|
396
|
+
--
|
|
394
397
|
-- Under the hood, this function uses the `Level.MakeRedRoomDoor` method to create the room.
|
|
395
398
|
--
|
|
396
|
-
-- @param seedOrRNG
|
|
399
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
397
400
|
-- `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
398
401
|
-- Note that the RNG is only used to select the random location to put the room on
|
|
399
402
|
-- the floor; it does not influence the randomly chosen room contents. (That is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextStage.d.ts","sourceRoot":"","sources":["../../../src/functions/nextStage.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"nextStage.d.ts","sourceRoot":"","sources":["../../../src/functions/nextStage.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAWtC;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,UAAU,CA4FzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,UAAQ,GAAG,SAAS,CAiF3D"}
|
|
@@ -2,10 +2,13 @@ local ____exports = {}
|
|
|
2
2
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
3
|
local GameStateFlag = ____isaac_2Dtypescript_2Ddefinitions.GameStateFlag
|
|
4
4
|
local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
|
|
5
|
+
local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
|
|
5
6
|
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
|
|
6
7
|
local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
|
|
7
8
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
8
9
|
local game = ____cachedClasses.game
|
|
10
|
+
local ____curses = require("src.functions.curses")
|
|
11
|
+
local hasCurse = ____curses.hasCurse
|
|
9
12
|
local ____roomData = require("src.functions.roomData")
|
|
10
13
|
local getRoomGridIndex = ____roomData.getRoomGridIndex
|
|
11
14
|
local ____stage = require("src.functions.stage")
|
|
@@ -51,7 +54,7 @@ function ____exports.getNextStage(self)
|
|
|
51
54
|
if repentanceStage then
|
|
52
55
|
return asNumber(nil, stage) + 1
|
|
53
56
|
end
|
|
54
|
-
if stage == LevelStage.DEPTHS_2 then
|
|
57
|
+
if stage == LevelStage.DEPTHS_2 or stage == LevelStage.DEPTHS_1 and hasCurse(nil, LevelCurse.LABYRINTH) then
|
|
55
58
|
return LevelStage.DEPTHS_2
|
|
56
59
|
end
|
|
57
60
|
return stage
|