isaacscript-common 20.12.2 → 20.13.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.
Files changed (67) hide show
  1. package/dist/index.d.ts +79 -40
  2. package/dist/isaacscript-common.lua +315 -419
  3. package/dist/src/classes/ModFeature.lua +0 -4
  4. package/dist/src/classes/ModUpgradedBase.lua +3 -9
  5. package/dist/src/classes/callbacks/PostNewRoomEarly.lua +2 -2
  6. package/dist/src/classes/features/callbackLogic/CustomRevive.lua +2 -5
  7. package/dist/src/classes/features/other/CustomStages.lua +4 -16
  8. package/dist/src/classes/features/other/CustomTrapdoors.lua +1 -4
  9. package/dist/src/classes/features/other/DeployJSONRoom.lua +8 -14
  10. package/dist/src/classes/features/other/Pause.lua +2 -2
  11. package/dist/src/classes/features/other/TaintedLazarusPlayers.lua +1 -1
  12. package/dist/src/classes/features/other/customStages/utils.lua +4 -16
  13. package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +4 -4
  14. package/dist/src/classes/features/other/extraConsoleCommands/subroutines.lua +2 -2
  15. package/dist/src/classes/features/other/saveDataManager/loadFromDisk.lua +4 -7
  16. package/dist/src/classes/features/other/saveDataManager/restoreDefaults.lua +2 -2
  17. package/dist/src/classes/features/other/saveDataManager/saveToDisk.lua +1 -1
  18. package/dist/src/enums/MysteriousPaperEffect.d.ts +13 -0
  19. package/dist/src/enums/MysteriousPaperEffect.d.ts.map +1 -0
  20. package/dist/src/enums/MysteriousPaperEffect.lua +15 -0
  21. package/dist/src/functions/benchmark.lua +2 -8
  22. package/dist/src/functions/debugFunctions.d.ts +2 -2
  23. package/dist/src/functions/debugFunctions.d.ts.map +1 -1
  24. package/dist/src/functions/debugFunctions.lua +4 -4
  25. package/dist/src/functions/deepCopy.lua +7 -7
  26. package/dist/src/functions/deepCopyTests.lua +1 -1
  27. package/dist/src/functions/globals.lua +3 -6
  28. package/dist/src/functions/hex.lua +4 -7
  29. package/dist/src/functions/jsonHelpers.lua +1 -1
  30. package/dist/src/functions/jsonRoom.lua +4 -16
  31. package/dist/src/functions/log.d.ts +8 -4
  32. package/dist/src/functions/log.d.ts.map +1 -1
  33. package/dist/src/functions/log.lua +18 -5
  34. package/dist/src/functions/logEntities.d.ts +8 -8
  35. package/dist/src/functions/logEntities.d.ts.map +1 -1
  36. package/dist/src/functions/logEntities.lua +24 -27
  37. package/dist/src/functions/logMisc.d.ts +26 -26
  38. package/dist/src/functions/logMisc.d.ts.map +1 -1
  39. package/dist/src/functions/logMisc.lua +114 -226
  40. package/dist/src/functions/merge.lua +6 -6
  41. package/dist/src/functions/revive.d.ts.map +1 -1
  42. package/dist/src/functions/revive.lua +10 -3
  43. package/dist/src/functions/run.lua +2 -5
  44. package/dist/src/functions/trinkets.d.ts +22 -0
  45. package/dist/src/functions/trinkets.d.ts.map +1 -1
  46. package/dist/src/functions/trinkets.lua +32 -0
  47. package/dist/src/functions/utils.d.ts.map +1 -1
  48. package/dist/src/functions/utils.lua +20 -1
  49. package/dist/src/index.d.ts +1 -0
  50. package/dist/src/index.d.ts.map +1 -1
  51. package/dist/src/index.lua +8 -0
  52. package/dist/src/lib/jsonLua.lua +16 -7
  53. package/dist/src/patchErrorFunctions.lua +1 -1
  54. package/package.json +1 -1
  55. package/src/classes/ModFeature.ts +0 -6
  56. package/src/classes/features/other/saveDataManager/saveToDisk.ts +3 -4
  57. package/src/enums/MysteriousPaperEffect.ts +12 -0
  58. package/src/functions/debugFunctions.ts +2 -2
  59. package/src/functions/deepCopy.ts +2 -0
  60. package/src/functions/log.ts +15 -4
  61. package/src/functions/logEntities.ts +14 -8
  62. package/src/functions/logMisc.ts +56 -39
  63. package/src/functions/revive.ts +12 -4
  64. package/src/functions/trinkets.ts +39 -0
  65. package/src/functions/utils.ts +30 -0
  66. package/src/index.ts +1 -0
  67. package/src/lib/jsonLua.lua +16 -7
package/dist/index.d.ts CHANGED
@@ -5158,6 +5158,28 @@ export declare function getMatchingGridEntities(gridEntityType: GridEntityType,
5158
5158
 
5159
5159
  export declare function getMoveActions(): ReadonlySet<ButtonAction>;
5160
5160
 
5161
+ /**
5162
+ * Helper function to get the current effect that the Mysterious Paper trinket is providing to the
5163
+ * player. Returns undefined if the player does not have the Mysterious Paper trinket.
5164
+ *
5165
+ * The Mysterious Paper trinket has four different effects:
5166
+ *
5167
+ * - The Polaroid (collectible)
5168
+ * - The Negative (collectible)
5169
+ * - A Missing Page (trinket)
5170
+ * - Missing Poster (trinket)
5171
+ *
5172
+ * It rotates between these four effects on every frame. Note that Mysterious Paper will cause the
5173
+ * `EntityPlayer.HasCollectible` and `EntityPlayer.HasTrinket` methods to return true for the
5174
+ * respective items on the particular frame, with the exception of the Missing Poster. (The player
5175
+ * will never "have" the Missing Poster, even on the correct corresponding frame.)
5176
+ *
5177
+ * @param player The player to look at.
5178
+ * @param frameCount Optional. The frame count that corresponds to time the effect will be active.
5179
+ * Default is the current frame.
5180
+ */
5181
+ export declare function getMysteriousPaperEffectForFrame(player: EntityPlayer, frameCount?: int): MysteriousPaperEffect | undefined;
5182
+
5161
5183
  /**
5162
5184
  * Helper function to get the first player with the lowest frame count. Useful to find a freshly
5163
5185
  * spawned player after using items like Esau Jr. Don't use this function if two or more players
@@ -5307,7 +5329,7 @@ export declare function getOtherPlayers(player: EntityPlayer): EntityPlayer[];
5307
5329
  * (because the first level is this function, the second level is the calling
5308
5330
  * function, and the third level is the parent of the calling function).
5309
5331
  */
5310
- export declare function getParentFunctionDescription(levels?: number): string | undefined;
5332
+ export declare function getParentFunctionDescription(this: void, levels?: number): string | undefined;
5311
5333
 
5312
5334
  /**
5313
5335
  * Helper function to get the closest value from an array of strings based on partial search text.
@@ -6459,7 +6481,7 @@ export declare function getTotalPlayerCollectibles(collectibleType: CollectibleT
6459
6481
  * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
6460
6482
  * enabled.
6461
6483
  */
6462
- export declare function getTraceback(): string;
6484
+ export declare function getTraceback(this: void): string;
6463
6485
 
6464
6486
  /**
6465
6487
  * Helper function to get a transformation name from a PlayerForm enum.
@@ -8410,8 +8432,8 @@ export declare function lockDoor(door: GridEntityDoor): void;
8410
8432
  /**
8411
8433
  * Helper function to avoid typing out `Isaac.DebugString()`.
8412
8434
  *
8413
- * If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
8414
- * function will also prepend the function name and the line number before the string, like this:
8435
+ * If you have the "--luadebug" launch flag turned on, then this function will also prepend the
8436
+ * function name and the line number before the string, like this:
8415
8437
  *
8416
8438
  * ```text
8417
8439
  * [INFO] - Lua Debug: saveToDisk:42494 - The save data manager wrote data to the "save#.dat" file.
@@ -8419,11 +8441,15 @@ export declare function lockDoor(door: GridEntityDoor): void;
8419
8441
  *
8420
8442
  * Subsequently, it is recommended that you turn on the "--luadebug" launch flag when developing
8421
8443
  * your mod so that debugging becomes a little bit easier.
8444
+ *
8445
+ * @param msg The message to log.
8446
+ * @param includeParentFunction Optional. Whether to prefix the message with the function name and
8447
+ * line number, as shown in the above example. Default is true.
8422
8448
  */
8423
- export declare function log(msg: string): void;
8449
+ export declare function log(this: void, msg: string, includeParentFunction?: boolean): void;
8424
8450
 
8425
8451
  /** Helper function for printing out every entity (or filtered entity) in the current room. */
8426
- export declare function logAllEntities(includeBackgroundEffects: boolean, entityTypeFilter?: EntityType): void;
8452
+ export declare function logAllEntities(this: void, includeBackgroundEffects: boolean, entityTypeFilter?: EntityType): void;
8427
8453
 
8428
8454
  /**
8429
8455
  * Helper function for printing out every grid entity (or filtered grid entity) in the current room.
@@ -8432,7 +8458,7 @@ export declare function logAllEntities(includeBackgroundEffects: boolean, entity
8432
8458
  * @param gridEntityTypeFilter Optional. If specified, will only log the given `GridEntityType`.
8433
8459
  * Default is undefined.
8434
8460
  */
8435
- export declare function logAllGridEntities(includeWalls?: boolean, gridEntityTypeFilter?: GridEntityType): void;
8461
+ export declare function logAllGridEntities(this: void, includeWalls?: boolean, gridEntityTypeFilter?: GridEntityType): void;
8436
8462
 
8437
8463
  /**
8438
8464
  * Helper function to log a message to the "log.txt" file and to print it to the screen at the same
@@ -8441,25 +8467,25 @@ export declare function logAllGridEntities(includeWalls?: boolean, gridEntityTyp
8441
8467
  export declare function logAndPrint(msg: string): void;
8442
8468
 
8443
8469
  /** Helper function to enumerate all of the values in an array. */
8444
- export declare function logArray<T>(array: T[] | readonly T[]): void;
8470
+ export declare function logArray<T>(this: void, array: T[] | readonly T[]): void;
8445
8471
 
8446
- export declare function logCollectibleTypes(collectibleTypes: CollectibleType[]): void;
8472
+ export declare function logCollectibleTypes(this: void, collectibleTypes: CollectibleType[]): void;
8447
8473
 
8448
- export declare function logColor(color: Color): void;
8474
+ export declare function logColor(this: void, color: Color): void;
8449
8475
 
8450
8476
  /** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
8451
- export declare function logDamageFlags(flags: DamageFlag | BitFlags<DamageFlag>): void;
8477
+ export declare function logDamageFlags(this: void, flags: DamageFlag | BitFlags<DamageFlag>): void;
8452
8478
 
8453
8479
  /** Helper function for logging an array of specific entities. */
8454
- export declare function logEntities(entities: Entity[]): void;
8480
+ export declare function logEntities(this: void, entities: Entity[]): void;
8455
8481
 
8456
8482
  /** Helper function to log information about a specific entity. */
8457
- export declare function logEntity(entity: Entity): void;
8483
+ export declare function logEntity(this: void, entity: Entity): void;
8458
8484
 
8459
8485
  /** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
8460
- export declare function logEntityFlags(flags: EntityFlag | BitFlags<EntityFlag>): void;
8486
+ export declare function logEntityFlags(this: void, flags: EntityFlag | BitFlags<EntityFlag>): void;
8461
8487
 
8462
- export declare function logEntityID(entity: Entity): void;
8488
+ export declare function logEntityID(this: void, entity: Entity): void;
8463
8489
 
8464
8490
  /**
8465
8491
  * Helper function to log an error message and also print it to the console for better visibility.
@@ -8467,67 +8493,67 @@ export declare function logEntityID(entity: Entity): void;
8467
8493
  * This is useful in situations where using the `error` function would be dangerous (since it
8468
8494
  * prevents all of the subsequent code in the callback from running).
8469
8495
  */
8470
- export declare function logError(msg: string): void;
8496
+ export declare function logError(this: void, msg: string): void;
8471
8497
 
8472
8498
  /** Helper function for printing out every flag that is turned on. Useful when debugging. */
8473
- export declare function logFlags<T extends BitFlag | BitFlag128>(flags: T | BitFlags<T>, flagEnum: Record<string, T>, description?: string): void;
8499
+ export declare function logFlags<T extends BitFlag | BitFlag128>(this: void, flags: T | BitFlags<T>, flagEnum: Record<string, T>, description?: string): void;
8474
8500
 
8475
8501
  /**
8476
8502
  * Helper function for printing out every game state flag that is turned on. Useful when debugging.
8477
8503
  */
8478
- export declare function logGameStateFlags(): void;
8504
+ export declare function logGameStateFlags(this: void): void;
8479
8505
 
8480
8506
  /** Helper function for logging an array of specific grid entities. */
8481
- export declare function logGridEntities(gridEntities: GridEntity[]): void;
8507
+ export declare function logGridEntities(this: void, gridEntities: GridEntity[]): void;
8482
8508
 
8483
8509
  /** Helper function for log information about a specific grid entity. */
8484
- export declare function logGridEntity(gridEntity: GridEntity): void;
8510
+ export declare function logGridEntity(this: void, gridEntity: GridEntity): void;
8485
8511
 
8486
- export declare function logKColor(kColor: KColor): void;
8512
+ export declare function logKColor(this: void, kColor: KColor): void;
8487
8513
 
8488
8514
  /**
8489
8515
  * Helper function for printing out every level state flag that is turned on. Useful when debugging.
8490
8516
  */
8491
- export declare function logLevelStateFlags(): void;
8517
+ export declare function logLevelStateFlags(this: void): void;
8492
8518
 
8493
- export declare function logMap(map: Map<AnyNotNil, unknown>): void;
8519
+ export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
8494
8520
 
8495
8521
  export declare function logNewGlobals(): void;
8496
8522
 
8497
- export declare function logPlayerEffects(player: EntityPlayer): void;
8523
+ export declare function logPlayerEffects(this: void, player: EntityPlayer): void;
8498
8524
 
8499
- export declare function logPlayerHealth(player: EntityPlayer): void;
8525
+ export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
8500
8526
 
8501
8527
  /**
8502
8528
  * Helper function for printing out every projectile flag that is turned on. Useful when debugging.
8503
8529
  */
8504
- export declare function logProjectileFlags(flags: ProjectileFlag | BitFlags<ProjectileFlag>): void;
8530
+ export declare function logProjectileFlags(this: void, flags: ProjectileFlag | BitFlags<ProjectileFlag>): void;
8505
8531
 
8506
8532
  /**
8507
8533
  * Helper function to log information about the entity that corresponding to a pointer hash. (Only
8508
8534
  * use this when debugging, since retrieving the corresponding entity is expensive.)
8509
8535
  */
8510
- export declare function logPtrHash(ptrHash: PtrHash): void;
8536
+ export declare function logPtrHash(this: void, ptrHash: PtrHash): void;
8511
8537
 
8512
8538
  /**
8513
8539
  * Helper function to log information about the entity that corresponding to one or more pointer
8514
8540
  * hashes. (Only use this when debugging, since retrieving the corresponding entity is expensive.)
8515
8541
  */
8516
- export declare function logPtrHashes(ptrHashes: PtrHash[]): void;
8542
+ export declare function logPtrHashes(this: void, ptrHashes: PtrHash[]): void;
8517
8543
 
8518
8544
  /** Helper function for logging information about the current room. */
8519
- export declare function logRoom(): void;
8545
+ export declare function logRoom(this: void): void;
8520
8546
 
8521
8547
  /**
8522
8548
  * Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
8523
8549
  * particular run.
8524
8550
  */
8525
- export declare function logSeedEffects(): void;
8551
+ export declare function logSeedEffects(this: void): void;
8526
8552
 
8527
- export declare function logSet(set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
8553
+ export declare function logSet(this: void, set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
8528
8554
 
8529
8555
  /** Helper function for logging every sound effect that is currently playing. */
8530
- export declare function logSounds(): void;
8556
+ export declare function logSounds(this: void): void;
8531
8557
 
8532
8558
  /**
8533
8559
  * Helper function for logging every key and value of a Lua table. This is a deep log; the function
@@ -8539,13 +8565,13 @@ export declare function logSounds(): void;
8539
8565
  * In order to prevent infinite recursion, this function will not log a sub-table when there are 10
8540
8566
  * or more parent tables.
8541
8567
  */
8542
- export declare function logTable(luaTable: unknown, parentTables?: number): void;
8568
+ export declare function logTable(this: void, luaTable: unknown, parentTables?: number): void;
8543
8569
 
8544
8570
  /**
8545
8571
  * Helper function to print out the differences between the entries of two tables. Note that this
8546
8572
  * will only do a shallow comparison.
8547
8573
  */
8548
- export declare function logTableDifferences<K extends AnyNotNil, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
8574
+ export declare function logTableDifferences<K extends AnyNotNil, V>(this: void, table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
8549
8575
 
8550
8576
  /**
8551
8577
  * Helper function to log the keys of a Lua table. This is not a deep log; only the keys of the
@@ -8553,21 +8579,21 @@ export declare function logTableDifferences<K extends AnyNotNil, V>(table1: LuaM
8553
8579
  *
8554
8580
  * This function is useful for tables that have recursive references.
8555
8581
  */
8556
- export declare function logTableKeys(luaTable: unknown): void;
8582
+ export declare function logTableKeys(this: void, luaTable: unknown): void;
8557
8583
 
8558
8584
  /** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
8559
- export declare function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void;
8585
+ export declare function logTearFlags(this: void, flags: TearFlag | BitFlags<TearFlag>): void;
8560
8586
 
8561
8587
  /** Helper function for printing out every use flag that is turned on. Useful when debugging. */
8562
- export declare function logUseFlags(flags: UseFlag | BitFlags<UseFlag>): void;
8588
+ export declare function logUseFlags(this: void, flags: UseFlag | BitFlags<UseFlag>): void;
8563
8589
 
8564
8590
  /**
8565
8591
  * Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
8566
8592
  * the Isaac API).
8567
8593
  */
8568
- export declare function logUserdata(userdata: unknown): void;
8594
+ export declare function logUserdata(this: void, userdata: unknown): void;
8569
8595
 
8570
- export declare function logVector(vector: Vector, round?: boolean): void;
8596
+ export declare function logVector(this: void, vector: Vector, round?: boolean): void;
8571
8597
 
8572
8598
  /** Helper type to match all of the lowercase keys of an object. */
8573
8599
  export declare type LowercaseKeys<T> = StartsWithLowercase<keyof T>;
@@ -11633,6 +11659,19 @@ export declare function movePlayersToCenter(radius?: float): void;
11633
11659
  */
11634
11660
  export declare const musicManager: MusicManager;
11635
11661
 
11662
+ /**
11663
+ * The possible effects that the Mysterious Paper trinket can grant.
11664
+ *
11665
+ * This enum has hard-coded values because they correspond to the specific in-game frame count of
11666
+ * the player.
11667
+ */
11668
+ export declare enum MysteriousPaperEffect {
11669
+ POLAROID = 0,
11670
+ NEGATIVE = 1,
11671
+ MISSING_PAGE = 2,
11672
+ MISSING_POSTER = 3
11673
+ }
11674
+
11636
11675
  /** This is near the top door. */
11637
11676
  export declare const NEW_FLOOR_STARTING_POSITION_GREED_MODE: Vector;
11638
11677
 
@@ -15097,7 +15136,7 @@ export declare function todo(...args: unknown[]): void;
15097
15136
  * This will only work if the `--luadebug` launch option is enabled or the Racing+ sandbox is
15098
15137
  * enabled.
15099
15138
  */
15100
- export declare function traceback(): void;
15139
+ export declare function traceback(this: void): void;
15101
15140
 
15102
15141
  /** Maps transformation names to the values of the `PlayerForm` enum. */
15103
15142
  export declare const TRANSFORMATION_NAME_TO_PLAYER_FORM_MAP: ReadonlyMap<string, PlayerForm>;