isaacscript-common 71.2.1 → 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 +10 -127
- 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/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/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
|
@@ -25,12 +25,16 @@ export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: A
|
|
|
25
25
|
/**
|
|
26
26
|
* Helper function to get a random element from the provided set.
|
|
27
27
|
*
|
|
28
|
+
* If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
29
|
+
* parameter.
|
|
30
|
+
*
|
|
28
31
|
* @param set The set to get an element from.
|
|
29
|
-
* @param seedOrRNG
|
|
30
|
-
* `RNG.Next` method will be called.
|
|
32
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
33
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
34
|
+
* a random seed.
|
|
31
35
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
32
36
|
*/
|
|
33
|
-
export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, seedOrRNG
|
|
37
|
+
export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, seedOrRNG: Seed | RNG | undefined, exceptions?: T[] | readonly T[]): T;
|
|
34
38
|
/**
|
|
35
39
|
* Helper function to get all possible combinations of the given set. This includes the combination
|
|
36
40
|
* of an empty set.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/functions/set.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/functions/set.ts"],"names":[],"mappings":";;AAIA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC3C,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GACtC,GAAG,CAAC,CAAC,CAAC,CASR;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAOlE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,EACf,GAAG,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC9C,IAAI,CAMN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,EACjC,UAAU,GAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAO,GAClC,CAAC,CAGH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,iBAAiB,EAAE,OAAO,GACzB,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAK/B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAkBvE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,EAAE,GAAG,IAAI,CAI7D;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACtB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAC5B,GAAG,QAAQ,EAAE,CAAC,EAAE,GACf,OAAO,CAET;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAGrE"}
|
|
@@ -13,8 +13,6 @@ local ____array = require("src.functions.array")
|
|
|
13
13
|
local getArrayCombinations = ____array.getArrayCombinations
|
|
14
14
|
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
15
15
|
local sumArray = ____array.sumArray
|
|
16
|
-
local ____rng = require("src.functions.rng")
|
|
17
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
18
16
|
local ____types = require("src.functions.types")
|
|
19
17
|
local isPrimitive = ____types.isPrimitive
|
|
20
18
|
--- Helper function to get a sorted array based on the contents of a set.
|
|
@@ -81,14 +79,15 @@ function ____exports.deleteSetsFromSet(self, mainSet, ...)
|
|
|
81
79
|
end
|
|
82
80
|
--- Helper function to get a random element from the provided set.
|
|
83
81
|
--
|
|
82
|
+
-- If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
83
|
+
-- parameter.
|
|
84
|
+
--
|
|
84
85
|
-- @param set The set to get an element from.
|
|
85
|
-
-- @param seedOrRNG
|
|
86
|
-
-- `RNG.Next` method will be called.
|
|
86
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
87
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
88
|
+
-- a random seed.
|
|
87
89
|
-- @param exceptions Optional. An array of elements to skip over if selected.
|
|
88
90
|
function ____exports.getRandomSetElement(self, set, seedOrRNG, exceptions)
|
|
89
|
-
if seedOrRNG == nil then
|
|
90
|
-
seedOrRNG = getRandomSeed(nil)
|
|
91
|
-
end
|
|
92
91
|
if exceptions == nil then
|
|
93
92
|
exceptions = {}
|
|
94
93
|
end
|
|
@@ -9,17 +9,21 @@ import { CollectibleType } from "isaac-typescript-definitions";
|
|
|
9
9
|
* Isaac's rotation mechanic. To handle that, use the `spawnCollectible` helper function instead
|
|
10
10
|
* (which is provided by `ISCFeature.SPAWN_COLLECTIBLE`).
|
|
11
11
|
*
|
|
12
|
+
* If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
13
|
+
* `seedOrRNG` parameter.
|
|
14
|
+
*
|
|
12
15
|
* @param collectibleType The collectible type to spawn.
|
|
13
16
|
* @param positionOrGridIndex The position or grid index to spawn the collectible at.
|
|
14
|
-
* @param seedOrRNG
|
|
15
|
-
* `RNG.Next` method will be called.
|
|
17
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
18
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
19
|
+
* a random seed.
|
|
16
20
|
* @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
17
21
|
* collectible. Default is false.
|
|
18
22
|
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
19
23
|
* Tainted Keeper. Default is false.
|
|
20
24
|
* @param spawner Optional.
|
|
21
25
|
*/
|
|
22
|
-
export declare function spawnCollectibleUnsafe(collectibleType: CollectibleType, positionOrGridIndex: Vector | int, seedOrRNG
|
|
26
|
+
export declare function spawnCollectibleUnsafe(collectibleType: CollectibleType, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG | undefined, options?: boolean, forceFreeItem?: boolean, spawner?: Entity): EntityPickupCollectible;
|
|
23
27
|
/**
|
|
24
28
|
* Helper function to spawn an empty collectible. Doing this is tricky since spawning a collectible
|
|
25
29
|
* with `CollectibleType.NULL` will result in spawning a collectible with a random type from the
|
|
@@ -30,9 +34,13 @@ export declare function spawnCollectibleUnsafe(collectibleType: CollectibleType,
|
|
|
30
34
|
* Onion because it is a quest collectible and quest collectibles will prevent Damocles from
|
|
31
35
|
* duplicating the pedestal.)
|
|
32
36
|
*
|
|
37
|
+
* If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
38
|
+
* `seedOrRNG` parameter.
|
|
39
|
+
*
|
|
33
40
|
* @param positionOrGridIndex The position or grid index to spawn the empty collectible at.
|
|
34
41
|
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
35
|
-
* `RNG.Next` method will be called.
|
|
42
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
43
|
+
* a random seed.
|
|
36
44
|
*/
|
|
37
|
-
export declare function spawnEmptyCollectible(positionOrGridIndex: Vector | int, seedOrRNG
|
|
45
|
+
export declare function spawnEmptyCollectible(positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG | undefined): EntityPickup;
|
|
38
46
|
//# sourceMappingURL=spawnCollectible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawnCollectible.d.ts","sourceRoot":"","sources":["../../../src/functions/spawnCollectible.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,8BAA8B,CAAC;AAQtC
|
|
1
|
+
{"version":3,"file":"spawnCollectible.d.ts","sourceRoot":"","sources":["../../../src/functions/spawnCollectible.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,8BAA8B,CAAC;AAQtC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,EAChC,mBAAmB,EAAE,MAAM,GAAG,GAAG,EACjC,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,EACjC,OAAO,UAAQ,EACf,aAAa,UAAQ,EACrB,OAAO,CAAC,EAAE,MAAM,GACf,uBAAuB,CAqCzB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,mBAAmB,EAAE,MAAM,GAAG,GAAG,EACjC,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,YAAY,CAWd"}
|
|
@@ -25,25 +25,29 @@ local isRNG = ____rng.isRNG
|
|
|
25
25
|
-- Isaac's rotation mechanic. To handle that, use the `spawnCollectible` helper function instead
|
|
26
26
|
-- (which is provided by `ISCFeature.SPAWN_COLLECTIBLE`).
|
|
27
27
|
--
|
|
28
|
+
-- If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
29
|
+
-- `seedOrRNG` parameter.
|
|
30
|
+
--
|
|
28
31
|
-- @param collectibleType The collectible type to spawn.
|
|
29
32
|
-- @param positionOrGridIndex The position or grid index to spawn the collectible at.
|
|
30
|
-
-- @param seedOrRNG
|
|
31
|
-
-- `RNG.Next` method will be called.
|
|
33
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
34
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
35
|
+
-- a random seed.
|
|
32
36
|
-- @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
33
37
|
-- collectible. Default is false.
|
|
34
38
|
-- @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
35
39
|
-- Tainted Keeper. Default is false.
|
|
36
40
|
-- @param spawner Optional.
|
|
37
41
|
function ____exports.spawnCollectibleUnsafe(self, collectibleType, positionOrGridIndex, seedOrRNG, options, forceFreeItem, spawner)
|
|
38
|
-
if seedOrRNG == nil then
|
|
39
|
-
seedOrRNG = getRandomSeed(nil)
|
|
40
|
-
end
|
|
41
42
|
if options == nil then
|
|
42
43
|
options = false
|
|
43
44
|
end
|
|
44
45
|
if forceFreeItem == nil then
|
|
45
46
|
forceFreeItem = false
|
|
46
47
|
end
|
|
48
|
+
if seedOrRNG == nil then
|
|
49
|
+
seedOrRNG = getRandomSeed(nil)
|
|
50
|
+
end
|
|
47
51
|
local seed = isRNG(nil, seedOrRNG) and seedOrRNG:Next() or seedOrRNG
|
|
48
52
|
local collectible = spawnPickupWithSeed(
|
|
49
53
|
nil,
|
|
@@ -72,13 +76,14 @@ end
|
|
|
72
76
|
-- Onion because it is a quest collectible and quest collectibles will prevent Damocles from
|
|
73
77
|
-- duplicating the pedestal.)
|
|
74
78
|
--
|
|
79
|
+
-- If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
80
|
+
-- `seedOrRNG` parameter.
|
|
81
|
+
--
|
|
75
82
|
-- @param positionOrGridIndex The position or grid index to spawn the empty collectible at.
|
|
76
83
|
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
77
|
-
-- `RNG.Next` method will be called.
|
|
84
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
85
|
+
-- a random seed.
|
|
78
86
|
function ____exports.spawnEmptyCollectible(self, positionOrGridIndex, seedOrRNG)
|
|
79
|
-
if seedOrRNG == nil then
|
|
80
|
-
seedOrRNG = getRandomSeed(nil)
|
|
81
|
-
end
|
|
82
87
|
local collectible = ____exports.spawnCollectibleUnsafe(
|
|
83
88
|
nil,
|
|
84
89
|
CollectibleType.BROKEN_SHOVEL_1,
|
|
@@ -38,10 +38,14 @@ export declare function getClosestVectorTo(referenceVector: Vector, vectors: Vec
|
|
|
38
38
|
*
|
|
39
39
|
* Use this over the `RandomVector` function when you need the vector to be seeded.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* If you want to generate an unseeded vector, you must explicitly pass `undefined` to the
|
|
42
|
+
* `seedOrRNG` parameter.
|
|
43
|
+
*
|
|
44
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
45
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
46
|
+
* a random seed.
|
|
43
47
|
*/
|
|
44
|
-
export declare function getRandomVector(seedOrRNG
|
|
48
|
+
export declare function getRandomVector(seedOrRNG: Seed | RNG | undefined): Readonly<Vector>;
|
|
45
49
|
/**
|
|
46
50
|
* Used to determine is the given table is a serialized `Vector` object created by the `deepCopy`
|
|
47
51
|
* function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AActC,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,MAAM,CAAC;CACnD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAmBlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,SAAO,GACf,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,EAAE,GAChB,MAAM,GAAG,SAAS,CAapB;AAED
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AActC,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,MAAM,CAAC;CACnD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAmBlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,SAAO,GACf,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,EAAE,GAChB,MAAM,GAAG,SAAS,CAapB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,QAAQ,CAAC,MAAM,CAAC,CAOlB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GACd,MAAM,IAAI,gBAAgB,CAM5B;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAG3D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,MAAM,CAIpE"}
|
|
@@ -10,7 +10,6 @@ local isaacAPIClassEquals = ____isaacAPIClass.isaacAPIClassEquals
|
|
|
10
10
|
local ____random = require("src.functions.random")
|
|
11
11
|
local getRandomFloat = ____random.getRandomFloat
|
|
12
12
|
local ____rng = require("src.functions.rng")
|
|
13
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
14
13
|
local isRNG = ____rng.isRNG
|
|
15
14
|
local newRNG = ____rng.newRNG
|
|
16
15
|
local ____table = require("src.functions.table")
|
|
@@ -88,12 +87,13 @@ end
|
|
|
88
87
|
--
|
|
89
88
|
-- Use this over the `RandomVector` function when you need the vector to be seeded.
|
|
90
89
|
--
|
|
91
|
-
--
|
|
92
|
-
-- `
|
|
90
|
+
-- If you want to generate an unseeded vector, you must explicitly pass `undefined` to the
|
|
91
|
+
-- `seedOrRNG` parameter.
|
|
92
|
+
--
|
|
93
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
94
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
95
|
+
-- a random seed.
|
|
93
96
|
function ____exports.getRandomVector(self, seedOrRNG)
|
|
94
|
-
if seedOrRNG == nil then
|
|
95
|
-
seedOrRNG = getRandomSeed(nil)
|
|
96
|
-
end
|
|
97
97
|
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
98
98
|
local x = getRandomFloat(nil, -1, 1, rng)
|
|
99
99
|
local y = getRandomFloat(nil, -1, 1, rng)
|
|
@@ -6,12 +6,28 @@ import type { WeightedArray } from "../types/WeightedArray";
|
|
|
6
6
|
* Get a random value from a `WeightedArray`. (A `WeightedArray` is an array of tuples, where the
|
|
7
7
|
* first element in the tuple is a value, and the second element in the tuple is a float
|
|
8
8
|
* corresponding to the value's weight.)
|
|
9
|
+
*
|
|
10
|
+
* If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
11
|
+
* parameter.
|
|
12
|
+
*
|
|
13
|
+
* @param weightedArray The array to pick from.
|
|
14
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
15
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
16
|
+
* a random seed.
|
|
9
17
|
*/
|
|
10
|
-
export declare function getRandomFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG
|
|
18
|
+
export declare function getRandomFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG: Seed | RNG | undefined): T;
|
|
11
19
|
/**
|
|
12
20
|
* Get a random index from a `WeightedArray`. (A `WeightedArray` is an array of tuples, where the
|
|
13
21
|
* first element in the tuple is a value, and the second element in the tuple is a float
|
|
14
22
|
* corresponding to the value's weight.)
|
|
23
|
+
*
|
|
24
|
+
* If you want to get an unseeded index, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
25
|
+
* parameter.
|
|
26
|
+
*
|
|
27
|
+
* @param weightedArray The array to pick from.
|
|
28
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
29
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
30
|
+
* a random seed.
|
|
15
31
|
*/
|
|
16
|
-
export declare function getRandomIndexFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG
|
|
32
|
+
export declare function getRandomIndexFromWeightedArray<T>(weightedArray: WeightedArray<T>, seedOrRNG: Seed | RNG | undefined): int;
|
|
17
33
|
//# sourceMappingURL=weighted.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weighted.d.ts","sourceRoot":"","sources":["../../../src/functions/weighted.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"weighted.d.ts","sourceRoot":"","sources":["../../../src/functions/weighted.ts"],"names":[],"mappings":";;;AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAK5D;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAC1C,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,EAC/B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,CAAC,CAUH;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,EAC/C,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,EAC/B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,GAAG,CAsBL"}
|
|
@@ -7,17 +7,20 @@ local ____array = require("src.functions.array")
|
|
|
7
7
|
local sumArray = ____array.sumArray
|
|
8
8
|
local ____random = require("src.functions.random")
|
|
9
9
|
local getRandomFloat = ____random.getRandomFloat
|
|
10
|
-
local ____rng = require("src.functions.rng")
|
|
11
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
12
10
|
local ____utils = require("src.functions.utils")
|
|
13
11
|
local assertDefined = ____utils.assertDefined
|
|
14
12
|
--- Get a random index from a `WeightedArray`. (A `WeightedArray` is an array of tuples, where the
|
|
15
13
|
-- first element in the tuple is a value, and the second element in the tuple is a float
|
|
16
14
|
-- corresponding to the value's weight.)
|
|
15
|
+
--
|
|
16
|
+
-- If you want to get an unseeded index, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
17
|
+
-- parameter.
|
|
18
|
+
--
|
|
19
|
+
-- @param weightedArray The array to pick from.
|
|
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.
|
|
17
23
|
function ____exports.getRandomIndexFromWeightedArray(self, weightedArray, seedOrRNG)
|
|
18
|
-
if seedOrRNG == nil then
|
|
19
|
-
seedOrRNG = getRandomSeed(nil)
|
|
20
|
-
end
|
|
21
24
|
if #weightedArray == 0 then
|
|
22
25
|
error("Failed to get a random index from a weighted array since the provided array was empty.")
|
|
23
26
|
end
|
|
@@ -42,10 +45,15 @@ end
|
|
|
42
45
|
--- Get a random value from a `WeightedArray`. (A `WeightedArray` is an array of tuples, where the
|
|
43
46
|
-- first element in the tuple is a value, and the second element in the tuple is a float
|
|
44
47
|
-- corresponding to the value's weight.)
|
|
48
|
+
--
|
|
49
|
+
-- If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
50
|
+
-- parameter.
|
|
51
|
+
--
|
|
52
|
+
-- @param weightedArray The array to pick from.
|
|
53
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
54
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
55
|
+
-- a random seed.
|
|
45
56
|
function ____exports.getRandomFromWeightedArray(self, weightedArray, seedOrRNG)
|
|
46
|
-
if seedOrRNG == nil then
|
|
47
|
-
seedOrRNG = getRandomSeed(nil)
|
|
48
|
-
end
|
|
49
57
|
local randomIndex = ____exports.getRandomIndexFromWeightedArray(nil, weightedArray, seedOrRNG)
|
|
50
58
|
local randomElement = weightedArray[randomIndex + 1]
|
|
51
59
|
assertDefined(
|
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@ import { Exported } from "../../../decorators";
|
|
|
4
4
|
import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
|
|
5
5
|
import { arrayRemoveIndexInPlace } from "../../../functions/array";
|
|
6
6
|
import { copyMap } from "../../../functions/map";
|
|
7
|
-
import { getRandomSeed } from "../../../functions/rng";
|
|
8
7
|
import { assertDefined } from "../../../functions/utils";
|
|
9
8
|
import { getRandomIndexFromWeightedArray } from "../../../functions/weighted";
|
|
10
9
|
import type { WeightedArray } from "../../../types/WeightedArray";
|
|
@@ -99,21 +98,25 @@ export class CustomItemPools extends Feature {
|
|
|
99
98
|
* By default, a collectible will not be removed from the pool once it is selected, unless the
|
|
100
99
|
* `decrease` argument is set to true (similar to how a vanilla item pool works).
|
|
101
100
|
*
|
|
101
|
+
* If you want to get an unseeded collectible type, you must explicitly pass `undefined` to the
|
|
102
|
+
* `seedOrRNG` parameter.
|
|
103
|
+
*
|
|
102
104
|
* In order to use this function, you must upgrade your mod with `ISCFeature.CUSTOM_ITEM_POOLS`.
|
|
103
105
|
*
|
|
104
106
|
* @param itemPoolTypeCustom An integer representing the custom item pool to use.
|
|
107
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
108
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
109
|
+
* to a random seed.
|
|
105
110
|
* @param decrease Optional. Whether to remove the selected collectible from the item pool.
|
|
106
111
|
* Default is true.
|
|
107
|
-
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided,
|
|
108
|
-
* the `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
109
112
|
* @param defaultItem Optional. The collectible to return if the item pool is depleted. Default is
|
|
110
113
|
* `CollectibleType.NULL`.
|
|
111
114
|
*/
|
|
112
115
|
@Exported
|
|
113
116
|
public getCustomItemPoolCollectible(
|
|
114
117
|
itemPoolTypeCustom: ItemPoolType,
|
|
118
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
115
119
|
decrease = false,
|
|
116
|
-
seedOrRNG: Seed | RNG = getRandomSeed(),
|
|
117
120
|
defaultItem = CollectibleType.NULL,
|
|
118
121
|
): CollectibleType {
|
|
119
122
|
const customItemPool = v.run.customItemPools.get(itemPoolTypeCustom);
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "../../../functions/gridEntities";
|
|
25
25
|
import { getRandomJSONEntity } from "../../../functions/jsonRoom";
|
|
26
26
|
import { log } from "../../../functions/log";
|
|
27
|
-
import {
|
|
27
|
+
import { isRNG, newRNG } from "../../../functions/rng";
|
|
28
28
|
import { gridCoordinatesToWorldPosition } from "../../../functions/roomGrid";
|
|
29
29
|
import { setRoomCleared, setRoomUncleared } from "../../../functions/rooms";
|
|
30
30
|
import { asCollectibleType, asNumber } from "../../../functions/types";
|
|
@@ -81,7 +81,7 @@ export class DeployJSONRoom extends Feature {
|
|
|
81
81
|
`Failed to convert the following y coordinate to a number (for a spawn): ${yString}`,
|
|
82
82
|
);
|
|
83
83
|
|
|
84
|
-
const jsonEntity = getRandomJSONEntity(jsonSpawn.entity);
|
|
84
|
+
const jsonEntity = getRandomJSONEntity(jsonSpawn.entity, rng);
|
|
85
85
|
|
|
86
86
|
const entityTypeString = jsonEntity.$.type;
|
|
87
87
|
const entityTypeNumber = tonumber(entityTypeString);
|
|
@@ -219,18 +219,22 @@ export class DeployJSONRoom extends Feature {
|
|
|
219
219
|
* }
|
|
220
220
|
* ```
|
|
221
221
|
*
|
|
222
|
+
* If you want to deploy an unseeded room, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
223
|
+
* parameter.
|
|
224
|
+
*
|
|
222
225
|
* In order to use this function, you must upgrade your mod with `ISCFeature.DEPLOY_JSON_ROOM`.
|
|
223
226
|
*
|
|
224
227
|
* @param jsonRoom The JSON room to deploy.
|
|
225
|
-
* @param seedOrRNG
|
|
226
|
-
*
|
|
228
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
229
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
230
|
+
* to a random seed.
|
|
227
231
|
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
228
232
|
* what the function is doing. Default is false.
|
|
229
233
|
*/
|
|
230
234
|
@Exported
|
|
231
235
|
public deployJSONRoom(
|
|
232
236
|
jsonRoom: JSONRoom | Readonly<JSONRoom>,
|
|
233
|
-
seedOrRNG: Seed | RNG
|
|
237
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
234
238
|
verbose = false,
|
|
235
239
|
): void {
|
|
236
240
|
const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
|
|
@@ -36,7 +36,6 @@ import {
|
|
|
36
36
|
isPassiveOrFamiliarCollectible,
|
|
37
37
|
} from "../../../functions/collectibles";
|
|
38
38
|
import { getFlagName } from "../../../functions/flag";
|
|
39
|
-
import { getRandomSeed } from "../../../functions/rng";
|
|
40
39
|
import {
|
|
41
40
|
copySet,
|
|
42
41
|
deleteSetsFromSet,
|
|
@@ -1181,18 +1180,23 @@ export class ModdedElementSets extends Feature {
|
|
|
1181
1180
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
1182
1181
|
* order).
|
|
1183
1182
|
*
|
|
1183
|
+
* If you want to get an unseeded collectible type, you must explicitly pass `undefined` to the
|
|
1184
|
+
* `seedOrRNG` parameter.
|
|
1185
|
+
*
|
|
1184
1186
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1185
1187
|
*
|
|
1186
|
-
* @param seedOrRNG
|
|
1187
|
-
*
|
|
1188
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
1189
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1190
|
+
* to a random seed.
|
|
1188
1191
|
* @param exceptions Optional. An array of runes to not select.
|
|
1189
1192
|
*/
|
|
1190
1193
|
@Exported
|
|
1191
1194
|
public getRandomEdenActiveCollectibleType(
|
|
1192
|
-
seedOrRNG: Seed | RNG
|
|
1195
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
1193
1196
|
exceptions: CollectibleType[] | readonly CollectibleType[] = [],
|
|
1194
1197
|
): CollectibleType {
|
|
1195
1198
|
this.lazyInit();
|
|
1199
|
+
|
|
1196
1200
|
return getRandomSetElement(
|
|
1197
1201
|
this.edenPassiveCollectibleTypesSet,
|
|
1198
1202
|
seedOrRNG,
|
|
@@ -1208,18 +1212,23 @@ export class ModdedElementSets extends Feature {
|
|
|
1208
1212
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
1209
1213
|
* order).
|
|
1210
1214
|
*
|
|
1215
|
+
* If you want to get an unseeded collectible type, you must explicitly pass `undefined` to the
|
|
1216
|
+
* `seedOrRNG` parameter.
|
|
1217
|
+
*
|
|
1211
1218
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1212
1219
|
*
|
|
1213
|
-
* @param seedOrRNG
|
|
1214
|
-
*
|
|
1220
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
1221
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1222
|
+
* to a random seed.
|
|
1215
1223
|
* @param exceptions Optional. An array of runes to not select.
|
|
1216
1224
|
*/
|
|
1217
1225
|
@Exported
|
|
1218
1226
|
public getRandomEdenPassiveCollectibleType(
|
|
1219
|
-
seedOrRNG: Seed | RNG
|
|
1227
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
1220
1228
|
exceptions: CollectibleType[] | readonly CollectibleType[] = [],
|
|
1221
1229
|
): CollectibleType {
|
|
1222
1230
|
this.lazyInit();
|
|
1231
|
+
|
|
1223
1232
|
return getRandomSetElement(
|
|
1224
1233
|
this.edenPassiveCollectibleTypesSet,
|
|
1225
1234
|
seedOrRNG,
|
|
@@ -1330,18 +1339,22 @@ export class ModdedElementSets extends Feature {
|
|
|
1330
1339
|
* This function can only be called if at least one callback has been executed. This is because
|
|
1331
1340
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
1332
1341
|
*
|
|
1342
|
+
* If you want to get an unseeded card type, you must explicitly pass `undefined` to the
|
|
1343
|
+
* `seedOrRNG` parameter.
|
|
1344
|
+
*
|
|
1333
1345
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1334
1346
|
*
|
|
1335
1347
|
* @param itemConfigCardType The item config card type that represents the pool of cards to select
|
|
1336
1348
|
* from.
|
|
1337
|
-
* @param seedOrRNG
|
|
1338
|
-
*
|
|
1349
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
1350
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1351
|
+
* to a random seed.
|
|
1339
1352
|
* @param exceptions Optional. An array of cards to not select.
|
|
1340
1353
|
*/
|
|
1341
1354
|
@Exported
|
|
1342
1355
|
public getRandomCardTypeOfType(
|
|
1343
1356
|
itemConfigCardType: ItemConfigCardType,
|
|
1344
|
-
seedOrRNG: Seed | RNG
|
|
1357
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
1345
1358
|
exceptions: CardType[] = [],
|
|
1346
1359
|
): CardType {
|
|
1347
1360
|
const cardTypeSet = this.getCardTypesOfType(itemConfigCardType);
|
|
@@ -1358,15 +1371,19 @@ export class ModdedElementSets extends Feature {
|
|
|
1358
1371
|
* This function can only be called if at least one callback has been executed. This is because
|
|
1359
1372
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
1360
1373
|
*
|
|
1374
|
+
* If you want to get an unseeded card type, you must explicitly pass `undefined` to the
|
|
1375
|
+
* `seedOrRNG` parameter.
|
|
1376
|
+
*
|
|
1361
1377
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1362
1378
|
*
|
|
1363
|
-
* @param seedOrRNG
|
|
1364
|
-
*
|
|
1379
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
1380
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1381
|
+
* to a random seed.
|
|
1365
1382
|
* @param exceptions Optional. An array of cards to not select.
|
|
1366
1383
|
*/
|
|
1367
1384
|
@Exported
|
|
1368
1385
|
public getRandomCard(
|
|
1369
|
-
seedOrRNG: Seed | RNG
|
|
1386
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
1370
1387
|
exceptions: CardType[] = [],
|
|
1371
1388
|
): CardType {
|
|
1372
1389
|
this.lazyInit();
|
|
@@ -1380,15 +1397,19 @@ export class ModdedElementSets extends Feature {
|
|
|
1380
1397
|
* This function can only be called if at least one callback has been executed. This is because
|
|
1381
1398
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
1382
1399
|
*
|
|
1400
|
+
* If you want to get an unseeded card type, you must explicitly pass `undefined` to the
|
|
1401
|
+
* `seedOrRNG` parameter.
|
|
1402
|
+
*
|
|
1383
1403
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1384
1404
|
*
|
|
1385
|
-
* @param seedOrRNG
|
|
1386
|
-
*
|
|
1405
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
1406
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1407
|
+
* to a random seed.
|
|
1387
1408
|
* @param exceptions Optional. An array of runes to not select.
|
|
1388
1409
|
*/
|
|
1389
1410
|
@Exported
|
|
1390
1411
|
public getRandomRune(
|
|
1391
|
-
seedOrRNG: Seed | RNG
|
|
1412
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
1392
1413
|
exceptions: CardType[] = [],
|
|
1393
1414
|
): CardType {
|
|
1394
1415
|
const runesSet = this.getCardTypesOfType(ItemConfigCardType.RUNE);
|
|
@@ -6,7 +6,6 @@ import { game } from "../../../core/cachedClasses";
|
|
|
6
6
|
import { Exported } from "../../../decorators";
|
|
7
7
|
import { ISCFeature } from "../../../enums/ISCFeature";
|
|
8
8
|
import { isQuestCollectible } from "../../../functions/collectibleTag";
|
|
9
|
-
import { getRandomSeed } from "../../../functions/rng";
|
|
10
9
|
import { spawnCollectibleUnsafe } from "../../../functions/spawnCollectible";
|
|
11
10
|
import { Feature } from "../../private/Feature";
|
|
12
11
|
import type { PreventCollectibleRotation } from "./PreventCollectibleRotation";
|
|
@@ -34,12 +33,16 @@ export class SpawnCollectible extends Feature {
|
|
|
34
33
|
* to be a quest item), then you can use the `spawnCollectibleUnsafe` helper function instead
|
|
35
34
|
* (which does not require an upgraded mod).
|
|
36
35
|
*
|
|
36
|
+
* If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
37
|
+
* `seedOrRNG` parameter.
|
|
38
|
+
*
|
|
37
39
|
* In order to use this function, you must upgrade your mod with `ISCFeature.SPAWN_COLLECTIBLE`.
|
|
38
40
|
*
|
|
39
41
|
* @param collectibleType The collectible type to spawn.
|
|
40
42
|
* @param positionOrGridIndex The position or grid index to spawn the collectible at.
|
|
41
|
-
* @param seedOrRNG
|
|
42
|
-
*
|
|
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
|
|
45
|
+
* to a random seed.
|
|
43
46
|
* @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
44
47
|
* collectible. Default is false.
|
|
45
48
|
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
@@ -50,7 +53,7 @@ export class SpawnCollectible extends Feature {
|
|
|
50
53
|
public spawnCollectible(
|
|
51
54
|
collectibleType: CollectibleType,
|
|
52
55
|
positionOrGridIndex: Vector | int,
|
|
53
|
-
seedOrRNG: Seed | RNG
|
|
56
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
54
57
|
options = false,
|
|
55
58
|
forceFreeItem = false,
|
|
56
59
|
spawner?: Entity,
|
|
@@ -81,12 +84,16 @@ export class SpawnCollectible extends Feature {
|
|
|
81
84
|
* collectibles costing coins and preventing quest items from being rotated by Tainted Isaac's
|
|
82
85
|
* rotation mechanic.
|
|
83
86
|
*
|
|
87
|
+
* If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
88
|
+
* `seedOrRNG` parameter.
|
|
89
|
+
*
|
|
84
90
|
* In order to use this function, you must upgrade your mod with `ISCFeature.SPAWN_COLLECTIBLE`.
|
|
85
91
|
*
|
|
86
92
|
* @param itemPoolType The item pool to draw the collectible type from.
|
|
87
93
|
* @param positionOrGridIndex The position or grid index to spawn the collectible at.
|
|
88
|
-
* @param seedOrRNG
|
|
89
|
-
*
|
|
94
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
95
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
96
|
+
* to a random seed.
|
|
90
97
|
* @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
91
98
|
* collectible. Default is false.
|
|
92
99
|
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
@@ -97,7 +104,7 @@ export class SpawnCollectible extends Feature {
|
|
|
97
104
|
public spawnCollectibleFromPool(
|
|
98
105
|
itemPoolType: ItemPoolType,
|
|
99
106
|
positionOrGridIndex: Vector | int,
|
|
100
|
-
seedOrRNG: Seed | RNG
|
|
107
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
101
108
|
options = false,
|
|
102
109
|
forceFreeItem = false,
|
|
103
110
|
spawner?: Entity,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "../../../functions/pickupsSpecific";
|
|
29
29
|
import { fireProjectilesInCircle } from "../../../functions/projectiles";
|
|
30
30
|
import { getRandom } from "../../../functions/random";
|
|
31
|
-
import {
|
|
31
|
+
import { isRNG, newRNG } from "../../../functions/rng";
|
|
32
32
|
import { spawnCollectibleUnsafe } from "../../../functions/spawnCollectible";
|
|
33
33
|
import { repeat } from "../../../functions/utils";
|
|
34
34
|
import { getRandomVector, isVector } from "../../../functions/vector";
|
|
@@ -89,22 +89,26 @@ export class SpawnRockAltRewards extends Feature {
|
|
|
89
89
|
* The logic in this function is based on the rewards listed on the wiki:
|
|
90
90
|
* https://bindingofisaacrebirth.fandom.com/wiki/Rocks
|
|
91
91
|
*
|
|
92
|
+
* If you want to spawn an unseeded reward, you must explicitly pass `undefined` to the
|
|
93
|
+
* `seedOrRNG` parameter.
|
|
94
|
+
*
|
|
92
95
|
* In order to use this function, you must upgrade your mod with
|
|
93
96
|
* `ISCFeature.SPAWN_ALT_ROCK_REWARDS`.
|
|
94
97
|
*
|
|
95
98
|
* @param positionOrGridIndex The position or grid index to spawn the reward.
|
|
96
99
|
* @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a
|
|
97
100
|
* chance at spawning coins and spiders.
|
|
98
|
-
* @param seedOrRNG
|
|
99
|
-
* the
|
|
100
|
-
*
|
|
101
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. Normally, you should pass the `InitSeed` of
|
|
102
|
+
* the grid entity that was broken. If an `RNG` object is provided, the
|
|
103
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
104
|
+
* to a random seed.
|
|
101
105
|
* @returns Whether this function spawned something.
|
|
102
106
|
*/
|
|
103
107
|
@Exported
|
|
104
108
|
public spawnRockAltReward(
|
|
105
109
|
positionOrGridIndex: Vector | int,
|
|
106
110
|
rockAltType: RockAltType,
|
|
107
|
-
seedOrRNG: Seed | RNG
|
|
111
|
+
seedOrRNG: Seed | RNG | undefined,
|
|
108
112
|
): boolean {
|
|
109
113
|
const room = game.GetRoom();
|
|
110
114
|
const position = isVector(positionOrGridIndex)
|