isaacscript-common 80.2.1 → 80.2.3

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 (65) hide show
  1. package/dist/classes/ModUpgraded.d.ts.map +1 -1
  2. package/dist/classes/ModUpgraded.lua +18 -8
  3. package/dist/classes/features/other/DeployJSONRoom.lua +11 -10
  4. package/dist/classes/features/other/extraConsoleCommands/commands.d.ts +1 -1
  5. package/dist/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
  6. package/dist/classes/features/other/extraConsoleCommands/commands.lua +104 -102
  7. package/dist/classes/features/other/extraConsoleCommands/subroutines.d.ts.map +1 -1
  8. package/dist/classes/features/other/extraConsoleCommands/subroutines.lua +6 -4
  9. package/dist/core/constantsFirstLast.d.ts +4 -26
  10. package/dist/core/constantsFirstLast.d.ts.map +1 -1
  11. package/dist/core/constantsFirstLast.lua +0 -18
  12. package/dist/functions/cards.d.ts +1 -0
  13. package/dist/functions/cards.d.ts.map +1 -1
  14. package/dist/functions/cards.lua +7 -0
  15. package/dist/functions/collectibles.d.ts +1 -1
  16. package/dist/functions/collectibles.d.ts.map +1 -1
  17. package/dist/functions/collectibles.lua +3 -1
  18. package/dist/functions/doors.d.ts.map +1 -1
  19. package/dist/functions/doors.lua +14 -4
  20. package/dist/functions/entities.d.ts.map +1 -1
  21. package/dist/functions/entities.lua +19 -30
  22. package/dist/functions/gridEntities.d.ts.map +1 -1
  23. package/dist/functions/gridEntities.lua +8 -13
  24. package/dist/functions/jsonRoom.d.ts.map +1 -1
  25. package/dist/functions/jsonRoom.lua +13 -5
  26. package/dist/functions/pills.d.ts +1 -0
  27. package/dist/functions/pills.d.ts.map +1 -1
  28. package/dist/functions/pills.lua +6 -0
  29. package/dist/functions/run.d.ts +1 -2
  30. package/dist/functions/run.d.ts.map +1 -1
  31. package/dist/functions/run.lua +2 -3
  32. package/dist/functions/string.d.ts.map +1 -1
  33. package/dist/functions/string.lua +5 -3
  34. package/dist/functions/table.d.ts +3 -2
  35. package/dist/functions/table.d.ts.map +1 -1
  36. package/dist/functions/table.lua +3 -2
  37. package/dist/functions/trinkets.d.ts +1 -0
  38. package/dist/functions/trinkets.d.ts.map +1 -1
  39. package/dist/functions/trinkets.lua +6 -0
  40. package/dist/functions/types.d.ts +9 -0
  41. package/dist/functions/types.d.ts.map +1 -1
  42. package/dist/functions/types.lua +17 -0
  43. package/dist/index.rollup.d.ts +23 -32
  44. package/dist/isaacscript-common.lua +254 -207
  45. package/dist/lualib_bundle.lua +5 -0
  46. package/dist/objects/itemPoolTypeToCollectibleTypesSet.lua +4 -3
  47. package/package.json +2 -2
  48. package/src/classes/ModUpgraded.ts +18 -4
  49. package/src/classes/features/other/DeployJSONRoom.ts +11 -11
  50. package/src/classes/features/other/extraConsoleCommands/commands.ts +124 -118
  51. package/src/classes/features/other/extraConsoleCommands/subroutines.ts +5 -4
  52. package/src/core/constantsFirstLast.ts +3 -37
  53. package/src/functions/cards.ts +7 -0
  54. package/src/functions/collectibles.ts +5 -4
  55. package/src/functions/doors.ts +8 -3
  56. package/src/functions/entities.ts +40 -19
  57. package/src/functions/gridEntities.ts +15 -5
  58. package/src/functions/jsonRoom.ts +18 -5
  59. package/src/functions/pills.ts +7 -1
  60. package/src/functions/run.ts +6 -4
  61. package/src/functions/string.ts +4 -3
  62. package/src/functions/table.ts +3 -2
  63. package/src/functions/trinkets.ts +9 -1
  64. package/src/functions/types.ts +25 -0
  65. package/src/objects/itemPoolTypeToCollectibleTypesSet.ts +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/functions/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,eAAe,EACf,UAAU,EACV,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAEtC;;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;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAe5D"}
@@ -119,4 +119,21 @@ end
119
119
  function ____exports.isUserdata(self, variable)
120
120
  return type(variable) == "userdata"
121
121
  end
122
+ --- Helper function to convert a string to an integer. Returns undefined if the string is not an
123
+ -- integer.
124
+ --
125
+ -- Under the hood, this uses the built-in `tonumber` and `math.floor` functions.
126
+ --
127
+ -- This is named `parseIntSafe` in order to match the helper function in `isaacscript-common-ts`.
128
+ function ____exports.parseIntSafe(self, ____string)
129
+ if not ____exports.isString(nil, ____string) then
130
+ return nil
131
+ end
132
+ local number = tonumber(____string)
133
+ if number == nil then
134
+ return nil
135
+ end
136
+ local flooredNumber = math.floor(number)
137
+ return number == flooredNumber and flooredNumber or nil
138
+ end
122
139
  return ____exports
@@ -4652,10 +4652,6 @@ export declare const FIRST_PILL_COLOR = PillColor.BLUE_BLUE;
4652
4652
  /** Equal to `PillEffect.BAD_GAS`. */
4653
4653
  export declare const FIRST_PILL_EFFECT = PillEffect.BAD_GAS;
4654
4654
 
4655
- export declare const FIRST_ROOM_TYPE = RoomType.DEFAULT;
4656
-
4657
- export declare const FIRST_STAGE = LevelStage.BASEMENT_1;
4658
-
4659
4655
  /** Equal to `TrinketType.SWALLOWED_PENNY`. */
4660
4656
  export declare const FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY;
4661
4657
 
@@ -6492,8 +6488,9 @@ export declare function getNormalTrinketType(trinketType: TrinketType): TrinketT
6492
6488
  export declare function getNPCs(entityType?: EntityType | -1, variant?: number, subType?: number, ignoreFriendly?: boolean): EntityNPC[];
6493
6489
 
6494
6490
  /**
6495
- * Helper function to safely get number values from specific keys on a Lua table. Will throw an
6496
- * error if the specific value does not exist on the table or if it cannot be converted to a number.
6491
+ * Helper function to safely get number values from specific keys on a Lua table. If the values are
6492
+ * strings, they will be converted to numbers. Will throw an error if the specific value does not
6493
+ * exist on the table or if it cannot be converted to a number.
6497
6494
  *
6498
6495
  * This function is variadic, meaning that you can specify N arguments to get N values.
6499
6496
  */
@@ -10249,7 +10246,9 @@ export declare function isTSTLSet(object: unknown): object is Set<AnyNotNil>;
10249
10246
 
10250
10247
  export declare function isUserdata(variable: unknown): variable is LuaUserdata;
10251
10248
 
10252
- export declare function isValidCollectibleType(collectibleType: CollectibleType): boolean;
10249
+ export declare function isValidCardType(cardType: int): cardType is CardType;
10250
+
10251
+ export declare function isValidCollectibleType(collectibleType: int): collectibleType is CollectibleType;
10253
10252
 
10254
10253
  /**
10255
10254
  * Test if a grid position is actually in the given `RoomShape`.
@@ -10258,6 +10257,10 @@ export declare function isValidCollectibleType(collectibleType: CollectibleType)
10258
10257
  */
10259
10258
  export declare function isValidGridPosition(gridPosition: Vector, roomShape: RoomShape): boolean;
10260
10259
 
10260
+ export declare function isValidPillEffect(pillEffect: int): pillEffect is PillEffect;
10261
+
10262
+ export declare function isValidTrinketType(trinketType: int): trinketType is TrinketType;
10263
+
10261
10264
  export declare function isVanillaCardType(cardType: CardType): boolean;
10262
10265
 
10263
10266
  export declare function isVanillaCharacter(character: PlayerType): boolean;
@@ -10579,26 +10582,10 @@ export declare const LAST_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW;
10579
10582
  */
10580
10583
  export declare const LAST_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW;
10581
10584
 
10582
- export declare const LAST_ROOM_TYPE: RoomType;
10583
-
10584
- export declare const LAST_STAGE: LevelStage;
10585
-
10586
- /**
10587
- * Calculated from the `CardType` enum.
10588
- *
10589
- * Note that this could be calculated from the length of the enum, because card types are
10590
- * contiguous. However, we instead get the highest enum value to be safer and to make the code more
10591
- * consistent with collectibles and trinkets.
10592
- */
10585
+ /** Calculated from the `CardType` enum. */
10593
10586
  export declare const LAST_VANILLA_CARD_TYPE: CardType;
10594
10587
 
10595
- /**
10596
- * Calculated from the `PlayerType` enum.
10597
- *
10598
- * Note that this could be calculated from the length of the enum, because characters are
10599
- * contiguous. However, we instead get the highest enum value to be safer and to make the code more
10600
- * consistent with collectibles and trinkets.
10601
- */
10588
+ /** Calculated from the `PlayerType` enum. */
10602
10589
  export declare const LAST_VANILLA_CHARACTER: PlayerType;
10603
10590
 
10604
10591
  /**
@@ -10609,13 +10596,7 @@ export declare const LAST_VANILLA_CHARACTER: PlayerType;
10609
10596
  */
10610
10597
  export declare const LAST_VANILLA_COLLECTIBLE_TYPE: CollectibleType;
10611
10598
 
10612
- /**
10613
- * Calculated from the `PillEffect` enum.
10614
- *
10615
- * Note that this could be calculated from the length of the enum, because pill effects are
10616
- * contiguous. However, we instead get the highest enum value to be safer and to make the code more
10617
- * consistent with collectibles and trinkets.
10618
- */
10599
+ /** Calculated from the `PillEffect` enum. */
10619
10600
  export declare const LAST_VANILLA_PILL_EFFECT: PillEffect;
10620
10601
 
10621
10602
  /**
@@ -15229,6 +15210,16 @@ export declare function parseEntityID(entityID: string): [entityType: EntityType
15229
15210
  */
15230
15211
  export declare function parseEntityTypeVariantString(entityTypeVariantString: string): [entityType: EntityType, variant: int] | undefined;
15231
15212
 
15213
+ /**
15214
+ * Helper function to convert a string to an integer. Returns undefined if the string is not an
15215
+ * integer.
15216
+ *
15217
+ * Under the hood, this uses the built-in `tonumber` and `math.floor` functions.
15218
+ *
15219
+ * This is named `parseIntSafe` in order to match the helper function in `isaacscript-common-ts`.
15220
+ */
15221
+ export declare function parseIntSafe(string: string): int | undefined;
15222
+
15232
15223
  /**
15233
15224
  * Helper function to parse a Semantic Versioning string into its individual constituents. Returns
15234
15225
  * undefined if the submitted string was not a proper Semantic Version string.