isaacscript-common 1.2.207 → 1.2.208
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/functions/rng.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface CopyRNGReturn {
|
|
|
17
17
|
export declare function copyRNG<R extends RNG | SerializedRNG, S extends SerializationType>(rng: R, serializationType: S): CopyRNGReturn[S];
|
|
18
18
|
export declare function copyRNG<R extends RNG | SerializedRNG>(rng: R): CopyRNGReturn[SerializationType.NONE];
|
|
19
19
|
/** Helper function to get the next seed value for the provided RNG object. */
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function getNextSeed(rng: RNG): Seed;
|
|
21
21
|
/**
|
|
22
22
|
* Helper function to get a random `Seed` value to be used in spawning entities and so on. Use this
|
|
23
23
|
* instead of calling the `Random` function directly since that can return a value of 0 and crash
|
|
@@ -37,13 +37,6 @@ export declare function isSerializedRNG(object: unknown): object is SerializedRN
|
|
|
37
37
|
* @param seed The seed to initialize it with. Default is `getRandomSeed()`.
|
|
38
38
|
*/
|
|
39
39
|
export declare function newRNG(seed?: Seed): RNG;
|
|
40
|
-
/**
|
|
41
|
-
* Helper function to get the next seed value.
|
|
42
|
-
*
|
|
43
|
-
* This function is useful if you are working with data structures that store seed values instead of
|
|
44
|
-
* RNG objects.
|
|
45
|
-
*/
|
|
46
|
-
export declare function nextSeed(seed: Seed): Seed;
|
|
47
40
|
/**
|
|
48
41
|
* Helper function to iterate over the provided object and set the seed for all of the values that
|
|
49
42
|
* are RNG objects equal to a particular seed.
|
package/dist/functions/rng.lua
CHANGED
|
@@ -92,7 +92,7 @@ function ____exports.copyRNG(self, rng, serializationType)
|
|
|
92
92
|
end
|
|
93
93
|
until true
|
|
94
94
|
end
|
|
95
|
-
function ____exports.
|
|
95
|
+
function ____exports.getNextSeed(self, rng)
|
|
96
96
|
rng:Next()
|
|
97
97
|
return rng:GetSeed()
|
|
98
98
|
end
|
|
@@ -108,11 +108,6 @@ function ____exports.isSerializedRNG(self, object)
|
|
|
108
108
|
table.unpack(KEYS)
|
|
109
109
|
) and ____table[SerializationBrand.RNG] ~= nil
|
|
110
110
|
end
|
|
111
|
-
function ____exports.nextSeed(self, seed)
|
|
112
|
-
local rng = ____exports.newRNG(nil, seed)
|
|
113
|
-
rng:Next()
|
|
114
|
-
return rng:GetSeed()
|
|
115
|
-
end
|
|
116
111
|
function ____exports.setAllRNGToSeed(self, object, seed)
|
|
117
112
|
local objectType = type(object)
|
|
118
113
|
if objectType ~= "table" then
|