isaacscript-common 43.1.0 → 44.1.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 (66) hide show
  1. package/dist/index.rollup.d.ts +53 -43
  2. package/dist/isaacscript-common.lua +5368 -5246
  3. package/dist/src/classes/features/other/ItemPoolDetection.d.ts.map +1 -1
  4. package/dist/src/classes/features/other/ItemPoolDetection.lua +2 -1
  5. package/dist/src/classes/features/other/Pause.lua +2 -2
  6. package/dist/src/classes/features/other/PlayerCollectibleTracking.d.ts +41 -0
  7. package/dist/src/classes/features/other/PlayerCollectibleTracking.d.ts.map +1 -0
  8. package/dist/src/classes/features/other/PlayerCollectibleTracking.lua +63 -0
  9. package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +4 -3
  10. package/dist/src/enums/ISCFeature.d.ts +1 -1
  11. package/dist/src/enums/ISCFeature.d.ts.map +1 -1
  12. package/dist/src/enums/ISCFeature.lua +2 -2
  13. package/dist/src/features.d.ts +3 -3
  14. package/dist/src/features.d.ts.map +1 -1
  15. package/dist/src/features.lua +3 -3
  16. package/dist/src/functions/characters.d.ts +9 -2
  17. package/dist/src/functions/characters.d.ts.map +1 -1
  18. package/dist/src/functions/characters.lua +13 -4
  19. package/dist/src/functions/charge.lua +2 -2
  20. package/dist/src/functions/playerCollectibles.d.ts +127 -0
  21. package/dist/src/functions/playerCollectibles.d.ts.map +1 -0
  22. package/dist/src/functions/playerCollectibles.lua +308 -0
  23. package/dist/src/functions/playerHealth.d.ts.map +1 -1
  24. package/dist/src/functions/playerHealth.lua +3 -2
  25. package/dist/src/functions/playerTrinkets.d.ts +69 -0
  26. package/dist/src/functions/playerTrinkets.d.ts.map +1 -0
  27. package/dist/src/functions/playerTrinkets.lua +160 -0
  28. package/dist/src/functions/players.d.ts +5 -166
  29. package/dist/src/functions/players.d.ts.map +1 -1
  30. package/dist/src/functions/players.lua +20 -389
  31. package/dist/src/functions/trinketGive.lua +2 -2
  32. package/dist/src/functions/trinkets.d.ts +0 -30
  33. package/dist/src/functions/trinkets.d.ts.map +1 -1
  34. package/dist/src/functions/trinkets.lua +0 -71
  35. package/dist/src/index.d.ts +2 -0
  36. package/dist/src/index.d.ts.map +1 -1
  37. package/dist/src/index.lua +16 -0
  38. package/dist/src/objects/{characterStartingCollectibles.d.ts → characterStartingCollectibleTypes.d.ts} +2 -2
  39. package/dist/src/objects/characterStartingCollectibleTypes.d.ts.map +1 -0
  40. package/dist/src/objects/{characterStartingCollectibles.lua → characterStartingCollectibleTypes.lua} +1 -1
  41. package/dist/src/objects/characterStartingTrinketTypes.d.ts +46 -0
  42. package/dist/src/objects/characterStartingTrinketTypes.d.ts.map +1 -0
  43. package/dist/src/objects/characterStartingTrinketTypes.lua +49 -0
  44. package/package.json +1 -1
  45. package/src/classes/features/other/ItemPoolDetection.ts +2 -4
  46. package/src/classes/features/other/Pause.ts +1 -1
  47. package/src/classes/features/other/PlayerCollectibleTracking.ts +126 -0
  48. package/src/classes/features/other/extraConsoleCommands/commands.ts +3 -3
  49. package/src/enums/ISCFeature.ts +1 -1
  50. package/src/features.ts +3 -3
  51. package/src/functions/characters.ts +20 -4
  52. package/src/functions/charge.ts +1 -1
  53. package/src/functions/playerCollectibles.ts +372 -0
  54. package/src/functions/playerHealth.ts +2 -6
  55. package/src/functions/playerTrinkets.ts +184 -0
  56. package/src/functions/players.ts +16 -481
  57. package/src/functions/trinketGive.ts +1 -1
  58. package/src/functions/trinkets.ts +1 -84
  59. package/src/index.ts +2 -0
  60. package/src/objects/{characterStartingCollectibles.ts → characterStartingCollectibleTypes.ts} +1 -1
  61. package/src/objects/characterStartingTrinketTypes.ts +129 -0
  62. package/dist/src/classes/features/other/PlayerInventory.d.ts +0 -39
  63. package/dist/src/classes/features/other/PlayerInventory.d.ts.map +0 -1
  64. package/dist/src/classes/features/other/PlayerInventory.lua +0 -64
  65. package/dist/src/objects/characterStartingCollectibles.d.ts.map +0 -1
  66. package/src/classes/features/other/PlayerInventory.ts +0 -124
@@ -4917,7 +4917,15 @@ export declare function getCharacters(): PlayerType[];
4917
4917
  *
4918
4918
  * Note that this will return an empty array for Eden and Tainted Eden.
4919
4919
  */
4920
- export declare function getCharacterStartingCollectibles(character: PlayerType): readonly CollectibleType[];
4920
+ export declare function getCharacterStartingCollectibleTypes(character: PlayerType): readonly CollectibleType[];
4921
+
4922
+ /**
4923
+ * Helper function to get the trinket that is granted to a particular character at the beginning of
4924
+ * a run. Returns undefined if the character does not start with a trinket.
4925
+ *
4926
+ * Note that this will return undefined for Eden and Tainted Eden.
4927
+ */
4928
+ export declare function getCharacterStartingTrinketType(character: PlayerType): TrinketType | undefined;
4921
4929
 
4922
4930
  /**
4923
4931
  * Helper function to get the amount of charges away from the maximum charge that a particular
@@ -6339,9 +6347,9 @@ export declare function getPlayers(performCharacterExclusions?: boolean): Entity
6339
6347
  export declare function getPlayersOfType(...characters: PlayerType[]): EntityPlayer[];
6340
6348
 
6341
6349
  /**
6342
- * Helper function to get all of the players that match the provided controller index. This function
6343
- * returns an array of players because it is possible that there is more than one player with the
6344
- * same controller index (e.g. Jacob & Esau).
6350
+ * Helper function to get all of the players that are using keyboard (i.e.
6351
+ * `ControllerIndex.KEYBOARD`). This function returns an array of players because it is possible
6352
+ * that there is more than one player with the same controller index (e.g. Jacob & Esau).
6345
6353
  *
6346
6354
  * Note that this function includes players with a non-undefined parent like e.g. the Strawman
6347
6355
  * Keeper.
@@ -8335,7 +8343,7 @@ export declare enum ISCFeature {
8335
8343
  PAUSE = 37,
8336
8344
  PERSISTENT_ENTITIES = 38,
8337
8345
  PICKUP_INDEX_CREATION = 39,
8338
- PLAYER_INVENTORY = 40,
8346
+ PLAYER_COLLECTIBLE_TRACKING = 40,
8339
8347
  PONY_DETECTION = 41,
8340
8348
  PRESS_INPUT = 42,
8341
8349
  PREVENT_CHILD_ENTITIES = 43,
@@ -8400,7 +8408,7 @@ declare interface ISCFeatureToClass {
8400
8408
  [ISCFeature.PAUSE]: Pause;
8401
8409
  [ISCFeature.PERSISTENT_ENTITIES]: PersistentEntities;
8402
8410
  [ISCFeature.PICKUP_INDEX_CREATION]: PickupIndexCreation;
8403
- [ISCFeature.PLAYER_INVENTORY]: PlayerInventory;
8411
+ [ISCFeature.PLAYER_COLLECTIBLE_TRACKING]: PlayerCollectibleTracking;
8404
8412
  [ISCFeature.PONY_DETECTION]: PonyDetection;
8405
8413
  [ISCFeature.PRESS_INPUT]: PressInput;
8406
8414
  [ISCFeature.PREVENT_CHILD_ENTITIES]: PreventChildEntities;
@@ -14248,6 +14256,45 @@ declare class PlayerCollectibleDetection extends Feature {
14248
14256
  private checkActiveItemsChanged;
14249
14257
  }
14250
14258
 
14259
+ declare class PlayerCollectibleTracking extends Feature {
14260
+ private readonly postPlayerCollectibleAdded;
14261
+ private readonly postPlayerCollectibleRemoved;
14262
+ /**
14263
+ * Helper function to get all of the collectible types that the player has gotten so far on this
14264
+ * run, in order.
14265
+ *
14266
+ * In the case of items given on the first frame of the run or the case where the player rerolls
14267
+ * their build in the middle of the run (e.g. with D4), the order of the collectible types will
14268
+ * not correspond to the order that the items were actually given to the player. In this case, the
14269
+ * order will be from the lowest `CollectibleType` to the highest.
14270
+ *
14271
+ * Under the hood, this feature works by tracking the number of collectibles that a player has on
14272
+ * every frame. Thus, in a situation where a collectible was both added and removed to the player
14273
+ * on the same frame, the amount of total collectibles would stay the same, and the collectible
14274
+ * types would not be updated. In vanilla, this situation would never happen, but another mod
14275
+ * might do this for some reason. (With that said, the next time that a collectible is normally
14276
+ * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
14277
+ *
14278
+ * In order to use this function, you must upgrade your mod with
14279
+ * `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
14280
+ *
14281
+ * @param player The player to get the collectible types for.
14282
+ * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
14283
+ * Default is true.
14284
+ */
14285
+ getPlayerCollectibleTypes(player: EntityPlayer, includeActiveCollectibles?: boolean): readonly CollectibleType[];
14286
+ /**
14287
+ * Helper function to get the last passive collectible type that the player picked up. In most
14288
+ * cases, this will be the passive that would be removed if the player used Clicker.
14289
+ *
14290
+ * Returns undefined if the player does not have any passive collectibles.
14291
+ *
14292
+ * In order to use this function, you must upgrade your mod with
14293
+ * `ISCFeature.PLAYER_COLLECTIBLE_TRACKING`.
14294
+ */
14295
+ getPlayerLastPassiveCollectibleType(player: EntityPlayer): CollectibleType | undefined;
14296
+ }
14297
+
14251
14298
  /**
14252
14299
  * Helper function to remove all of a player's black hearts and add the corresponding amount of soul
14253
14300
  * hearts.
@@ -14303,43 +14350,6 @@ export declare type PlayerIndex = int & {
14303
14350
  readonly __playerIndexBrand: symbol;
14304
14351
  };
14305
14352
 
14306
- declare class PlayerInventory extends Feature {
14307
- private readonly postCollectibleAdded;
14308
- private readonly postCollectibleRemoved;
14309
- /**
14310
- * Helper function to get all of the collectibles that the player has gotten so far on this run,
14311
- * in order.
14312
- *
14313
- * In the case of inventory initialization or the case where the player rerolls their build in the
14314
- * middle of the run (e.g. with D4), the order of the inventory will not correspond to the order
14315
- * that the items were actually given to the player. In this case, the inventory will be in the
14316
- * order of the lowest `CollectibleType` to the highest.
14317
- *
14318
- * Under the hood, the inventory tracking works by tracking the number of collectibles that a
14319
- * player has on every frame. Thus, in a situation where a collectible was both added and removed
14320
- * to the player on the same frame, the amount of total collectibles would stay the same, and the
14321
- * inventory would not be updated. In vanilla, this situation would never happen, but another mod
14322
- * might do this for some reason. (With that said, the next time that a collectible is normally
14323
- * added or removed, it would trigger a re-scan, and the previous changes would be picked up.)
14324
- *
14325
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
14326
- *
14327
- * @param player The player to get the inventory for.
14328
- * @param includeActiveCollectibles Optional. If true, will include all active collectibles.
14329
- * Default is true.
14330
- */
14331
- getPlayerInventory(player: EntityPlayer, includeActiveCollectibles?: boolean): CollectibleType[];
14332
- /**
14333
- * Helper function to get the last passive collectible that the player picked up. In most cases,
14334
- * this will be the passive that is removed when the player would use Clicker.
14335
- *
14336
- * Returns undefined if the player does not have any passive collectibles.
14337
- *
14338
- * In order to use this function, you must upgrade your mod with `ISCFeature.PLAYER_INVENTORY`.
14339
- */
14340
- getPlayerLastPassiveCollectible(player: EntityPlayer): CollectibleType | undefined;
14341
- }
14342
-
14343
14353
  declare class PlayerReorderedCallbacks extends Feature {
14344
14354
  v: {
14345
14355
  run: {