isaacscript-common 13.2.0 → 13.3.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 (55) hide show
  1. package/dist/index.d.ts +25 -3
  2. package/dist/isaacscript-common.lua +11810 -11745
  3. package/dist/src/callbacks/customRevive.d.ts.map +1 -1
  4. package/dist/src/callbacks/customRevive.lua +2 -1
  5. package/dist/src/callbacks/postNewRoomEarly.lua +2 -2
  6. package/dist/src/classes/ModUpgraded.d.ts +5 -2
  7. package/dist/src/classes/ModUpgraded.d.ts.map +1 -1
  8. package/dist/src/classes/ModUpgraded.lua +39 -3
  9. package/dist/src/core/upgradeMod.d.ts +6 -1
  10. package/dist/src/core/upgradeMod.d.ts.map +1 -1
  11. package/dist/src/core/upgradeMod.lua +9 -2
  12. package/dist/src/features/customStage/exports.lua +2 -2
  13. package/dist/src/features/extraConsoleCommands/listCommands.lua +5 -5
  14. package/dist/src/features/pause.lua +2 -2
  15. package/dist/src/features/saveDataManager/load.d.ts.map +1 -1
  16. package/dist/src/features/saveDataManager/load.lua +2 -1
  17. package/dist/src/features/saveDataManager/main.lua +2 -2
  18. package/dist/src/features/taintedLazarusPlayers.lua +2 -2
  19. package/dist/src/functions/benchmark.d.ts +12 -0
  20. package/dist/src/functions/benchmark.d.ts.map +1 -1
  21. package/dist/src/functions/benchmark.lua +19 -0
  22. package/dist/src/functions/debugFunctions.d.ts +1 -0
  23. package/dist/src/functions/debugFunctions.d.ts.map +1 -1
  24. package/dist/src/functions/debugFunctions.lua +15 -23
  25. package/dist/src/functions/globals.lua +1 -1
  26. package/dist/src/functions/hex.lua +2 -2
  27. package/dist/src/functions/jsonHelpers.lua +2 -2
  28. package/dist/src/functions/log.d.ts +0 -68
  29. package/dist/src/functions/log.d.ts.map +1 -1
  30. package/dist/src/functions/log.lua +3 -496
  31. package/dist/src/functions/logMisc.d.ts +69 -0
  32. package/dist/src/functions/logMisc.d.ts.map +1 -0
  33. package/dist/src/functions/logMisc.lua +498 -0
  34. package/dist/src/index.d.ts +1 -0
  35. package/dist/src/index.d.ts.map +1 -1
  36. package/dist/src/index.lua +8 -0
  37. package/package.json +2 -2
  38. package/src/callbacks/customRevive.ts +2 -1
  39. package/src/callbacks/postNewRoomEarly.ts +1 -1
  40. package/src/classes/ModUpgraded.ts +43 -4
  41. package/src/core/upgradeMod.ts +10 -2
  42. package/src/features/customStage/exports.ts +1 -1
  43. package/src/features/extraConsoleCommands/listCommands.ts +1 -1
  44. package/src/features/pause.ts +1 -1
  45. package/src/features/saveDataManager/load.ts +2 -1
  46. package/src/features/saveDataManager/main.ts +1 -1
  47. package/src/features/taintedLazarusPlayers.ts +1 -1
  48. package/src/functions/benchmark.ts +23 -0
  49. package/src/functions/debugFunctions.ts +15 -25
  50. package/src/functions/globals.ts +1 -1
  51. package/src/functions/hex.ts +1 -1
  52. package/src/functions/jsonHelpers.ts +1 -1
  53. package/src/functions/log.ts +5 -443
  54. package/src/functions/logMisc.ts +441 -0
  55. package/src/index.ts +1 -0
package/dist/index.d.ts CHANGED
@@ -5195,6 +5195,19 @@ export declare function getTearsStat(fireDelay: float): float;
5195
5195
  */
5196
5196
  export declare function getTeleporters(variant?: number): GridEntity[];
5197
5197
 
5198
+ /**
5199
+ * Helper function to get the current time in seconds for benchmarking / profiling purposes.
5200
+ *
5201
+ * - If the "--luadebug" flag is enabled, then this function will use the `socket.gettime` method,
5202
+ * which returns the epoch timestamp in seconds (e.g. "1640320492.5779"). This is preferable over
5203
+ * the `Isaac.GetTime` method, since it has one extra decimal point of precision.
5204
+ * - If the "--luadebug" flag is disabled, then this function will use the `Isaac.GetTime` method,
5205
+ * which returns the number of seconds since the computer's operating system was started (e.g.
5206
+ * "739454.963"). (The milliseconds return value of `Isaac.GetTime` is converted to seconds to
5207
+ * align with the return value of `socket.gettime`.)
5208
+ */
5209
+ export declare function getTime(): float;
5210
+
5198
5211
  /** Helper function to get all of the `GridEntityTNT` in the room. */
5199
5212
  export declare function getTNT(variant?: number): GridEntityTNT[];
5200
5213
 
@@ -8593,7 +8606,8 @@ export declare enum ModCallbackCustom {
8593
8606
  /**
8594
8607
  * `isaacscript-common` has many custom callbacks that you can use in your mods. Instead of
8595
8608
  * hijacking the vanilla `Mod` object, we provide a `ModUpgraded` object for you to use, which
8596
- * extends the base class and adds a new method of `AddCallbackCustom`.
8609
+ * extends the base class and adds a new method of `AddCallbackCustom`. (There is no corresponding
8610
+ * `RemoveCallbackCustom`.)
8597
8611
  *
8598
8612
  * To upgrade your mod, use the `upgradeMod` helper function.
8599
8613
  */
@@ -8605,7 +8619,9 @@ export declare class ModUpgraded implements Mod {
8605
8619
  Name: string;
8606
8620
  /** We store a copy of the original mod object so that we can re-implement its functions. */
8607
8621
  Mod: Mod;
8608
- constructor(mod: Mod);
8622
+ Debug: boolean;
8623
+ TimeThreshold: float | undefined;
8624
+ constructor(mod: Mod, debug: boolean, timeThreshold?: float);
8609
8625
  AddCallback<T extends ModCallback>(modCallback: T, ...args: AddCallbackParameter[T]): void;
8610
8626
  HasData(): boolean;
8611
8627
  LoadData(): string;
@@ -11219,6 +11235,8 @@ export declare function setTNTDisplay(textCallback: (tnt: GridEntityTNT) => stri
11219
11235
  /** Helper function to convert a set of flags to a single `BitFlags` object. */
11220
11236
  export declare function setToBitFlags<T extends BitFlag | BitFlag128>(set: Set<T> | ReadonlySet<T>): BitFlags<T>;
11221
11237
 
11238
+ export declare function setTracebackFunctionsGlobal(): void;
11239
+
11222
11240
  /**
11223
11241
  * Helper function to change the sprite of a trinket entity.
11224
11242
  *
@@ -12239,9 +12257,13 @@ export declare function unsetHotkey(keyboard: Keyboard): void;
12239
12257
  * ```
12240
12258
  *
12241
12259
  * @param modVanilla The mod object returned by the `RegisterMod` function.
12260
+ * @param debug Optional. Whether to log additional output when a callback is fired. Default is
12261
+ * false.
12262
+ * @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
12263
+ * specified number of seconds.
12242
12264
  * @returns The upgraded mod object.
12243
12265
  */
12244
- export declare function upgradeMod(modVanilla: Mod): ModUpgraded;
12266
+ export declare function upgradeMod(modVanilla: Mod, debug?: boolean, timeThreshold?: float): ModUpgraded;
12245
12267
 
12246
12268
  /**
12247
12269
  * Helper function to use an active item without showing an animation, keeping the item, or adding