isaacscript-common 1.2.207 → 1.2.210

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.
@@ -234,6 +234,7 @@ function spawnNormalEntityForJSONRoom(self, entityType, variant, subType, x, y,
234
234
  local room = game:GetRoom()
235
235
  local roomType = room:GetType()
236
236
  local position = gridToPos(nil, x, y)
237
+ local seed = rng:Next()
237
238
  local entity
238
239
  if entityType == EntityType.ENTITY_PICKUP and variant == 100 then
239
240
  local options = roomType == RoomType.ROOM_ANGEL
@@ -241,12 +242,10 @@ function spawnNormalEntityForJSONRoom(self, entityType, variant, subType, x, y,
241
242
  nil,
242
243
  subType,
243
244
  position,
244
- rng,
245
+ seed,
245
246
  options
246
247
  )
247
248
  else
248
- rng:Next()
249
- local seed = rng:GetSeed()
250
249
  entity = game:Spawn(
251
250
  entityType,
252
251
  variant,
@@ -54,7 +54,6 @@ function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamil
54
54
  nil,
55
55
  numFamiliarsToSpawn,
56
56
  function()
57
- collectibleRNG:Next()
58
57
  local familiar = game:Spawn(
59
58
  EntityType.ENTITY_FAMILIAR,
60
59
  familiarVariant,
@@ -62,7 +61,7 @@ function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamil
62
61
  Vector.Zero,
63
62
  player,
64
63
  familiarSubTypeToUse,
65
- collectibleRNG:GetSeed()
64
+ collectibleRNG:Next()
66
65
  ):ToFamiliar()
67
66
  if familiar ~= nil then
68
67
  familiar.Player = player
@@ -16,8 +16,6 @@ interface CopyRNGReturn {
16
16
  */
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
- /** Helper function to get the next seed value for the provided RNG object. */
20
- export declare function getNewSeed(rng: RNG): Seed;
21
19
  /**
22
20
  * Helper function to get a random `Seed` value to be used in spawning entities and so on. Use this
23
21
  * instead of calling the `Random` function directly since that can return a value of 0 and crash
@@ -37,13 +35,6 @@ export declare function isSerializedRNG(object: unknown): object is SerializedRN
37
35
  * @param seed The seed to initialize it with. Default is `getRandomSeed()`.
38
36
  */
39
37
  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
38
  /**
48
39
  * Helper function to iterate over the provided object and set the seed for all of the values that
49
40
  * are RNG objects equal to a particular seed.
@@ -92,10 +92,6 @@ function ____exports.copyRNG(self, rng, serializationType)
92
92
  end
93
93
  until true
94
94
  end
95
- function ____exports.getNewSeed(self, rng)
96
- rng:Next()
97
- return rng:GetSeed()
98
- end
99
95
  function ____exports.isSerializedRNG(self, object)
100
96
  local objectType = type(object)
101
97
  if objectType ~= "table" then
@@ -108,11 +104,6 @@ function ____exports.isSerializedRNG(self, object)
108
104
  table.unpack(KEYS)
109
105
  ) and ____table[SerializationBrand.RNG] ~= nil
110
106
  end
111
- function ____exports.nextSeed(self, seed)
112
- local rng = ____exports.newRNG(nil, seed)
113
- rng:Next()
114
- return rng:GetSeed()
115
- end
116
107
  function ____exports.setAllRNGToSeed(self, object, seed)
117
108
  local objectType = type(object)
118
109
  if objectType ~= "table" then
@@ -7,13 +7,13 @@
7
7
  *
8
8
  * @param collectibleType The collectible type to spawn.
9
9
  * @param position The position to spawn the collectible at.
10
- * @param rng Optional. Default is `newRNG()`.
10
+ * @param seed Optional. Default is `getRandomSeed()`.
11
11
  * @param options Optional. Set to true to make the collectible a "There's Options" style
12
12
  * collectible. Default is false.
13
13
  * @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
14
14
  * Tainted Keeper. Default is false.
15
15
  */
16
- export declare function spawnCollectible(collectibleType: CollectibleType | int, position: Vector, rng?: RNG, options?: boolean, forceFreeItem?: boolean): EntityPickup;
16
+ export declare function spawnCollectible(collectibleType: CollectibleType | int, position: Vector, seed?: Seed, options?: boolean, forceFreeItem?: boolean): EntityPickup;
17
17
  /**
18
18
  * Helper function to spawn an empty collectible. Doing this is tricky since spawning a collectible
19
19
  * with `CollectibleType.COLLECTIBLE_NULL` will result in spawning a collectible with a random type
@@ -22,4 +22,4 @@ export declare function spawnCollectible(collectibleType: CollectibleType | int,
22
22
  * Instead, this function arbitrarily spawns a collectible with
23
23
  * `CollectibleType.COLLECTIBLE_SAD_ONION`, and then converts it to an empty pedestal afterward.
24
24
  */
25
- export declare function spawnEmptyCollectible(position: Vector, rng?: RNG): EntityPickup;
25
+ export declare function spawnEmptyCollectible(position: Vector, seed?: Seed): EntityPickup;
@@ -12,10 +12,10 @@ local setCollectibleEmpty = ____collectibles.setCollectibleEmpty
12
12
  local ____player = require("functions.player")
13
13
  local anyPlayerIs = ____player.anyPlayerIs
14
14
  local ____rng = require("functions.rng")
15
- local newRNG = ____rng.newRNG
16
- function ____exports.spawnCollectible(self, collectibleType, position, rng, options, forceFreeItem)
17
- if rng == nil then
18
- rng = newRNG(nil)
15
+ local getRandomSeed = ____rng.getRandomSeed
16
+ function ____exports.spawnCollectible(self, collectibleType, position, seed, options, forceFreeItem)
17
+ if seed == nil then
18
+ seed = getRandomSeed(nil)
19
19
  end
20
20
  if options == nil then
21
21
  options = false
@@ -23,8 +23,6 @@ function ____exports.spawnCollectible(self, collectibleType, position, rng, opti
23
23
  if forceFreeItem == nil then
24
24
  forceFreeItem = false
25
25
  end
26
- rng:Next()
27
- local seed = rng:GetSeed()
28
26
  local collectible = game:Spawn(
29
27
  EntityType.ENTITY_PICKUP,
30
28
  100,
@@ -49,15 +47,15 @@ function ____exports.spawnCollectible(self, collectibleType, position, rng, opti
49
47
  end
50
48
  return collectible
51
49
  end
52
- function ____exports.spawnEmptyCollectible(self, position, rng)
53
- if rng == nil then
54
- rng = newRNG(nil)
50
+ function ____exports.spawnEmptyCollectible(self, position, seed)
51
+ if seed == nil then
52
+ seed = getRandomSeed(nil)
55
53
  end
56
54
  local collectible = ____exports.spawnCollectible(
57
55
  nil,
58
56
  CollectibleType.COLLECTIBLE_SAD_ONION,
59
57
  position,
60
- rng,
58
+ seed,
61
59
  false,
62
60
  true
63
61
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.207",
3
+ "version": "1.2.210",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",