isaacscript-common 71.2.1 → 72.0.1
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 +13 -128
- package/dist/src/classes/callbacks/PostHolyMantleRemoved.d.ts.map +1 -1
- package/dist/src/classes/callbacks/PostHolyMantleRemoved.lua +3 -1
- 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/callbacks/PostHolyMantleRemoved.ts +6 -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
|
@@ -460,13 +460,17 @@ export declare class ModdedElementSets extends Feature {
|
|
|
460
460
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
461
461
|
* order).
|
|
462
462
|
*
|
|
463
|
+
* If you want to get an unseeded collectible type, you must explicitly pass `undefined` to the
|
|
464
|
+
* `seedOrRNG` parameter.
|
|
465
|
+
*
|
|
463
466
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
464
467
|
*
|
|
465
|
-
* @param seedOrRNG
|
|
466
|
-
*
|
|
468
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
469
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
470
|
+
* to a random seed.
|
|
467
471
|
* @param exceptions Optional. An array of runes to not select.
|
|
468
472
|
*/
|
|
469
|
-
getRandomEdenActiveCollectibleType(seedOrRNG
|
|
473
|
+
getRandomEdenActiveCollectibleType(seedOrRNG: Seed | RNG | undefined, exceptions?: CollectibleType[] | readonly CollectibleType[]): CollectibleType;
|
|
470
474
|
/**
|
|
471
475
|
* Returns a random passive collectible type that that is a valid starting item for Eden
|
|
472
476
|
* (including familiars).
|
|
@@ -475,13 +479,17 @@ export declare class ModdedElementSets extends Feature {
|
|
|
475
479
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
476
480
|
* order).
|
|
477
481
|
*
|
|
482
|
+
* If you want to get an unseeded collectible type, you must explicitly pass `undefined` to the
|
|
483
|
+
* `seedOrRNG` parameter.
|
|
484
|
+
*
|
|
478
485
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
479
486
|
*
|
|
480
|
-
* @param seedOrRNG
|
|
481
|
-
*
|
|
487
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
488
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
489
|
+
* to a random seed.
|
|
482
490
|
* @param exceptions Optional. An array of runes to not select.
|
|
483
491
|
*/
|
|
484
|
-
getRandomEdenPassiveCollectibleType(seedOrRNG
|
|
492
|
+
getRandomEdenPassiveCollectibleType(seedOrRNG: Seed | RNG | undefined, exceptions?: CollectibleType[] | readonly CollectibleType[]): CollectibleType;
|
|
485
493
|
/**
|
|
486
494
|
* Returns a set containing every collectible type with the given quality.
|
|
487
495
|
*
|
|
@@ -520,15 +528,19 @@ export declare class ModdedElementSets extends Feature {
|
|
|
520
528
|
* This function can only be called if at least one callback has been executed. This is because
|
|
521
529
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
522
530
|
*
|
|
531
|
+
* If you want to get an unseeded card type, you must explicitly pass `undefined` to the
|
|
532
|
+
* `seedOrRNG` parameter.
|
|
533
|
+
*
|
|
523
534
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
524
535
|
*
|
|
525
536
|
* @param itemConfigCardType The item config card type that represents the pool of cards to select
|
|
526
537
|
* from.
|
|
527
|
-
* @param seedOrRNG
|
|
528
|
-
*
|
|
538
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
539
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
540
|
+
* to a random seed.
|
|
529
541
|
* @param exceptions Optional. An array of cards to not select.
|
|
530
542
|
*/
|
|
531
|
-
getRandomCardTypeOfType(itemConfigCardType: ItemConfigCardType, seedOrRNG
|
|
543
|
+
getRandomCardTypeOfType(itemConfigCardType: ItemConfigCardType, seedOrRNG: Seed | RNG | undefined, exceptions?: CardType[]): CardType;
|
|
532
544
|
/**
|
|
533
545
|
* Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.).
|
|
534
546
|
*
|
|
@@ -539,13 +551,17 @@ export declare class ModdedElementSets extends Feature {
|
|
|
539
551
|
* This function can only be called if at least one callback has been executed. This is because
|
|
540
552
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
541
553
|
*
|
|
554
|
+
* If you want to get an unseeded card type, you must explicitly pass `undefined` to the
|
|
555
|
+
* `seedOrRNG` parameter.
|
|
556
|
+
*
|
|
542
557
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
543
558
|
*
|
|
544
|
-
* @param seedOrRNG
|
|
545
|
-
*
|
|
559
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
560
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
561
|
+
* to a random seed.
|
|
546
562
|
* @param exceptions Optional. An array of cards to not select.
|
|
547
563
|
*/
|
|
548
|
-
getRandomCard(seedOrRNG
|
|
564
|
+
getRandomCard(seedOrRNG: Seed | RNG | undefined, exceptions?: CardType[]): CardType;
|
|
549
565
|
/**
|
|
550
566
|
* Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul
|
|
551
567
|
* of Isaac, etc.). This will never return a Rune Shard.
|
|
@@ -553,12 +569,16 @@ export declare class ModdedElementSets extends Feature {
|
|
|
553
569
|
* This function can only be called if at least one callback has been executed. This is because
|
|
554
570
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
555
571
|
*
|
|
572
|
+
* If you want to get an unseeded card type, you must explicitly pass `undefined` to the
|
|
573
|
+
* `seedOrRNG` parameter.
|
|
574
|
+
*
|
|
556
575
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
557
576
|
*
|
|
558
|
-
* @param seedOrRNG
|
|
559
|
-
*
|
|
577
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
578
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
579
|
+
* to a random seed.
|
|
560
580
|
* @param exceptions Optional. An array of runes to not select.
|
|
561
581
|
*/
|
|
562
|
-
getRandomRune(seedOrRNG
|
|
582
|
+
getRandomRune(seedOrRNG: Seed | RNG | undefined, exceptions?: CardType[]): CardType;
|
|
563
583
|
}
|
|
564
584
|
//# sourceMappingURL=ModdedElementSets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModdedElementSets.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ModdedElementSets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"ModdedElementSets.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/ModdedElementSets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AA8CtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AA2BhD;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,OAAO;IAC5C,OAAO,CAAC,iBAAiB,CAAS;IAMlC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAyB;IAClE,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA8B;IAErE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,GAAG,GAAG,GAAG,SAAS,EACjC,UAAU,GAAE,QAAQ,EAAO,GAC1B,QAAQ;CAKZ"}
|
|
@@ -45,8 +45,6 @@ local isHiddenCollectible = ____collectibles.isHiddenCollectible
|
|
|
45
45
|
local isPassiveOrFamiliarCollectible = ____collectibles.isPassiveOrFamiliarCollectible
|
|
46
46
|
local ____flag = require("src.functions.flag")
|
|
47
47
|
local getFlagName = ____flag.getFlagName
|
|
48
|
-
local ____rng = require("src.functions.rng")
|
|
49
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
50
48
|
local ____set = require("src.functions.set")
|
|
51
49
|
local copySet = ____set.copySet
|
|
52
50
|
local deleteSetsFromSet = ____set.deleteSetsFromSet
|
|
@@ -599,9 +597,6 @@ function ModdedElementSets.prototype.getEdenPassiveCollectibleTypes(self)
|
|
|
599
597
|
end
|
|
600
598
|
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getEdenPassiveCollectibleTypes", true)
|
|
601
599
|
function ModdedElementSets.prototype.getRandomEdenActiveCollectibleType(self, seedOrRNG, exceptions)
|
|
602
|
-
if seedOrRNG == nil then
|
|
603
|
-
seedOrRNG = getRandomSeed(nil)
|
|
604
|
-
end
|
|
605
600
|
if exceptions == nil then
|
|
606
601
|
exceptions = {}
|
|
607
602
|
end
|
|
@@ -610,9 +605,6 @@ function ModdedElementSets.prototype.getRandomEdenActiveCollectibleType(self, se
|
|
|
610
605
|
end
|
|
611
606
|
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomEdenActiveCollectibleType", true)
|
|
612
607
|
function ModdedElementSets.prototype.getRandomEdenPassiveCollectibleType(self, seedOrRNG, exceptions)
|
|
613
|
-
if seedOrRNG == nil then
|
|
614
|
-
seedOrRNG = getRandomSeed(nil)
|
|
615
|
-
end
|
|
616
608
|
if exceptions == nil then
|
|
617
609
|
exceptions = {}
|
|
618
610
|
end
|
|
@@ -666,9 +658,6 @@ function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
|
|
|
666
658
|
end
|
|
667
659
|
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCardTypesOfType", true)
|
|
668
660
|
function ModdedElementSets.prototype.getRandomCardTypeOfType(self, itemConfigCardType, seedOrRNG, exceptions)
|
|
669
|
-
if seedOrRNG == nil then
|
|
670
|
-
seedOrRNG = getRandomSeed(nil)
|
|
671
|
-
end
|
|
672
661
|
if exceptions == nil then
|
|
673
662
|
exceptions = {}
|
|
674
663
|
end
|
|
@@ -677,9 +666,6 @@ function ModdedElementSets.prototype.getRandomCardTypeOfType(self, itemConfigCar
|
|
|
677
666
|
end
|
|
678
667
|
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomCardTypeOfType", true)
|
|
679
668
|
function ModdedElementSets.prototype.getRandomCard(self, seedOrRNG, exceptions)
|
|
680
|
-
if seedOrRNG == nil then
|
|
681
|
-
seedOrRNG = getRandomSeed(nil)
|
|
682
|
-
end
|
|
683
669
|
if exceptions == nil then
|
|
684
670
|
exceptions = {}
|
|
685
671
|
end
|
|
@@ -688,9 +674,6 @@ function ModdedElementSets.prototype.getRandomCard(self, seedOrRNG, exceptions)
|
|
|
688
674
|
end
|
|
689
675
|
__TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomCard", true)
|
|
690
676
|
function ModdedElementSets.prototype.getRandomRune(self, seedOrRNG, exceptions)
|
|
691
|
-
if seedOrRNG == nil then
|
|
692
|
-
seedOrRNG = getRandomSeed(nil)
|
|
693
|
-
end
|
|
694
677
|
if exceptions == nil then
|
|
695
678
|
exceptions = {}
|
|
696
679
|
end
|
|
@@ -13,19 +13,23 @@ export declare class SpawnCollectible extends Feature {
|
|
|
13
13
|
* to be a quest item), then you can use the `spawnCollectibleUnsafe` helper function instead
|
|
14
14
|
* (which does not require an upgraded mod).
|
|
15
15
|
*
|
|
16
|
+
* If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
17
|
+
* `seedOrRNG` parameter.
|
|
18
|
+
*
|
|
16
19
|
* In order to use this function, you must upgrade your mod with `ISCFeature.SPAWN_COLLECTIBLE`.
|
|
17
20
|
*
|
|
18
21
|
* @param collectibleType The collectible type to spawn.
|
|
19
22
|
* @param positionOrGridIndex The position or grid index to spawn the collectible at.
|
|
20
|
-
* @param seedOrRNG
|
|
21
|
-
*
|
|
23
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
24
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
25
|
+
* to a random seed.
|
|
22
26
|
* @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
23
27
|
* collectible. Default is false.
|
|
24
28
|
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
25
29
|
* Tainted Keeper. Default is false.
|
|
26
30
|
* @param spawner Optional.
|
|
27
31
|
*/
|
|
28
|
-
spawnCollectible(collectibleType: CollectibleType, positionOrGridIndex: Vector | int, seedOrRNG
|
|
32
|
+
spawnCollectible(collectibleType: CollectibleType, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG | undefined, options?: boolean, forceFreeItem?: boolean, spawner?: Entity): EntityPickupCollectible;
|
|
29
33
|
/**
|
|
30
34
|
* Helper function to spawn a collectible from a specific item pool.
|
|
31
35
|
*
|
|
@@ -33,18 +37,22 @@ export declare class SpawnCollectible extends Feature {
|
|
|
33
37
|
* collectibles costing coins and preventing quest items from being rotated by Tainted Isaac's
|
|
34
38
|
* rotation mechanic.
|
|
35
39
|
*
|
|
40
|
+
* If you want to spawn an unseeded collectible, you must explicitly pass `undefined` to the
|
|
41
|
+
* `seedOrRNG` parameter.
|
|
42
|
+
*
|
|
36
43
|
* In order to use this function, you must upgrade your mod with `ISCFeature.SPAWN_COLLECTIBLE`.
|
|
37
44
|
*
|
|
38
45
|
* @param itemPoolType The item pool to draw the collectible type from.
|
|
39
46
|
* @param positionOrGridIndex The position or grid index to spawn the collectible at.
|
|
40
|
-
* @param seedOrRNG
|
|
41
|
-
*
|
|
47
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
48
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
49
|
+
* to a random seed.
|
|
42
50
|
* @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
43
51
|
* collectible. Default is false.
|
|
44
52
|
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
45
53
|
* Tainted Keeper. Default is false.
|
|
46
54
|
* @param spawner Optional.
|
|
47
55
|
*/
|
|
48
|
-
spawnCollectibleFromPool(itemPoolType: ItemPoolType, positionOrGridIndex: Vector | int, seedOrRNG
|
|
56
|
+
spawnCollectibleFromPool(itemPoolType: ItemPoolType, positionOrGridIndex: Vector | int, seedOrRNG: Seed | RNG | undefined, options?: boolean, forceFreeItem?: boolean, spawner?: Entity): EntityPickupCollectible;
|
|
49
57
|
}
|
|
50
58
|
//# sourceMappingURL=SpawnCollectible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpawnCollectible.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SpawnCollectible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"SpawnCollectible.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SpawnCollectible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACb,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAA6B;IAWxE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IAEI,gBAAgB,CACrB,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;IAoB1B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IAEI,wBAAwB,CAC7B,YAAY,EAAE,YAAY,EAC1B,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;CAa3B"}
|
|
@@ -11,8 +11,6 @@ local ____ISCFeature = require("src.enums.ISCFeature")
|
|
|
11
11
|
local ISCFeature = ____ISCFeature.ISCFeature
|
|
12
12
|
local ____collectibleTag = require("src.functions.collectibleTag")
|
|
13
13
|
local isQuestCollectible = ____collectibleTag.isQuestCollectible
|
|
14
|
-
local ____rng = require("src.functions.rng")
|
|
15
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
16
14
|
local ____spawnCollectible = require("src.functions.spawnCollectible")
|
|
17
15
|
local spawnCollectibleUnsafe = ____spawnCollectible.spawnCollectibleUnsafe
|
|
18
16
|
local ____Feature = require("src.classes.private.Feature")
|
|
@@ -27,9 +25,6 @@ function SpawnCollectible.prototype.____constructor(self, preventCollectibleRota
|
|
|
27
25
|
self.preventCollectibleRotation = preventCollectibleRotation
|
|
28
26
|
end
|
|
29
27
|
function SpawnCollectible.prototype.spawnCollectible(self, collectibleType, positionOrGridIndex, seedOrRNG, options, forceFreeItem, spawner)
|
|
30
|
-
if seedOrRNG == nil then
|
|
31
|
-
seedOrRNG = getRandomSeed(nil)
|
|
32
|
-
end
|
|
33
28
|
if options == nil then
|
|
34
29
|
options = false
|
|
35
30
|
end
|
|
@@ -52,9 +47,6 @@ function SpawnCollectible.prototype.spawnCollectible(self, collectibleType, posi
|
|
|
52
47
|
end
|
|
53
48
|
__TS__DecorateLegacy({Exported}, SpawnCollectible.prototype, "spawnCollectible", true)
|
|
54
49
|
function SpawnCollectible.prototype.spawnCollectibleFromPool(self, itemPoolType, positionOrGridIndex, seedOrRNG, options, forceFreeItem, spawner)
|
|
55
|
-
if seedOrRNG == nil then
|
|
56
|
-
seedOrRNG = getRandomSeed(nil)
|
|
57
|
-
end
|
|
58
50
|
if options == nil then
|
|
59
51
|
options = false
|
|
60
52
|
end
|
|
@@ -27,18 +27,22 @@ export declare class SpawnRockAltRewards extends Feature {
|
|
|
27
27
|
* The logic in this function is based on the rewards listed on the wiki:
|
|
28
28
|
* https://bindingofisaacrebirth.fandom.com/wiki/Rocks
|
|
29
29
|
*
|
|
30
|
+
* If you want to spawn an unseeded reward, you must explicitly pass `undefined` to the
|
|
31
|
+
* `seedOrRNG` parameter.
|
|
32
|
+
*
|
|
30
33
|
* In order to use this function, you must upgrade your mod with
|
|
31
34
|
* `ISCFeature.SPAWN_ALT_ROCK_REWARDS`.
|
|
32
35
|
*
|
|
33
36
|
* @param positionOrGridIndex The position or grid index to spawn the reward.
|
|
34
37
|
* @param rockAltType The type of reward to spawn. For example, `RockAltType.URN` will have a
|
|
35
38
|
* chance at spawning coins and spiders.
|
|
36
|
-
* @param seedOrRNG
|
|
37
|
-
* the
|
|
38
|
-
*
|
|
39
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. Normally, you should pass the `InitSeed` of
|
|
40
|
+
* the grid entity that was broken. If an `RNG` object is provided, the
|
|
41
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
42
|
+
* to a random seed.
|
|
39
43
|
* @returns Whether this function spawned something.
|
|
40
44
|
*/
|
|
41
|
-
spawnRockAltReward(positionOrGridIndex: Vector | int, rockAltType: RockAltType, seedOrRNG
|
|
45
|
+
spawnRockAltReward(positionOrGridIndex: Vector | int, rockAltType: RockAltType, seedOrRNG: Seed | RNG | undefined): boolean;
|
|
42
46
|
/**
|
|
43
47
|
* Helper function for emulating what happens when a vanilla `GridEntityType.ROCK_ALT` grid entity
|
|
44
48
|
* breaks of `RockAltType.URN`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpawnRockAltRewards.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SpawnRockAltRewards.ts"],"names":[],"mappings":";;;;AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAkBzD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAwBhD,qBAAa,mBAAoB,SAAQ,OAAO;IAC9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAoB;IAWtD
|
|
1
|
+
{"version":3,"file":"SpawnRockAltRewards.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/SpawnRockAltRewards.ts"],"names":[],"mappings":";;;;AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAkBzD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAwBhD,qBAAa,mBAAoB,SAAQ,OAAO;IAC9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAoB;IAWtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IAEI,kBAAkB,CACvB,mBAAmB,EAAE,MAAM,GAAG,GAAG,EACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,OAAO;IAkCV;;;;;;;;OAQG;IAEI,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO;IAwDjE;;;;;;;;OAQG;IAEI,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO;IA+EtE;;;;;;;;OAQG;IAEI,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO;IA6DnE;;;;;;;;OAQG;IAEI,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO;IAoEnE;;;;;;;;OAQG;IAEI,gCAAgC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO;IA2E5E;;;;;;;;OAQG;IAEI,6BAA6B,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO;CAsE1E"}
|
|
@@ -38,7 +38,6 @@ local fireProjectilesInCircle = ____projectiles.fireProjectilesInCircle
|
|
|
38
38
|
local ____random = require("src.functions.random")
|
|
39
39
|
local getRandom = ____random.getRandom
|
|
40
40
|
local ____rng = require("src.functions.rng")
|
|
41
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
42
41
|
local isRNG = ____rng.isRNG
|
|
43
42
|
local newRNG = ____rng.newRNG
|
|
44
43
|
local ____spawnCollectible = require("src.functions.spawnCollectible")
|
|
@@ -68,9 +67,6 @@ function SpawnRockAltRewards.prototype.____constructor(self, itemPoolDetection)
|
|
|
68
67
|
self.itemPoolDetection = itemPoolDetection
|
|
69
68
|
end
|
|
70
69
|
function SpawnRockAltRewards.prototype.spawnRockAltReward(self, positionOrGridIndex, rockAltType, seedOrRNG)
|
|
71
|
-
if seedOrRNG == nil then
|
|
72
|
-
seedOrRNG = getRandomSeed(nil)
|
|
73
|
-
end
|
|
74
70
|
local room = game:GetRoom()
|
|
75
71
|
local position = isVector(nil, positionOrGridIndex) and positionOrGridIndex or room:GetGridPosition(positionOrGridIndex)
|
|
76
72
|
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
@@ -8,6 +8,6 @@ import type { CustomStageBossPoolEntry, CustomStageRoomMetadata } from "../../..
|
|
|
8
8
|
* properly account for each room weight using the algorithm from:
|
|
9
9
|
* https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
10
10
|
*/
|
|
11
|
-
export declare function getRandomCustomStageRoom(roomsMetadata: readonly CustomStageRoomMetadata[], seedOrRNG
|
|
12
|
-
export declare function getRandomBossRoomFromPool(roomsMetadata: readonly CustomStageRoomMetadata[], bossPool: readonly CustomStageBossPoolEntry[], seedOrRNG
|
|
11
|
+
export declare function getRandomCustomStageRoom(roomsMetadata: readonly CustomStageRoomMetadata[], seedOrRNG: Seed | RNG | undefined, verbose?: boolean): CustomStageRoomMetadata;
|
|
12
|
+
export declare function getRandomBossRoomFromPool(roomsMetadata: readonly CustomStageRoomMetadata[], bossPool: readonly CustomStageBossPoolEntry[], seedOrRNG: Seed | RNG | undefined, verbose?: boolean): CustomStageRoomMetadata;
|
|
13
13
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/customStages/utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/classes/features/other/customStages/utils.ts"],"names":[],"mappings":";;AAGA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,4CAA4C,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,SAAS,uBAAuB,EAAE,EACjD,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,EACjC,OAAO,UAAQ,GACd,uBAAuB,CAYzB;AA0BD,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,SAAS,uBAAuB,EAAE,EACjD,QAAQ,EAAE,SAAS,wBAAwB,EAAE,EAC7C,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,EACjC,OAAO,UAAQ,GACd,uBAAuB,CAiBzB"}
|
|
@@ -9,8 +9,6 @@ local ____log = require("src.functions.log")
|
|
|
9
9
|
local log = ____log.log
|
|
10
10
|
local ____random = require("src.functions.random")
|
|
11
11
|
local getRandomFloat = ____random.getRandomFloat
|
|
12
|
-
local ____rng = require("src.functions.rng")
|
|
13
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
14
12
|
function getTotalWeightOfCustomStageRooms(self, roomsMetadata)
|
|
15
13
|
local weights = __TS__ArrayMap(
|
|
16
14
|
roomsMetadata,
|
|
@@ -49,9 +47,6 @@ end
|
|
|
49
47
|
-- properly account for each room weight using the algorithm from:
|
|
50
48
|
-- https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
51
49
|
function ____exports.getRandomCustomStageRoom(self, roomsMetadata, seedOrRNG, verbose)
|
|
52
|
-
if seedOrRNG == nil then
|
|
53
|
-
seedOrRNG = getRandomSeed(nil)
|
|
54
|
-
end
|
|
55
50
|
if verbose == nil then
|
|
56
51
|
verbose = false
|
|
57
52
|
end
|
|
@@ -66,9 +61,6 @@ function ____exports.getRandomCustomStageRoom(self, roomsMetadata, seedOrRNG, ve
|
|
|
66
61
|
return getCustomStageRoomWithChosenWeight(nil, roomsMetadata, chosenWeight)
|
|
67
62
|
end
|
|
68
63
|
function ____exports.getRandomBossRoomFromPool(self, roomsMetadata, bossPool, seedOrRNG, verbose)
|
|
69
|
-
if seedOrRNG == nil then
|
|
70
|
-
seedOrRNG = getRandomSeed(nil)
|
|
71
|
-
end
|
|
72
64
|
if verbose == nil then
|
|
73
65
|
verbose = false
|
|
74
66
|
end
|
|
@@ -233,7 +233,7 @@ function ____exports.spawnCollectible(self, params)
|
|
|
233
233
|
end
|
|
234
234
|
local roomClass = game:GetRoom()
|
|
235
235
|
local centerPos = roomClass:GetCenterPos()
|
|
236
|
-
spawnCollectibleUnsafe(nil, collectibleType, centerPos)
|
|
236
|
+
spawnCollectibleUnsafe(nil, collectibleType, centerPos, nil)
|
|
237
237
|
end
|
|
238
238
|
--- The same thing as the `spawnTrinket` command but spawns a golden version of the specified
|
|
239
239
|
-- trinket.
|
|
@@ -1284,7 +1284,7 @@ function ____exports.spawnCollectibleAt(self, params)
|
|
|
1284
1284
|
return
|
|
1285
1285
|
end
|
|
1286
1286
|
local collectibleType = asCollectibleType(nil, collectibleTypeNumber)
|
|
1287
|
-
spawnCollectibleUnsafe(nil, collectibleType, gridIndex)
|
|
1287
|
+
spawnCollectibleUnsafe(nil, collectibleType, gridIndex, nil)
|
|
1288
1288
|
end
|
|
1289
1289
|
--- Alias for the `spawnGoldenTrinket` command.
|
|
1290
1290
|
function ____exports.spawnGoldTrinket(self, params)
|
|
@@ -153,32 +153,44 @@ export declare function getLowestArrayElement(array: number[]): number | undefin
|
|
|
153
153
|
/**
|
|
154
154
|
* Helper function to get a random element from the provided array.
|
|
155
155
|
*
|
|
156
|
+
* If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
157
|
+
* parameter.
|
|
158
|
+
*
|
|
156
159
|
* @param array The array to get an element from.
|
|
157
|
-
* @param seedOrRNG
|
|
158
|
-
* `RNG.Next` method will be called.
|
|
160
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
161
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
162
|
+
* a random seed.
|
|
159
163
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
160
164
|
*/
|
|
161
|
-
export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seedOrRNG
|
|
165
|
+
export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seedOrRNG: Seed | RNG | undefined, exceptions?: T[] | readonly T[]): T;
|
|
162
166
|
/**
|
|
163
167
|
* Helper function to get a random element from the provided array. Once the random element is
|
|
164
168
|
* decided, it is then removed from the array (in-place).
|
|
165
169
|
*
|
|
170
|
+
* If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
171
|
+
* parameter.
|
|
172
|
+
*
|
|
166
173
|
* @param array The array to get an element from.
|
|
167
|
-
* @param seedOrRNG
|
|
168
|
-
* `RNG.Next` method will be called.
|
|
174
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
175
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
176
|
+
* a random seed.
|
|
169
177
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
170
178
|
*/
|
|
171
|
-
export declare function getRandomArrayElementAndRemove<T>(array: T[], seedOrRNG
|
|
179
|
+
export declare function getRandomArrayElementAndRemove<T>(array: T[], seedOrRNG: Seed | RNG | undefined, exceptions?: T[] | readonly T[]): T;
|
|
172
180
|
/**
|
|
173
181
|
* Helper function to get a random index from the provided array.
|
|
174
182
|
*
|
|
183
|
+
* If you want to get an unseeded index, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
184
|
+
* parameter.
|
|
185
|
+
*
|
|
175
186
|
* @param array The array to get the index from.
|
|
176
|
-
* @param seedOrRNG
|
|
177
|
-
* `RNG.Next` method will be called.
|
|
187
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
188
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
189
|
+
* a random seed.
|
|
178
190
|
* @param exceptions Optional. An array of indexes that will be skipped over when getting the random
|
|
179
191
|
* index. Default is an empty array.
|
|
180
192
|
*/
|
|
181
|
-
export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seedOrRNG
|
|
193
|
+
export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seedOrRNG: Seed | RNG | undefined, exceptions?: int[] | readonly int[]): int;
|
|
182
194
|
/**
|
|
183
195
|
* Similar to the `Array.includes` method, but works on a widened version of the array.
|
|
184
196
|
*
|
|
@@ -211,23 +223,31 @@ export declare function setAllArrayElements<T>(array: T[], value: T): void;
|
|
|
211
223
|
/**
|
|
212
224
|
* Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
|
|
213
225
|
*
|
|
226
|
+
* If you want an unseeded shuffle, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
227
|
+
* parameter.
|
|
228
|
+
*
|
|
214
229
|
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
215
230
|
*
|
|
216
231
|
* @param originalArray The array to shuffle.
|
|
217
|
-
* @param seedOrRNG
|
|
218
|
-
* `RNG.Next` method will be called.
|
|
232
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
233
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
234
|
+
* a random seed.
|
|
219
235
|
*/
|
|
220
|
-
export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seedOrRNG
|
|
236
|
+
export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seedOrRNG: Seed | RNG | undefined): T[];
|
|
221
237
|
/**
|
|
222
238
|
* Shuffles the provided array in-place using the Fisher-Yates algorithm.
|
|
223
239
|
*
|
|
240
|
+
* If you want an unseeded shuffle, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
241
|
+
* parameter.
|
|
242
|
+
*
|
|
224
243
|
* From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
225
244
|
*
|
|
226
245
|
* @param array The array to shuffle.
|
|
227
|
-
* @param seedOrRNG
|
|
228
|
-
* `RNG.Next` method will be called.
|
|
246
|
+
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
247
|
+
* `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
248
|
+
* a random seed.
|
|
229
249
|
*/
|
|
230
|
-
export declare function shuffleArrayInPlace<T>(array: T[], seedOrRNG
|
|
250
|
+
export declare function shuffleArrayInPlace<T>(array: T[], seedOrRNG: Seed | RNG | undefined): void;
|
|
231
251
|
/** Helper function to sum every value in an array together. */
|
|
232
252
|
export declare function sumArray(array: number[] | readonly number[]): number;
|
|
233
253
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/functions/array.ts"],"names":[],"mappings":";;;AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAM1D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,EAAE,GAAG,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,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAIjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,aAAa,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EACjC,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,CAAC,EAAE,CAKL;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,IAAI,CAWN;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM3E"}
|
|
@@ -24,7 +24,6 @@ local ReadonlySet = ____ReadonlySet.ReadonlySet
|
|
|
24
24
|
local ____random = require("src.functions.random")
|
|
25
25
|
local getRandomInt = ____random.getRandomInt
|
|
26
26
|
local ____rng = require("src.functions.rng")
|
|
27
|
-
local getRandomSeed = ____rng.getRandomSeed
|
|
28
27
|
local isRNG = ____rng.isRNG
|
|
29
28
|
local newRNG = ____rng.newRNG
|
|
30
29
|
local ____types = require("src.functions.types")
|
|
@@ -127,15 +126,16 @@ function addCombinations(self, n, src, got, all)
|
|
|
127
126
|
end
|
|
128
127
|
--- Helper function to get a random index from the provided array.
|
|
129
128
|
--
|
|
129
|
+
-- If you want to get an unseeded index, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
130
|
+
-- parameter.
|
|
131
|
+
--
|
|
130
132
|
-- @param array The array to get the index from.
|
|
131
|
-
-- @param seedOrRNG
|
|
132
|
-
-- `RNG.Next` method will be called.
|
|
133
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
134
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
135
|
+
-- a random seed.
|
|
133
136
|
-- @param exceptions Optional. An array of indexes that will be skipped over when getting the random
|
|
134
137
|
-- index. Default is an empty array.
|
|
135
138
|
function ____exports.getRandomArrayIndex(self, array, seedOrRNG, exceptions)
|
|
136
|
-
if seedOrRNG == nil then
|
|
137
|
-
seedOrRNG = getRandomSeed(nil)
|
|
138
|
-
end
|
|
139
139
|
if exceptions == nil then
|
|
140
140
|
exceptions = {}
|
|
141
141
|
end
|
|
@@ -152,15 +152,16 @@ function ____exports.getRandomArrayIndex(self, array, seedOrRNG, exceptions)
|
|
|
152
152
|
end
|
|
153
153
|
--- Shuffles the provided array in-place using the Fisher-Yates algorithm.
|
|
154
154
|
--
|
|
155
|
+
-- If you want an unseeded shuffle, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
156
|
+
-- parameter.
|
|
157
|
+
--
|
|
155
158
|
-- From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
156
159
|
--
|
|
157
160
|
-- @param array The array to shuffle.
|
|
158
|
-
-- @param seedOrRNG
|
|
159
|
-
-- `RNG.Next` method will be called.
|
|
161
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
162
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
163
|
+
-- a random seed.
|
|
160
164
|
function ____exports.shuffleArrayInPlace(self, array, seedOrRNG)
|
|
161
|
-
if seedOrRNG == nil then
|
|
162
|
-
seedOrRNG = getRandomSeed(nil)
|
|
163
|
-
end
|
|
164
165
|
local currentIndex = #array
|
|
165
166
|
local rng = isRNG(nil, seedOrRNG) and seedOrRNG or newRNG(nil, seedOrRNG)
|
|
166
167
|
while currentIndex > 0 do
|
|
@@ -405,14 +406,15 @@ function ____exports.getLowestArrayElement(self, array)
|
|
|
405
406
|
end
|
|
406
407
|
--- Helper function to get a random element from the provided array.
|
|
407
408
|
--
|
|
409
|
+
-- If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
410
|
+
-- parameter.
|
|
411
|
+
--
|
|
408
412
|
-- @param array The array to get an element from.
|
|
409
|
-
-- @param seedOrRNG
|
|
410
|
-
-- `RNG.Next` method will be called.
|
|
413
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
414
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
415
|
+
-- a random seed.
|
|
411
416
|
-- @param exceptions Optional. An array of elements to skip over if selected.
|
|
412
417
|
function ____exports.getRandomArrayElement(self, array, seedOrRNG, exceptions)
|
|
413
|
-
if seedOrRNG == nil then
|
|
414
|
-
seedOrRNG = getRandomSeed(nil)
|
|
415
|
-
end
|
|
416
418
|
if exceptions == nil then
|
|
417
419
|
exceptions = {}
|
|
418
420
|
end
|
|
@@ -436,14 +438,15 @@ end
|
|
|
436
438
|
--- Helper function to get a random element from the provided array. Once the random element is
|
|
437
439
|
-- decided, it is then removed from the array (in-place).
|
|
438
440
|
--
|
|
441
|
+
-- If you want to get an unseeded element, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
442
|
+
-- parameter.
|
|
443
|
+
--
|
|
439
444
|
-- @param array The array to get an element from.
|
|
440
|
-
-- @param seedOrRNG
|
|
441
|
-
-- `RNG.Next` method will be called.
|
|
445
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
446
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
447
|
+
-- a random seed.
|
|
442
448
|
-- @param exceptions Optional. An array of elements to skip over if selected.
|
|
443
449
|
function ____exports.getRandomArrayElementAndRemove(self, array, seedOrRNG, exceptions)
|
|
444
|
-
if seedOrRNG == nil then
|
|
445
|
-
seedOrRNG = getRandomSeed(nil)
|
|
446
|
-
end
|
|
447
450
|
if exceptions == nil then
|
|
448
451
|
exceptions = {}
|
|
449
452
|
end
|
|
@@ -538,15 +541,16 @@ function ____exports.setAllArrayElements(self, array, value)
|
|
|
538
541
|
end
|
|
539
542
|
--- Shallow copies and shuffles the array using the Fisher-Yates algorithm. Returns the copied array.
|
|
540
543
|
--
|
|
544
|
+
-- If you want an unseeded shuffle, you must explicitly pass `undefined` to the `seedOrRNG`
|
|
545
|
+
-- parameter.
|
|
546
|
+
--
|
|
541
547
|
-- From: https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
|
|
542
548
|
--
|
|
543
549
|
-- @param originalArray The array to shuffle.
|
|
544
|
-
-- @param seedOrRNG
|
|
545
|
-
-- `RNG.Next` method will be called.
|
|
550
|
+
-- @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
551
|
+
-- `RNG.Next` method will be called. If `undefined` is provided, it will default to
|
|
552
|
+
-- a random seed.
|
|
546
553
|
function ____exports.shuffleArray(self, originalArray, seedOrRNG)
|
|
547
|
-
if seedOrRNG == nil then
|
|
548
|
-
seedOrRNG = getRandomSeed(nil)
|
|
549
|
-
end
|
|
550
554
|
local array = ____exports.copyArray(nil, originalArray)
|
|
551
555
|
____exports.shuffleArrayInPlace(nil, array, seedOrRNG)
|
|
552
556
|
return array
|