isaacscript-common 52.0.0 → 52.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 +2 -6
- package/dist/isaacscript-common.lua +244 -236
- package/dist/src/functions/gridEntities.d.ts +2 -5
- package/dist/src/functions/gridEntities.d.ts.map +1 -1
- package/dist/src/functions/gridEntities.lua +220 -212
- package/dist/src/objects/gridEntityTypeToANM2Name.d.ts +32 -0
- package/dist/src/objects/gridEntityTypeToANM2Name.d.ts.map +1 -0
- package/dist/src/objects/gridEntityTypeToANM2Name.lua +35 -0
- package/package.json +1 -1
- package/src/functions/gridEntities.ts +33 -19
- package/src/objects/gridEntityTypeToANM2Name.ts +36 -0
- package/dist/src/objects/gridEntityTypeToANM2Path.d.ts +0 -31
- package/dist/src/objects/gridEntityTypeToANM2Path.d.ts.map +0 -1
- package/dist/src/objects/gridEntityTypeToANM2Path.lua +0 -34
- package/src/objects/gridEntityTypeToANM2Path.ts +0 -35
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
DEFAULT_TOP_LEFT_WALL_GRID_INDEX,
|
|
18
18
|
ROOM_SHAPE_TO_TOP_LEFT_WALL_GRID_INDEX_MAP,
|
|
19
19
|
} from "../maps/roomShapeToTopLeftWallGridIndexMap";
|
|
20
|
-
import {
|
|
20
|
+
import { GRID_ENTITY_TYPE_TO_ANM2_NAME } from "../objects/gridEntityTypeToANM2Name";
|
|
21
21
|
import { POOP_GRID_ENTITY_XML_TYPES_SET } from "../sets/poopGridEntityXMLTypesSet";
|
|
22
22
|
import type { AnyGridEntity } from "../types/AnyGridEntity";
|
|
23
23
|
import type { GridEntityID } from "../types/GridEntityID";
|
|
@@ -341,15 +341,22 @@ export function getGridEntitiesMap(
|
|
|
341
341
|
/** Helper function to get the ANM2 path for a grid entity type. */
|
|
342
342
|
export function getGridEntityANM2Path(
|
|
343
343
|
gridEntityType: GridEntityType,
|
|
344
|
+
): string | undefined {
|
|
345
|
+
const gridEntityANM2Name = getGridEntityANM2Name(gridEntityType);
|
|
346
|
+
return `gfx/grid/${gridEntityANM2Name}`;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function getGridEntityANM2Name(
|
|
350
|
+
gridEntityType: GridEntityType,
|
|
344
351
|
): string | undefined {
|
|
345
352
|
switch (gridEntityType) {
|
|
346
353
|
// 1
|
|
347
354
|
case GridEntityType.DECORATION: {
|
|
348
|
-
return
|
|
355
|
+
return getGridEntityANM2NameDecoration();
|
|
349
356
|
}
|
|
350
357
|
|
|
351
358
|
default: {
|
|
352
|
-
return
|
|
359
|
+
return GRID_ENTITY_TYPE_TO_ANM2_NAME[gridEntityType];
|
|
353
360
|
}
|
|
354
361
|
}
|
|
355
362
|
}
|
|
@@ -358,7 +365,7 @@ export function getGridEntityANM2Path(
|
|
|
358
365
|
* Helper function to get the ANM2 path for a decoration. This depends on the current room's
|
|
359
366
|
* backdrop. The values are taken from the "backdrops.xml" file.
|
|
360
367
|
*/
|
|
361
|
-
|
|
368
|
+
function getGridEntityANM2NameDecoration(): string {
|
|
362
369
|
const room = game.GetRoom();
|
|
363
370
|
const backdropType = room.GetBackdropType();
|
|
364
371
|
|
|
@@ -370,7 +377,7 @@ export function getGridEntityANM2PathDecoration(): string {
|
|
|
370
377
|
case BackdropType.DOWNPOUR_ENTRANCE:
|
|
371
378
|
case BackdropType.ISAACS_BEDROOM:
|
|
372
379
|
case BackdropType.CLOSET: {
|
|
373
|
-
return "
|
|
380
|
+
return "Props_01_Basement.anm2";
|
|
374
381
|
}
|
|
375
382
|
|
|
376
383
|
// 4, 5, 6, 37
|
|
@@ -378,7 +385,7 @@ export function getGridEntityANM2PathDecoration(): string {
|
|
|
378
385
|
case BackdropType.CATACOMBS:
|
|
379
386
|
case BackdropType.FLOODED_CAVES:
|
|
380
387
|
case BackdropType.MINES_ENTRANCE: {
|
|
381
|
-
return "
|
|
388
|
+
return "Props_03_Caves.anm2";
|
|
382
389
|
}
|
|
383
390
|
|
|
384
391
|
// 7, 8, 9, 30, 33, 38, 39, 40, 41, 42, 53, 60
|
|
@@ -394,50 +401,50 @@ export function getGridEntityANM2PathDecoration(): string {
|
|
|
394
401
|
case BackdropType.MAUSOLEUM_4:
|
|
395
402
|
case BackdropType.CLOSET_B:
|
|
396
403
|
case BackdropType.DARK_CLOSET: {
|
|
397
|
-
return "
|
|
404
|
+
return "Props_05_Depths.anm2";
|
|
398
405
|
}
|
|
399
406
|
|
|
400
407
|
// 10, 12
|
|
401
408
|
case BackdropType.WOMB:
|
|
402
409
|
case BackdropType.SCARRED_WOMB: {
|
|
403
|
-
return "
|
|
410
|
+
return "Props_07_The Womb.anm2";
|
|
404
411
|
}
|
|
405
412
|
|
|
406
413
|
// 11
|
|
407
414
|
case BackdropType.UTERO: {
|
|
408
|
-
return "
|
|
415
|
+
return "Props_07_Utero.anm2";
|
|
409
416
|
}
|
|
410
417
|
|
|
411
418
|
// 13, 27
|
|
412
419
|
case BackdropType.BLUE_WOMB:
|
|
413
420
|
case BackdropType.BLUE_WOMB_PASS: {
|
|
414
|
-
return "
|
|
421
|
+
return "Props_07_The Womb_blue.anm2";
|
|
415
422
|
}
|
|
416
423
|
|
|
417
424
|
// 14, 47
|
|
418
425
|
case BackdropType.SHEOL:
|
|
419
426
|
case BackdropType.GEHENNA: {
|
|
420
|
-
return "
|
|
427
|
+
return "Props_09_Sheol.anm2";
|
|
421
428
|
}
|
|
422
429
|
|
|
423
430
|
// 15
|
|
424
431
|
case BackdropType.CATHEDRAL: {
|
|
425
|
-
return "
|
|
432
|
+
return "Props_10_Cathedral.anm2";
|
|
426
433
|
}
|
|
427
434
|
|
|
428
435
|
// 17
|
|
429
436
|
case BackdropType.CHEST: {
|
|
430
|
-
return "
|
|
437
|
+
return "Props_11_The Chest.anm2";
|
|
431
438
|
}
|
|
432
439
|
|
|
433
440
|
// 28
|
|
434
441
|
case BackdropType.GREED_SHOP: {
|
|
435
|
-
return "
|
|
442
|
+
return "Props_12_Greed.anm2";
|
|
436
443
|
}
|
|
437
444
|
|
|
438
445
|
// 31
|
|
439
446
|
case BackdropType.DOWNPOUR: {
|
|
440
|
-
return "
|
|
447
|
+
return "props_01x_downpour.anm2";
|
|
441
448
|
}
|
|
442
449
|
|
|
443
450
|
// 32, 46, 58, 59
|
|
@@ -445,7 +452,7 @@ export function getGridEntityANM2PathDecoration(): string {
|
|
|
445
452
|
case BackdropType.ASHPIT:
|
|
446
453
|
case BackdropType.MINES_SHAFT:
|
|
447
454
|
case BackdropType.ASHPIT_SHAFT: {
|
|
448
|
-
return "
|
|
455
|
+
return "props_03x_mines.anm2";
|
|
449
456
|
}
|
|
450
457
|
|
|
451
458
|
// 34, 43, 44, 48
|
|
@@ -453,16 +460,16 @@ export function getGridEntityANM2PathDecoration(): string {
|
|
|
453
460
|
case BackdropType.CORPSE_2:
|
|
454
461
|
case BackdropType.CORPSE_3:
|
|
455
462
|
case BackdropType.MORTIS: {
|
|
456
|
-
return "
|
|
463
|
+
return "props_07_the corpse.anm2";
|
|
457
464
|
}
|
|
458
465
|
|
|
459
466
|
// 45
|
|
460
467
|
case BackdropType.DROSS: {
|
|
461
|
-
return "
|
|
468
|
+
return "props_02x_dross.anm2";
|
|
462
469
|
}
|
|
463
470
|
|
|
464
471
|
default: {
|
|
465
|
-
return "
|
|
472
|
+
return "Props_01_Basement.anm2";
|
|
466
473
|
}
|
|
467
474
|
}
|
|
468
475
|
}
|
|
@@ -521,8 +528,15 @@ export function getMatchingGridEntities(
|
|
|
521
528
|
/**
|
|
522
529
|
* Helper function to get the PNG path for a rock. This depends on the current room's backdrop. The
|
|
523
530
|
* values are taken from the "backdrops.xml" file.
|
|
531
|
+
*
|
|
532
|
+
* All of the rock PNGs are in the "gfx/grid" directory.
|
|
524
533
|
*/
|
|
525
534
|
export function getRockPNGPath(): string {
|
|
535
|
+
const rockPNGName = getRockPNGName();
|
|
536
|
+
return `gfx/grid/${rockPNGName}`;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function getRockPNGName(): string {
|
|
526
540
|
const room = game.GetRoom();
|
|
527
541
|
const backdropType = room.GetBackdropType();
|
|
528
542
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GridEntityType } from "isaac-typescript-definitions";
|
|
2
|
+
|
|
3
|
+
// cspell:disable
|
|
4
|
+
|
|
5
|
+
/** These files exist in the "gfx/grid" directory. */
|
|
6
|
+
export const GRID_ENTITY_TYPE_TO_ANM2_NAME = {
|
|
7
|
+
[GridEntityType.NULL]: undefined, // 0
|
|
8
|
+
// There are more decoration ANM2 files; see the `getGridEntityANM2Path` function.
|
|
9
|
+
[GridEntityType.DECORATION]: "Props_01_Basement.anm2", // 1
|
|
10
|
+
[GridEntityType.ROCK]: "grid_rock.anm2", // 2
|
|
11
|
+
[GridEntityType.BLOCK]: "grid_rock.anm2", // 3
|
|
12
|
+
[GridEntityType.ROCK_TINTED]: "grid_rock.anm2", // 4
|
|
13
|
+
[GridEntityType.ROCK_BOMB]: "grid_rock.anm2", // 5
|
|
14
|
+
[GridEntityType.ROCK_ALT]: "grid_rock.anm2", // 6
|
|
15
|
+
[GridEntityType.PIT]: "grid_pit.anm2", // 7
|
|
16
|
+
[GridEntityType.SPIKES]: "grid_spikes.anm2", // 8
|
|
17
|
+
[GridEntityType.SPIKES_ON_OFF]: "grid_spikes.anm2", // 9
|
|
18
|
+
[GridEntityType.SPIDER_WEB]: "grid_web.anm2", // 10
|
|
19
|
+
[GridEntityType.LOCK]: "grid_locks.anm2", // 11
|
|
20
|
+
[GridEntityType.TNT]: "grid_tnt.anm2", // 12
|
|
21
|
+
[GridEntityType.FIREPLACE]: "grid_fireplace.anm2", // 13
|
|
22
|
+
[GridEntityType.POOP]: "grid_poop.anm2", // 14
|
|
23
|
+
[GridEntityType.WALL]: undefined, // 15
|
|
24
|
+
[GridEntityType.DOOR]: undefined, // 16
|
|
25
|
+
[GridEntityType.TRAPDOOR]: "Door_11_TrapDoor.anm2", // 17
|
|
26
|
+
[GridEntityType.CRAWL_SPACE]: "door_20_secrettrapdoor.anm2", // 18
|
|
27
|
+
[GridEntityType.GRAVITY]: undefined, // 19
|
|
28
|
+
[GridEntityType.PRESSURE_PLATE]: "grid_pressureplate.anm2", // 20
|
|
29
|
+
[GridEntityType.STATUE]: undefined, // 21
|
|
30
|
+
[GridEntityType.ROCK_SUPER_SPECIAL]: "grid_rock.anm2", // 22
|
|
31
|
+
[GridEntityType.TELEPORTER]: "grid_teleporter.anm2", // 23
|
|
32
|
+
[GridEntityType.PILLAR]: "grid_rock.anm2", // 24
|
|
33
|
+
[GridEntityType.ROCK_SPIKED]: "grid_rock.anm2", // 25
|
|
34
|
+
[GridEntityType.ROCK_ALT_2]: "grid_rock.anm2", // 26
|
|
35
|
+
[GridEntityType.ROCK_GOLD]: "grid_rock.anm2", // 27
|
|
36
|
+
} as const satisfies Record<GridEntityType, string | undefined>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const GRID_ENTITY_TYPE_TO_ANM2_PATH: {
|
|
2
|
-
readonly 0: undefined;
|
|
3
|
-
readonly 1: "gfx/grid/Props_01_Basement.anm2";
|
|
4
|
-
readonly 2: "gfx/grid/grid_rock.anm2";
|
|
5
|
-
readonly 3: "gfx/grid/grid_rock.anm2";
|
|
6
|
-
readonly 4: "gfx/grid/grid_rock.anm2";
|
|
7
|
-
readonly 5: "gfx/grid/grid_rock.anm2";
|
|
8
|
-
readonly 6: "gfx/grid/grid_rock.anm2";
|
|
9
|
-
readonly 7: "gfx/grid/grid_pit.anm2";
|
|
10
|
-
readonly 8: "gfx/grid/grid_spikes.anm2";
|
|
11
|
-
readonly 9: "gfx/grid/grid_spikes.anm2";
|
|
12
|
-
readonly 10: "gfx/grid/grid_web.anm2";
|
|
13
|
-
readonly 11: "gfx/grid/grid_locks.anm2";
|
|
14
|
-
readonly 12: "gfx/grid/grid_tnt.anm2";
|
|
15
|
-
readonly 13: "gfx/grid/grid_fireplace.anm2";
|
|
16
|
-
readonly 14: "gfx/grid/grid_poop.anm2";
|
|
17
|
-
readonly 15: undefined;
|
|
18
|
-
readonly 16: undefined;
|
|
19
|
-
readonly 17: "gfx/grid/Door_11_TrapDoor.anm2";
|
|
20
|
-
readonly 18: "gfx/grid/door_20_secrettrapdoor.anm2";
|
|
21
|
-
readonly 19: undefined;
|
|
22
|
-
readonly 20: "gfx/grid/grid_pressureplate.anm2";
|
|
23
|
-
readonly 21: undefined;
|
|
24
|
-
readonly 22: "gfx/grid/grid_rock.anm2";
|
|
25
|
-
readonly 23: "gfx/grid/grid_teleporter.anm2";
|
|
26
|
-
readonly 24: "gfx/grid/grid_rock.anm2";
|
|
27
|
-
readonly 25: "gfx/grid/grid_rock.anm2";
|
|
28
|
-
readonly 26: "gfx/grid/grid_rock.anm2";
|
|
29
|
-
readonly 27: "gfx/grid/grid_rock.anm2";
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=gridEntityTypeToANM2Path.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gridEntityTypeToANM2Path.d.ts","sourceRoot":"","sources":["../../../src/objects/gridEntityTypeToANM2Path.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BqB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
local ____exports = {}
|
|
2
|
-
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
|
-
local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
|
|
4
|
-
____exports.GRID_ENTITY_TYPE_TO_ANM2_PATH = {
|
|
5
|
-
[GridEntityType.NULL] = nil,
|
|
6
|
-
[GridEntityType.DECORATION] = "gfx/grid/Props_01_Basement.anm2",
|
|
7
|
-
[GridEntityType.ROCK] = "gfx/grid/grid_rock.anm2",
|
|
8
|
-
[GridEntityType.BLOCK] = "gfx/grid/grid_rock.anm2",
|
|
9
|
-
[GridEntityType.ROCK_TINTED] = "gfx/grid/grid_rock.anm2",
|
|
10
|
-
[GridEntityType.ROCK_BOMB] = "gfx/grid/grid_rock.anm2",
|
|
11
|
-
[GridEntityType.ROCK_ALT] = "gfx/grid/grid_rock.anm2",
|
|
12
|
-
[GridEntityType.PIT] = "gfx/grid/grid_pit.anm2",
|
|
13
|
-
[GridEntityType.SPIKES] = "gfx/grid/grid_spikes.anm2",
|
|
14
|
-
[GridEntityType.SPIKES_ON_OFF] = "gfx/grid/grid_spikes.anm2",
|
|
15
|
-
[GridEntityType.SPIDER_WEB] = "gfx/grid/grid_web.anm2",
|
|
16
|
-
[GridEntityType.LOCK] = "gfx/grid/grid_locks.anm2",
|
|
17
|
-
[GridEntityType.TNT] = "gfx/grid/grid_tnt.anm2",
|
|
18
|
-
[GridEntityType.FIREPLACE] = "gfx/grid/grid_fireplace.anm2",
|
|
19
|
-
[GridEntityType.POOP] = "gfx/grid/grid_poop.anm2",
|
|
20
|
-
[GridEntityType.WALL] = nil,
|
|
21
|
-
[GridEntityType.DOOR] = nil,
|
|
22
|
-
[GridEntityType.TRAPDOOR] = "gfx/grid/Door_11_TrapDoor.anm2",
|
|
23
|
-
[GridEntityType.CRAWL_SPACE] = "gfx/grid/door_20_secrettrapdoor.anm2",
|
|
24
|
-
[GridEntityType.GRAVITY] = nil,
|
|
25
|
-
[GridEntityType.PRESSURE_PLATE] = "gfx/grid/grid_pressureplate.anm2",
|
|
26
|
-
[GridEntityType.STATUE] = nil,
|
|
27
|
-
[GridEntityType.ROCK_SUPER_SPECIAL] = "gfx/grid/grid_rock.anm2",
|
|
28
|
-
[GridEntityType.TELEPORTER] = "gfx/grid/grid_teleporter.anm2",
|
|
29
|
-
[GridEntityType.PILLAR] = "gfx/grid/grid_rock.anm2",
|
|
30
|
-
[GridEntityType.ROCK_SPIKED] = "gfx/grid/grid_rock.anm2",
|
|
31
|
-
[GridEntityType.ROCK_ALT_2] = "gfx/grid/grid_rock.anm2",
|
|
32
|
-
[GridEntityType.ROCK_GOLD] = "gfx/grid/grid_rock.anm2"
|
|
33
|
-
}
|
|
34
|
-
return ____exports
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { GridEntityType } from "isaac-typescript-definitions";
|
|
2
|
-
|
|
3
|
-
// cspell:disable
|
|
4
|
-
|
|
5
|
-
export const GRID_ENTITY_TYPE_TO_ANM2_PATH = {
|
|
6
|
-
[GridEntityType.NULL]: undefined, // 0
|
|
7
|
-
// There are more decoration ANM2 files; see the `getGridEntityANM2Path` function.
|
|
8
|
-
[GridEntityType.DECORATION]: "gfx/grid/Props_01_Basement.anm2", // 1
|
|
9
|
-
[GridEntityType.ROCK]: "gfx/grid/grid_rock.anm2", // 2
|
|
10
|
-
[GridEntityType.BLOCK]: "gfx/grid/grid_rock.anm2", // 3
|
|
11
|
-
[GridEntityType.ROCK_TINTED]: "gfx/grid/grid_rock.anm2", // 4
|
|
12
|
-
[GridEntityType.ROCK_BOMB]: "gfx/grid/grid_rock.anm2", // 5
|
|
13
|
-
[GridEntityType.ROCK_ALT]: "gfx/grid/grid_rock.anm2", // 6
|
|
14
|
-
[GridEntityType.PIT]: "gfx/grid/grid_pit.anm2", // 7
|
|
15
|
-
[GridEntityType.SPIKES]: "gfx/grid/grid_spikes.anm2", // 8
|
|
16
|
-
[GridEntityType.SPIKES_ON_OFF]: "gfx/grid/grid_spikes.anm2", // 9
|
|
17
|
-
[GridEntityType.SPIDER_WEB]: "gfx/grid/grid_web.anm2", // 10
|
|
18
|
-
[GridEntityType.LOCK]: "gfx/grid/grid_locks.anm2", // 11
|
|
19
|
-
[GridEntityType.TNT]: "gfx/grid/grid_tnt.anm2", // 12
|
|
20
|
-
[GridEntityType.FIREPLACE]: "gfx/grid/grid_fireplace.anm2", // 13
|
|
21
|
-
[GridEntityType.POOP]: "gfx/grid/grid_poop.anm2", // 14
|
|
22
|
-
[GridEntityType.WALL]: undefined, // 15
|
|
23
|
-
[GridEntityType.DOOR]: undefined, // 16
|
|
24
|
-
[GridEntityType.TRAPDOOR]: "gfx/grid/Door_11_TrapDoor.anm2", // 17
|
|
25
|
-
[GridEntityType.CRAWL_SPACE]: "gfx/grid/door_20_secrettrapdoor.anm2", // 18
|
|
26
|
-
[GridEntityType.GRAVITY]: undefined, // 19
|
|
27
|
-
[GridEntityType.PRESSURE_PLATE]: "gfx/grid/grid_pressureplate.anm2", // 20
|
|
28
|
-
[GridEntityType.STATUE]: undefined, // 21
|
|
29
|
-
[GridEntityType.ROCK_SUPER_SPECIAL]: "gfx/grid/grid_rock.anm2", // 22
|
|
30
|
-
[GridEntityType.TELEPORTER]: "gfx/grid/grid_teleporter.anm2", // 23
|
|
31
|
-
[GridEntityType.PILLAR]: "gfx/grid/grid_rock.anm2", // 24
|
|
32
|
-
[GridEntityType.ROCK_SPIKED]: "gfx/grid/grid_rock.anm2", // 25
|
|
33
|
-
[GridEntityType.ROCK_ALT_2]: "gfx/grid/grid_rock.anm2", // 26
|
|
34
|
-
[GridEntityType.ROCK_GOLD]: "gfx/grid/grid_rock.anm2", // 27
|
|
35
|
-
} as const satisfies Record<GridEntityType, string | undefined>;
|