isaacscript-common 13.2.0 → 13.3.1

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 (58) hide show
  1. package/dist/index.d.ts +37 -8
  2. package/dist/isaacscript-common.lua +6695 -6631
  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 +9 -70
  29. package/dist/src/functions/log.d.ts.map +1 -1
  30. package/dist/src/functions/log.lua +18 -504
  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/dist/src/indexLua.d.ts +185 -0
  38. package/dist/src/indexLua.d.ts.map +1 -0
  39. package/dist/src/indexLua.lua +1314 -0
  40. package/package.json +2 -2
  41. package/src/callbacks/customRevive.ts +2 -1
  42. package/src/callbacks/postNewRoomEarly.ts +1 -1
  43. package/src/classes/ModUpgraded.ts +50 -4
  44. package/src/core/upgradeMod.ts +10 -2
  45. package/src/features/customStage/exports.ts +1 -1
  46. package/src/features/extraConsoleCommands/listCommands.ts +1 -1
  47. package/src/features/pause.ts +1 -1
  48. package/src/features/saveDataManager/load.ts +2 -1
  49. package/src/features/saveDataManager/main.ts +1 -1
  50. package/src/features/taintedLazarusPlayers.ts +1 -1
  51. package/src/functions/benchmark.ts +23 -0
  52. package/src/functions/debugFunctions.ts +15 -25
  53. package/src/functions/globals.ts +1 -1
  54. package/src/functions/hex.ts +1 -1
  55. package/src/functions/jsonHelpers.ts +1 -1
  56. package/src/functions/log.ts +24 -455
  57. package/src/functions/logMisc.ts +441 -0
  58. package/src/index.ts +1 -0
package/dist/index.d.ts CHANGED
@@ -2977,11 +2977,6 @@ data: GridEntityCustomData
2977
2977
  */
2978
2978
  export declare function getCustomGridEntityType(gridEntityOrGridIndex: GridEntity | int): GridEntityType | undefined;
2979
2979
 
2980
- /**
2981
- * Helper function to prefix the name of the function and the line number before a debug message.
2982
- */
2983
- export declare function getDebugPrependString(msg: string, numParentFunctions?: number): string;
2984
-
2985
2980
  /**
2986
2981
  * Helper function to get a set containing all of the global variable names that are contained
2987
2982
  * within the Isaac environment by default.
@@ -3963,6 +3958,18 @@ export declare function getOppositeDoorSlot(doorSlot: DoorSlot): DoorSlot | unde
3963
3958
  */
3964
3959
  export declare function getOtherPlayers(player: EntityPlayer): EntityPlayer[];
3965
3960
 
3961
+ /**
3962
+ * Helper function to get the name and the line number of the current calling function.
3963
+ *
3964
+ * For this function to work properly, the "--luadebug" flag must be enabled. Otherwise, it will
3965
+ * always return undefined.
3966
+ *
3967
+ * @param levels Optional. The amount of levels to look backwards in the call stack. Default is 3
3968
+ * (because the first level is this function, the second level is the calling
3969
+ * function, and the third level is the parent of the calling function).
3970
+ */
3971
+ export declare function getParentFunctionDescription(levels?: number): string | undefined;
3972
+
3966
3973
  /**
3967
3974
  * Helper function to get the closest value from an array of strings based on partial search text.
3968
3975
  * For the purposes of this function, both search text and the array are converted to lowercase
@@ -5195,6 +5202,19 @@ export declare function getTearsStat(fireDelay: float): float;
5195
5202
  */
5196
5203
  export declare function getTeleporters(variant?: number): GridEntity[];
5197
5204
 
5205
+ /**
5206
+ * Helper function to get the current time in seconds for benchmarking / profiling purposes.
5207
+ *
5208
+ * - If the "--luadebug" flag is enabled, then this function will use the `socket.gettime` method,
5209
+ * which returns the epoch timestamp in seconds (e.g. "1640320492.5779"). This is preferable over
5210
+ * the `Isaac.GetTime` method, since it has one extra decimal point of precision.
5211
+ * - If the "--luadebug" flag is disabled, then this function will use the `Isaac.GetTime` method,
5212
+ * which returns the number of seconds since the computer's operating system was started (e.g.
5213
+ * "739454.963"). (The milliseconds return value of `Isaac.GetTime` is converted to seconds to
5214
+ * align with the return value of `socket.gettime`.)
5215
+ */
5216
+ export declare function getTime(): float;
5217
+
5198
5218
  /** Helper function to get all of the `GridEntityTNT` in the room. */
5199
5219
  export declare function getTNT(variant?: number): GridEntityTNT[];
5200
5220
 
@@ -8593,7 +8613,8 @@ export declare enum ModCallbackCustom {
8593
8613
  /**
8594
8614
  * `isaacscript-common` has many custom callbacks that you can use in your mods. Instead of
8595
8615
  * 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`.
8616
+ * extends the base class and adds a new method of `AddCallbackCustom`. (There is no corresponding
8617
+ * `RemoveCallbackCustom`.)
8597
8618
  *
8598
8619
  * To upgrade your mod, use the `upgradeMod` helper function.
8599
8620
  */
@@ -8605,7 +8626,9 @@ export declare class ModUpgraded implements Mod {
8605
8626
  Name: string;
8606
8627
  /** We store a copy of the original mod object so that we can re-implement its functions. */
8607
8628
  Mod: Mod;
8608
- constructor(mod: Mod);
8629
+ Debug: boolean;
8630
+ TimeThreshold: float | undefined;
8631
+ constructor(mod: Mod, debug: boolean, timeThreshold?: float);
8609
8632
  AddCallback<T extends ModCallback>(modCallback: T, ...args: AddCallbackParameter[T]): void;
8610
8633
  HasData(): boolean;
8611
8634
  LoadData(): string;
@@ -11219,6 +11242,8 @@ export declare function setTNTDisplay(textCallback: (tnt: GridEntityTNT) => stri
11219
11242
  /** Helper function to convert a set of flags to a single `BitFlags` object. */
11220
11243
  export declare function setToBitFlags<T extends BitFlag | BitFlag128>(set: Set<T> | ReadonlySet<T>): BitFlags<T>;
11221
11244
 
11245
+ export declare function setTracebackFunctionsGlobal(): void;
11246
+
11222
11247
  /**
11223
11248
  * Helper function to change the sprite of a trinket entity.
11224
11249
  *
@@ -12239,9 +12264,13 @@ export declare function unsetHotkey(keyboard: Keyboard): void;
12239
12264
  * ```
12240
12265
  *
12241
12266
  * @param modVanilla The mod object returned by the `RegisterMod` function.
12267
+ * @param debug Optional. Whether to log additional output when a callback is fired. Default is
12268
+ * false.
12269
+ * @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
12270
+ * specified number of seconds.
12242
12271
  * @returns The upgraded mod object.
12243
12272
  */
12244
- export declare function upgradeMod(modVanilla: Mod): ModUpgraded;
12273
+ export declare function upgradeMod(modVanilla: Mod, debug?: boolean, timeThreshold?: float): ModUpgraded;
12245
12274
 
12246
12275
  /**
12247
12276
  * Helper function to use an active item without showing an animation, keeping the item, or adding