isaacscript-common 9.13.1 → 9.13.4
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/levelGrid.d.ts +3 -1
- package/dist/functions/levelGrid.d.ts.map +1 -1
- package/dist/functions/levelGrid.lua +11 -3
- 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/index.d.ts +38 -36
- package/package.json +2 -2
- package/src/features/customPickup.ts +5 -4
- package/src/features/customStage/exports.ts +0 -1
- package/src/functions/levelGrid.ts +12 -4
- package/src/functions/log.ts +23 -48
- package/src/functions/logEntities.ts +6 -8
- package/src/lib/jsonLua.d.ts +4 -2
|
@@ -255,7 +255,7 @@ function ____exports.runMergeTests(self)
|
|
|
255
255
|
oldTableHasRNG(nil)
|
|
256
256
|
oldTableHasRNGSerialized(nil)
|
|
257
257
|
local successText = "All merge tests passed!"
|
|
258
|
-
log(successText)
|
|
258
|
+
log(nil, successText)
|
|
259
259
|
printConsole(nil, successText)
|
|
260
260
|
end
|
|
261
261
|
return ____exports
|
package/dist/functions/run.lua
CHANGED
|
@@ -40,7 +40,7 @@ end
|
|
|
40
40
|
function ____exports.restart(self, character)
|
|
41
41
|
if character == nil then
|
|
42
42
|
local command = "restart"
|
|
43
|
-
log("Restarting the run with a console command of: " .. command)
|
|
43
|
+
log(nil, "Restarting the run with a console command of: " .. command)
|
|
44
44
|
Isaac.ExecuteCommand(command)
|
|
45
45
|
return
|
|
46
46
|
end
|
|
@@ -48,7 +48,10 @@ function ____exports.restart(self, character)
|
|
|
48
48
|
error(("Restarting as a character of " .. tostring(character)) .. " would crash the game.")
|
|
49
49
|
end
|
|
50
50
|
local command = "restart " .. tostring(character)
|
|
51
|
-
log(
|
|
51
|
+
log(
|
|
52
|
+
nil,
|
|
53
|
+
(((("Restarting the run as PlayerType." .. tostring(PlayerType[character])) .. " (") .. tostring(character)) .. ") with a console command of: ") .. command
|
|
54
|
+
)
|
|
52
55
|
Isaac.ExecuteCommand(command)
|
|
53
56
|
end
|
|
54
57
|
--- Helper function to restart on the next render frame. Useful because it is impossible to restart
|
package/dist/index.d.ts
CHANGED
|
@@ -6585,35 +6585,35 @@ export declare function lockDoor(door: GridEntityDoor): void;
|
|
|
6585
6585
|
* If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
|
|
6586
6586
|
* function will also prepend the function name and the line number before the string.
|
|
6587
6587
|
*/
|
|
6588
|
-
export declare function log(
|
|
6588
|
+
export declare function log(msg: string): void;
|
|
6589
6589
|
|
|
6590
6590
|
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
6591
|
-
export declare function logAllEntities(
|
|
6591
|
+
export declare function logAllEntities(includeBackgroundEffects: boolean, entityTypeFilter?: EntityType): void;
|
|
6592
6592
|
|
|
6593
6593
|
/**
|
|
6594
6594
|
* Helper function for printing out every grid entity (or filtered grid entity) in the current room.
|
|
6595
6595
|
*/
|
|
6596
|
-
export declare function logAllGridEntities(
|
|
6596
|
+
export declare function logAllGridEntities(includeWalls: boolean, gridEntityTypeFilter?: GridEntityType): void;
|
|
6597
6597
|
|
|
6598
|
-
export declare function logArray<T>(
|
|
6598
|
+
export declare function logArray<T>(array: T[] | readonly T[]): void;
|
|
6599
6599
|
|
|
6600
|
-
export declare function logCollectibleTypes(
|
|
6600
|
+
export declare function logCollectibleTypes(collectibleTypes: CollectibleType[]): void;
|
|
6601
6601
|
|
|
6602
|
-
export declare function logColor(
|
|
6602
|
+
export declare function logColor(color: Color): void;
|
|
6603
6603
|
|
|
6604
6604
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
6605
|
-
export declare function logDamageFlags(
|
|
6605
|
+
export declare function logDamageFlags(flags: DamageFlag | BitFlags<DamageFlag>): void;
|
|
6606
6606
|
|
|
6607
6607
|
/** Helper function for logging an array of specific entities. */
|
|
6608
|
-
export declare function logEntities(
|
|
6608
|
+
export declare function logEntities(entities: Entity[]): void;
|
|
6609
6609
|
|
|
6610
6610
|
/** Helper function to log information about a specific entity. */
|
|
6611
|
-
export declare function logEntity(
|
|
6611
|
+
export declare function logEntity(entity: Entity): void;
|
|
6612
6612
|
|
|
6613
6613
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
6614
|
-
export declare function logEntityFlags(
|
|
6614
|
+
export declare function logEntityFlags(flags: EntityFlag | BitFlags<EntityFlag>): void;
|
|
6615
6615
|
|
|
6616
|
-
export declare function logEntityID(
|
|
6616
|
+
export declare function logEntityID(entity: Entity): void;
|
|
6617
6617
|
|
|
6618
6618
|
/**
|
|
6619
6619
|
* Helper function to log an error message and also print it to the console for better visibility.
|
|
@@ -6621,67 +6621,67 @@ export declare function logEntityID(this: void, entity: Entity): void;
|
|
|
6621
6621
|
* This is useful in situations where using the `error` function would be dangerous (since it
|
|
6622
6622
|
* prevents all of the subsequent code in the callback from running).
|
|
6623
6623
|
*/
|
|
6624
|
-
export declare function logError(
|
|
6624
|
+
export declare function logError(msg: string): void;
|
|
6625
6625
|
|
|
6626
6626
|
/** Helper function for printing out every flag that is turned on. Useful when debugging. */
|
|
6627
|
-
export declare function logFlags<T extends BitFlag | BitFlag128>(
|
|
6627
|
+
export declare function logFlags<T extends BitFlag | BitFlag128>(flags: T | BitFlags<T>, flagEnum: Record<string, T>, description?: string): void;
|
|
6628
6628
|
|
|
6629
6629
|
/**
|
|
6630
6630
|
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
6631
6631
|
*/
|
|
6632
|
-
export declare function logGameStateFlags(
|
|
6632
|
+
export declare function logGameStateFlags(): void;
|
|
6633
6633
|
|
|
6634
6634
|
/** Helper function for logging an array of specific grid entities. */
|
|
6635
|
-
export declare function logGridEntities(
|
|
6635
|
+
export declare function logGridEntities(gridEntities: GridEntity[]): void;
|
|
6636
6636
|
|
|
6637
6637
|
/** Helper function for log information about a specific grid entity. */
|
|
6638
|
-
export declare function logGridEntity(
|
|
6638
|
+
export declare function logGridEntity(gridEntity: GridEntity): void;
|
|
6639
6639
|
|
|
6640
|
-
export declare function logKColor(
|
|
6640
|
+
export declare function logKColor(kColor: KColor): void;
|
|
6641
6641
|
|
|
6642
6642
|
/**
|
|
6643
6643
|
* Helper function for printing out every level state flag that is turned on. Useful when debugging.
|
|
6644
6644
|
*/
|
|
6645
|
-
export declare function logLevelStateFlags(
|
|
6645
|
+
export declare function logLevelStateFlags(): void;
|
|
6646
6646
|
|
|
6647
|
-
export declare function logMap(
|
|
6647
|
+
export declare function logMap(map: Map<AnyNotNil, unknown>): void;
|
|
6648
6648
|
|
|
6649
6649
|
export declare function logNewGlobals(): void;
|
|
6650
6650
|
|
|
6651
|
-
export declare function logPlayerEffects(
|
|
6651
|
+
export declare function logPlayerEffects(player: EntityPlayer): void;
|
|
6652
6652
|
|
|
6653
|
-
export declare function logPlayerHealth(
|
|
6653
|
+
export declare function logPlayerHealth(player: EntityPlayer): void;
|
|
6654
6654
|
|
|
6655
6655
|
/**
|
|
6656
6656
|
* Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
6657
6657
|
*/
|
|
6658
|
-
export declare function logProjectileFlags(
|
|
6658
|
+
export declare function logProjectileFlags(flags: ProjectileFlag | BitFlags<ProjectileFlag>): void;
|
|
6659
6659
|
|
|
6660
6660
|
/**
|
|
6661
6661
|
* Helper function to log information about the entity that corresponding to a pointer hash. (Only
|
|
6662
6662
|
* use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
6663
6663
|
*/
|
|
6664
|
-
export declare function logPtrHash(
|
|
6664
|
+
export declare function logPtrHash(ptrHash: PtrHash): void;
|
|
6665
6665
|
|
|
6666
6666
|
/**
|
|
6667
6667
|
* Helper function to log information about the entity that corresponding to one or more pointer
|
|
6668
6668
|
* hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
|
|
6669
6669
|
*/
|
|
6670
|
-
export declare function logPtrHashes(
|
|
6670
|
+
export declare function logPtrHashes(ptrHashes: PtrHash[]): void;
|
|
6671
6671
|
|
|
6672
6672
|
/** Helper function for logging information about the current room. */
|
|
6673
|
-
export declare function logRoom(
|
|
6673
|
+
export declare function logRoom(): void;
|
|
6674
6674
|
|
|
6675
6675
|
/**
|
|
6676
6676
|
* Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
6677
6677
|
* particular run.
|
|
6678
6678
|
*/
|
|
6679
|
-
export declare function logSeedEffects(
|
|
6679
|
+
export declare function logSeedEffects(): void;
|
|
6680
6680
|
|
|
6681
|
-
export declare function logSet(
|
|
6681
|
+
export declare function logSet(set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
|
|
6682
6682
|
|
|
6683
6683
|
/** Helper function for logging every sound effect that is currently playing. */
|
|
6684
|
-
export declare function logSounds(
|
|
6684
|
+
export declare function logSounds(): void;
|
|
6685
6685
|
|
|
6686
6686
|
/**
|
|
6687
6687
|
* Helper function for logging every key and value of a table. This is a deep log; the function will
|
|
@@ -6690,27 +6690,27 @@ export declare function logSounds(this: void): void;
|
|
|
6690
6690
|
* This function will only work on tables that have string keys (because it logs the keys in order,
|
|
6691
6691
|
* instead of randomly). It will throw a run-time error if it encounters a non-string key.
|
|
6692
6692
|
*/
|
|
6693
|
-
export declare function logTable(
|
|
6693
|
+
export declare function logTable(luaTable: unknown, parentTables?: number): void;
|
|
6694
6694
|
|
|
6695
6695
|
/**
|
|
6696
6696
|
* Helper function to print out the differences between the entries of two tables. Note that this
|
|
6697
6697
|
* will only do a shallow comparison.
|
|
6698
6698
|
*/
|
|
6699
|
-
export declare function logTableDifferences<K, V>(
|
|
6699
|
+
export declare function logTableDifferences<K, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
|
|
6700
6700
|
|
|
6701
6701
|
/** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
|
|
6702
|
-
export declare function logTearFlags(
|
|
6702
|
+
export declare function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void;
|
|
6703
6703
|
|
|
6704
6704
|
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
6705
|
-
export declare function logUseFlags(
|
|
6705
|
+
export declare function logUseFlags(flags: UseFlag | BitFlags<UseFlag>): void;
|
|
6706
6706
|
|
|
6707
6707
|
/**
|
|
6708
6708
|
* Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
|
|
6709
6709
|
* the Isaac API).
|
|
6710
6710
|
*/
|
|
6711
|
-
export declare function logUserdata(
|
|
6711
|
+
export declare function logUserdata(userdata: unknown): void;
|
|
6712
6712
|
|
|
6713
|
-
export declare function logVector(
|
|
6713
|
+
export declare function logVector(vector: Vector, round?: boolean): void;
|
|
6714
6714
|
|
|
6715
6715
|
/**
|
|
6716
6716
|
* Helper function to make using maps with an index of `PlayerIndex` easier. Use this instead of the
|
|
@@ -8329,10 +8329,12 @@ export declare function newRNG(seed?: Seed): RNG;
|
|
|
8329
8329
|
* The newly created room will have data corresponding to the game's randomly generated red room. If
|
|
8330
8330
|
* you want to modify this, use the `setRoomData` helper function.
|
|
8331
8331
|
*
|
|
8332
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
8333
|
+
* `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
8332
8334
|
* @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
8333
8335
|
* place a room.
|
|
8334
8336
|
*/
|
|
8335
|
-
export declare function newRoom(): int | undefined;
|
|
8337
|
+
export declare function newRoom(seedOrRNG?: Seed | RNG): int | undefined;
|
|
8336
8338
|
|
|
8337
8339
|
/**
|
|
8338
8340
|
* Helper function to generate a new sprite based on a collectible. If the provided collectible type
|
|
@@ -9164,7 +9166,7 @@ export declare function registerCharacterStats(playerType: PlayerType, statMap:
|
|
|
9164
9166
|
* this function if your pickup should only be able to be collected under
|
|
9165
9167
|
* certain conditions.
|
|
9166
9168
|
*/
|
|
9167
|
-
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (player: EntityPlayer) => void, collisionFunc?: (player: EntityPlayer) => boolean): void;
|
|
9169
|
+
export declare function registerCustomPickup(pickupVariantCustom: PickupVariant, subType: int, collectFunc: (this: void, player: EntityPlayer) => void, collisionFunc?: (this: void, player: EntityPlayer) => boolean): void;
|
|
9168
9170
|
|
|
9169
9171
|
/**
|
|
9170
9172
|
* Helper function to run arbitrary code when you press and release a specific keyboard key.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "9.13.
|
|
3
|
+
"version": "9.13.4",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"main": "dist/index",
|
|
23
23
|
"types": "dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"isaac-typescript-definitions": "^4.0.
|
|
25
|
+
"isaac-typescript-definitions": "^4.0.5"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -13,9 +13,10 @@ import { spawnEffect } from "../functions/entitiesSpecific";
|
|
|
13
13
|
|
|
14
14
|
const FEATURE_NAME = "customPickup";
|
|
15
15
|
|
|
16
|
+
/** We must specify "this: void" to prevent compiler errors. */
|
|
16
17
|
interface CustomPickupFunctions {
|
|
17
|
-
collectFunc: (player: EntityPlayer) => void;
|
|
18
|
-
collisionFunc: (player: EntityPlayer) => boolean;
|
|
18
|
+
collectFunc: (this: void, player: EntityPlayer) => void;
|
|
19
|
+
collisionFunc: (this: void, player: EntityPlayer) => boolean;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -121,8 +122,8 @@ function postEffectRenderPickupEffect(effect: EntityEffect) {
|
|
|
121
122
|
export function registerCustomPickup(
|
|
122
123
|
pickupVariantCustom: PickupVariant,
|
|
123
124
|
subType: int,
|
|
124
|
-
collectFunc: (player: EntityPlayer) => void,
|
|
125
|
-
collisionFunc: (player: EntityPlayer) => boolean = () => true,
|
|
125
|
+
collectFunc: (this: void, player: EntityPlayer) => void,
|
|
126
|
+
collisionFunc: (this: void, player: EntityPlayer) => boolean = () => true,
|
|
126
127
|
): void {
|
|
127
128
|
errorIfFeaturesNotInitialized(FEATURE_NAME);
|
|
128
129
|
|
|
@@ -27,7 +27,7 @@ import { ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA } from "../objects/roomSha
|
|
|
27
27
|
import { getRandomArrayElement } from "./array";
|
|
28
28
|
import { doorSlotToDoorSlotFlag } from "./doors";
|
|
29
29
|
import { addFlag, hasFlag, removeFlag } from "./flag";
|
|
30
|
-
import { getRandomSeed } from "./rng";
|
|
30
|
+
import { getRandomSeed, isRNG, newRNG } from "./rng";
|
|
31
31
|
import {
|
|
32
32
|
getRoomAllowedDoors,
|
|
33
33
|
getRoomData,
|
|
@@ -460,17 +460,25 @@ export function isRoomInsideGrid(roomGridIndex?: int): boolean {
|
|
|
460
460
|
* The newly created room will have data corresponding to the game's randomly generated red room. If
|
|
461
461
|
* you want to modify this, use the `setRoomData` helper function.
|
|
462
462
|
*
|
|
463
|
+
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
464
|
+
* `RNG.Next` method will be called. Default is `Level.GetDungeonPlacementSeed`.
|
|
463
465
|
* @returns The room grid index of the new room or undefined if the floor had no valid dead ends to
|
|
464
466
|
* place a room.
|
|
465
467
|
*/
|
|
466
|
-
export function newRoom(): int | undefined {
|
|
467
|
-
const
|
|
468
|
+
export function newRoom(seedOrRNG?: Seed | RNG): int | undefined {
|
|
469
|
+
const level = game.GetLevel();
|
|
470
|
+
|
|
471
|
+
if (seedOrRNG === undefined) {
|
|
472
|
+
seedOrRNG = level.GetDungeonPlacementSeed();
|
|
473
|
+
}
|
|
474
|
+
const rng = isRNG(seedOrRNG) ? seedOrRNG : newRNG(seedOrRNG);
|
|
475
|
+
|
|
476
|
+
const newRoomCandidate = getNewRoomCandidate(rng);
|
|
468
477
|
if (newRoomCandidate === undefined) {
|
|
469
478
|
return undefined;
|
|
470
479
|
}
|
|
471
480
|
const [adjacentRoomGridIndex, doorSlot, newRoomGridIndex] = newRoomCandidate;
|
|
472
481
|
|
|
473
|
-
const level = game.GetLevel();
|
|
474
482
|
level.MakeRedRoomDoor(adjacentRoomGridIndex, doorSlot);
|
|
475
483
|
|
|
476
484
|
// By default, the room will be a "red room" and have a red graphical tint, so we want to make it
|
package/src/functions/log.ts
CHANGED
|
@@ -64,20 +64,17 @@ export function getDebugPrependString(
|
|
|
64
64
|
* If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
|
|
65
65
|
* function will also prepend the function name and the line number before the string.
|
|
66
66
|
*/
|
|
67
|
-
export function log(
|
|
67
|
+
export function log(msg: string): void {
|
|
68
68
|
const debugMsg = getDebugPrependString(msg);
|
|
69
69
|
Isaac.DebugString(debugMsg);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export function logArray<T>(
|
|
72
|
+
export function logArray<T>(array: T[] | readonly T[]): void {
|
|
73
73
|
const arrayString = arrayToString(array);
|
|
74
74
|
log(`Array: ${arrayString}`);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export function logCollectibleTypes(
|
|
78
|
-
this: void,
|
|
79
|
-
collectibleTypes: CollectibleType[],
|
|
80
|
-
): void {
|
|
77
|
+
export function logCollectibleTypes(collectibleTypes: CollectibleType[]): void {
|
|
81
78
|
log("Collectibles:");
|
|
82
79
|
|
|
83
80
|
let i = 1;
|
|
@@ -88,29 +85,23 @@ export function logCollectibleTypes(
|
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
|
|
91
|
-
export function logColor(
|
|
88
|
+
export function logColor(color: Color): void {
|
|
92
89
|
log(
|
|
93
90
|
`Color: R${color.R}, G${color.G}, B${color.B}, A${color.A}, RO${color.RO}, BO${color.BO}, GO${color.GO}`,
|
|
94
91
|
);
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
/** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
|
|
98
|
-
export function logDamageFlags(
|
|
99
|
-
this: void,
|
|
100
|
-
flags: DamageFlag | BitFlags<DamageFlag>,
|
|
101
|
-
): void {
|
|
95
|
+
export function logDamageFlags(flags: DamageFlag | BitFlags<DamageFlag>): void {
|
|
102
96
|
logFlags(flags, DamageFlag, "damage");
|
|
103
97
|
}
|
|
104
98
|
|
|
105
99
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
106
|
-
export function logEntityFlags(
|
|
107
|
-
this: void,
|
|
108
|
-
flags: EntityFlag | BitFlags<EntityFlag>,
|
|
109
|
-
): void {
|
|
100
|
+
export function logEntityFlags(flags: EntityFlag | BitFlags<EntityFlag>): void {
|
|
110
101
|
logFlags(flags, EntityFlag, "entity");
|
|
111
102
|
}
|
|
112
103
|
|
|
113
|
-
export function logEntityID(
|
|
104
|
+
export function logEntityID(entity: Entity): void {
|
|
114
105
|
const entityID = getEntityID(entity);
|
|
115
106
|
log(`Entity: ${entityID}`);
|
|
116
107
|
}
|
|
@@ -121,7 +112,7 @@ export function logEntityID(this: void, entity: Entity): void {
|
|
|
121
112
|
* This is useful in situations where using the `error` function would be dangerous (since it
|
|
122
113
|
* prevents all of the subsequent code in the callback from running).
|
|
123
114
|
*/
|
|
124
|
-
export function logError(
|
|
115
|
+
export function logError(msg: string): void {
|
|
125
116
|
const errorMsg = `Error: ${msg}`;
|
|
126
117
|
log(errorMsg);
|
|
127
118
|
printConsole(errorMsg);
|
|
@@ -129,7 +120,6 @@ export function logError(this: void, msg: string): void {
|
|
|
129
120
|
|
|
130
121
|
/** Helper function for printing out every flag that is turned on. Useful when debugging. */
|
|
131
122
|
export function logFlags<T extends BitFlag | BitFlag128>(
|
|
132
|
-
this: void,
|
|
133
123
|
flags: T | BitFlags<T>,
|
|
134
124
|
flagEnum: Record<string, T>,
|
|
135
125
|
description = "",
|
|
@@ -157,7 +147,7 @@ export function logFlags<T extends BitFlag | BitFlag128>(
|
|
|
157
147
|
/**
|
|
158
148
|
* Helper function for printing out every game state flag that is turned on. Useful when debugging.
|
|
159
149
|
*/
|
|
160
|
-
export function logGameStateFlags(
|
|
150
|
+
export function logGameStateFlags(): void {
|
|
161
151
|
log("Logging game state flags:");
|
|
162
152
|
|
|
163
153
|
const gameStateFlagEntries = getEnumEntries(GameStateFlag);
|
|
@@ -176,7 +166,7 @@ export function logGameStateFlags(this: void): void {
|
|
|
176
166
|
}
|
|
177
167
|
}
|
|
178
168
|
|
|
179
|
-
export function logKColor(
|
|
169
|
+
export function logKColor(kColor: KColor): void {
|
|
180
170
|
log(
|
|
181
171
|
`Color: R${kColor.Red}, G${kColor.Green}, B${kColor.Blue}, A${kColor.Alpha}`,
|
|
182
172
|
);
|
|
@@ -185,7 +175,7 @@ export function logKColor(this: void, kColor: KColor): void {
|
|
|
185
175
|
/**
|
|
186
176
|
* Helper function for printing out every level state flag that is turned on. Useful when debugging.
|
|
187
177
|
*/
|
|
188
|
-
export function logLevelStateFlags(
|
|
178
|
+
export function logLevelStateFlags(): void {
|
|
189
179
|
const level = game.GetLevel();
|
|
190
180
|
|
|
191
181
|
const levelStateFlagEntries = getEnumEntries(LevelStateFlag);
|
|
@@ -205,7 +195,7 @@ export function logLevelStateFlags(this: void): void {
|
|
|
205
195
|
}
|
|
206
196
|
}
|
|
207
197
|
|
|
208
|
-
export function logMap(
|
|
198
|
+
export function logMap(map: Map<AnyNotNil, unknown>): void {
|
|
209
199
|
log("Printing out a TSTL Map:");
|
|
210
200
|
|
|
211
201
|
const mapKeys = [...map.keys()];
|
|
@@ -220,7 +210,7 @@ export function logMap(this: void, map: Map<AnyNotNil, unknown>): void {
|
|
|
220
210
|
log(` The size of the map was: ${map.size}`);
|
|
221
211
|
}
|
|
222
212
|
|
|
223
|
-
export function logPlayerEffects(
|
|
213
|
+
export function logPlayerEffects(player: EntityPlayer): void {
|
|
224
214
|
const effects = getEffectsList(player);
|
|
225
215
|
|
|
226
216
|
log("Logging player effects:");
|
|
@@ -248,7 +238,7 @@ export function logPlayerEffects(this: void, player: EntityPlayer): void {
|
|
|
248
238
|
});
|
|
249
239
|
}
|
|
250
240
|
|
|
251
|
-
export function logPlayerHealth(
|
|
241
|
+
export function logPlayerHealth(player: EntityPlayer): void {
|
|
252
242
|
const playerName = getPlayerName(player);
|
|
253
243
|
const playerHealth = getPlayerHealth(player);
|
|
254
244
|
|
|
@@ -274,14 +264,13 @@ export function logPlayerHealth(this: void, player: EntityPlayer): void {
|
|
|
274
264
|
* Helper function for printing out every projectile flag that is turned on. Useful when debugging.
|
|
275
265
|
*/
|
|
276
266
|
export function logProjectileFlags(
|
|
277
|
-
this: void,
|
|
278
267
|
flags: ProjectileFlag | BitFlags<ProjectileFlag>,
|
|
279
268
|
): void {
|
|
280
269
|
logFlags(flags, ProjectileFlag, "projectile");
|
|
281
270
|
}
|
|
282
271
|
|
|
283
272
|
/** Helper function for logging information about the current room. */
|
|
284
|
-
export function logRoom(
|
|
273
|
+
export function logRoom(): void {
|
|
285
274
|
const room = game.GetRoom();
|
|
286
275
|
const bossID = room.GetBossID();
|
|
287
276
|
const roomGridIndex = getRoomGridIndex();
|
|
@@ -315,7 +304,7 @@ export function logRoom(this: void): void {
|
|
|
315
304
|
* Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
|
|
316
305
|
* particular run.
|
|
317
306
|
*/
|
|
318
|
-
export function logSeedEffects(
|
|
307
|
+
export function logSeedEffects(): void {
|
|
319
308
|
const seeds = game.GetSeeds();
|
|
320
309
|
|
|
321
310
|
const seedEffectEntries = getEnumEntries(SeedEffect);
|
|
@@ -334,10 +323,7 @@ export function logSeedEffects(this: void): void {
|
|
|
334
323
|
}
|
|
335
324
|
}
|
|
336
325
|
|
|
337
|
-
export function logSet(
|
|
338
|
-
this: void,
|
|
339
|
-
set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>,
|
|
340
|
-
): void {
|
|
326
|
+
export function logSet(set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void {
|
|
341
327
|
log("Printing out a TSTL Set:");
|
|
342
328
|
|
|
343
329
|
const setValues = getSortedSetValues(set);
|
|
@@ -350,7 +336,7 @@ export function logSet(
|
|
|
350
336
|
}
|
|
351
337
|
|
|
352
338
|
/** Helper function for logging every sound effect that is currently playing. */
|
|
353
|
-
export function logSounds(
|
|
339
|
+
export function logSounds(): void {
|
|
354
340
|
const soundEffects = getEnumEntries(SoundEffect);
|
|
355
341
|
|
|
356
342
|
for (const [key, soundEffect] of soundEffects) {
|
|
@@ -367,11 +353,7 @@ export function logSounds(this: void): void {
|
|
|
367
353
|
* This function will only work on tables that have string keys (because it logs the keys in order,
|
|
368
354
|
* instead of randomly). It will throw a run-time error if it encounters a non-string key.
|
|
369
355
|
*/
|
|
370
|
-
export function logTable(
|
|
371
|
-
this: void,
|
|
372
|
-
luaTable: unknown,
|
|
373
|
-
parentTables = 0,
|
|
374
|
-
): void {
|
|
356
|
+
export function logTable(luaTable: unknown, parentTables = 0): void {
|
|
375
357
|
if (parentTables === 0) {
|
|
376
358
|
log("Printing out a Lua table:");
|
|
377
359
|
}
|
|
@@ -421,7 +403,6 @@ export function logTable(
|
|
|
421
403
|
* will only do a shallow comparison.
|
|
422
404
|
*/
|
|
423
405
|
export function logTableDifferences<K, V>(
|
|
424
|
-
this: void,
|
|
425
406
|
table1: LuaMap<K, V>,
|
|
426
407
|
table2: LuaMap<K, V>,
|
|
427
408
|
): void {
|
|
@@ -453,18 +434,12 @@ export function logTableDifferences<K, V>(
|
|
|
453
434
|
}
|
|
454
435
|
|
|
455
436
|
/** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
|
|
456
|
-
export function logTearFlags(
|
|
457
|
-
this: void,
|
|
458
|
-
flags: TearFlag | BitFlags<TearFlag>,
|
|
459
|
-
): void {
|
|
437
|
+
export function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void {
|
|
460
438
|
logFlags(flags, TearFlag, "tear");
|
|
461
439
|
}
|
|
462
440
|
|
|
463
441
|
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
464
|
-
export function logUseFlags(
|
|
465
|
-
this: void,
|
|
466
|
-
flags: UseFlag | BitFlags<UseFlag>,
|
|
467
|
-
): void {
|
|
442
|
+
export function logUseFlags(flags: UseFlag | BitFlags<UseFlag>): void {
|
|
468
443
|
logFlags(flags, UseFlag, "use");
|
|
469
444
|
}
|
|
470
445
|
|
|
@@ -472,7 +447,7 @@ export function logUseFlags(
|
|
|
472
447
|
* Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
|
|
473
448
|
* the Isaac API).
|
|
474
449
|
*/
|
|
475
|
-
export function logUserdata(
|
|
450
|
+
export function logUserdata(userdata: unknown): void {
|
|
476
451
|
if (!isUserdata(userdata)) {
|
|
477
452
|
log("Userdata: [not userdata]");
|
|
478
453
|
return;
|
|
@@ -496,7 +471,7 @@ export function logUserdata(this: void, userdata: unknown): void {
|
|
|
496
471
|
logTable(metatable);
|
|
497
472
|
}
|
|
498
473
|
|
|
499
|
-
export function logVector(
|
|
474
|
+
export function logVector(vector: Vector, round = false): void {
|
|
500
475
|
const vectorString = vectorToString(vector, round);
|
|
501
476
|
log(`Vector: ${vectorString}`);
|
|
502
477
|
}
|
|
@@ -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/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;
|