isaacscript-common 21.9.0 → 23.0.0

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.
Files changed (45) hide show
  1. package/dist/index.rollup.d.ts +61 -45
  2. package/dist/isaacscript-common.lua +202 -177
  3. package/dist/lualib_bundle.lua +59 -100
  4. package/dist/src/functions/characters.d.ts +8 -1
  5. package/dist/src/functions/characters.d.ts.map +1 -1
  6. package/dist/src/functions/characters.lua +9 -0
  7. package/dist/src/functions/color.d.ts +1 -1
  8. package/dist/src/functions/color.d.ts.map +1 -1
  9. package/dist/src/functions/hex.d.ts +2 -2
  10. package/dist/src/functions/hex.d.ts.map +1 -1
  11. package/dist/src/functions/isaacAPIClass.d.ts +1 -1
  12. package/dist/src/functions/isaacAPIClass.d.ts.map +1 -1
  13. package/dist/src/functions/isaacAPIClass.lua +1 -1
  14. package/dist/src/functions/kColor.d.ts +1 -1
  15. package/dist/src/functions/kColor.d.ts.map +1 -1
  16. package/dist/src/functions/log.d.ts +1 -1
  17. package/dist/src/functions/log.d.ts.map +1 -1
  18. package/dist/src/functions/log.lua +5 -0
  19. package/dist/src/functions/players.d.ts +28 -21
  20. package/dist/src/functions/players.d.ts.map +1 -1
  21. package/dist/src/functions/players.lua +60 -51
  22. package/dist/src/functions/positionVelocity.d.ts +1 -1
  23. package/dist/src/functions/positionVelocity.d.ts.map +1 -1
  24. package/dist/src/functions/roomGrid.d.ts +5 -5
  25. package/dist/src/functions/roomGrid.d.ts.map +1 -1
  26. package/dist/src/functions/ui.d.ts +8 -8
  27. package/dist/src/functions/ui.d.ts.map +1 -1
  28. package/dist/src/functions/vector.d.ts +1 -1
  29. package/dist/src/functions/vector.d.ts.map +1 -1
  30. package/dist/src/objects/characterStartingCollectibles.d.ts +46 -0
  31. package/dist/src/objects/characterStartingCollectibles.d.ts.map +1 -0
  32. package/dist/src/objects/characterStartingCollectibles.lua +49 -0
  33. package/package.json +1 -1
  34. package/src/functions/characters.ts +14 -1
  35. package/src/functions/color.ts +1 -1
  36. package/src/functions/hex.ts +2 -2
  37. package/src/functions/isaacAPIClass.ts +1 -1
  38. package/src/functions/kColor.ts +1 -1
  39. package/src/functions/log.ts +7 -1
  40. package/src/functions/players.ts +72 -57
  41. package/src/functions/positionVelocity.ts +1 -1
  42. package/src/functions/roomGrid.ts +14 -5
  43. package/src/functions/ui.ts +8 -8
  44. package/src/functions/vector.ts +1 -1
  45. package/src/objects/characterStartingCollectibles.ts +144 -0
@@ -7,7 +7,6 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
7
7
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
8
8
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
9
9
  local ____exports = {}
10
- local isTaintedModded
11
10
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
12
11
  local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
13
12
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
@@ -60,16 +59,20 @@ end
60
59
  function ____exports.isModdedPlayer(self, player)
61
60
  return not ____exports.isVanillaPlayer(nil, player)
62
61
  end
63
- function isTaintedModded(self, player)
64
- local character = player:GetPlayerType()
65
- local name = player:GetName()
66
- local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
67
- return character == taintedCharacter
68
- end
69
62
  function ____exports.isVanillaPlayer(self, player)
70
63
  local character = player:GetPlayerType()
71
64
  return isVanillaCharacter(nil, character)
72
65
  end
66
+ --- Helper function to add one or more collectibles to a player.
67
+ --
68
+ -- This function is variadic, meaning that you can supply as many collectible types as you want to
69
+ -- add.
70
+ function ____exports.addCollectible(self, player, ...)
71
+ local collectibleTypes = {...}
72
+ for ____, collectibleType in ipairs(collectibleTypes) do
73
+ player:AddCollectible(collectibleType)
74
+ end
75
+ end
73
76
  function ____exports.addCollectibleCostume(self, player, collectibleType)
74
77
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
75
78
  if itemConfigItem == nil then
@@ -383,6 +386,28 @@ function ____exports.getTotalPlayerCollectibles(self, collectibleType)
383
386
  )
384
387
  return sumArray(nil, numCollectiblesArray)
385
388
  end
389
+ --- Helper function to check to see if a player has one or more collectibles.
390
+ --
391
+ -- This function is variadic, meaning that you can supply as many collectible types as you want to
392
+ -- check for. Returns true if the player has any of the supplied collectible types.
393
+ function ____exports.hasCollectible(self, player, ...)
394
+ local collectibleTypes = {...}
395
+ return __TS__ArraySome(
396
+ collectibleTypes,
397
+ function(____, collectibleType) return player:HasCollectible(collectibleType) end
398
+ )
399
+ end
400
+ --- Helper function to check to see if a player has one or more transformations.
401
+ --
402
+ -- This function is variadic, meaning that you can supply as many transformations as you want to
403
+ -- check for. Returns true if the player has any of the supplied transformations.
404
+ function ____exports.hasForm(self, player, ...)
405
+ local playerForms = {...}
406
+ return __TS__ArraySome(
407
+ playerForms,
408
+ function(____, playerForm) return player:HasPlayerForm(playerForm) end
409
+ )
410
+ end
386
411
  --- After touching a white fire, a player will turn into The Lost until they clear a room.
387
412
  function ____exports.hasLostCurse(self, player)
388
413
  local effects = player:GetEffects()
@@ -459,6 +484,12 @@ function ____exports.isLost(self, player)
459
484
  local character = player:GetPlayerType()
460
485
  return character == PlayerType.LOST or character == PlayerType.LOST_B
461
486
  end
487
+ local function isTaintedModded(self, player)
488
+ local character = player:GetPlayerType()
489
+ local name = player:GetName()
490
+ local taintedCharacter = Isaac.GetPlayerTypeByName(name, true)
491
+ return character == taintedCharacter
492
+ end
462
493
  --- Helper function for determining if a player is able to turn their head by pressing the shooting
463
494
  -- buttons.
464
495
  --
@@ -482,38 +513,6 @@ function ____exports.isTaintedLazarus(self, player)
482
513
  local character = player:GetPlayerType()
483
514
  return character == PlayerType.LAZARUS_B or character == PlayerType.LAZARUS_2_B
484
515
  end
485
- --- Helper function to add one or more collectibles to a player.
486
- --
487
- -- This function is variadic, meaning that you can supply as many collectible types as you want to
488
- -- add.
489
- function ____exports.playerAddCollectible(self, player, ...)
490
- local collectibleTypes = {...}
491
- for ____, collectibleType in ipairs(collectibleTypes) do
492
- player:AddCollectible(collectibleType)
493
- end
494
- end
495
- --- Helper function to check to see if a player has one or more collectibles.
496
- --
497
- -- This function is variadic, meaning that you can supply as many collectible types as you want to
498
- -- check for. Returns true if the player has any of the supplied collectible types.
499
- function ____exports.playerHasCollectible(self, player, ...)
500
- local collectibleTypes = {...}
501
- return __TS__ArraySome(
502
- collectibleTypes,
503
- function(____, collectibleType) return player:HasCollectible(collectibleType) end
504
- )
505
- end
506
- --- Helper function to check to see if a player has one or more transformations.
507
- --
508
- -- This function is variadic, meaning that you can supply as many transformations as you want to
509
- -- check for. Returns true if the player has any of the supplied transformations.
510
- function ____exports.playerHasForm(self, player, ...)
511
- local playerForms = {...}
512
- return __TS__ArraySome(
513
- playerForms,
514
- function(____, playerForm) return player:HasPlayerForm(playerForm) end
515
- )
516
- end
517
516
  --- Helper function to remove all of the active items from a player. This includes the Schoolbag item
518
517
  -- and any pocket actives.
519
518
  function ____exports.removeAllActiveItems(self, player)
@@ -523,13 +522,13 @@ function ____exports.removeAllActiveItems(self, player)
523
522
  if collectibleType == CollectibleType.NULL then
524
523
  goto __continue93
525
524
  end
526
- local hasCollectible
525
+ local stillHasCollectible
527
526
  repeat
528
527
  do
529
528
  player:RemoveCollectible(collectibleType)
530
- hasCollectible = player:HasCollectible(collectibleType)
529
+ stillHasCollectible = player:HasCollectible(collectibleType)
531
530
  end
532
- until not hasCollectible
531
+ until not stillHasCollectible
533
532
  end
534
533
  ::__continue93::
535
534
  end
@@ -556,6 +555,16 @@ function ____exports.removeAllPlayerTrinkets(self, player)
556
555
  ::__continue98::
557
556
  end
558
557
  end
558
+ --- Helper function to remove one or more collectibles to a player.
559
+ --
560
+ -- This function is variadic, meaning that you can supply as many collectible types as you want to
561
+ -- remove.
562
+ function ____exports.removeCollectible(self, player, ...)
563
+ local collectibleTypes = {...}
564
+ for ____, collectibleType in ipairs(collectibleTypes) do
565
+ player:RemoveCollectible(collectibleType)
566
+ end
567
+ end
559
568
  --- Helper function to remove a collectible costume from a player. Use this helper function to avoid
560
569
  -- having to request the collectible from the item config.
561
570
  function ____exports.removeCollectibleCostume(self, player, collectibleType)
@@ -634,9 +643,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
634
643
  itemPool:RemoveCollectible(collectibleType)
635
644
  end
636
645
  repeat
637
- local ____switch117 = activeSlot
638
- local ____cond117 = ____switch117 == ActiveSlot.PRIMARY
639
- if ____cond117 then
646
+ local ____switch120 = activeSlot
647
+ local ____cond120 = ____switch120 == ActiveSlot.PRIMARY
648
+ if ____cond120 then
640
649
  do
641
650
  if primaryCollectibleType ~= CollectibleType.NULL then
642
651
  player:RemoveCollectible(primaryCollectibleType)
@@ -645,8 +654,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
645
654
  break
646
655
  end
647
656
  end
648
- ____cond117 = ____cond117 or ____switch117 == ActiveSlot.SECONDARY
649
- if ____cond117 then
657
+ ____cond120 = ____cond120 or ____switch120 == ActiveSlot.SECONDARY
658
+ if ____cond120 then
650
659
  do
651
660
  if primaryCollectibleType ~= CollectibleType.NULL then
652
661
  player:RemoveCollectible(primaryCollectibleType)
@@ -661,16 +670,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
661
670
  break
662
671
  end
663
672
  end
664
- ____cond117 = ____cond117 or ____switch117 == ActiveSlot.POCKET
665
- if ____cond117 then
673
+ ____cond120 = ____cond120 or ____switch120 == ActiveSlot.POCKET
674
+ if ____cond120 then
666
675
  do
667
676
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
668
677
  player:SetActiveCharge(charge, activeSlot)
669
678
  break
670
679
  end
671
680
  end
672
- ____cond117 = ____cond117 or ____switch117 == ActiveSlot.POCKET_SINGLE_USE
673
- if ____cond117 then
681
+ ____cond120 = ____cond120 or ____switch120 == ActiveSlot.POCKET_SINGLE_USE
682
+ if ____cond120 then
674
683
  do
675
684
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
676
685
  break
@@ -23,7 +23,7 @@ export declare function anyPlayerCloserThan(position: Vector, distance: float):
23
23
  * @param minimumDistance Optional. If specified, will ensure that the randomly generated position
24
24
  * is equal to or greater than the distance provided.
25
25
  */
26
- export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Vector;
26
+ export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Readonly<Vector>;
27
27
  /**
28
28
  * Helper function to get a map containing the positions of every entity in the current room.
29
29
  *
@@ -1 +1 @@
1
- {"version":3,"file":"positionVelocity.d.ts","sourceRoot":"","sources":["../../../src/functions/positionVelocity.ts"],"names":[],"mappings":";;;;AAaA,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,GAAG,GACZ,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,KAAK,GACd,OAAO,CAKT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,UAAQ,EAC3B,eAAe,CAAC,EAAE,KAAK,GACtB,MAAM,CA4CR;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAY7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAClB,IAAI,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@@ import { RoomShape } from "isaac-typescript-definitions";
12
12
  *
13
13
  * For example, the coordinates of (0, 0) are equal to `Vector(80, 160)`.
14
14
  */
15
- export declare function gridCoordinatesToWorldPosition(x: int, y: int): Vector;
15
+ export declare function gridCoordinatesToWorldPosition(x: int, y: int): Readonly<Vector>;
16
16
  /**
17
17
  * Helper function to convert a grid index to a grid position.
18
18
  *
19
19
  * For example, in a 1x1 room, grid index 0 is equal to "Vector(-1, -1) and grid index 16 is equal
20
20
  * to "Vector(0, 0)".
21
21
  */
22
- export declare function gridIndexToGridPosition(gridIndex: int, roomShape: RoomShape): Vector;
22
+ export declare function gridIndexToGridPosition(gridIndex: int, roomShape: RoomShape): Readonly<Vector>;
23
23
  /**
24
24
  * Helper function to convert a grid position `Vector` to a world position `Vector`.
25
25
  *
26
26
  * For example, the coordinates of (0, 0) are equal to `Vector(80, 160)`.
27
27
  */
28
- export declare function gridPositionToWorldPosition(gridPosition: Vector): Vector;
28
+ export declare function gridPositionToWorldPosition(gridPosition: Vector): Readonly<Vector>;
29
29
  /**
30
30
  * Test if a grid position is actually in the given `RoomShape`.
31
31
  *
@@ -37,7 +37,7 @@ export declare function isValidGridPosition(gridPosition: Vector, roomShape: Roo
37
37
  *
38
38
  * In this context, the grid position of the top-left wall is "Vector(-1, -1)".
39
39
  */
40
- export declare function worldPositionToGridPosition(worldPos: Vector): Vector;
40
+ export declare function worldPositionToGridPosition(worldPos: Vector): Readonly<Vector>;
41
41
  /**
42
42
  * Helper function to convert a world position `Vector` to a grid position `Vector`.
43
43
  *
@@ -45,5 +45,5 @@ export declare function worldPositionToGridPosition(worldPos: Vector): Vector;
45
45
  *
46
46
  * This is similar to the `worldPositionToGridPosition` function, but the values are not rounded.
47
47
  */
48
- export declare function worldPositionToGridPositionFast(worldPos: Vector): Vector;
48
+ export declare function worldPositionToGridPositionFast(worldPos: Vector): Readonly<Vector>;
49
49
  //# sourceMappingURL=roomGrid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"roomGrid.d.ts","sourceRoot":"","sources":["../../../src/functions/roomGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAUzD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,SAAS,GACnB,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAKxE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,SAAS,GACnB,OAAO,CAIT;AA0BD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIpE;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIxE"}
1
+ {"version":3,"file":"roomGrid.d.ts","sourceRoot":"","sources":["../../../src/functions/roomGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAUzD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,CAAC,EAAE,GAAG,EACN,CAAC,EAAE,GAAG,GACL,QAAQ,CAAC,MAAM,CAAC,CAGlB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,SAAS,GACnB,QAAQ,CAAC,MAAM,CAAC,CAMlB;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,MAAM,GACnB,QAAQ,CAAC,MAAM,CAAC,CAKlB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,SAAS,GACnB,OAAO,CAIT;AA0BD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GACf,QAAQ,CAAC,MAAM,CAAC,CAIlB;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,MAAM,GACf,QAAQ,CAAC,MAAM,CAAC,CAIlB"}
@@ -11,7 +11,7 @@
11
11
  * - If the user does not have a HUD offset configured, this function will return `Vector(0, 0)`.
12
12
  * - If the user has a HUD offset of 1.0 configured, this function will return `Vector(20, 12)`.
13
13
  */
14
- export declare function getHUDOffsetVector(): Vector;
14
+ export declare function getHUDOffsetVector(): Readonly<Vector>;
15
15
  /**
16
16
  * Returns how many hearts are in the heart UI row. If the player has more than 6 hearts, this
17
17
  * function will return 6.
@@ -23,13 +23,13 @@ export declare function getHeartRowLength(player: EntityPlayer): int;
23
23
  * combination with the `getHUDOffsetVector` helper function.
24
24
  */
25
25
  export declare function getHeartsUIWidth(): int;
26
- export declare function getScreenBottomCenterPos(): Vector;
27
- export declare function getScreenBottomLeftPos(): Vector;
28
- export declare function getScreenBottomRightPos(): Vector;
29
- export declare function getScreenCenterPos(): Vector;
30
- export declare function getScreenTopCenterPos(): Vector;
31
- export declare function getScreenTopLeftPos(): Vector;
32
- export declare function getScreenTopRightPos(): Vector;
26
+ export declare function getScreenBottomCenterPos(): Readonly<Vector>;
27
+ export declare function getScreenBottomLeftPos(): Readonly<Vector>;
28
+ export declare function getScreenBottomRightPos(): Readonly<Vector>;
29
+ export declare function getScreenCenterPos(): Readonly<Vector>;
30
+ export declare function getScreenTopCenterPos(): Readonly<Vector>;
31
+ export declare function getScreenTopLeftPos(): Readonly<Vector>;
32
+ export declare function getScreenTopRightPos(): Readonly<Vector>;
33
33
  /**
34
34
  * Get how many hearts are currently being shown on the hearts UI.
35
35
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/functions/ui.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAmB3C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAU3D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAgCtC;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAGjD;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAG/C;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAKhD;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAG9C;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAa1D"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/functions/ui.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAmBrD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAU3D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,CAgCtC;AAED,wBAAgB,wBAAwB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAG3D;AAED,wBAAgB,sBAAsB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGzD;AAED,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAK1D;AAED,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGrD;AAED,wBAAgB,qBAAqB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGxD;AAED,wBAAgB,mBAAmB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAEtD;AAED,wBAAgB,oBAAoB,IAAI,QAAQ,CAAC,MAAM,CAAC,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAa1D"}
@@ -33,7 +33,7 @@ export declare function doesVectorHaveLength(vector: Vector, threshold?: number)
33
33
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
34
34
  * `RNG.Next` method will be called. Default is `getRandomSeed()`.
35
35
  */
36
- export declare function getRandomVector(seedOrRNG?: Seed | RNG): Vector;
36
+ export declare function getRandomVector(seedOrRNG?: Seed | RNG): Readonly<Vector>;
37
37
  /**
38
38
  * Used to determine is the given table is a serialized `Vector` object created by the `deepCopy`
39
39
  * function.
@@ -1 +1 @@
1
- {"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/functions/vector.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AAatC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACvD,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC,MAAM,CAAC;CACnD,CAAC;AAKF,0DAA0D;AAC1D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,SAAO,GACf,OAAO,CAET;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,SAAS,GAAE,IAAI,GAAG,GAAqB,GACtC,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAA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AAO,GACd,MAAM,IAAI,gBAAgB,CAM5B;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAWhE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAG3D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,MAAM,CAIpE"}
@@ -0,0 +1,46 @@
1
+ import { CollectibleType } from "isaac-typescript-definitions";
2
+ export declare const CHARACTER_STARTING_COLLECTIBLES: {
3
+ readonly [-1]: readonly [];
4
+ readonly 0: readonly [CollectibleType.D6];
5
+ readonly 1: readonly [CollectibleType.YUM_HEART];
6
+ readonly 2: readonly [CollectibleType.LUCKY_FOOT];
7
+ readonly 3: readonly [CollectibleType.BOOK_OF_BELIAL];
8
+ readonly 4: readonly [CollectibleType.POOP];
9
+ readonly 5: readonly [CollectibleType.DEAD_BIRD, CollectibleType.WHORE_OF_BABYLON, CollectibleType.RAZOR_BLADE];
10
+ readonly 6: readonly [CollectibleType.BLOODY_LUST];
11
+ readonly 7: readonly [];
12
+ readonly 8: readonly [CollectibleType.ANEMIC];
13
+ readonly 9: readonly [];
14
+ readonly 10: readonly [CollectibleType.ETERNAL_D6];
15
+ readonly 11: readonly [CollectibleType.ANEMIC];
16
+ readonly 12: readonly [];
17
+ readonly 13: readonly [CollectibleType.BOX_OF_FRIENDS, CollectibleType.CAMBION_CONCEPTION];
18
+ readonly 14: readonly [CollectibleType.WOODEN_NICKEL];
19
+ readonly 15: readonly [CollectibleType.VOID];
20
+ readonly 16: readonly [];
21
+ readonly 17: readonly [];
22
+ readonly 18: readonly [CollectibleType.BOOK_OF_VIRTUES];
23
+ readonly 19: readonly [];
24
+ readonly 20: readonly [];
25
+ readonly 21: readonly [];
26
+ readonly 22: readonly [CollectibleType.YUM_HEART];
27
+ readonly 23: readonly [CollectibleType.BAG_OF_CRAFTING];
28
+ readonly 24: readonly [CollectibleType.DARK_ARTS];
29
+ readonly 25: readonly [CollectibleType.HOLD];
30
+ readonly 26: readonly [CollectibleType.SUMPTORIUM];
31
+ readonly 27: readonly [];
32
+ readonly 28: readonly [];
33
+ readonly 29: readonly [CollectibleType.FLIP];
34
+ readonly 30: readonly [];
35
+ readonly 31: readonly [];
36
+ readonly 32: readonly [];
37
+ readonly 33: readonly [];
38
+ readonly 34: readonly [CollectibleType.ABYSS];
39
+ readonly 35: readonly [];
40
+ readonly 36: readonly [CollectibleType.LEMEGETON];
41
+ readonly 37: readonly [CollectibleType.ANIMA_SOLA];
42
+ readonly 38: readonly [CollectibleType.FLIP];
43
+ readonly 39: readonly [CollectibleType.ANIMA_SOLA];
44
+ readonly 40: readonly [];
45
+ };
46
+ //# sourceMappingURL=characterStartingCollectibles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"characterStartingCollectibles.d.ts","sourceRoot":"","sources":["../../../src/objects/characterStartingCollectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,8BAA8B,CAAC;AAE3E,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6IuB,CAAC"}
@@ -0,0 +1,49 @@
1
+ local ____exports = {}
2
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
+ local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
4
+ local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
5
+ ____exports.CHARACTER_STARTING_COLLECTIBLES = {
6
+ [PlayerType.POSSESSOR] = {},
7
+ [PlayerType.ISAAC] = {CollectibleType.D6},
8
+ [PlayerType.MAGDALENE] = {CollectibleType.YUM_HEART},
9
+ [PlayerType.CAIN] = {CollectibleType.LUCKY_FOOT},
10
+ [PlayerType.JUDAS] = {CollectibleType.BOOK_OF_BELIAL},
11
+ [PlayerType.BLUE_BABY] = {CollectibleType.POOP},
12
+ [PlayerType.EVE] = {CollectibleType.DEAD_BIRD, CollectibleType.WHORE_OF_BABYLON, CollectibleType.RAZOR_BLADE},
13
+ [PlayerType.SAMSON] = {CollectibleType.BLOODY_LUST},
14
+ [PlayerType.AZAZEL] = {},
15
+ [PlayerType.LAZARUS] = {CollectibleType.ANEMIC},
16
+ [PlayerType.EDEN] = {},
17
+ [PlayerType.LOST] = {CollectibleType.ETERNAL_D6},
18
+ [PlayerType.LAZARUS_2] = {CollectibleType.ANEMIC},
19
+ [PlayerType.DARK_JUDAS] = {},
20
+ [PlayerType.LILITH] = {CollectibleType.BOX_OF_FRIENDS, CollectibleType.CAMBION_CONCEPTION},
21
+ [PlayerType.KEEPER] = {CollectibleType.WOODEN_NICKEL},
22
+ [PlayerType.APOLLYON] = {CollectibleType.VOID},
23
+ [PlayerType.FORGOTTEN] = {},
24
+ [PlayerType.SOUL] = {},
25
+ [PlayerType.BETHANY] = {CollectibleType.BOOK_OF_VIRTUES},
26
+ [PlayerType.JACOB] = {},
27
+ [PlayerType.ESAU] = {},
28
+ [PlayerType.ISAAC_B] = {},
29
+ [PlayerType.MAGDALENE_B] = {CollectibleType.YUM_HEART},
30
+ [PlayerType.CAIN_B] = {CollectibleType.BAG_OF_CRAFTING},
31
+ [PlayerType.JUDAS_B] = {CollectibleType.DARK_ARTS},
32
+ [PlayerType.BLUE_BABY_B] = {CollectibleType.HOLD},
33
+ [PlayerType.EVE_B] = {CollectibleType.SUMPTORIUM},
34
+ [PlayerType.SAMSON_B] = {},
35
+ [PlayerType.AZAZEL_B] = {},
36
+ [PlayerType.LAZARUS_B] = {CollectibleType.FLIP},
37
+ [PlayerType.EDEN_B] = {},
38
+ [PlayerType.LOST_B] = {},
39
+ [PlayerType.LILITH_B] = {},
40
+ [PlayerType.KEEPER_B] = {},
41
+ [PlayerType.APOLLYON_B] = {CollectibleType.ABYSS},
42
+ [PlayerType.FORGOTTEN_B] = {},
43
+ [PlayerType.BETHANY_B] = {CollectibleType.LEMEGETON},
44
+ [PlayerType.JACOB_B] = {CollectibleType.ANIMA_SOLA},
45
+ [PlayerType.LAZARUS_2_B] = {CollectibleType.FLIP},
46
+ [PlayerType.JACOB_2_B] = {CollectibleType.ANIMA_SOLA},
47
+ [PlayerType.SOUL_B] = {}
48
+ }
49
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "21.9.0",
3
+ "version": "23.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,7 +1,8 @@
1
- import { PlayerType } from "isaac-typescript-definitions";
1
+ import { CollectibleType, PlayerType } from "isaac-typescript-definitions";
2
2
  import { LAST_VANILLA_CHARACTER } from "../core/constantsFirstLast";
3
3
  import { CHARACTER_DAMAGE_MULTIPLIERS } from "../objects/characterDamageMultipliers";
4
4
  import { CHARACTER_NAMES } from "../objects/characterNames";
5
+ import { CHARACTER_STARTING_COLLECTIBLES } from "../objects/characterStartingCollectibles";
5
6
  import { CHARACTERS_THAT_START_WITH_AN_ACTIVE_ITEM_SET } from "../sets/charactersThatStartWithAnActiveItemSet";
6
7
  import { CHARACTERS_WITH_BLACK_HEART_FROM_ETERNAL_HEART_SET } from "../sets/charactersWithBlackHeartFromEternalHeartSet";
7
8
  import { CHARACTERS_WITH_FREE_DEVIL_DEALS_SET } from "../sets/charactersWithFreeDevilDealsSet";
@@ -134,6 +135,18 @@ export function getCharacterName(character: PlayerType): string {
134
135
  return CHARACTER_NAMES[character];
135
136
  }
136
137
 
138
+ /**
139
+ * Helper function to get the collectibles that are granted to a particular character at the
140
+ * beginning of a run.
141
+ *
142
+ * Note that this will return an empty array for Eden and Tainted Eden.
143
+ */
144
+ export function getCharacterStartingItems(
145
+ character: PlayerType,
146
+ ): readonly CollectibleType[] {
147
+ return CHARACTER_STARTING_COLLECTIBLES[character];
148
+ }
149
+
137
150
  export function isFlyingCharacter(player: EntityPlayer): boolean {
138
151
  const character = player.GetPlayerType();
139
152
  return FLYING_CHARACTERS.has(character);
@@ -87,7 +87,7 @@ export function deserializeColor(color: SerializedColor): Color {
87
87
  export function getRandomColor(
88
88
  seedOrRNG: Seed | RNG = getRandomSeed(),
89
89
  alpha = 1,
90
- ): Color {
90
+ ): Readonly<Color> {
91
91
  const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
92
92
 
93
93
  const r = getRandom(rng);
@@ -8,7 +8,7 @@ const HEX_STRING_LENGTH = 6;
8
8
  * @param hexString A hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
9
9
  * @param alpha Optional. Range is from 0 to 1. Default is 1. (The same as the `Color` constructor.)
10
10
  */
11
- export function hexToColor(hexString: string, alpha = 1.0): Color {
11
+ export function hexToColor(hexString: string, alpha = 1.0): Readonly<Color> {
12
12
  const [r, g, b] = hexToRGB(hexString);
13
13
 
14
14
  // Color values should be between 0 and 1.
@@ -22,7 +22,7 @@ export function hexToColor(hexString: string, alpha = 1.0): Color {
22
22
  * @param hexString A hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
23
23
  * @param alpha Range is from 0 to 1. Default is 1.
24
24
  */
25
- export function hexToKColor(hexString: string, alpha = 1.0): KColor {
25
+ export function hexToKColor(hexString: string, alpha = 1.0): Readonly<KColor> {
26
26
  const [r, g, b] = hexToRGB(hexString);
27
27
 
28
28
  // KColor values should be between 0 and 1.
@@ -57,7 +57,7 @@ export function isEntity(variable: unknown): variable is Entity {
57
57
  return getIsaacAPIClassName(variable) === "Entity";
58
58
  }
59
59
 
60
- /** Helper function to detect if a variable is of type `EntityEffect`. */
60
+ /** Helper function to detect if a variable is of type `EntityFamiliar`. */
61
61
  export function isFamiliar(variable: unknown): variable is EntityFamiliar {
62
62
  return getIsaacAPIClassName(variable) === "EntityEffect";
63
63
  }
@@ -76,7 +76,7 @@ export function deserializeKColor(kColor: SerializedKColor): KColor {
76
76
  export function getRandomKColor(
77
77
  seedOrRNG: Seed | RNG = getRandomSeed(),
78
78
  alpha = 1,
79
- ): KColor {
79
+ ): Readonly<KColor> {
80
80
  const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
81
81
 
82
82
  const r = getRandom(rng);
@@ -1,3 +1,5 @@
1
+ import { isNumber } from "./types";
2
+
1
3
  /**
2
4
  * Helper function to get the name and the line number of the current calling function.
3
5
  *
@@ -53,9 +55,13 @@ export function getParentFunctionDescription(
53
55
  */
54
56
  export function log(
55
57
  this: void,
56
- msg: string,
58
+ msg: string | number,
57
59
  includeParentFunction = true,
58
60
  ): void {
61
+ if (isNumber(msg)) {
62
+ msg = msg.toString();
63
+ }
64
+
59
65
  const parentFunctionDescription = includeParentFunction
60
66
  ? getParentFunctionDescription()
61
67
  : undefined;