isaacscript-common 9.13.0 → 9.13.3
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/callbacks/customRevive.lua +5 -2
- package/dist/callbacks/postNewRoomEarly.lua +2 -2
- package/dist/features/customPickup.d.ts +1 -1
- package/dist/features/customPickup.d.ts.map +1 -1
- package/dist/features/customPickup.lua +2 -2
- package/dist/features/customStage/customStageUtils.lua +16 -4
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +17 -5
- package/dist/features/deployJSONRoom.lua +15 -9
- package/dist/features/extraConsoleCommands/commandsSubroutines.lua +2 -2
- package/dist/features/extraConsoleCommands/listCommands.lua +4 -4
- package/dist/features/pause.lua +2 -2
- package/dist/features/saveDataManager/load.lua +7 -4
- package/dist/features/saveDataManager/main.lua +2 -2
- package/dist/features/saveDataManager/merge.lua +3 -3
- package/dist/features/saveDataManager/save.lua +1 -1
- package/dist/features/taintedLazarusPlayers.lua +1 -1
- package/dist/functions/benchmark.lua +8 -2
- package/dist/functions/debug.lua +1 -1
- package/dist/functions/deepCopy.lua +8 -8
- package/dist/functions/deepCopyTests.lua +1 -1
- package/dist/functions/globals.lua +6 -3
- package/dist/functions/hex.lua +7 -4
- package/dist/functions/jsonHelpers.lua +1 -1
- package/dist/functions/jsonRoom.lua +8 -2
- package/dist/functions/log.d.ts +26 -26
- package/dist/functions/log.d.ts.map +1 -1
- package/dist/functions/log.lua +209 -98
- package/dist/functions/logEntities.d.ts +8 -8
- package/dist/functions/logEntities.d.ts.map +1 -1
- package/dist/functions/logEntities.lua +21 -18
- package/dist/functions/mergeTests.lua +1 -1
- package/dist/functions/run.lua +5 -2
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/set.lua +9 -0
- package/dist/index.d.ts +35 -35
- package/package.json +2 -2
- package/src/features/customPickup.ts +5 -4
- package/src/features/customStage/exports.ts +0 -1
- package/src/functions/log.ts +23 -48
- package/src/functions/logEntities.ts +6 -8
- package/src/functions/set.ts +13 -0
- package/src/lib/jsonLua.d.ts +4 -2
|
@@ -21,7 +21,6 @@ const IGNORE_EFFECT_VARIANTS: ReadonlySet<EffectVariant> = new Set([
|
|
|
21
21
|
|
|
22
22
|
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
23
23
|
export function logAllEntities(
|
|
24
|
-
this: void,
|
|
25
24
|
includeBackgroundEffects: boolean,
|
|
26
25
|
entityTypeFilter?: EntityType,
|
|
27
26
|
): void {
|
|
@@ -69,7 +68,6 @@ export function logAllEntities(
|
|
|
69
68
|
* Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
70
69
|
*/
|
|
71
70
|
export function logAllGridEntities(
|
|
72
|
-
this: void,
|
|
73
71
|
includeWalls: boolean,
|
|
74
72
|
gridEntityTypeFilter?: GridEntityType,
|
|
75
73
|
): void {
|
|
@@ -120,14 +118,14 @@ export function logAllGridEntities(
|
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
/** Helper function for logging an array of specific entities. */
|
|
123
|
-
export function logEntities(
|
|
121
|
+
export function logEntities(entities: Entity[]): void {
|
|
124
122
|
for (const entity of entities) {
|
|
125
123
|
logEntity(entity);
|
|
126
124
|
}
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
/** Helper function to log information about a specific entity. */
|
|
130
|
-
export function logEntity(
|
|
128
|
+
export function logEntity(entity: Entity): void {
|
|
131
129
|
const msg = getEntityLogLine(entity);
|
|
132
130
|
log(msg);
|
|
133
131
|
}
|
|
@@ -206,14 +204,14 @@ function getEntityLogLine(entity: Entity, num?: int): string {
|
|
|
206
204
|
}
|
|
207
205
|
|
|
208
206
|
/** Helper function for logging an array of specific grid entities. */
|
|
209
|
-
export function logGridEntities(
|
|
207
|
+
export function logGridEntities(gridEntities: GridEntity[]): void {
|
|
210
208
|
for (const gridEntity of gridEntities) {
|
|
211
209
|
logGridEntity(gridEntity);
|
|
212
210
|
}
|
|
213
211
|
}
|
|
214
212
|
|
|
215
213
|
/** Helper function for log information about a specific grid entity. */
|
|
216
|
-
export function logGridEntity(
|
|
214
|
+
export function logGridEntity(gridEntity: GridEntity): void {
|
|
217
215
|
const msg = getGridEntityLogLine(gridEntity);
|
|
218
216
|
log(msg);
|
|
219
217
|
}
|
|
@@ -279,7 +277,7 @@ function getGridEntityLogLine(gridEntity: GridEntity, num?: int): string {
|
|
|
279
277
|
* Helper function to log information about the entity that corresponding to a pointer hash. (Only
|
|
280
278
|
* use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
281
279
|
*/
|
|
282
|
-
export function logPtrHash(
|
|
280
|
+
export function logPtrHash(ptrHash: PtrHash): void {
|
|
283
281
|
log(`PtrHash: ${ptrHash}`);
|
|
284
282
|
const entity = getEntityFromPtrHash(ptrHash);
|
|
285
283
|
if (entity === undefined) {
|
|
@@ -293,7 +291,7 @@ export function logPtrHash(this: void, ptrHash: PtrHash): void {
|
|
|
293
291
|
* Helper function to log information about the entity that corresponding to one or more pointer
|
|
294
292
|
* hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
295
293
|
*/
|
|
296
|
-
export function logPtrHashes(
|
|
294
|
+
export function logPtrHashes(ptrHashes: PtrHash[]): void {
|
|
297
295
|
for (const ptrHash of ptrHashes) {
|
|
298
296
|
logPtrHash(ptrHash);
|
|
299
297
|
}
|
package/src/functions/set.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getArrayCombinations, getRandomArrayElement, sumArray } from "./array";
|
|
2
2
|
import { getRandomSeed } from "./rng";
|
|
3
|
+
import { isPrimitive } from "./types";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Helper function to add all of the values in one set to another set. The first set passed will be
|
|
@@ -118,6 +119,18 @@ export function getSetCombinations<T>(
|
|
|
118
119
|
export function getSortedSetValues<T>(set: Set<T> | ReadonlySet<T>): T[] {
|
|
119
120
|
const values = set.values();
|
|
120
121
|
const array = [...values];
|
|
122
|
+
|
|
123
|
+
// Check for problematic types in order to throw a helpful error message.
|
|
124
|
+
const firstElement = array[0];
|
|
125
|
+
if (firstElement !== undefined) {
|
|
126
|
+
const arrayType = type(firstElement);
|
|
127
|
+
if (!isPrimitive(arrayType)) {
|
|
128
|
+
error(
|
|
129
|
+
`Failed to get the sorted set values because the provided set was of type "${arrayType}". Having sets with non-primitive types doesn't make much sense in general, so you might need to rethink what you are doing.`,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
121
134
|
array.sort();
|
|
122
135
|
|
|
123
136
|
return array;
|
package/src/lib/jsonLua.d.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This parser was measured to be 11.8 times faster than the vanilla parser at decoding a sample
|
|
6
6
|
* "save1.dat" file.
|
|
7
|
+
*
|
|
8
|
+
* @noSelfInFile
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
|
-
export function encode(
|
|
10
|
-
export function decode(
|
|
11
|
+
export function encode(data: unknown): string;
|
|
12
|
+
export function decode(data: string): unknown;
|