isaacscript-common 15.6.1 → 16.0.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 (166) hide show
  1. package/dist/index.d.ts +32 -13
  2. package/dist/isaacscript-common.lua +143 -134
  3. package/dist/lualib_bundle.lua +20 -21
  4. package/dist/src/callbacks.d.ts +1 -1
  5. package/dist/src/callbacks.d.ts.map +1 -1
  6. package/dist/src/classes/DefaultMap.d.ts +1 -1
  7. package/dist/src/classes/DefaultMap.d.ts.map +1 -1
  8. package/dist/src/classes/ModUpgradedBase.d.ts +5 -0
  9. package/dist/src/classes/ModUpgradedBase.d.ts.map +1 -1
  10. package/dist/src/classes/ModUpgradedBase.lua +5 -1
  11. package/dist/src/classes/callbacks/PostCollectibleEmpty.d.ts +1 -1
  12. package/dist/src/classes/callbacks/PostCollectibleEmpty.d.ts.map +1 -1
  13. package/dist/src/classes/callbacks/PostCustomRevive.d.ts +1 -1
  14. package/dist/src/classes/callbacks/PostCustomRevive.d.ts.map +1 -1
  15. package/dist/src/classes/callbacks/PostDiceRoomActivated.d.ts +1 -1
  16. package/dist/src/classes/callbacks/PostDiceRoomActivated.d.ts.map +1 -1
  17. package/dist/src/classes/callbacks/PostGridEntityCollision.d.ts +1 -1
  18. package/dist/src/classes/callbacks/PostGridEntityCollision.d.ts.map +1 -1
  19. package/dist/src/classes/callbacks/PostGridEntityCustomCollision.d.ts +1 -1
  20. package/dist/src/classes/callbacks/PostGridEntityCustomCollision.d.ts.map +1 -1
  21. package/dist/src/classes/callbacks/PostGridEntityCustomRemove.d.ts +1 -1
  22. package/dist/src/classes/callbacks/PostGridEntityCustomRemove.d.ts.map +1 -1
  23. package/dist/src/classes/callbacks/PostGridEntityRemove.d.ts +1 -1
  24. package/dist/src/classes/callbacks/PostGridEntityRemove.d.ts.map +1 -1
  25. package/dist/src/classes/callbacks/PostItemDischarge.d.ts +3 -3
  26. package/dist/src/classes/callbacks/PostItemDischarge.d.ts.map +1 -1
  27. package/dist/src/classes/callbacks/PostPurchase.d.ts +1 -1
  28. package/dist/src/classes/callbacks/PostPurchase.d.ts.map +1 -1
  29. package/dist/src/classes/callbacks/PostRoomClearChanged.d.ts +1 -1
  30. package/dist/src/classes/callbacks/PostRoomClearChanged.d.ts.map +1 -1
  31. package/dist/src/classes/callbacks/PostTransformation.d.ts +1 -1
  32. package/dist/src/classes/callbacks/PostTransformation.d.ts.map +1 -1
  33. package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts +1 -1
  34. package/dist/src/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
  35. package/dist/src/classes/features/callbackLogic/CustomGridEntities.lua +30 -27
  36. package/dist/src/classes/features/callbackLogic/CustomRevive.d.ts +1 -1
  37. package/dist/src/classes/features/callbackLogic/CustomRevive.d.ts.map +1 -1
  38. package/dist/src/classes/features/callbackLogic/CustomRevive.lua +4 -4
  39. package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.d.ts +2 -2
  40. package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.d.ts.map +1 -1
  41. package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.lua +5 -2
  42. package/dist/src/classes/features/other/CustomHotkeys.lua +2 -2
  43. package/dist/src/classes/features/other/CustomStages.lua +4 -4
  44. package/dist/src/classes/features/other/PickupIndexCreation.d.ts +2 -2
  45. package/dist/src/classes/features/other/PickupIndexCreation.d.ts.map +1 -1
  46. package/dist/src/classes/features/other/PickupIndexCreation.lua +33 -48
  47. package/dist/src/classes/features/other/RoomHistory.d.ts +2 -2
  48. package/dist/src/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
  49. package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +1 -1
  50. package/dist/src/classes/private/CustomCallback.d.ts +2 -2
  51. package/dist/src/classes/private/CustomCallback.d.ts.map +1 -1
  52. package/dist/src/core/upgradeMod.d.ts +11 -2
  53. package/dist/src/core/upgradeMod.d.ts.map +1 -1
  54. package/dist/src/core/upgradeMod.lua +19 -2
  55. package/dist/src/functions/bitSet128.d.ts +1 -1
  56. package/dist/src/functions/bitSet128.d.ts.map +1 -1
  57. package/dist/src/functions/color.d.ts +1 -1
  58. package/dist/src/functions/color.d.ts.map +1 -1
  59. package/dist/src/functions/flag.lua +5 -1
  60. package/dist/src/functions/gridIndex.lua +1 -1
  61. package/dist/src/functions/input.d.ts +1 -1
  62. package/dist/src/functions/input.d.ts.map +1 -1
  63. package/dist/src/functions/input.lua +0 -3
  64. package/dist/src/functions/kColor.d.ts +1 -1
  65. package/dist/src/functions/kColor.d.ts.map +1 -1
  66. package/dist/src/functions/logEntities.lua +9 -9
  67. package/dist/src/functions/logMisc.lua +1 -4
  68. package/dist/src/functions/pills.d.ts +3 -3
  69. package/dist/src/functions/pills.lua +3 -3
  70. package/dist/src/functions/rng.d.ts +1 -1
  71. package/dist/src/functions/rng.d.ts.map +1 -1
  72. package/dist/src/functions/roomShapeWalls.lua +2 -2
  73. package/dist/src/functions/run.lua +1 -1
  74. package/dist/src/functions/ui.d.ts +1 -1
  75. package/dist/src/functions/ui.lua +1 -1
  76. package/dist/src/functions/vector.d.ts +7 -1
  77. package/dist/src/functions/vector.d.ts.map +1 -1
  78. package/dist/src/functions/vector.lua +4 -0
  79. package/dist/src/interfaces/CustomStageTSConfig.d.ts +1 -1
  80. package/dist/src/interfaces/CustomStageTSConfig.d.ts.map +1 -1
  81. package/dist/src/interfaces/PlayerHealth.d.ts +1 -1
  82. package/dist/src/interfaces/PlayerHealth.d.ts.map +1 -1
  83. package/dist/src/interfaces/SaveData.d.ts +12 -12
  84. package/dist/src/interfaces/SaveData.d.ts.map +1 -1
  85. package/dist/src/interfaces/private/CustomStage.d.ts +3 -3
  86. package/dist/src/interfaces/private/CustomStage.d.ts.map +1 -1
  87. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts +2 -2
  88. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts.map +1 -1
  89. package/dist/src/types/AllButFirst.d.ts +1 -1
  90. package/dist/src/types/AllButFirst.d.ts.map +1 -1
  91. package/dist/src/types/AllButLast.d.ts +1 -1
  92. package/dist/src/types/AllButLast.d.ts.map +1 -1
  93. package/dist/src/types/AnyClass.d.ts +1 -1
  94. package/dist/src/types/AnyClass.d.ts.map +1 -1
  95. package/dist/src/types/AnyEntity.d.ts +1 -1
  96. package/dist/src/types/AnyEntity.d.ts.map +1 -1
  97. package/dist/src/types/AnyFunction.d.ts +1 -1
  98. package/dist/src/types/AnyFunction.d.ts.map +1 -1
  99. package/dist/src/types/AnyGridEntity.d.ts +1 -1
  100. package/dist/src/types/AnyGridEntity.d.ts.map +1 -1
  101. package/dist/src/types/CollectibleIndex.d.ts +1 -1
  102. package/dist/src/types/CollectibleIndex.d.ts.map +1 -1
  103. package/dist/src/types/ConversionHeartSubType.d.ts +1 -1
  104. package/dist/src/types/ConversionHeartSubType.d.ts.map +1 -1
  105. package/dist/src/types/EntityID.d.ts +1 -1
  106. package/dist/src/types/EntityID.d.ts.map +1 -1
  107. package/dist/src/types/FunctionTuple.d.ts +1 -1
  108. package/dist/src/types/FunctionTuple.d.ts.map +1 -1
  109. package/dist/src/types/GridEntityID.d.ts +1 -1
  110. package/dist/src/types/GridEntityID.d.ts.map +1 -1
  111. package/dist/src/types/HasAllEnumKeys.d.ts +1 -1
  112. package/dist/src/types/HasAllEnumKeys.d.ts.map +1 -1
  113. package/dist/src/types/HasFunction.d.ts +1 -1
  114. package/dist/src/types/HasFunction.d.ts.map +1 -1
  115. package/dist/src/types/Immutable.d.ts +6 -6
  116. package/dist/src/types/Immutable.d.ts.map +1 -1
  117. package/dist/src/types/LowercaseKeys.d.ts +1 -1
  118. package/dist/src/types/LowercaseKeys.d.ts.map +1 -1
  119. package/dist/src/types/ModUpgraded.d.ts +3 -3
  120. package/dist/src/types/ModUpgraded.d.ts.map +1 -1
  121. package/dist/src/types/PickingUpItem.d.ts +1 -1
  122. package/dist/src/types/PickingUpItem.d.ts.map +1 -1
  123. package/dist/src/types/PickupIndex.d.ts +1 -1
  124. package/dist/src/types/PickupIndex.d.ts.map +1 -1
  125. package/dist/src/types/PlayerIndex.d.ts +1 -1
  126. package/dist/src/types/PlayerIndex.d.ts.map +1 -1
  127. package/dist/src/types/PossibleStatType.d.ts +1 -1
  128. package/dist/src/types/PossibleStatType.d.ts.map +1 -1
  129. package/dist/src/types/PublicInterface.d.ts +1 -1
  130. package/dist/src/types/PublicInterface.d.ts.map +1 -1
  131. package/dist/src/types/StartsWithLowercase.d.ts +1 -1
  132. package/dist/src/types/StartsWithLowercase.d.ts.map +1 -1
  133. package/dist/src/types/StartsWithUppercase.d.ts +1 -1
  134. package/dist/src/types/StartsWithUppercase.d.ts.map +1 -1
  135. package/dist/src/types/TSTLClass.d.ts +1 -1
  136. package/dist/src/types/TSTLClass.d.ts.map +1 -1
  137. package/dist/src/types/TupleToIntersection.d.ts +1 -1
  138. package/dist/src/types/TupleToIntersection.d.ts.map +1 -1
  139. package/dist/src/types/TupleToUnion.d.ts +1 -1
  140. package/dist/src/types/TupleToUnion.d.ts.map +1 -1
  141. package/dist/src/types/UnionToIntersection.d.ts +1 -1
  142. package/dist/src/types/UnionToIntersection.d.ts.map +1 -1
  143. package/dist/src/types/UppercaseKeys.d.ts +1 -1
  144. package/dist/src/types/UppercaseKeys.d.ts.map +1 -1
  145. package/dist/src/types/WeightedArray.d.ts +1 -1
  146. package/dist/src/types/WeightedArray.d.ts.map +1 -1
  147. package/dist/src/types/Writable.d.ts +1 -1
  148. package/dist/src/types/Writable.d.ts.map +1 -1
  149. package/dist/src/types/private/AllButFirst.d.ts +1 -1
  150. package/dist/src/types/private/AllButFirst.d.ts.map +1 -1
  151. package/dist/src/types/private/CallbackTuple.d.ts +2 -2
  152. package/dist/src/types/private/CallbackTuple.d.ts.map +1 -1
  153. package/package.json +1 -1
  154. package/src/classes/ModUpgradedBase.ts +9 -0
  155. package/src/classes/features/callbackLogic/CustomGridEntities.ts +36 -32
  156. package/src/classes/features/callbackLogic/CustomRevive.ts +3 -3
  157. package/src/classes/features/callbackLogic/GridEntityUpdateDetection.ts +7 -3
  158. package/src/classes/features/other/PickupIndexCreation.ts +43 -53
  159. package/src/classes/features/other/RoomHistory.ts +2 -2
  160. package/src/classes/features/other/extraConsoleCommands/commands.ts +2 -0
  161. package/src/core/upgradeMod.ts +23 -0
  162. package/src/functions/flag.ts +1 -1
  163. package/src/functions/input.ts +1 -5
  164. package/src/functions/pills.ts +3 -3
  165. package/src/functions/ui.ts +1 -1
  166. package/src/functions/vector.ts +6 -0
package/dist/index.d.ts CHANGED
@@ -1363,7 +1363,7 @@ export declare function combineSets<T>(...sets: Array<Set<T> | ReadonlySet<T>>):
1363
1363
  * Helper function to get the enum name for the specified `Controller` value. Note that this will
1364
1364
  * trim off the "BUTTON_" prefix.
1365
1365
  */
1366
- export declare function controllerToString(controller: Controller): string | undefined;
1366
+ export declare function controllerToString(controller: Controller): string;
1367
1367
 
1368
1368
  /**
1369
1369
  * This is the type that is fed to `registerCharacterHealthConversion` helper function to signify
@@ -1501,8 +1501,8 @@ declare abstract class CustomCallback<T extends ModCallbackCustom> extends Featu
1501
1501
 
1502
1502
  declare class CustomGridEntities extends Feature {
1503
1503
  private runInNFrames;
1504
- private postNewRoom;
1505
1504
  private preUseItemWeNeedToGoDeeper;
1505
+ private postNewRoomReordered;
1506
1506
  /**
1507
1507
  * Helper function to spawn a custom grid entity. Custom grid entities are persistent in that they
1508
1508
  * will reappear if the player leaves and re-enters the room. (It will be manually respawned in
@@ -1804,7 +1804,7 @@ declare class CustomRevive extends Feature {
1804
1804
  private postRender;
1805
1805
  private postPEffectUpdate;
1806
1806
  private checkWaitingForItemAnimation;
1807
- private postNewRoom;
1807
+ private postNewRoomReordered;
1808
1808
  private postPlayerFatalDamage;
1809
1809
  private preBerserkDeath;
1810
1810
  /**
@@ -4865,7 +4865,7 @@ export declare function getHearts(heartSubType?: HeartSubType): EntityPickupHear
4865
4865
  /**
4866
4866
  * Helper function to get the width of the first player's hearts on the UI. This is useful for
4867
4867
  * drawing UI elements to the right of where the player's hearts are. Make sure to use this in
4868
- * combination with the the `getHUDOffsetVector` helper function.
4868
+ * combination with the `getHUDOffsetVector` helper function.
4869
4869
  */
4870
4870
  export declare function getHeartsUIWidth(): int;
4871
4871
 
@@ -5268,9 +5268,9 @@ export declare function getPillEffectName(pillEffect: PillEffect): string;
5268
5268
 
5269
5269
  /**
5270
5270
  * Helper function to get a pill effect type from a PillEffect enum value. In this context, the type
5271
- * is equal to positive, negative, or neutral. This is derived from the suffix of the the "class"
5272
- * tag in the "pocketitems.xml" file. Use the `getPillEffectClass` helper function to determine the
5273
- * "power" of the pill.
5271
+ * is equal to positive, negative, or neutral. This is derived from the suffix of the "class" tag in
5272
+ * the "pocketitems.xml" file. Use the `getPillEffectClass` helper function to determine the "power"
5273
+ * of the pill.
5274
5274
  *
5275
5275
  * Due to limitations in the API, this function will not work properly for modded pill effects, and
5276
5276
  * will always return `DEFAULT_PILL_EFFECT_TYPE` in those cases.
@@ -6613,7 +6613,7 @@ declare class GridEntityUpdateDetection extends Feature {
6613
6613
  private checkGridEntityStateChanged;
6614
6614
  private checkNewGridEntity;
6615
6615
  private updateTupleInMap;
6616
- private postNewRoom;
6616
+ private postNewRoomReordered;
6617
6617
  }
6618
6618
 
6619
6619
  /**
@@ -10974,6 +10974,11 @@ export declare class ModUpgradedBase implements Mod {
10974
10974
  * don't have access to it..
10975
10975
  */
10976
10976
  private initOptionalFeature;
10977
+ /**
10978
+ * This is mostly the same as the `AddCustomCallback` method, but we initialize the custom
10979
+ * callback without actually registering a subscription.
10980
+ */
10981
+ private initCustomCallbackEarly;
10977
10982
  }
10978
10983
 
10979
10984
  export declare const MOVEMENT_ACTIONS_SET: ReadonlySet<ButtonAction>;
@@ -11322,7 +11327,8 @@ export declare type PickupIndex = int & {
11322
11327
  declare class PickupIndexCreation extends Feature {
11323
11328
  private roomHistory;
11324
11329
  private postPickupInit;
11325
- private trySetPickupIndex;
11330
+ private setPickupIndex;
11331
+ private getPickupIndexFromPreviousData;
11326
11332
  private postEntityRemovePickup;
11327
11333
  private checkDespawningFromPlayerLeavingRoom;
11328
11334
  /**
@@ -11330,7 +11336,6 @@ declare class PickupIndexCreation extends Feature {
11330
11336
  * Keep track of the metadata for later.
11331
11337
  */
11332
11338
  private trackDespawningPickupMetadata;
11333
- private postNewRoomReordered;
11334
11339
  private getPostAscentPickupIndex;
11335
11340
  /**
11336
11341
  * Mods often have to track variables relating to a pickups. Finding an index for these kinds of
@@ -12561,8 +12566,8 @@ declare class RoomHistory extends Feature {
12561
12566
  /**
12562
12567
  * Helper function to detect if the game is in the state where the room index has changed to a new
12563
12568
  * room, but the entities from the previous room are currently in the process of despawning. (At
12564
- * this point, the `POST_NEW_ROOM` callback will not have fired yet, and there will not be an
12565
- * entry in the room history array for the current room.)
12569
+ * this point, the `POST_NEW_ROOM` callback and the `POST_NEW_ROOM_EARLY` callback will not have
12570
+ * fired yet, and there will not be an entry in the room history array for the current room.)
12566
12571
  *
12567
12572
  * This function is intended to be used in the `POST_ENTITY_REMOVE` callback to detect when an
12568
12573
  * entity is despawning.
@@ -14434,6 +14439,14 @@ export declare type UnionToIntersection<U> = (U extends U ? (u: U) => 0 : never)
14434
14439
  * @param modVanilla The mod object returned by the `RegisterMod` function.
14435
14440
  * @param features Optional. An array containing the optional standard library features that you
14436
14441
  * want to enable, if any. Default is an empty array.
14442
+ * @param customCallbacksUsed Optional. An array containing the custom callbacks that you will be
14443
+ * subscribing to after you upgrade your mod. Specifying this will
14444
+ * immediately initialize the callbacks (as opposed to lazy-initializing
14445
+ * them when you first subscribe to the callback). This is only necessary
14446
+ * if you the order of callback firing is important for your mod. (For
14447
+ * example, you may want the `POST_NEW_ROOM` part of the
14448
+ * `POST_GRID_ENTITY_INIT` callback to fire before your own
14449
+ * `POST_NEW_ROOM` callbacks.)
14437
14450
  * @param debug Optional. Whether to log additional output when a callback is fired. Default is
14438
14451
  * false.
14439
14452
  * @param timeThreshold Optional. If provided, will only log callbacks that take longer than the
@@ -14441,7 +14454,7 @@ export declare type UnionToIntersection<U> = (U extends U ? (u: U) => 0 : never)
14441
14454
  * or milliseconds (if the "--luadebug" launch flag is turned off).
14442
14455
  * @returns The upgraded mod object.
14443
14456
  */
14444
- export declare function upgradeMod<T extends readonly ISCFeature[] = never[]>(modVanilla: Mod, features?: ISCFeatureTuple<T>, debug?: boolean, timeThreshold?: float): ModUpgraded<T>;
14457
+ export declare function upgradeMod<T extends readonly ISCFeature[] = never[]>(modVanilla: Mod, features?: ISCFeatureTuple<T>, customCallbacksUsed?: ModCallbackCustom[] | readonly ModCallbackCustom[], debug?: boolean, timeThreshold?: float): ModUpgraded<T>;
14445
14458
 
14446
14459
  /** Helper type to match all of the uppercase keys of an object. */
14447
14460
  export declare type UppercaseKeys<T> = StartsWithUppercase<keyof T>;
@@ -14505,6 +14518,12 @@ export declare function validateEnumContiguous<T>(transpiledEnumName: string, tr
14505
14518
  */
14506
14519
  export declare function validateInterfaceMatchesEnum<T extends Record<Enum, unknown>, Enum extends string | number>(): void;
14507
14520
 
14521
+ /**
14522
+ * Helper function to compare two vectors for equality.
14523
+ *
14524
+ * This function is useful because vectors are not directly comparable. In other words, `Vector(1.2)
14525
+ * === Vector(1.2)` will be equal to false.
14526
+ */
14508
14527
  export declare function vectorEquals(vector1: Vector, vector2: Vector): boolean;
14509
14528
 
14510
14529
  /**