isaacscript-common 13.1.1 → 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 (59) hide show
  1. package/dist/index.d.ts +47 -3
  2. package/dist/isaacscript-common.lua +11781 -11710
  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/deployJSONRoom.d.ts +21 -0
  14. package/dist/src/features/deployJSONRoom.d.ts.map +1 -1
  15. package/dist/src/features/deployJSONRoom.lua +33 -9
  16. package/dist/src/features/extraConsoleCommands/listCommands.lua +5 -5
  17. package/dist/src/features/pause.lua +2 -2
  18. package/dist/src/features/saveDataManager/load.d.ts.map +1 -1
  19. package/dist/src/features/saveDataManager/load.lua +2 -1
  20. package/dist/src/features/saveDataManager/main.lua +2 -2
  21. package/dist/src/features/taintedLazarusPlayers.lua +2 -2
  22. package/dist/src/functions/benchmark.d.ts +12 -0
  23. package/dist/src/functions/benchmark.d.ts.map +1 -1
  24. package/dist/src/functions/benchmark.lua +19 -0
  25. package/dist/src/functions/debugFunctions.d.ts +1 -0
  26. package/dist/src/functions/debugFunctions.d.ts.map +1 -1
  27. package/dist/src/functions/debugFunctions.lua +15 -23
  28. package/dist/src/functions/globals.lua +1 -1
  29. package/dist/src/functions/hex.lua +2 -2
  30. package/dist/src/functions/jsonHelpers.lua +2 -2
  31. package/dist/src/functions/log.d.ts +0 -68
  32. package/dist/src/functions/log.d.ts.map +1 -1
  33. package/dist/src/functions/log.lua +3 -496
  34. package/dist/src/functions/logMisc.d.ts +69 -0
  35. package/dist/src/functions/logMisc.d.ts.map +1 -0
  36. package/dist/src/functions/logMisc.lua +498 -0
  37. package/dist/src/index.d.ts +1 -0
  38. package/dist/src/index.d.ts.map +1 -1
  39. package/dist/src/index.lua +8 -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 +43 -4
  44. package/src/core/upgradeMod.ts +10 -2
  45. package/src/features/customStage/exports.ts +1 -1
  46. package/src/features/deployJSONRoom.ts +28 -16
  47. package/src/features/extraConsoleCommands/listCommands.ts +1 -1
  48. package/src/features/pause.ts +1 -1
  49. package/src/features/saveDataManager/load.ts +2 -1
  50. package/src/features/saveDataManager/main.ts +1 -1
  51. package/src/features/taintedLazarusPlayers.ts +1 -1
  52. package/src/functions/benchmark.ts +23 -0
  53. package/src/functions/debugFunctions.ts +15 -25
  54. package/src/functions/globals.ts +1 -1
  55. package/src/functions/hex.ts +1 -1
  56. package/src/functions/jsonHelpers.ts +1 -1
  57. package/src/functions/log.ts +5 -443
  58. package/src/functions/logMisc.ts +441 -0
  59. 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;
@@ -9468,6 +9484,28 @@ export declare function preventChildEntities(entity: Entity): void;
9468
9484
  */
9469
9485
  export declare function preventCollectibleRotation(collectible: EntityPickup, collectibleType: CollectibleType): void;
9470
9486
 
9487
+ /**
9488
+ * Helper function to prevent any removed grid entities from respawning if the player re-enters the
9489
+ * room.
9490
+ *
9491
+ * This is accomplished by spawning a new grid entity on every tile that does not already have a
9492
+ * grid entity. This will force the game to spawn the new grid entity instead of the old one. The
9493
+ * natural grid entity to choose for this purpose is a decoration, since it is non-interacting.
9494
+ * Then, the decorations are made invisible and any shovel uses are intercepted to avoid creating a
9495
+ * crawl space (instead of a trapdoor).
9496
+ *
9497
+ * Another option besides decorations would be to use a pressure plates with a state of 1, which is
9498
+ * a state that is normally unused by the game and makes it invisible & persistent. However, pickups
9499
+ * will not be able to spawn on pressure plates, which lead to various bugs (e.g. pickups spawning
9500
+ * on top of pits). Thus, using a decoration is preferable.
9501
+ *
9502
+ * Yet another option to accomplish this would be to replace the room data with that of an empty
9503
+ * room. However, the room data must exactly match the room type, the room shape, and the doors, so
9504
+ * this is not possible to do in a robust way without adding empty rooms to the mod's `content`
9505
+ * folder to draw the data from.
9506
+ */
9507
+ export declare function preventGridEntityRespawn(): void;
9508
+
9471
9509
  /**
9472
9510
  * Helper function to print something to the in-game console. Use this instead of invoking the
9473
9511
  * `Isaac.ConsoleOutput` method directly because it will automatically insert a newline at the end
@@ -11197,6 +11235,8 @@ export declare function setTNTDisplay(textCallback: (tnt: GridEntityTNT) => stri
11197
11235
  /** Helper function to convert a set of flags to a single `BitFlags` object. */
11198
11236
  export declare function setToBitFlags<T extends BitFlag | BitFlag128>(set: Set<T> | ReadonlySet<T>): BitFlags<T>;
11199
11237
 
11238
+ export declare function setTracebackFunctionsGlobal(): void;
11239
+
11200
11240
  /**
11201
11241
  * Helper function to change the sprite of a trinket entity.
11202
11242
  *
@@ -12217,9 +12257,13 @@ export declare function unsetHotkey(keyboard: Keyboard): void;
12217
12257
  * ```
12218
12258
  *
12219
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.
12220
12264
  * @returns The upgraded mod object.
12221
12265
  */
12222
- export declare function upgradeMod(modVanilla: Mod): ModUpgraded;
12266
+ export declare function upgradeMod(modVanilla: Mod, debug?: boolean, timeThreshold?: float): ModUpgraded;
12223
12267
 
12224
12268
  /**
12225
12269
  * Helper function to use an active item without showing an animation, keeping the item, or adding