isaacscript-common 80.2.4 → 81.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 (123) hide show
  1. package/dist/functions/array.d.ts +1 -1
  2. package/dist/functions/array.d.ts.map +1 -1
  3. package/dist/functions/arrayLua.d.ts +2 -2
  4. package/dist/functions/arrayLua.d.ts.map +1 -1
  5. package/dist/functions/benchmark.d.ts +1 -1
  6. package/dist/functions/benchmark.d.ts.map +1 -1
  7. package/dist/functions/bitwise.d.ts +1 -1
  8. package/dist/functions/bitwise.d.ts.map +1 -1
  9. package/dist/functions/bosses.d.ts +2 -2
  10. package/dist/functions/bosses.d.ts.map +1 -1
  11. package/dist/functions/charge.d.ts +1 -1
  12. package/dist/functions/charge.d.ts.map +1 -1
  13. package/dist/functions/collectibles.d.ts +2 -1
  14. package/dist/functions/collectibles.d.ts.map +1 -1
  15. package/dist/functions/collectibles.lua +2 -1
  16. package/dist/functions/doors.d.ts +4 -4
  17. package/dist/functions/doors.d.ts.map +1 -1
  18. package/dist/functions/entities.d.ts +4 -4
  19. package/dist/functions/entities.d.ts.map +1 -1
  20. package/dist/functions/entitiesSpecific.d.ts +20 -20
  21. package/dist/functions/entitiesSpecific.d.ts.map +1 -1
  22. package/dist/functions/enums.d.ts +4 -4
  23. package/dist/functions/enums.d.ts.map +1 -1
  24. package/dist/functions/familiars.d.ts +1 -1
  25. package/dist/functions/familiars.d.ts.map +1 -1
  26. package/dist/functions/gridEntities.d.ts +11 -11
  27. package/dist/functions/gridEntities.d.ts.map +1 -1
  28. package/dist/functions/gridEntitiesSpecific.d.ts +18 -18
  29. package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -1
  30. package/dist/functions/gridIndex.d.ts +1 -1
  31. package/dist/functions/gridIndex.d.ts.map +1 -1
  32. package/dist/functions/input.d.ts +2 -2
  33. package/dist/functions/input.d.ts.map +1 -1
  34. package/dist/functions/itemPool.d.ts +1 -1
  35. package/dist/functions/itemPool.d.ts.map +1 -1
  36. package/dist/functions/jsonRoom.d.ts +1 -1
  37. package/dist/functions/jsonRoom.d.ts.map +1 -1
  38. package/dist/functions/level.d.ts +1 -1
  39. package/dist/functions/level.d.ts.map +1 -1
  40. package/dist/functions/levelGrid.d.ts +1 -1
  41. package/dist/functions/levelGrid.d.ts.map +1 -1
  42. package/dist/functions/math.d.ts +2 -2
  43. package/dist/functions/math.d.ts.map +1 -1
  44. package/dist/functions/newArray.d.ts.map +1 -1
  45. package/dist/functions/npcs.d.ts +1 -1
  46. package/dist/functions/npcs.d.ts.map +1 -1
  47. package/dist/functions/pickups.d.ts +2 -2
  48. package/dist/functions/pickups.d.ts.map +1 -1
  49. package/dist/functions/pickupsSpecific.d.ts +22 -22
  50. package/dist/functions/pickupsSpecific.d.ts.map +1 -1
  51. package/dist/functions/playerCollectibles.d.ts +2 -2
  52. package/dist/functions/playerCollectibles.d.ts.map +1 -1
  53. package/dist/functions/playerEffects.d.ts +1 -1
  54. package/dist/functions/playerEffects.d.ts.map +1 -1
  55. package/dist/functions/playerIndex.d.ts +3 -3
  56. package/dist/functions/playerIndex.d.ts.map +1 -1
  57. package/dist/functions/playerTrinkets.d.ts +1 -1
  58. package/dist/functions/playerTrinkets.d.ts.map +1 -1
  59. package/dist/functions/players.d.ts +4 -4
  60. package/dist/functions/players.d.ts.map +1 -1
  61. package/dist/functions/pocketItems.d.ts +2 -2
  62. package/dist/functions/pocketItems.d.ts.map +1 -1
  63. package/dist/functions/positionVelocity.d.ts +5 -5
  64. package/dist/functions/positionVelocity.d.ts.map +1 -1
  65. package/dist/functions/projectiles.d.ts +2 -2
  66. package/dist/functions/projectiles.d.ts.map +1 -1
  67. package/dist/functions/rooms.d.ts +5 -5
  68. package/dist/functions/rooms.d.ts.map +1 -1
  69. package/dist/functions/run.d.ts +1 -1
  70. package/dist/functions/run.d.ts.map +1 -1
  71. package/dist/functions/set.d.ts.map +1 -1
  72. package/dist/functions/sort.d.ts.map +1 -1
  73. package/dist/functions/sprites.d.ts +1 -1
  74. package/dist/functions/sprites.d.ts.map +1 -1
  75. package/dist/functions/table.d.ts +3 -3
  76. package/dist/functions/table.d.ts.map +1 -1
  77. package/dist/functions/utils.d.ts +2 -2
  78. package/dist/functions/utils.d.ts.map +1 -1
  79. package/dist/index.rollup.d.ts +138 -137
  80. package/dist/isaacscript-common.lua +3 -2
  81. package/package.json +2 -2
  82. package/src/classes/ModUpgraded.ts +4 -2
  83. package/src/functions/array.ts +10 -1
  84. package/src/functions/arrayLua.ts +2 -2
  85. package/src/functions/benchmark.ts +1 -1
  86. package/src/functions/bitwise.ts +4 -1
  87. package/src/functions/bosses.ts +2 -2
  88. package/src/functions/charge.ts +1 -1
  89. package/src/functions/collectibles.ts +2 -1
  90. package/src/functions/deepCopy.ts +1 -1
  91. package/src/functions/doors.ts +6 -4
  92. package/src/functions/entities.ts +7 -7
  93. package/src/functions/entitiesSpecific.ts +20 -20
  94. package/src/functions/enums.ts +6 -4
  95. package/src/functions/familiars.ts +3 -1
  96. package/src/functions/gridEntities.ts +13 -13
  97. package/src/functions/gridEntitiesSpecific.ts +20 -18
  98. package/src/functions/gridIndex.ts +1 -1
  99. package/src/functions/input.ts +2 -2
  100. package/src/functions/itemPool.ts +1 -1
  101. package/src/functions/jsonRoom.ts +1 -1
  102. package/src/functions/level.ts +1 -1
  103. package/src/functions/levelGrid.ts +1 -1
  104. package/src/functions/math.ts +2 -2
  105. package/src/functions/newArray.ts +1 -0
  106. package/src/functions/npcs.ts +1 -1
  107. package/src/functions/pickups.ts +2 -2
  108. package/src/functions/pickupsSpecific.ts +31 -22
  109. package/src/functions/playerCollectibles.ts +2 -2
  110. package/src/functions/playerEffects.ts +3 -1
  111. package/src/functions/playerIndex.ts +5 -3
  112. package/src/functions/playerTrinkets.ts +1 -1
  113. package/src/functions/players.ts +6 -4
  114. package/src/functions/pocketItems.ts +5 -3
  115. package/src/functions/positionVelocity.ts +9 -5
  116. package/src/functions/projectiles.ts +2 -2
  117. package/src/functions/rooms.ts +8 -6
  118. package/src/functions/run.ts +1 -1
  119. package/src/functions/set.ts +1 -0
  120. package/src/functions/sort.ts +1 -0
  121. package/src/functions/sprites.ts +1 -1
  122. package/src/functions/table.ts +3 -3
  123. package/src/functions/utils.ts +2 -2
@@ -29,7 +29,7 @@ export function fireProjectiles(
29
29
  velocity: Vector,
30
30
  projectilesMode: ProjectilesMode = ProjectilesMode.ONE_PROJECTILE,
31
31
  projectileParams: ProjectileParams = ProjectileParams(),
32
- ): EntityProjectile[] {
32
+ ): readonly EntityProjectile[] {
33
33
  const oldProjectiles = getProjectiles(projectileParams.Variant);
34
34
 
35
35
  let spawnedFly = false;
@@ -67,7 +67,7 @@ export function fireProjectilesInCircle(
67
67
  position: Vector,
68
68
  speed: float,
69
69
  numProjectiles: int,
70
- ): EntityProjectile[] {
70
+ ): readonly EntityProjectile[] {
71
71
  const velocity = Vector(speed, numProjectiles);
72
72
  return fireProjectiles(
73
73
  npc,
@@ -97,7 +97,7 @@ export function getNumRooms(): int {
97
97
  * method. This is the best way to see if off-grid rooms have been initialized, since it is possible
98
98
  * for mods to insert room data at non-official negative room grid indexes.
99
99
  */
100
- export function getReadOnlyRooms(): Array<Readonly<RoomDescriptor>> {
100
+ export function getReadOnlyRooms(): ReadonlyArray<Readonly<RoomDescriptor>> {
101
101
  const level = game.GetLevel();
102
102
  const roomList = level.GetRooms();
103
103
 
@@ -200,7 +200,7 @@ export function getRoomTypeName(roomType: RoomType): string {
200
200
  */
201
201
  export function getRooms(
202
202
  includeExtraDimensionalRooms = false,
203
- ): RoomDescriptor[] {
203
+ ): readonly RoomDescriptor[] {
204
204
  // The naive way to get all of the rooms would be to iterate over the `RoomList` from the
205
205
  // `Level.GetRooms` method. However, this results in read-only data, and we want to return a
206
206
  // writable object. Instead, we let the heavy lifting be handled by other functions.
@@ -221,7 +221,7 @@ export function getRooms(
221
221
  */
222
222
  export function getRoomsInsideGrid(
223
223
  includeExtraDimensionalRooms = false,
224
- ): RoomDescriptor[] {
224
+ ): readonly RoomDescriptor[] {
225
225
  const level = game.GetLevel();
226
226
 
227
227
  const dimensions = includeExtraDimensionalRooms
@@ -250,7 +250,9 @@ export function getRoomsInsideGrid(
250
250
  *
251
251
  * Room descriptors without any data are assumed to be non-existent and are not included.
252
252
  */
253
- export function getRoomsOfDimension(dimension: Dimension): RoomDescriptor[] {
253
+ export function getRoomsOfDimension(
254
+ dimension: Dimension,
255
+ ): readonly RoomDescriptor[] {
254
256
  const level = game.GetLevel();
255
257
 
256
258
  /** We use a map instead of an array because room shapes occupy more than one room grid index. */
@@ -273,7 +275,7 @@ export function getRoomsOfDimension(dimension: Dimension): RoomDescriptor[] {
273
275
  *
274
276
  * Room descriptors without any data are assumed to be non-existent and are not included.
275
277
  */
276
- export function getRoomsOutsideGrid(): RoomDescriptor[] {
278
+ export function getRoomsOutsideGrid(): readonly RoomDescriptor[] {
277
279
  // We filter an array of all rooms instead of iterating over the `GridRoom` enum because it is
278
280
  // possible for mods to insert data at arbitrary negative room grid indexes.
279
281
  const readOnlyRooms = getReadOnlyRooms();
@@ -550,7 +552,7 @@ export function isAllRoomsClear(
550
552
  ): boolean {
551
553
  const roomsInsideGrid = getRoomsInsideGrid();
552
554
 
553
- let matchingRooms: RoomDescriptor[];
555
+ let matchingRooms: readonly RoomDescriptor[];
554
556
  if (onlyCheckRoomTypes === undefined) {
555
557
  matchingRooms = roomsInsideGrid;
556
558
  } else {
@@ -37,7 +37,7 @@ export function anySeedEffectEnabled(exceptions?: SeedEffect[]): boolean {
37
37
  /**
38
38
  * Helper function to get the seed effects (i.e. Easter Eggs) that are enabled for the current run.
39
39
  */
40
- export function getSeedEffects(): SeedEffect[] {
40
+ export function getSeedEffects(): readonly SeedEffect[] {
41
41
  const seeds = game.GetSeeds();
42
42
 
43
43
  return SEED_EFFECTS.filter(
@@ -120,6 +120,7 @@ export function getSetCombinations<T>(
120
120
  * Normally, set values are returned in insertion order, so use this function when the ordering of
121
121
  * the contents is important.
122
122
  */
123
+ // eslint-disable-next-line isaacscript/no-mutable-array-return
123
124
  export function getSortedSetValues<T>(set: Set<T> | ReadonlySet<T>): T[] {
124
125
  const values = [...set];
125
126
 
@@ -146,6 +146,7 @@ export function sortTwoDimensionalArray<T>(a: T[], b: T[]): -1 | 0 | 1 {
146
146
  *
147
147
  * Under the hood, this uses the merge sort algorithm.
148
148
  */
149
+ // eslint-disable-next-line isaacscript/no-mutable-array-return
149
150
  export function stableSort<T>(
150
151
  array: T[],
151
152
  sortFunc: (a: T, b: T) => -1 | 0 | 1 = sortNormal,
@@ -23,7 +23,7 @@ import { eRange } from "./utils";
23
23
  *
24
24
  * @allowEmptyVariadic
25
25
  */
26
- export function clearSprite(sprite: Sprite, ...layerIDs: int[]): void {
26
+ export function clearSprite(sprite: Sprite, ...layerIDs: readonly int[]): void {
27
27
  if (layerIDs.length === 0) {
28
28
  const numLayers = sprite.GetLayerCount();
29
29
  layerIDs = eRange(numLayers);
@@ -44,7 +44,7 @@ export function getBooleansFromTable(
44
44
  luaMap: LuaMap<string, unknown>,
45
45
  objectName: string,
46
46
  ...keys: string[]
47
- ): boolean[] {
47
+ ): readonly boolean[] {
48
48
  const booleans: boolean[] = [];
49
49
  for (const key of keys) {
50
50
  const value = luaMap.get(key);
@@ -76,7 +76,7 @@ export function getNumbersFromTable(
76
76
  luaMap: LuaMap<string, unknown>,
77
77
  objectName: string,
78
78
  ...keys: string[]
79
- ): number[] {
79
+ ): readonly number[] {
80
80
  const numbers: number[] = [];
81
81
  for (const key of keys) {
82
82
  const value = luaMap.get(key);
@@ -115,7 +115,7 @@ export function getStringsFromTable(
115
115
  luaMap: LuaMap<string, unknown>,
116
116
  objectName: string,
117
117
  ...keys: string[]
118
- ): string[] {
118
+ ): readonly string[] {
119
119
  const strings: string[] = [];
120
120
  for (const key of keys) {
121
121
  const value = luaMap.get(key);
@@ -61,7 +61,7 @@ export function assertNotNull<T>(
61
61
  * first argument will be the end.
62
62
  * @param increment Optional. The increment to use. Default is 1.
63
63
  */
64
- export function eRange(start: int, end?: int, increment = 1): int[] {
64
+ export function eRange(start: int, end?: int, increment = 1): readonly int[] {
65
65
  if (end === undefined) {
66
66
  return eRange(0, start, increment);
67
67
  }
@@ -118,7 +118,7 @@ export function getTraversalDescription(
118
118
  * first argument will be the end.
119
119
  * @param increment Optional. The increment to use. Default is 1.
120
120
  */
121
- export function iRange(start: int, end?: int, increment = 1): int[] {
121
+ export function iRange(start: int, end?: int, increment = 1): readonly int[] {
122
122
  if (end === undefined) {
123
123
  return iRange(0, start, increment);
124
124
  }