isaacscript-common 1.2.210 → 1.2.211

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.
@@ -54,6 +54,7 @@ function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamil
54
54
  nil,
55
55
  numFamiliarsToSpawn,
56
56
  function()
57
+ local seed = collectibleRNG:Next()
57
58
  local familiar = game:Spawn(
58
59
  EntityType.ENTITY_FAMILIAR,
59
60
  familiarVariant,
@@ -61,7 +62,7 @@ function ____exports.checkFamiliar(self, player, collectibleType, numTargetFamil
61
62
  Vector.Zero,
62
63
  player,
63
64
  familiarSubTypeToUse,
64
- collectibleRNG:Next()
65
+ seed
65
66
  ):ToFamiliar()
66
67
  if familiar ~= nil then
67
68
  familiar.Player = player
@@ -7,13 +7,14 @@
7
7
  *
8
8
  * @param collectibleType The collectible type to spawn.
9
9
  * @param position The position to spawn the collectible at.
10
- * @param seed Optional. Default is `getRandomSeed()`.
10
+ * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
11
+ * `RNG.Next` method will be called. Default is `getRandomSeed()`.
11
12
  * @param options Optional. Set to true to make the collectible a "There's Options" style
12
13
  * collectible. Default is false.
13
14
  * @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
14
15
  * Tainted Keeper. Default is false.
15
16
  */
16
- export declare function spawnCollectible(collectibleType: CollectibleType | int, position: Vector, seed?: Seed, options?: boolean, forceFreeItem?: boolean): EntityPickup;
17
+ export declare function spawnCollectible(collectibleType: CollectibleType | int, position: Vector, seedOrRNG?: Seed | RNG, options?: boolean, forceFreeItem?: boolean): EntityPickup;
17
18
  /**
18
19
  * Helper function to spawn an empty collectible. Doing this is tricky since spawning a collectible
19
20
  * with `CollectibleType.COLLECTIBLE_NULL` will result in spawning a collectible with a random type
@@ -21,5 +22,9 @@ export declare function spawnCollectible(collectibleType: CollectibleType | int,
21
22
  *
22
23
  * Instead, this function arbitrarily spawns a collectible with
23
24
  * `CollectibleType.COLLECTIBLE_SAD_ONION`, and then converts it to an empty pedestal afterward.
25
+ *
26
+ * @param position The position to spawn the empty collectible at.
27
+ * @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
28
+ * `RNG.Next` method will be called. Default is `getRandomSeed()`.
24
29
  */
25
- export declare function spawnEmptyCollectible(position: Vector, seed?: Seed): EntityPickup;
30
+ export declare function spawnEmptyCollectible(position: Vector, seedOrRNG?: Seed | RNG): EntityPickup;
@@ -13,9 +13,10 @@ local ____player = require("functions.player")
13
13
  local anyPlayerIs = ____player.anyPlayerIs
14
14
  local ____rng = require("functions.rng")
15
15
  local getRandomSeed = ____rng.getRandomSeed
16
- function ____exports.spawnCollectible(self, collectibleType, position, seed, options, forceFreeItem)
17
- if seed == nil then
18
- seed = getRandomSeed(nil)
16
+ local isRNG = ____rng.isRNG
17
+ function ____exports.spawnCollectible(self, collectibleType, position, seedOrRNG, options, forceFreeItem)
18
+ if seedOrRNG == nil then
19
+ seedOrRNG = getRandomSeed(nil)
19
20
  end
20
21
  if options == nil then
21
22
  options = false
@@ -23,6 +24,7 @@ function ____exports.spawnCollectible(self, collectibleType, position, seed, opt
23
24
  if forceFreeItem == nil then
24
25
  forceFreeItem = false
25
26
  end
27
+ local seed = isRNG(nil, seedOrRNG) and seedOrRNG:Next() or seedOrRNG
26
28
  local collectible = game:Spawn(
27
29
  EntityType.ENTITY_PICKUP,
28
30
  100,
@@ -47,15 +49,15 @@ function ____exports.spawnCollectible(self, collectibleType, position, seed, opt
47
49
  end
48
50
  return collectible
49
51
  end
50
- function ____exports.spawnEmptyCollectible(self, position, seed)
51
- if seed == nil then
52
- seed = getRandomSeed(nil)
52
+ function ____exports.spawnEmptyCollectible(self, position, seedOrRNG)
53
+ if seedOrRNG == nil then
54
+ seedOrRNG = getRandomSeed(nil)
53
55
  end
54
56
  local collectible = ____exports.spawnCollectible(
55
57
  nil,
56
58
  CollectibleType.COLLECTIBLE_SAD_ONION,
57
59
  position,
58
- seed,
60
+ seedOrRNG,
59
61
  false,
60
62
  true
61
63
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.210",
3
+ "version": "1.2.211",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",