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.
- package/dist/functions/array.d.ts +1 -1
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/arrayLua.d.ts +2 -2
- package/dist/functions/arrayLua.d.ts.map +1 -1
- package/dist/functions/benchmark.d.ts +1 -1
- package/dist/functions/benchmark.d.ts.map +1 -1
- package/dist/functions/bitwise.d.ts +1 -1
- package/dist/functions/bitwise.d.ts.map +1 -1
- package/dist/functions/bosses.d.ts +2 -2
- package/dist/functions/bosses.d.ts.map +1 -1
- package/dist/functions/charge.d.ts +1 -1
- package/dist/functions/charge.d.ts.map +1 -1
- package/dist/functions/collectibles.d.ts +2 -1
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +2 -1
- package/dist/functions/doors.d.ts +4 -4
- package/dist/functions/doors.d.ts.map +1 -1
- package/dist/functions/entities.d.ts +4 -4
- package/dist/functions/entities.d.ts.map +1 -1
- package/dist/functions/entitiesSpecific.d.ts +20 -20
- package/dist/functions/entitiesSpecific.d.ts.map +1 -1
- package/dist/functions/enums.d.ts +4 -4
- package/dist/functions/enums.d.ts.map +1 -1
- package/dist/functions/familiars.d.ts +1 -1
- package/dist/functions/familiars.d.ts.map +1 -1
- package/dist/functions/gridEntities.d.ts +11 -11
- package/dist/functions/gridEntities.d.ts.map +1 -1
- package/dist/functions/gridEntitiesSpecific.d.ts +18 -18
- package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -1
- package/dist/functions/gridIndex.d.ts +1 -1
- package/dist/functions/gridIndex.d.ts.map +1 -1
- package/dist/functions/input.d.ts +2 -2
- package/dist/functions/input.d.ts.map +1 -1
- package/dist/functions/itemPool.d.ts +1 -1
- package/dist/functions/itemPool.d.ts.map +1 -1
- package/dist/functions/jsonRoom.d.ts +1 -1
- package/dist/functions/jsonRoom.d.ts.map +1 -1
- package/dist/functions/level.d.ts +1 -1
- package/dist/functions/level.d.ts.map +1 -1
- package/dist/functions/levelGrid.d.ts +1 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/math.d.ts +2 -2
- package/dist/functions/math.d.ts.map +1 -1
- package/dist/functions/newArray.d.ts.map +1 -1
- package/dist/functions/npcs.d.ts +1 -1
- package/dist/functions/npcs.d.ts.map +1 -1
- package/dist/functions/pickups.d.ts +2 -2
- package/dist/functions/pickups.d.ts.map +1 -1
- package/dist/functions/pickupsSpecific.d.ts +22 -22
- package/dist/functions/pickupsSpecific.d.ts.map +1 -1
- package/dist/functions/playerCollectibles.d.ts +2 -2
- package/dist/functions/playerCollectibles.d.ts.map +1 -1
- package/dist/functions/playerEffects.d.ts +1 -1
- package/dist/functions/playerEffects.d.ts.map +1 -1
- package/dist/functions/playerIndex.d.ts +3 -3
- package/dist/functions/playerIndex.d.ts.map +1 -1
- package/dist/functions/playerTrinkets.d.ts +1 -1
- package/dist/functions/playerTrinkets.d.ts.map +1 -1
- package/dist/functions/players.d.ts +4 -4
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/pocketItems.d.ts +2 -2
- package/dist/functions/pocketItems.d.ts.map +1 -1
- package/dist/functions/positionVelocity.d.ts +5 -5
- package/dist/functions/positionVelocity.d.ts.map +1 -1
- package/dist/functions/projectiles.d.ts +2 -2
- package/dist/functions/projectiles.d.ts.map +1 -1
- package/dist/functions/rooms.d.ts +5 -5
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/run.d.ts +1 -1
- package/dist/functions/run.d.ts.map +1 -1
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/sort.d.ts.map +1 -1
- package/dist/functions/sprites.d.ts +1 -1
- package/dist/functions/sprites.d.ts.map +1 -1
- package/dist/functions/table.d.ts +3 -3
- package/dist/functions/table.d.ts.map +1 -1
- package/dist/functions/utils.d.ts +2 -2
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/index.rollup.d.ts +138 -137
- package/dist/isaacscript-common.lua +3 -2
- package/package.json +2 -2
- package/src/classes/ModUpgraded.ts +4 -2
- package/src/functions/array.ts +10 -1
- package/src/functions/arrayLua.ts +2 -2
- package/src/functions/benchmark.ts +1 -1
- package/src/functions/bitwise.ts +4 -1
- package/src/functions/bosses.ts +2 -2
- package/src/functions/charge.ts +1 -1
- package/src/functions/collectibles.ts +2 -1
- package/src/functions/deepCopy.ts +1 -1
- package/src/functions/doors.ts +6 -4
- package/src/functions/entities.ts +7 -7
- package/src/functions/entitiesSpecific.ts +20 -20
- package/src/functions/enums.ts +6 -4
- package/src/functions/familiars.ts +3 -1
- package/src/functions/gridEntities.ts +13 -13
- package/src/functions/gridEntitiesSpecific.ts +20 -18
- package/src/functions/gridIndex.ts +1 -1
- package/src/functions/input.ts +2 -2
- package/src/functions/itemPool.ts +1 -1
- package/src/functions/jsonRoom.ts +1 -1
- package/src/functions/level.ts +1 -1
- package/src/functions/levelGrid.ts +1 -1
- package/src/functions/math.ts +2 -2
- package/src/functions/newArray.ts +1 -0
- package/src/functions/npcs.ts +1 -1
- package/src/functions/pickups.ts +2 -2
- package/src/functions/pickupsSpecific.ts +31 -22
- package/src/functions/playerCollectibles.ts +2 -2
- package/src/functions/playerEffects.ts +3 -1
- package/src/functions/playerIndex.ts +5 -3
- package/src/functions/playerTrinkets.ts +1 -1
- package/src/functions/players.ts +6 -4
- package/src/functions/pocketItems.ts +5 -3
- package/src/functions/positionVelocity.ts +9 -5
- package/src/functions/projectiles.ts +2 -2
- package/src/functions/rooms.ts +8 -6
- package/src/functions/run.ts +1 -1
- package/src/functions/set.ts +1 -0
- package/src/functions/sort.ts +1 -0
- package/src/functions/sprites.ts +1 -1
- package/src/functions/table.ts +3 -3
- 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,
|
package/src/functions/rooms.ts
CHANGED
|
@@ -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():
|
|
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(
|
|
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 {
|
package/src/functions/run.ts
CHANGED
|
@@ -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(
|
package/src/functions/set.ts
CHANGED
|
@@ -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
|
|
package/src/functions/sort.ts
CHANGED
|
@@ -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,
|
package/src/functions/sprites.ts
CHANGED
|
@@ -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);
|
package/src/functions/table.ts
CHANGED
|
@@ -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);
|
package/src/functions/utils.ts
CHANGED
|
@@ -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
|
}
|