isaacscript-common 6.22.2 → 6.23.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/features/customStage/exports.lua +2 -2
- package/dist/features/saveDataManager/exports.d.ts +13 -8
- package/dist/features/saveDataManager/exports.d.ts.map +1 -1
- package/dist/features/saveDataManager/exports.lua +12 -7
- package/dist/features/saveDataManager/maps.d.ts +2 -2
- package/dist/features/saveDataManager/maps.d.ts.map +1 -1
- package/dist/features/taintedLazarusPlayers.lua +1 -6
- package/dist/functions/index.d.ts +1 -0
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.lua +8 -0
- package/dist/functions/isaacAPIClass.d.ts +1 -1
- package/dist/functions/isaacAPIClass.d.ts.map +1 -1
- package/dist/functions/level.lua +2 -2
- package/dist/functions/levelGrid.d.ts +3 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +15 -10
- package/dist/functions/minimap.lua +3 -3
- package/dist/functions/rooms.d.ts +1 -1
- package/dist/functions/rooms.d.ts.map +1 -1
- package/dist/functions/rooms.lua +4 -4
- package/dist/interfaces/CustomStageLua.d.ts.map +1 -1
- package/dist/interfaces/SaveData.d.ts +33 -4
- package/dist/interfaces/SaveData.d.ts.map +1 -1
- package/dist/types/AnyClass.d.ts +2 -0
- package/dist/types/AnyClass.d.ts.map +1 -0
- package/dist/{interfaces/indexTypeDoc.lua → types/AnyClass.lua} +0 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/features/customStage/exports.ts +2 -2
- package/src/features/saveDataManager/exports.ts +28 -10
- package/src/features/saveDataManager/save.ts +2 -1
- package/src/features/taintedLazarusPlayers.ts +2 -2
- package/src/functions/entities.ts +2 -2
- package/src/functions/index.ts +1 -0
- package/src/functions/indexTypeDoc.ts +1 -0
- package/src/functions/isaacAPIClass.ts +0 -1
- package/src/functions/level.ts +2 -2
- package/src/functions/levelGrid.ts +16 -12
- package/src/functions/minimap.ts +3 -3
- package/src/functions/rooms.ts +4 -4
- package/src/interfaces/CustomStageLua.ts +1 -0
- package/src/interfaces/SaveData.ts +55 -5
- package/src/types/AnyClass.ts +1 -0
- package/src/types/index.ts +1 -1
- package/src/types/indexTypeDoc.ts +1 -1
- package/dist/classes/indexTypeDoc.d.ts +0 -3
- package/dist/classes/indexTypeDoc.d.ts.map +0 -1
- package/dist/classes/indexTypeDoc.lua +0 -4
- package/dist/core/indexTypeDoc.d.ts +0 -5
- package/dist/core/indexTypeDoc.d.ts.map +0 -1
- package/dist/core/indexTypeDoc.lua +0 -6
- package/dist/enums/indexTypeDoc.d.ts +0 -9
- package/dist/enums/indexTypeDoc.d.ts.map +0 -1
- package/dist/enums/indexTypeDoc.lua +0 -10
- package/dist/features/indexTypeDoc.d.ts +0 -30
- package/dist/features/indexTypeDoc.d.ts.map +0 -1
- package/dist/features/indexTypeDoc.lua +0 -31
- package/dist/functions/indexTypeDoc.d.ts +0 -98
- package/dist/functions/indexTypeDoc.d.ts.map +0 -1
- package/dist/functions/indexTypeDoc.lua +0 -99
- package/dist/indexTypeDoc.d.ts +0 -10
- package/dist/indexTypeDoc.d.ts.map +0 -1
- package/dist/indexTypeDoc.lua +0 -11
- package/dist/interfaces/indexTypeDoc.d.ts +0 -11
- package/dist/interfaces/indexTypeDoc.d.ts.map +0 -1
- package/dist/maps/indexTypeDoc.d.ts +0 -5
- package/dist/maps/indexTypeDoc.d.ts.map +0 -1
- package/dist/maps/indexTypeDoc.lua +0 -6
- package/dist/objects/indexTypeDoc.d.ts +0 -2
- package/dist/objects/indexTypeDoc.d.ts.map +0 -1
- package/dist/objects/indexTypeDoc.lua +0 -3
- package/dist/types/IsaacAPIClass.d.ts +0 -5
- package/dist/types/IsaacAPIClass.d.ts.map +0 -1
- package/dist/types/IsaacAPIClass.lua +0 -2
- package/dist/types/indexTypeDoc.d.ts +0 -12
- package/dist/types/indexTypeDoc.d.ts.map +0 -1
- package/dist/types/indexTypeDoc.lua +0 -3
- package/src/types/IsaacAPIClass.ts +0 -3
|
@@ -96,18 +96,30 @@ import { SAVE_DATA_MANAGER_FEATURE_NAME } from "./saveDataManagerConstants";
|
|
|
96
96
|
* manager. The save data manager will throw an error if the key is already registered.
|
|
97
97
|
* @param v An object that corresponds to the `SaveData` interface. The object is conventionally
|
|
98
98
|
* called "v" for brevity. ("v" is short for "local variables").
|
|
99
|
-
* @param conditionalFunc
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* save
|
|
105
|
-
*
|
|
99
|
+
* @param conditionalFunc Optional. A function to run to check if this save data should be written
|
|
100
|
+
* to disk. Default is `() => true`, meaning that this save data will always
|
|
101
|
+
* be written to disk. Use a conditional function for the situations when the
|
|
102
|
+
* local variables are for a feature that the end-user can disable. (If the
|
|
103
|
+
* feature is disabled, then there would be no point in writing any of the
|
|
104
|
+
* variables to the "save#.dat" file.) You can also specify `false` to this
|
|
105
|
+
* argument in order to completely disable saving data. (Specifying `false`
|
|
106
|
+
* will allow you to use non-serializable objects in your save data, such as
|
|
107
|
+
* `EntityPtr`.
|
|
106
108
|
*/
|
|
109
|
+
export function saveDataManager<Persistent, Run, Level>(
|
|
110
|
+
key: string, // This is the overload for the standard case with serializable data.
|
|
111
|
+
v: SaveData<Persistent, Run, Level>,
|
|
112
|
+
conditionalFunc?: () => boolean,
|
|
113
|
+
): void;
|
|
107
114
|
export function saveDataManager(
|
|
115
|
+
key: string, // This is the overload for the case when saving data is disabled.
|
|
116
|
+
v: SaveData<unknown, unknown, unknown>,
|
|
117
|
+
conditionalFunc: false,
|
|
118
|
+
): void;
|
|
119
|
+
export function saveDataManager<Persistent, Run, Level>(
|
|
108
120
|
key: string,
|
|
109
|
-
v: SaveData,
|
|
110
|
-
conditionalFunc?: () => boolean,
|
|
121
|
+
v: SaveData<Persistent, Run, Level>,
|
|
122
|
+
conditionalFunc?: (() => boolean) | false,
|
|
111
123
|
): void {
|
|
112
124
|
errorIfFeaturesNotInitialized(SAVE_DATA_MANAGER_FEATURE_NAME);
|
|
113
125
|
|
|
@@ -126,6 +138,12 @@ export function saveDataManager(
|
|
|
126
138
|
// Add the new save data to the map.
|
|
127
139
|
saveDataMap.set(key, v);
|
|
128
140
|
|
|
141
|
+
// Convert the boolean to a function, if necessary. (Having the argument be a boolean is necessary
|
|
142
|
+
// in order for the overloads to work properly.)
|
|
143
|
+
if (conditionalFunc === false) {
|
|
144
|
+
conditionalFunc = () => false;
|
|
145
|
+
}
|
|
146
|
+
|
|
129
147
|
// If the only key in the save data is "room", then we don't have to worry about saving this data
|
|
130
148
|
// to disk (because the room would be reloaded upon resuming a continued run).
|
|
131
149
|
const saveDataKeys = Object.keys(v);
|
|
@@ -135,7 +153,7 @@ export function saveDataManager(
|
|
|
135
153
|
|
|
136
154
|
// Make a copy of the initial save data so that we can use it to restore the default values later
|
|
137
155
|
// on.
|
|
138
|
-
const saveDataCopy = deepCopy(v, SerializationType.NONE, key) as
|
|
156
|
+
const saveDataCopy = deepCopy(v, SerializationType.NONE, key) as typeof v;
|
|
139
157
|
saveDataDefaultsMap.set(key, saveDataCopy);
|
|
140
158
|
|
|
141
159
|
// Store the conditional function for later, if present.
|
|
@@ -44,7 +44,8 @@ function getAllSaveDataToWriteToDisk(
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// Strip out the room part of the save data
|
|
47
|
+
// Strip out the room part of the save data (and any other arbitrary fields that they might
|
|
48
|
+
// have added).
|
|
48
49
|
const saveDataWithoutRoom: SaveData = {
|
|
49
50
|
persistent: saveData.persistent,
|
|
50
51
|
run: saveData.run,
|
|
@@ -31,10 +31,10 @@ const v = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export function taintedLazarusPlayersInit(mod: ModUpgraded): void {
|
|
34
|
-
// `EntityPtr` is not serializable, so we cannot save data. However, this is inconsequential,
|
|
34
|
+
// `EntityPtr` is not serializable, so we cannot save the data. However, this is inconsequential,
|
|
35
35
|
// since the `POST_PLAYER_INIT` callback will fire when a run is continued, which will repopulate
|
|
36
36
|
// the `subPlayerMap`.
|
|
37
|
-
saveDataManager(FEATURE_NAME, v,
|
|
37
|
+
saveDataManager(FEATURE_NAME, v, false);
|
|
38
38
|
|
|
39
39
|
mod.AddCallback(ModCallback.POST_PLAYER_INIT, postPlayerInit);
|
|
40
40
|
}
|
|
@@ -187,9 +187,9 @@ function setPrimitiveEntityFields(
|
|
|
187
187
|
const indexKey = key as keyof typeof entity;
|
|
188
188
|
const value = entity[indexKey];
|
|
189
189
|
if (isPrimitive(value)) {
|
|
190
|
-
entityFields.set(indexKey, value);
|
|
190
|
+
entityFields.set(indexKey as string, value);
|
|
191
191
|
} else if (isVector(value)) {
|
|
192
|
-
entityFields.set(indexKey, vectorToString(value));
|
|
192
|
+
entityFields.set(indexKey as string, vectorToString(value));
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
}
|
package/src/functions/index.ts
CHANGED
|
@@ -76,6 +76,7 @@ export * as RoomData from "./roomData";
|
|
|
76
76
|
export * as RoomGrid from "./roomGrid";
|
|
77
77
|
export * as Rooms from "./rooms";
|
|
78
78
|
export * as RoomShape from "./roomShape";
|
|
79
|
+
export * as RoomTransition from "./roomTransition";
|
|
79
80
|
export * as Run from "./run";
|
|
80
81
|
export * as SaveFile from "./saveFile";
|
|
81
82
|
export * as Seeds from "./seeds";
|
package/src/functions/level.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { DoorSlot } from "isaac-typescript-definitions";
|
|
|
2
2
|
import { game } from "../core/cachedClasses";
|
|
3
3
|
import { getEnumValues } from "./enums";
|
|
4
4
|
import { isDoorSlotValidAtGridIndexForRedRoom } from "./levelGrid";
|
|
5
|
-
import { getNumRooms,
|
|
5
|
+
import { getNumRooms, getRoomsInsideGrid } from "./rooms";
|
|
6
6
|
|
|
7
7
|
export function fillLevelWithRedRooms(): void {
|
|
8
8
|
const level = game.GetLevel();
|
|
9
9
|
|
|
10
10
|
let numRoomsInGrid: int;
|
|
11
11
|
do {
|
|
12
|
-
const roomsInGrid =
|
|
12
|
+
const roomsInGrid = getRoomsInsideGrid();
|
|
13
13
|
numRoomsInGrid = roomsInGrid.length;
|
|
14
14
|
|
|
15
15
|
for (const roomDescriptor of roomsInGrid) {
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
getRoomGridIndex,
|
|
36
36
|
getRoomShape,
|
|
37
37
|
} from "./roomData";
|
|
38
|
-
import { getRooms,
|
|
38
|
+
import { getRooms, getRoomsInsideGrid } from "./rooms";
|
|
39
39
|
import { getGridIndexDelta } from "./roomShape";
|
|
40
40
|
|
|
41
41
|
const LEFT = -1;
|
|
@@ -63,7 +63,7 @@ export function getAdjacentRoomGridIndexes(roomGridIndex?: int): int[] {
|
|
|
63
63
|
const roomGridIndexToUse =
|
|
64
64
|
roomGridIndex === undefined ? getRoomGridIndex() : roomGridIndex;
|
|
65
65
|
|
|
66
|
-
if (!
|
|
66
|
+
if (!isRoomInsideGrid(roomGridIndexToUse)) {
|
|
67
67
|
return [];
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -72,7 +72,7 @@ export function getAdjacentRoomGridIndexes(roomGridIndex?: int): int[] {
|
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
return adjacentRoomGridIndexes.filter((adjacentRoomGridIndex) =>
|
|
75
|
-
|
|
75
|
+
isRoomInsideGrid(adjacentRoomGridIndex),
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -117,7 +117,7 @@ export function getNewRoomCandidatesBesideRoom(
|
|
|
117
117
|
): Array<[doorSlot: DoorSlot, roomGridIndex: int]> {
|
|
118
118
|
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
119
119
|
|
|
120
|
-
if (!
|
|
120
|
+
if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
|
|
121
121
|
return [];
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -172,7 +172,7 @@ export function getNewRoomCandidatesBesideRoom(
|
|
|
172
172
|
export function getNewRoomCandidatesForLevel(): Array<
|
|
173
173
|
[adjacentRoomGridIndex: int, doorSlot: DoorSlot, newRoomGridIndex: int]
|
|
174
174
|
> {
|
|
175
|
-
const rooms =
|
|
175
|
+
const rooms = getRoomsInsideGrid();
|
|
176
176
|
const normalRooms = rooms.filter(
|
|
177
177
|
(room) =>
|
|
178
178
|
room.Data !== undefined &&
|
|
@@ -207,7 +207,7 @@ export function getNewRoomCandidatesForLevel(): Array<
|
|
|
207
207
|
export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
|
|
208
208
|
const roomTypesSet = new Set<RoomType>([...roomTypes]);
|
|
209
209
|
|
|
210
|
-
const rooms =
|
|
210
|
+
const rooms = getRoomsInsideGrid();
|
|
211
211
|
const matchingRooms = rooms.filter(
|
|
212
212
|
(roomDescriptor) =>
|
|
213
213
|
roomDescriptor.Data !== undefined &&
|
|
@@ -230,7 +230,7 @@ export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
|
|
|
230
230
|
export function getRoomNeighbors(roomGridIndex?: int): Map<DoorSlot, int> {
|
|
231
231
|
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
232
232
|
|
|
233
|
-
if (!
|
|
233
|
+
if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
|
|
234
234
|
return new Map();
|
|
235
235
|
}
|
|
236
236
|
|
|
@@ -293,7 +293,7 @@ export function getRoomShapeNeighborGridIndexes(
|
|
|
293
293
|
const neighborGridIndexes = new Map<DoorSlot, int>();
|
|
294
294
|
for (const [doorSlot, delta] of roomShapeNeighborGridIndexDeltas.entries()) {
|
|
295
295
|
const roomGridIndex = safeRoomGridIndex + delta;
|
|
296
|
-
if (
|
|
296
|
+
if (isRoomInsideGrid(roomGridIndex)) {
|
|
297
297
|
neighborGridIndexes.set(doorSlot, roomGridIndex);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
@@ -356,9 +356,7 @@ export function isDoorSlotValidAtGridIndexForRedRoom(
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
const redRoomGridIndex = roomGridIndex + delta;
|
|
359
|
-
return (
|
|
360
|
-
!roomExists(redRoomGridIndex) && isRoomGridIndexInBounds(redRoomGridIndex)
|
|
361
|
-
);
|
|
359
|
+
return !roomExists(redRoomGridIndex) && isRoomInsideGrid(redRoomGridIndex);
|
|
362
360
|
}
|
|
363
361
|
|
|
364
362
|
/**
|
|
@@ -376,8 +374,14 @@ export function isRedKeyRoom(roomGridIndex?: int): boolean {
|
|
|
376
374
|
* Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
|
|
377
375
|
*
|
|
378
376
|
* For example, Devil Rooms and the Mega Satan room are not considered to be inside the grid.
|
|
377
|
+
*
|
|
378
|
+
* @param roomGridIndex Optional. Default is the current room index.
|
|
379
379
|
*/
|
|
380
|
-
export function
|
|
380
|
+
export function isRoomInsideGrid(roomGridIndex?: int): boolean {
|
|
381
|
+
if (roomGridIndex === undefined) {
|
|
382
|
+
roomGridIndex = getRoomGridIndex();
|
|
383
|
+
}
|
|
384
|
+
|
|
381
385
|
return roomGridIndex >= 0 && roomGridIndex <= MAX_LEVEL_GRID_INDEX;
|
|
382
386
|
}
|
|
383
387
|
|
package/src/functions/minimap.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DisplayFlag, DisplayFlagZero } from "isaac-typescript-definitions";
|
|
2
2
|
import { game } from "../core/cachedClasses";
|
|
3
3
|
import { getRoomDescriptor } from "./roomData";
|
|
4
|
-
import {
|
|
4
|
+
import { getRoomsInsideGrid } from "./rooms";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Helper function to set the value of `DisplayFlag` for every room on the floor to 0.
|
|
@@ -12,7 +12,7 @@ import { getRoomsInGrid } from "./rooms";
|
|
|
12
12
|
export function clearFloorDisplayFlags(): void {
|
|
13
13
|
const level = game.GetLevel();
|
|
14
14
|
|
|
15
|
-
for (const room of
|
|
15
|
+
for (const room of getRoomsInsideGrid()) {
|
|
16
16
|
room.DisplayFlags = DisplayFlagZero;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -27,7 +27,7 @@ export function clearFloorDisplayFlags(): void {
|
|
|
27
27
|
export function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>> {
|
|
28
28
|
const displayFlagsMap = new Map<int, BitFlags<DisplayFlag>>();
|
|
29
29
|
|
|
30
|
-
const roomsInGrid =
|
|
30
|
+
const roomsInGrid = getRoomsInsideGrid();
|
|
31
31
|
for (const roomDescriptor of roomsInGrid) {
|
|
32
32
|
displayFlagsMap.set(
|
|
33
33
|
roomDescriptor.SafeGridIndex,
|
package/src/functions/rooms.ts
CHANGED
|
@@ -74,7 +74,7 @@ export function changeRoom(roomGridIndex: int): void {
|
|
|
74
74
|
* include off-grid rooms, like the Devil Room.
|
|
75
75
|
*/
|
|
76
76
|
export function getNumRooms(): int {
|
|
77
|
-
const rooms =
|
|
77
|
+
const rooms = getRoomsInsideGrid();
|
|
78
78
|
return rooms.length;
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -186,7 +186,7 @@ export function getRooms(
|
|
|
186
186
|
// The obvious way to get all of the rooms would be to iterate over the `RoomList` from the
|
|
187
187
|
// `Level.GetRooms` method. However, this results in read-only data, and we want to return a
|
|
188
188
|
// writable object. Instead, we let the heavy lifting be handled by other functions.
|
|
189
|
-
const roomsInGrid =
|
|
189
|
+
const roomsInGrid = getRoomsInsideGrid(includeExtraDimensionalRooms);
|
|
190
190
|
const roomsOutsideGrid = getRoomsOutsideGrid();
|
|
191
191
|
return [...roomsInGrid, ...roomsOutsideGrid];
|
|
192
192
|
}
|
|
@@ -201,7 +201,7 @@ export function getRooms(
|
|
|
201
201
|
* extra-dimensional rooms are automatically be generated. Default
|
|
202
202
|
* is false.
|
|
203
203
|
*/
|
|
204
|
-
export function
|
|
204
|
+
export function getRoomsInsideGrid(
|
|
205
205
|
includeExtraDimensionalRooms = false,
|
|
206
206
|
): RoomDescriptor[] {
|
|
207
207
|
const level = game.GetLevel();
|
|
@@ -463,7 +463,7 @@ export function inStartingRoom(): boolean {
|
|
|
463
463
|
export function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean {
|
|
464
464
|
const roomTypeWhitelist =
|
|
465
465
|
onlyCheckRoomTypes === undefined ? null : new Set(onlyCheckRoomTypes);
|
|
466
|
-
const rooms =
|
|
466
|
+
const rooms = getRoomsInsideGrid();
|
|
467
467
|
const matchingRooms =
|
|
468
468
|
roomTypeWhitelist === null
|
|
469
469
|
? rooms
|
|
@@ -384,6 +384,7 @@ export type CustomStageShadow = Readonly<{
|
|
|
384
384
|
}>;
|
|
385
385
|
|
|
386
386
|
/** An object that represents a possible boss for a custom stage. */
|
|
387
|
+
// ts-prune-ignore-next
|
|
387
388
|
export interface CustomStageBossPoolEntry {
|
|
388
389
|
/**
|
|
389
390
|
* The name of the boss. This must correspond to the entry in "entities2.xml".
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AnyClass } from "../types";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* This is the format of the object that you give to the save data manager. It will contains all of
|
|
3
5
|
* the variables for the particular mod feature.
|
|
@@ -11,6 +13,8 @@
|
|
|
11
13
|
* - `boolean`
|
|
12
14
|
* - `number`
|
|
13
15
|
* - `string`
|
|
16
|
+
* - `undefined` (will be skipped over when saving)
|
|
17
|
+
* - `null` (will be skipped over when saving)
|
|
14
18
|
* - `Map` / `DefaultMap`
|
|
15
19
|
* - `Set`
|
|
16
20
|
* - serializable Isaac API classes (such as `Color`)
|
|
@@ -21,9 +25,55 @@
|
|
|
21
25
|
* properties. This means that the TypeScript compiler will not be able to validate that you are
|
|
22
26
|
* passing in serializable data.)
|
|
23
27
|
*/
|
|
24
|
-
export interface SaveData
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
export interface SaveData<
|
|
29
|
+
Persistent = unknown,
|
|
30
|
+
Run = unknown,
|
|
31
|
+
Level = unknown,
|
|
32
|
+
> {
|
|
33
|
+
persistent?: Serializable<Persistent>;
|
|
34
|
+
run?: Serializable<Run>;
|
|
35
|
+
level?: Serializable<Level>;
|
|
36
|
+
room?: Record<string, unknown>; // Room data is never saved to disk.
|
|
29
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A type that represents valid serializable data fed to the save data manager.
|
|
41
|
+
*
|
|
42
|
+
* Custom errors are thrown when an Isaac API class or a nested custom class is detected.
|
|
43
|
+
*
|
|
44
|
+
* The recursive nature of this type is based on the `Immutable` type:
|
|
45
|
+
* https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
|
|
46
|
+
*/
|
|
47
|
+
type Serializable<T> = T extends SerializableIsaacAPIClass
|
|
48
|
+
? T
|
|
49
|
+
: T extends IsaacAPIClass
|
|
50
|
+
? IsaacAPIClassIsNotSerializable
|
|
51
|
+
: T extends SerializablePrimitive
|
|
52
|
+
? T
|
|
53
|
+
: T extends Array<infer U>
|
|
54
|
+
? SerializableArray<U>
|
|
55
|
+
: T extends Map<infer K, infer V>
|
|
56
|
+
? SerializableMap<K, V>
|
|
57
|
+
: T extends Set<infer M>
|
|
58
|
+
? SerializableSet<M>
|
|
59
|
+
: SerializableObject<T>;
|
|
60
|
+
|
|
61
|
+
type SerializableInsideArrayOrMap<T> = T extends AnyClass
|
|
62
|
+
? CustomClassIsNotSerializable
|
|
63
|
+
: Serializable<T>;
|
|
64
|
+
|
|
65
|
+
type SerializablePrimitive = boolean | string | number | undefined | null;
|
|
66
|
+
type SerializableArray<T> = Array<SerializableInsideArrayOrMap<T>>;
|
|
67
|
+
type SerializableMap<K, V> = Map<
|
|
68
|
+
SerializableInsideArrayOrMap<K>,
|
|
69
|
+
SerializableInsideArrayOrMap<V>
|
|
70
|
+
>;
|
|
71
|
+
type SerializableSet<T> = Set<SerializableInsideArrayOrMap<T>>;
|
|
72
|
+
type SerializableObject<T> = { [K in keyof T]: Serializable<T[K]> };
|
|
73
|
+
type SerializableIsaacAPIClass = Color | KColor | RNG | Vector;
|
|
74
|
+
|
|
75
|
+
type IsaacAPIClassIsNotSerializable =
|
|
76
|
+
"Error: Isaac API classes (such as e.g. `Entity` or `RoomConfig`) are not serializable. For more information, see: https://isaacscript.github.io/main/gotchas#isaac-api-classes-are-not-serializable";
|
|
77
|
+
|
|
78
|
+
type CustomClassIsNotSerializable =
|
|
79
|
+
'Error: The "DefaultMap" class and other custom classes are not serializable when they are placed inside of an array, map, or set. For more information, see: https://isaacscript.github.io/main/gotchas#defaultmap-and-other-custom-classes-are-not-serializable';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type AnyClass = new (...args: readonly unknown[]) => unknown;
|
package/src/types/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export * from "./AnyClass";
|
|
1
2
|
export * from "./AnyEntity";
|
|
2
3
|
export * from "./AnyGridEntity";
|
|
3
4
|
export * from "./CollectibleIndex";
|
|
4
5
|
export * from "./Immutable";
|
|
5
|
-
export * from "./IsaacAPIClass";
|
|
6
6
|
export * from "./PickingUpItem";
|
|
7
7
|
export * from "./PickupIndex";
|
|
8
8
|
export * from "./PlayerIndex";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export * as AnyClass from "./AnyClass";
|
|
1
2
|
export * as AnyEntity from "./AnyEntity";
|
|
2
3
|
export * as AnyGridEntity from "./AnyGridEntity";
|
|
3
4
|
export * as CollectibleIndex from "./CollectibleIndex";
|
|
4
5
|
export * as Immutable from "./Immutable";
|
|
5
|
-
export * as IsaacAPIClass from "./IsaacAPIClass";
|
|
6
6
|
export * as PickingUpItem from "./PickingUpItem";
|
|
7
7
|
export * as PickupIndex from "./PickupIndex";
|
|
8
8
|
export * as PlayerIndex from "./PlayerIndex";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indexTypeDoc.d.ts","sourceRoot":"","sources":["../../src/classes/indexTypeDoc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indexTypeDoc.d.ts","sourceRoot":"","sources":["../../src/core/indexTypeDoc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
local ____exports = {}
|
|
2
|
-
____exports.CachedClasses = require("core.cachedClasses")
|
|
3
|
-
____exports.Constants = require("core.constants")
|
|
4
|
-
____exports.ConstantsFirstLast = require("core.constantsFirstLast")
|
|
5
|
-
____exports.UpgradeMod = require("core.upgradeMod")
|
|
6
|
-
return ____exports
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * as AmbushType from "./AmbushType";
|
|
2
|
-
export * as CornerType from "./CornerType";
|
|
3
|
-
export * as HealthType from "./HealthType";
|
|
4
|
-
export * as ModCallbackCustom from "./ModCallbackCustom";
|
|
5
|
-
export * as PocketItemType from "./PocketItemType";
|
|
6
|
-
export * as RockAltType from "./RockAltType";
|
|
7
|
-
export * as SerializationType from "./SerializationType";
|
|
8
|
-
export * as SlotDestructionType from "./SlotDestructionType";
|
|
9
|
-
//# sourceMappingURL=indexTypeDoc.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indexTypeDoc.d.ts","sourceRoot":"","sources":["../../src/enums/indexTypeDoc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,mBAAmB,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
local ____exports = {}
|
|
2
|
-
____exports.AmbushType = require("enums.AmbushType")
|
|
3
|
-
____exports.CornerType = require("enums.CornerType")
|
|
4
|
-
____exports.HealthType = require("enums.HealthType")
|
|
5
|
-
____exports.ModCallbackCustom = require("enums.ModCallbackCustom")
|
|
6
|
-
____exports.PocketItemType = require("enums.PocketItemType")
|
|
7
|
-
____exports.RockAltType = require("enums.RockAltType")
|
|
8
|
-
____exports.SerializationType = require("enums.SerializationType")
|
|
9
|
-
____exports.SlotDestructionType = require("enums.SlotDestructionType")
|
|
10
|
-
return ____exports
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export * as CharacterHealthConversion from "./characterHealthConversion";
|
|
2
|
-
export * as CharacterStats from "./characterStats";
|
|
3
|
-
export * as CollectibleItemPoolType from "./collectibleItemPoolType";
|
|
4
|
-
export * as CustomDoor from "./customDoor";
|
|
5
|
-
export * as CustomGridEntity from "./customGridEntity";
|
|
6
|
-
export * as CustomStage from "./customStage/exports";
|
|
7
|
-
export * as CustomTrapdoor from "./customTrapdoor/exports";
|
|
8
|
-
export * as DebugDisplay from "./debugDisplay/exports";
|
|
9
|
-
export * as DeployJSONRoom from "./deployJSONRoom";
|
|
10
|
-
export * as DisableAllSound from "./disableAllSound";
|
|
11
|
-
export * as DisableInputs from "./disableInputs";
|
|
12
|
-
export * as ExtraConsoleCommands from "./extraConsoleCommands/exports";
|
|
13
|
-
export * as FadeInRemover from "./fadeInRemover";
|
|
14
|
-
export * as FastReset from "./fastReset";
|
|
15
|
-
export * as ForgottenSwitch from "./forgottenSwitch";
|
|
16
|
-
export * as Pause from "./pause";
|
|
17
|
-
export * as PersistentEntities from "./persistentEntities";
|
|
18
|
-
export * as PickupIndex from "./pickupIndex";
|
|
19
|
-
export * as PlayerInventory from "./playerInventory";
|
|
20
|
-
export * as PonyDetection from "./ponyDetection";
|
|
21
|
-
export * as PreventCollectibleRotation from "./preventCollectibleRotation";
|
|
22
|
-
export * as RegisterHotkey from "./registerHotkey";
|
|
23
|
-
export * as RoomClearFrame from "./roomClearFrame";
|
|
24
|
-
export * as RoomHistory from "./roomHistory";
|
|
25
|
-
export * as RunInNFrames from "./runInNFrames";
|
|
26
|
-
export * as SaveDataManager from "./saveDataManager/exports";
|
|
27
|
-
export * as SirenHelpers from "./sirenHelpers";
|
|
28
|
-
export * as StageHistory from "./stageHistory";
|
|
29
|
-
export * as TaintedLazarusPlayers from "./taintedLazarusPlayers";
|
|
30
|
-
//# sourceMappingURL=indexTypeDoc.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indexTypeDoc.d.ts","sourceRoot":"","sources":["../../src/features/indexTypeDoc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,yBAAyB,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,uBAAuB,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,cAAc,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,oBAAoB,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,0BAA0B,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,eAAe,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,qBAAqB,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
local ____exports = {}
|
|
2
|
-
____exports.CharacterHealthConversion = require("features.characterHealthConversion")
|
|
3
|
-
____exports.CharacterStats = require("features.characterStats")
|
|
4
|
-
____exports.CollectibleItemPoolType = require("features.collectibleItemPoolType")
|
|
5
|
-
____exports.CustomDoor = require("features.customDoor")
|
|
6
|
-
____exports.CustomGridEntity = require("features.customGridEntity")
|
|
7
|
-
____exports.CustomStage = require("features.customStage.exports")
|
|
8
|
-
____exports.CustomTrapdoor = require("features.customTrapdoor.exports")
|
|
9
|
-
____exports.DebugDisplay = require("features.debugDisplay.exports")
|
|
10
|
-
____exports.DeployJSONRoom = require("features.deployJSONRoom")
|
|
11
|
-
____exports.DisableAllSound = require("features.disableAllSound")
|
|
12
|
-
____exports.DisableInputs = require("features.disableInputs")
|
|
13
|
-
____exports.ExtraConsoleCommands = require("features.extraConsoleCommands.exports")
|
|
14
|
-
____exports.FadeInRemover = require("features.fadeInRemover")
|
|
15
|
-
____exports.FastReset = require("features.fastReset")
|
|
16
|
-
____exports.ForgottenSwitch = require("features.forgottenSwitch")
|
|
17
|
-
____exports.Pause = require("features.pause")
|
|
18
|
-
____exports.PersistentEntities = require("features.persistentEntities")
|
|
19
|
-
____exports.PickupIndex = require("features.pickupIndex")
|
|
20
|
-
____exports.PlayerInventory = require("features.playerInventory")
|
|
21
|
-
____exports.PonyDetection = require("features.ponyDetection")
|
|
22
|
-
____exports.PreventCollectibleRotation = require("features.preventCollectibleRotation")
|
|
23
|
-
____exports.RegisterHotkey = require("features.registerHotkey")
|
|
24
|
-
____exports.RoomClearFrame = require("features.roomClearFrame")
|
|
25
|
-
____exports.RoomHistory = require("features.roomHistory")
|
|
26
|
-
____exports.RunInNFrames = require("features.runInNFrames")
|
|
27
|
-
____exports.SaveDataManager = require("features.saveDataManager.exports")
|
|
28
|
-
____exports.SirenHelpers = require("features.sirenHelpers")
|
|
29
|
-
____exports.StageHistory = require("features.stageHistory")
|
|
30
|
-
____exports.TaintedLazarusPlayers = require("features.taintedLazarusPlayers")
|
|
31
|
-
return ____exports
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
export * as Ambush from "./ambush";
|
|
2
|
-
export * as Array from "./array";
|
|
3
|
-
export * as Benchmark from "./benchmark";
|
|
4
|
-
export * as Bitwise from "./bitwise";
|
|
5
|
-
export * as Bombs from "./bombs";
|
|
6
|
-
export * as Bosses from "./bosses";
|
|
7
|
-
export * as CacheFlag from "./cacheFlag";
|
|
8
|
-
export * as Cards from "./cards";
|
|
9
|
-
export * as Challenges from "./challenges";
|
|
10
|
-
export * as Characters from "./characters";
|
|
11
|
-
export * as Charge from "./charge";
|
|
12
|
-
export * as ChargeBar from "./chargeBar";
|
|
13
|
-
export * as CollectibleCacheFlag from "./collectibleCacheFlag";
|
|
14
|
-
export * as Collectibles from "./collectibles";
|
|
15
|
-
export * as CollectibleSet from "./collectibleSet";
|
|
16
|
-
export * as CollectibleTag from "./collectibleTag";
|
|
17
|
-
export * as Color from "./color";
|
|
18
|
-
export * as Curses from "./curses";
|
|
19
|
-
export * as Debug from "./debug";
|
|
20
|
-
export * as DeepCopy from "./deepCopy";
|
|
21
|
-
export * as DeepCopyTests from "./deepCopyTests";
|
|
22
|
-
export * as Dimensions from "./dimensions";
|
|
23
|
-
export * as Direction from "./direction";
|
|
24
|
-
export * as Doors from "./doors";
|
|
25
|
-
export * as Easing from "./easing";
|
|
26
|
-
export * as Eden from "./eden";
|
|
27
|
-
export * as Effects from "./effects";
|
|
28
|
-
export * as Entities from "./entities";
|
|
29
|
-
export * as EntitiesSpecific from "./entitiesSpecific";
|
|
30
|
-
export * as EntityTypes from "./entityTypes";
|
|
31
|
-
export * as Enums from "./enums";
|
|
32
|
-
export * as Familiars from "./familiars";
|
|
33
|
-
export * as Flag from "./flag";
|
|
34
|
-
export * as Flying from "./flying";
|
|
35
|
-
export * as Globals from "./globals";
|
|
36
|
-
export * as GridEntities from "./gridEntities";
|
|
37
|
-
export * as GridEntitiesSpecific from "./gridEntitiesSpecific";
|
|
38
|
-
export * as Input from "./input";
|
|
39
|
-
export * as IsaacAPIClass from "./isaacAPIClass";
|
|
40
|
-
export * as ItemPool from "./itemPool";
|
|
41
|
-
export * as JSONHelpers from "./jsonHelpers";
|
|
42
|
-
export * as JSONRoom from "./jsonRoom";
|
|
43
|
-
export * as KColor from "./kColor";
|
|
44
|
-
export * as Language from "./language";
|
|
45
|
-
export * as Level from "./level";
|
|
46
|
-
export * as LevelGrid from "./levelGrid";
|
|
47
|
-
export * as Log from "./log";
|
|
48
|
-
export * as LogEntities from "./logEntities";
|
|
49
|
-
export * as Map from "./map";
|
|
50
|
-
export * as Math from "./math";
|
|
51
|
-
export * as MergeTests from "./mergeTests";
|
|
52
|
-
export * as Minimap from "./minimap";
|
|
53
|
-
export * as NextStage from "./nextStage";
|
|
54
|
-
export * as NPCs from "./npcs";
|
|
55
|
-
export * as Pickups from "./pickups";
|
|
56
|
-
export * as PickupsSpecific from "./pickupsSpecific";
|
|
57
|
-
export * as PickupVariants from "./pickupVariants";
|
|
58
|
-
export * as Pills from "./pills";
|
|
59
|
-
export * as PlayerCenter from "./playerCenter";
|
|
60
|
-
export * as PlayerDataStructures from "./playerDataStructures";
|
|
61
|
-
export * as PlayerHealth from "./playerHealth";
|
|
62
|
-
export * as PlayerIndex from "./playerIndex";
|
|
63
|
-
export * as Players from "./players";
|
|
64
|
-
export * as PocketItems from "./pocketItems";
|
|
65
|
-
export * as PositionVelocity from "./positionVelocity";
|
|
66
|
-
export * as PressurePlate from "./pressurePlate";
|
|
67
|
-
export * as Projectiles from "./projectiles";
|
|
68
|
-
export * as Random from "./random";
|
|
69
|
-
export * as ReorderedCallbacks from "./reorderedCallbacks";
|
|
70
|
-
export * as Revive from "./revive";
|
|
71
|
-
export * as RNG from "./rng";
|
|
72
|
-
export * as RockAlt from "./rockAlt";
|
|
73
|
-
export * as RoomData from "./roomData";
|
|
74
|
-
export * as RoomGrid from "./roomGrid";
|
|
75
|
-
export * as Rooms from "./rooms";
|
|
76
|
-
export * as RoomShape from "./roomShape";
|
|
77
|
-
export * as Run from "./run";
|
|
78
|
-
export * as SaveFile from "./saveFile";
|
|
79
|
-
export * as Seeds from "./seeds";
|
|
80
|
-
export * as Serialization from "./serialization";
|
|
81
|
-
export * as Set from "./set";
|
|
82
|
-
export * as Sound from "./sound";
|
|
83
|
-
export * as SpawnCollectible from "./spawnCollectible";
|
|
84
|
-
export * as Sprites from "./sprites";
|
|
85
|
-
export * as Stage from "./stage";
|
|
86
|
-
export * as String from "./string";
|
|
87
|
-
export * as Table from "./table";
|
|
88
|
-
export * as Tears from "./tears";
|
|
89
|
-
export * as Transformations from "./transformations";
|
|
90
|
-
export * as TrinketCacheFlag from "./trinketCacheFlag";
|
|
91
|
-
export * as TrinketGive from "./trinketGive";
|
|
92
|
-
export * as Trinkets from "./trinkets";
|
|
93
|
-
export * as TSTLClass from "./tstlClass";
|
|
94
|
-
export * as Types from "./types";
|
|
95
|
-
export * as UI from "./ui";
|
|
96
|
-
export * as Utils from "./utils";
|
|
97
|
-
export * as Vector from "./vector";
|
|
98
|
-
//# sourceMappingURL=indexTypeDoc.d.ts.map
|