isaacscript-common 1.2.209 → 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
@@ -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.209",
3
+ "version": "1.2.210",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",