isaacscript-common 7.0.0 → 7.2.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 (254) hide show
  1. package/dist/callbacks/postPlayerChangeHealth.lua +8 -1
  2. package/dist/callbacks/postPlayerChangeStat.d.ts +3 -0
  3. package/dist/callbacks/postPlayerChangeStat.d.ts.map +1 -0
  4. package/dist/callbacks/postPlayerChangeStat.lua +88 -0
  5. package/dist/callbacks/subscriptions/postPlayerChangeHealth.d.ts +2 -2
  6. package/dist/callbacks/subscriptions/postPlayerChangeHealth.d.ts.map +1 -1
  7. package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +9 -2
  8. package/dist/callbacks/subscriptions/postPlayerChangeStat.d.ts +12 -0
  9. package/dist/callbacks/subscriptions/postPlayerChangeStat.d.ts.map +1 -0
  10. package/dist/callbacks/subscriptions/postPlayerChangeStat.lua +35 -0
  11. package/dist/classes/DefaultMap.d.ts +5 -5
  12. package/dist/classes/DefaultMap.d.ts.map +1 -1
  13. package/dist/core/constants.d.ts +1 -1
  14. package/dist/core/constants.d.ts.map +1 -1
  15. package/dist/core/constants.lua +1 -1
  16. package/dist/enums/AmbushType.d.ts +1 -0
  17. package/dist/enums/AmbushType.d.ts.map +1 -1
  18. package/dist/enums/AmbushType.lua +1 -0
  19. package/dist/enums/CornerType.d.ts +1 -0
  20. package/dist/enums/CornerType.d.ts.map +1 -1
  21. package/dist/enums/CornerType.lua +1 -0
  22. package/dist/enums/ModCallbackCustom.d.ts +70 -39
  23. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  24. package/dist/enums/ModCallbackCustom.lua +37 -35
  25. package/dist/enums/PocketItemType.d.ts +1 -0
  26. package/dist/enums/PocketItemType.d.ts.map +1 -1
  27. package/dist/enums/PocketItemType.lua +1 -0
  28. package/dist/enums/RockAltType.d.ts +1 -0
  29. package/dist/enums/RockAltType.d.ts.map +1 -1
  30. package/dist/enums/RockAltType.lua +1 -0
  31. package/dist/enums/SerializationType.d.ts +1 -0
  32. package/dist/enums/SerializationType.d.ts.map +1 -1
  33. package/dist/enums/SerializationType.lua +1 -0
  34. package/dist/enums/SlotDestructionType.d.ts +1 -0
  35. package/dist/enums/SlotDestructionType.d.ts.map +1 -1
  36. package/dist/enums/SlotDestructionType.lua +1 -0
  37. package/dist/enums/StatType.d.ts +28 -0
  38. package/dist/enums/StatType.d.ts.map +1 -0
  39. package/dist/enums/StatType.lua +28 -0
  40. package/dist/enums/index.d.ts +1 -0
  41. package/dist/enums/index.d.ts.map +1 -1
  42. package/dist/enums/index.lua +8 -0
  43. package/dist/enums/private/CopyableIsaacAPIClassType.d.ts +5 -1
  44. package/dist/enums/private/CopyableIsaacAPIClassType.d.ts.map +1 -1
  45. package/dist/enums/private/CopyableIsaacAPIClassType.lua +3 -1
  46. package/dist/enums/private/SerializationBrand.d.ts +1 -0
  47. package/dist/enums/private/SerializationBrand.d.ts.map +1 -1
  48. package/dist/enums/private/SerializationBrand.lua +1 -0
  49. package/dist/features/customStage/backdrop.d.ts +1 -1
  50. package/dist/features/customStage/backdrop.d.ts.map +1 -1
  51. package/dist/features/customStage/backdrop.lua +1 -1
  52. package/dist/features/customStage/init.lua +2 -2
  53. package/dist/features/customStage/versusScreen.lua +2 -2
  54. package/dist/features/saveDataManager/merge.d.ts +1 -0
  55. package/dist/features/saveDataManager/merge.d.ts.map +1 -1
  56. package/dist/features/saveDataManager/merge.lua +1 -0
  57. package/dist/functions/bitSet128.d.ts +25 -0
  58. package/dist/functions/bitSet128.d.ts.map +1 -0
  59. package/dist/functions/bitSet128.lua +71 -0
  60. package/dist/functions/cacheFlag.d.ts +23 -1
  61. package/dist/functions/cacheFlag.d.ts.map +1 -1
  62. package/dist/functions/cacheFlag.lua +78 -0
  63. package/dist/functions/collectibles.d.ts +2 -2
  64. package/dist/functions/collectibles.lua +2 -2
  65. package/dist/functions/color.d.ts +1 -1
  66. package/dist/functions/color.d.ts.map +1 -1
  67. package/dist/functions/color.lua +2 -2
  68. package/dist/functions/deepCopy.d.ts +1 -0
  69. package/dist/functions/deepCopy.d.ts.map +1 -1
  70. package/dist/functions/deepCopy.lua +1 -0
  71. package/dist/functions/familiars.d.ts +4 -4
  72. package/dist/functions/familiars.lua +4 -4
  73. package/dist/functions/flag.d.ts +1 -1
  74. package/dist/functions/flag.lua +1 -1
  75. package/dist/functions/flying.lua +2 -2
  76. package/dist/functions/index.d.ts +2 -1
  77. package/dist/functions/index.d.ts.map +1 -1
  78. package/dist/functions/index.lua +16 -8
  79. package/dist/functions/input.d.ts +4 -1
  80. package/dist/functions/input.d.ts.map +1 -1
  81. package/dist/functions/input.lua +10 -2
  82. package/dist/functions/jsonRoom.lua +4 -4
  83. package/dist/functions/kColor.d.ts +1 -1
  84. package/dist/functions/kColor.d.ts.map +1 -1
  85. package/dist/functions/kColor.lua +2 -2
  86. package/dist/functions/log.lua +1 -1
  87. package/dist/functions/npcs.d.ts +2 -2
  88. package/dist/functions/npcs.lua +2 -2
  89. package/dist/functions/playerIndex.d.ts +1 -1
  90. package/dist/functions/playerIndex.lua +1 -1
  91. package/dist/functions/playerStats.d.ts +6 -0
  92. package/dist/functions/playerStats.d.ts.map +1 -0
  93. package/dist/functions/playerStats.lua +21 -0
  94. package/dist/functions/players.d.ts +1 -1
  95. package/dist/functions/players.lua +1 -1
  96. package/dist/functions/rng.d.ts +1 -1
  97. package/dist/functions/rng.d.ts.map +1 -1
  98. package/dist/functions/rng.lua +2 -2
  99. package/dist/functions/rockAlt.d.ts.map +1 -1
  100. package/dist/functions/rockAlt.lua +11 -20
  101. package/dist/functions/roomTransition.d.ts +1 -1
  102. package/dist/functions/roomTransition.lua +1 -1
  103. package/dist/functions/rooms.d.ts +1 -1
  104. package/dist/functions/rooms.d.ts.map +1 -1
  105. package/dist/functions/rooms.lua +2 -1
  106. package/dist/functions/sprites.d.ts +3 -3
  107. package/dist/functions/sprites.lua +3 -3
  108. package/dist/functions/tears.d.ts +5 -4
  109. package/dist/functions/tears.d.ts.map +1 -1
  110. package/dist/functions/tears.lua +5 -4
  111. package/dist/functions/utils.d.ts +4 -1
  112. package/dist/functions/utils.d.ts.map +1 -1
  113. package/dist/functions/utils.lua +4 -1
  114. package/dist/functions/vector.d.ts +1 -1
  115. package/dist/functions/vector.d.ts.map +1 -1
  116. package/dist/functions/vector.lua +2 -2
  117. package/dist/initCustomCallbacks.d.ts.map +1 -1
  118. package/dist/initCustomCallbacks.lua +3 -0
  119. package/dist/interfaces/ChargeBarSprites.d.ts +1 -1
  120. package/dist/interfaces/Corner.d.ts +5 -0
  121. package/dist/interfaces/Corner.d.ts.map +1 -1
  122. package/dist/interfaces/CustomStageLua.d.ts +57 -0
  123. package/dist/interfaces/CustomStageLua.d.ts.map +1 -1
  124. package/dist/interfaces/GridEntityCustomData.d.ts +6 -0
  125. package/dist/interfaces/GridEntityCustomData.d.ts.map +1 -1
  126. package/dist/interfaces/JSONRoomsFile.d.ts +7 -3
  127. package/dist/interfaces/JSONRoomsFile.d.ts.map +1 -1
  128. package/dist/interfaces/PlayerHealth.d.ts +1 -1
  129. package/dist/interfaces/PlayerHealth.d.ts.map +1 -1
  130. package/dist/interfaces/PocketItemDescription.d.ts +1 -1
  131. package/dist/interfaces/PocketItemDescription.d.ts.map +1 -1
  132. package/dist/interfaces/RoomDescription.d.ts +1 -1
  133. package/dist/interfaces/RoomDescription.d.ts.map +1 -1
  134. package/dist/interfaces/SaveData.d.ts +2 -5
  135. package/dist/interfaces/SaveData.d.ts.map +1 -1
  136. package/dist/interfaces/StatTypeType.d.ts +21 -0
  137. package/dist/interfaces/StatTypeType.d.ts.map +1 -0
  138. package/dist/interfaces/StatTypeType.lua +4 -0
  139. package/dist/interfaces/TrinketSituation.d.ts +1 -1
  140. package/dist/interfaces/TrinketSituation.d.ts.map +1 -1
  141. package/dist/interfaces/index.d.ts +1 -0
  142. package/dist/interfaces/index.d.ts.map +1 -1
  143. package/dist/interfaces/private/AddCallbackParameterCustom.d.ts +2 -0
  144. package/dist/interfaces/private/AddCallbackParameterCustom.d.ts.map +1 -1
  145. package/dist/maps/keyboardToString.d.ts +4 -0
  146. package/dist/maps/keyboardToString.d.ts.map +1 -0
  147. package/dist/maps/keyboardToString.lua +73 -0
  148. package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
  149. package/dist/objects/callbackRegisterFunctions.lua +3 -0
  150. package/dist/objects/isaacAPIClassTypeToBrand.d.ts.map +1 -1
  151. package/dist/objects/isaacAPIClassTypeToBrand.lua +7 -1
  152. package/dist/objects/isaacAPIClassTypeToFunctions.d.ts.map +1 -1
  153. package/dist/objects/isaacAPIClassTypeToFunctions.lua +12 -1
  154. package/dist/types/AnyEntity.d.ts +5 -0
  155. package/dist/types/AnyEntity.d.ts.map +1 -1
  156. package/dist/types/AnyGridEntity.d.ts +5 -0
  157. package/dist/types/AnyGridEntity.d.ts.map +1 -1
  158. package/dist/types/CollectibleIndex.d.ts +4 -3
  159. package/dist/types/CollectibleIndex.d.ts.map +1 -1
  160. package/dist/types/Immutable.d.ts +3 -1
  161. package/dist/types/Immutable.d.ts.map +1 -1
  162. package/dist/types/PickupIndex.d.ts +4 -2
  163. package/dist/types/PickupIndex.d.ts.map +1 -1
  164. package/dist/types/PlayerIndex.d.ts +3 -2
  165. package/dist/types/PlayerIndex.d.ts.map +1 -1
  166. package/dist/types/SerializedIsaacAPIClass.d.ts +6 -0
  167. package/dist/types/SerializedIsaacAPIClass.d.ts.map +1 -1
  168. package/dist/types/TSTLClass.d.ts +5 -0
  169. package/dist/types/TSTLClass.d.ts.map +1 -1
  170. package/dist/types/TrapdoorDestination.d.ts +3 -0
  171. package/dist/types/TrapdoorDestination.d.ts.map +1 -1
  172. package/package.json +2 -2
  173. package/src/callbacks/postPlayerChangeHealth.ts +7 -1
  174. package/src/callbacks/postPlayerChangeStat.ts +110 -0
  175. package/src/callbacks/subscriptions/postPlayerChangeHealth.ts +5 -1
  176. package/src/callbacks/subscriptions/postPlayerChangeStat.ts +55 -0
  177. package/src/classes/DefaultMap.ts +7 -7
  178. package/src/core/constants.ts +1 -1
  179. package/src/enums/AmbushType.ts +1 -0
  180. package/src/enums/CornerType.ts +1 -0
  181. package/src/enums/ModCallbackCustom.ts +36 -4
  182. package/src/enums/PocketItemType.ts +1 -0
  183. package/src/enums/RockAltType.ts +1 -0
  184. package/src/enums/SerializationType.ts +1 -0
  185. package/src/enums/SlotDestructionType.ts +1 -0
  186. package/src/enums/StatType.ts +47 -0
  187. package/src/enums/index.ts +1 -0
  188. package/src/enums/indexTypeDoc.ts +1 -0
  189. package/src/enums/private/CopyableIsaacAPIClassType.ts +5 -1
  190. package/src/enums/private/SerializationBrand.ts +1 -0
  191. package/src/features/customStage/backdrop.ts +1 -1
  192. package/src/features/customStage/init.ts +2 -2
  193. package/src/features/customStage/versusScreen.ts +2 -2
  194. package/src/features/fastReset.ts +1 -1
  195. package/src/features/indexTypeDoc.ts +2 -1
  196. package/src/features/saveDataManager/merge.ts +1 -0
  197. package/src/functions/bitSet128.ts +96 -0
  198. package/src/functions/cacheFlag.ts +90 -1
  199. package/src/functions/collectibles.ts +2 -2
  200. package/src/functions/color.ts +3 -2
  201. package/src/functions/deepCopy.ts +1 -0
  202. package/src/functions/familiars.ts +4 -4
  203. package/src/functions/flag.ts +1 -1
  204. package/src/functions/flying.ts +1 -1
  205. package/src/functions/index.ts +2 -1
  206. package/src/functions/indexTypeDoc.ts +2 -1
  207. package/src/functions/input.ts +15 -2
  208. package/src/functions/jsonRoom.ts +4 -4
  209. package/src/functions/kColor.ts +2 -2
  210. package/src/functions/log.ts +1 -1
  211. package/src/functions/npcs.ts +2 -2
  212. package/src/functions/playerIndex.ts +1 -1
  213. package/src/functions/playerStats.ts +25 -0
  214. package/src/functions/players.ts +1 -1
  215. package/src/functions/rng.ts +2 -2
  216. package/src/functions/rockAlt.ts +28 -13
  217. package/src/functions/roomTransition.ts +1 -1
  218. package/src/functions/rooms.ts +2 -1
  219. package/src/functions/sprites.ts +3 -3
  220. package/src/functions/tears.ts +5 -4
  221. package/src/functions/utils.ts +5 -1
  222. package/src/functions/vector.ts +2 -2
  223. package/src/initCustomCallbacks.ts +2 -0
  224. package/src/interfaces/ChargeBarSprites.ts +1 -1
  225. package/src/interfaces/Corner.ts +5 -0
  226. package/src/interfaces/CustomStageLua.ts +66 -0
  227. package/src/interfaces/GridEntityCustomData.ts +6 -0
  228. package/src/interfaces/JSONRoomsFile.ts +7 -3
  229. package/src/interfaces/PlayerHealth.ts +1 -1
  230. package/src/interfaces/PocketItemDescription.ts +1 -1
  231. package/src/interfaces/RoomDescription.ts +1 -1
  232. package/src/interfaces/SaveData.ts +1 -5
  233. package/src/interfaces/StatTypeType.ts +21 -0
  234. package/src/interfaces/TrinketSituation.ts +1 -1
  235. package/src/interfaces/index.ts +1 -0
  236. package/src/interfaces/indexTypeDoc.ts +1 -0
  237. package/src/interfaces/private/AddCallbackParameterCustom.ts +2 -0
  238. package/src/maps/keyboardToString.ts +77 -0
  239. package/src/objects/callbackRegisterFunctions.ts +2 -0
  240. package/src/objects/isaacAPIClassTypeToBrand.ts +1 -0
  241. package/src/objects/isaacAPIClassTypeToFunctions.ts +12 -0
  242. package/src/types/AnyEntity.ts +5 -0
  243. package/src/types/AnyGridEntity.ts +5 -0
  244. package/src/types/CollectibleIndex.ts +4 -3
  245. package/src/types/Immutable.ts +3 -1
  246. package/src/types/PickupIndex.ts +4 -2
  247. package/src/types/PlayerIndex.ts +3 -2
  248. package/src/types/SerializedIsaacAPIClass.ts +6 -0
  249. package/src/types/TSTLClass.ts +5 -0
  250. package/src/types/TrapdoorDestination.ts +3 -0
  251. package/dist/functions/collectibleCacheFlag.d.ts +0 -24
  252. package/dist/functions/collectibleCacheFlag.d.ts.map +0 -1
  253. package/dist/functions/collectibleCacheFlag.lua +0 -80
  254. package/src/functions/collectibleCacheFlag.ts +0 -90
@@ -1,6 +1,7 @@
1
1
  /**
2
- * - Converts the specified amount of tears stat into MaxFireDelay and adds it to the player.
3
- * - This function should only be used inside the EvaluateCache callback.
2
+ * - Converts the specified amount of tears stat into the format of `EntityPlayer.MaxFireDelay` and
3
+ * adds it to the player.
4
+ * - This function should only be used inside the `EVALUATE_CACHE` callback.
4
5
  * - In this context, the "tears stat" represents what is shown on the in-game stat UI.
5
6
  */
6
7
  export function addTearsStat(player: EntityPlayer, tearsStat: float): void {
@@ -11,7 +12,7 @@ export function addTearsStat(player: EntityPlayer, tearsStat: float): void {
11
12
  }
12
13
 
13
14
  /**
14
- * - The `EntityPlayer` object stores a player's tear rate in the `MaxFireDelay` attribute. This is
15
+ * - The `EntityPlayer` object stores a player's tear rate in the `MaxFireDelay` field. This is
15
16
  * equivalent to how many tears the player can shoot per frame.
16
17
  * - If you already have a "tears" stat and you want to convert it back to MaxFireDelay, then use
17
18
  * this function.
@@ -22,7 +23,7 @@ export function getFireDelay(tearsStat: float): float {
22
23
  }
23
24
 
24
25
  /**
25
- * - The `EntityPlayer` object stores a player's tear rate in the `MaxFireDelay` attribute. This is
26
+ * - The `EntityPlayer` object stores a player's tear rate in the `MaxFireDelay` field. This is
26
27
  * equivalent to how many tears the player can shoot per frame.
27
28
  * - If you want to convert this to the "tears" stat that is shown on the in-game stat UI, then use
28
29
  * this function.
@@ -187,9 +187,13 @@ export function repeat(n: int, func: (i: int) => void): void {
187
187
  * When you see this function, it simply means that the programmer intends to add in more code to
188
188
  * this spot later.
189
189
  *
190
+ * This function is variadic, meaning that you can pass as many arguments as you want. (This is
191
+ * useful as a means to prevent lint warnings.)
192
+ *
190
193
  * This function does not actually do anything. (It is an "empty" function.)
191
194
  */
192
- export function todo(): void {}
195
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
196
+ export function todo(...args: unknown[]): void {}
193
197
 
194
198
  /**
195
199
  * Helper function to sort a two-dimensional array by the first element.
@@ -11,8 +11,8 @@ export type SerializedVector = LuaMap<string, unknown> & {
11
11
  readonly __serializedVectorBrand: symbol;
12
12
  };
13
13
 
14
- const KEYS = ["X", "Y"];
15
14
  const OBJECT_NAME = "Vector";
15
+ const KEYS = ["X", "Y"];
16
16
 
17
17
  /** Helper function to copy a `Vector` Isaac API class. */
18
18
  export function copyVector(vector: Vector): Vector {
@@ -91,7 +91,7 @@ export function isSerializedVector(
91
91
  return tableHasKeys(object, ...KEYS) && object.has(SerializationBrand.VECTOR);
92
92
  }
93
93
 
94
- /** Helper function to check if something is an instantiated Vector object. */
94
+ /** Helper function to check if something is an instantiated `Vector` object. */
95
95
  export function isVector(object: unknown): object is Vector {
96
96
  return isIsaacAPIClassOfType(object, OBJECT_NAME);
97
97
  }
@@ -37,6 +37,7 @@ import { postPickupStateChangedInit } from "./callbacks/postPickupStateChanged";
37
37
  import { postPitRenderInit } from "./callbacks/postPitRender";
38
38
  import { postPitUpdateInit } from "./callbacks/postPitUpdate";
39
39
  import { postPlayerChangeHealthInit } from "./callbacks/postPlayerChangeHealth";
40
+ import { postPlayerChangeStatInit } from "./callbacks/postPlayerChangeStat";
40
41
  import { postPlayerChangeTypeInit } from "./callbacks/postPlayerChangeType";
41
42
  import { postPlayerCollectibleCallbacksInit } from "./callbacks/postPlayerCollectible";
42
43
  import { postPlayerFatalDamageInit } from "./callbacks/postPlayerFatalDamage";
@@ -109,6 +110,7 @@ export function initCustomCallbacks(mod: ModUpgraded): void {
109
110
  postPitRenderInit(mod);
110
111
  postPitUpdateInit(mod);
111
112
  postPlayerChangeHealthInit(mod);
113
+ postPlayerChangeStatInit(mod);
112
114
  postPlayerChangeTypeInit(mod);
113
115
  postPlayerCollectibleCallbacksInit(mod);
114
116
  postPlayerFatalDamageInit(mod);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A collection of the four sprites necessary in order to render a charge bar.
3
3
  *
4
- * Used in the `newChargeBarSprites` and related helper functions.
4
+ * This is used in the `newChargeBarSprites` and related helper functions.
5
5
  */
6
6
  export interface ChargeBarSprites {
7
7
  back: Sprite;
@@ -1,5 +1,10 @@
1
1
  import { CornerType } from "../enums/CornerType";
2
2
 
3
+ /**
4
+ * An interface representing a corner in the room.
5
+ *
6
+ * This is used by the `getRoomShapeCorners` helper function.
7
+ */
3
8
  export interface Corner {
4
9
  readonly type: CornerType;
5
10
  readonly position: Readonly<Vector>;
@@ -27,6 +27,9 @@ export type CustomStageTSConfig = Readonly<{
27
27
  * Make sure the chosen prefix does not conflict with any other mods. You can find a list of
28
28
  * registered room variant prefixes on the IsaacScript website:
29
29
  * https://isaacscript.github.io/main/custom-stages
30
+ *
31
+ * @minimum 101
32
+ * @maximum 109
30
33
  */
31
34
  roomVariantPrefix: number;
32
35
 
@@ -39,6 +42,9 @@ export type CustomStageTSConfig = Readonly<{
39
42
  * method.)
40
43
  *
41
44
  * If not specified, `LevelStage.BASEMENT_2` (2) will be used.
45
+ *
46
+ * @minimum 2
47
+ * @maximum 13
42
48
  */
43
49
  baseStage?: number;
44
50
 
@@ -48,6 +54,9 @@ export type CustomStageTSConfig = Readonly<{
48
54
  * generation algorithm.
49
55
  *
50
56
  * If not specified, `StageType.ORIGINAL` (0) will be used.
57
+ *
58
+ * @minimum 0
59
+ * @maximum 5
51
60
  */
52
61
  baseStageType?: number;
53
62
 
@@ -331,9 +340,28 @@ export type CustomStageTSConfig = Readonly<{
331
340
  * `versusScreenBackgroundColors.ts`.
332
341
  */
333
342
  backgroundColor?: Readonly<{
343
+ /**
344
+ * @minimum 0
345
+ * @maximum 1
346
+ */
334
347
  r: number;
348
+
349
+ /**
350
+ * @minimum 0
351
+ * @maximum 1
352
+ */
335
353
  g: number;
354
+
355
+ /**
356
+ * @minimum 0
357
+ * @maximum 1
358
+ */
336
359
  b: number;
360
+
361
+ /**
362
+ * @minimum 0
363
+ * @maximum 1
364
+ */
337
365
  a: number;
338
366
  }>;
339
367
 
@@ -346,9 +374,28 @@ export type CustomStageTSConfig = Readonly<{
346
374
  * `versusScreenDirtSpotColors.ts`.
347
375
  */
348
376
  dirtSpotColor?: Readonly<{
377
+ /**
378
+ * @minimum 0
379
+ * @maximum 1
380
+ */
349
381
  r: number;
382
+
383
+ /**
384
+ * @minimum 0
385
+ * @maximum 1
386
+ */
350
387
  g: number;
388
+
389
+ /**
390
+ * @minimum 0
391
+ * @maximum 1
392
+ */
351
393
  b: number;
394
+
395
+ /**
396
+ * @minimum 0
397
+ * @maximum 1
398
+ */
352
399
  a: number;
353
400
  }>;
354
401
  }>;
@@ -376,9 +423,28 @@ export type CustomStageShadow = Readonly<{
376
423
  * to 75% faded black).
377
424
  */
378
425
  color?: Readonly<{
426
+ /**
427
+ * @minimum 0
428
+ * @maximum 1
429
+ */
379
430
  r: number;
431
+
432
+ /**
433
+ * @minimum 0
434
+ * @maximum 1
435
+ */
380
436
  g: number;
437
+
438
+ /**
439
+ * @minimum 0
440
+ * @maximum 1
441
+ */
381
442
  b: number;
443
+
444
+ /**
445
+ * @minimum 0
446
+ * @maximum 1
447
+ */
382
448
  a: number;
383
449
  }>;
384
450
  }>;
@@ -3,6 +3,12 @@ import {
3
3
  GridEntityType,
4
4
  } from "isaac-typescript-definitions";
5
5
 
6
+ /**
7
+ * This is meta-data that describes a custom grid entity.
8
+ *
9
+ * (One of the extra features that the standard library offers is the ability to spawn custom grid
10
+ * entities with the `spawnCustomGridEntity` helper function.)
11
+ */
6
12
  export interface GridEntityCustomData {
7
13
  /**
8
14
  * This is not a real `GridEntityType`; rather it is an arbitrary integer selected by end-user
@@ -1,13 +1,17 @@
1
1
  /**
2
- * Custom rooms are created with the Basement Renovator program, which outputs XML files and STB
3
- * files. A `JSONRoomsFile` object is simply an XML file converted to JSON. (It is useful to have
4
- * the room data in JSON format so that it can be directly consumed by TypeScript programs.)
2
+ * The standard library has the feature to deploy a new room on-the-fly with the `deployJSONRoom`
3
+ * helper function. It requires a `JSONRoomsFile` as an argument, which is simply an XML file
4
+ * converted to JSON. (You create XML room files using the Basement Renovator program.)
5
5
  *
6
6
  * You can convert your XML files using the following command:
7
7
  *
8
8
  * ```sh
9
9
  * npx convert-xml-to-json foo.xml foo.json
10
10
  * ```
11
+ *
12
+ * Note that the custom stages feature of the standard library uses real XML/STB files, not JSON
13
+ * rooms, so you would only need to do this if you are using the `deployJSONRoom` command
14
+ * specifically.
11
15
  */
12
16
  export interface JSONRoomsFile {
13
17
  rooms: JSONRooms;
@@ -1,6 +1,6 @@
1
1
  import { HeartSubType } from "isaac-typescript-definitions";
2
2
 
3
- /** Used by the `getPlayerHealth` and `setPlayerHealth` helper functions. */
3
+ /** This is used by the `getPlayerHealth` and `setPlayerHealth` helper functions. */
4
4
  export interface PlayerHealth {
5
5
  maxHearts: int;
6
6
  hearts: int;
@@ -1,7 +1,7 @@
1
1
  import { PocketItemSlot } from "isaac-typescript-definitions";
2
2
  import { PocketItemType } from "../enums/PocketItemType";
3
3
 
4
- /** Used by the `getPocketItems` and related helper functions. */
4
+ /** This is used by the `getPocketItems` and related helper functions. */
5
5
  export interface PocketItemDescription {
6
6
  slot: PocketItemSlot;
7
7
  type: PocketItemType;
@@ -5,7 +5,7 @@ import {
5
5
  StageType,
6
6
  } from "isaac-typescript-definitions";
7
7
 
8
- /** Used by the room history feature. */
8
+ /** This is used by the room history feature of the standard library. */
9
9
  export interface RoomDescription {
10
10
  stage: LevelStage;
11
11
  stageType: StageType;
@@ -20,10 +20,6 @@
20
20
  * - serializable Isaac API classes (such as `Color`)
21
21
  * - TSTL classes (i.e. classes that you made yourself)
22
22
  * - sub-objects or a `LuaMap` that contains the above values
23
- *
24
- * (Unfortunately, it is not possible to create a recursive type definition that matches these
25
- * properties. This means that the TypeScript compiler will not be able to validate that you are
26
- * passing in serializable data.)
27
23
  */
28
24
  export interface SaveData<
29
25
  Persistent = unknown,
@@ -129,7 +125,7 @@ type SerializableReadonlyMap<K, V> = ReadonlyMap<
129
125
  type SerializableSet<T> = Set<SerializableInsideArrayOrMap<T>>;
130
126
  type SerializableReadonlySet<T> = ReadonlySet<SerializableInsideArrayOrMap<T>>;
131
127
  type SerializableObject<T> = { [K in keyof T]: Serializable<T[K]> };
132
- type SerializableIsaacAPIClass = Color | KColor | RNG | Vector;
128
+ type SerializableIsaacAPIClass = BitSet128 | Color | KColor | RNG | Vector;
133
129
 
134
130
  // eslint-disable-next-line @typescript-eslint/ban-types
135
131
  type HasMethods<T> = {} extends {
@@ -0,0 +1,21 @@
1
+ import { TearFlag } from "isaac-typescript-definitions";
2
+ import { StatType } from "../enums/StatType";
3
+
4
+ /**
5
+ * This is an interface mapping a stat type to the data type. For example, `StatType.DAMAGE` is a
6
+ * `float` type.
7
+ */
8
+ export interface StatTypeType {
9
+ [StatType.DAMAGE]: float;
10
+ [StatType.FIRE_DELAY]: float;
11
+ [StatType.SHOT_SPEED]: float;
12
+ [StatType.TEAR_HEIGHT]: float;
13
+ [StatType.TEAR_RANGE]: float;
14
+ [StatType.TEAR_FALLING_ACCELERATION]: float;
15
+ [StatType.TEAR_FALLING_SPEED]: float;
16
+ [StatType.MOVE_SPEED]: float;
17
+ [StatType.TEAR_FLAG]: BitFlags<TearFlag>;
18
+ [StatType.TEAR_COLOR]: Color;
19
+ [StatType.FLYING]: boolean;
20
+ [StatType.LUCK]: float;
21
+ }
@@ -1,6 +1,6 @@
1
1
  import { TrinketType } from "isaac-typescript-definitions";
2
2
 
3
- /** Used by the `temporarilyRemoveTrinkets` and related helper functions. */
3
+ /** This is used by the `temporarilyRemoveTrinkets` and related helper functions. */
4
4
  export interface TrinketSituation {
5
5
  trinketTypeRemoved: TrinketType;
6
6
  trinketType1: TrinketType;
@@ -7,4 +7,5 @@ export * from "./PlayerHealth";
7
7
  export * from "./PocketItemDescription";
8
8
  export * from "./RoomDescription";
9
9
  export * from "./SaveData";
10
+ export * from "./StatTypeType";
10
11
  export * from "./TrinketSituation";
@@ -7,4 +7,5 @@ export * as PlayerHealth from "./PlayerHealth";
7
7
  export * as PocketItemDescription from "./PocketItemDescription";
8
8
  export * as RoomDescription from "./RoomDescription";
9
9
  export * as SaveData from "./SaveData";
10
+ export * as StatTypeType from "./StatTypeType";
10
11
  export * as TrinketSituation from "./TrinketSituation";
@@ -50,6 +50,7 @@ import { PostPickupStateChangedRegisterParameters } from "../../callbacks/subscr
50
50
  import { PostPitRenderRegisterParameters } from "../../callbacks/subscriptions/postPitRender";
51
51
  import { PostPitUpdateRegisterParameters } from "../../callbacks/subscriptions/postPitUpdate";
52
52
  import { PostPlayerChangeHealthRegisterParameters } from "../../callbacks/subscriptions/postPlayerChangeHealth";
53
+ import { PostPlayerChangeStatRegisterParameters } from "../../callbacks/subscriptions/postPlayerChangeStat";
53
54
  import { PostPlayerChangeTypeRegisterParameters } from "../../callbacks/subscriptions/postPlayerChangeType";
54
55
  import { PostPlayerCollectibleAddedRegisterParameters } from "../../callbacks/subscriptions/postPlayerCollectibleAdded";
55
56
  import { PostPlayerCollectibleRemovedRegisterParameters } from "../../callbacks/subscriptions/postPlayerCollectibleRemoved";
@@ -140,6 +141,7 @@ export interface AddCallbackParameterCustom {
140
141
  [ModCallbackCustom.POST_PIT_RENDER]: PostPitRenderRegisterParameters;
141
142
  [ModCallbackCustom.POST_PIT_UPDATE]: PostPitUpdateRegisterParameters;
142
143
  [ModCallbackCustom.POST_PLAYER_CHANGE_HEALTH]: PostPlayerChangeHealthRegisterParameters;
144
+ [ModCallbackCustom.POST_PLAYER_CHANGE_STAT]: PostPlayerChangeStatRegisterParameters;
143
145
  [ModCallbackCustom.POST_PLAYER_CHANGE_TYPE]: PostPlayerChangeTypeRegisterParameters;
144
146
  [ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED]: PostPlayerCollectibleAddedRegisterParameters;
145
147
  [ModCallbackCustom.POST_PLAYER_COLLECTIBLE_REMOVED]: PostPlayerCollectibleRemovedRegisterParameters;
@@ -0,0 +1,77 @@
1
+ import { Keyboard } from "isaac-typescript-definitions";
2
+
3
+ /** Maps each keyboard enum member to its corresponding lowercase and uppercase characters. */
4
+ export const KEYBOARD_TO_STRING: ReadonlyMap<
5
+ Keyboard,
6
+ readonly [lowercaseCharacter: string, uppercaseCharacter: string]
7
+ > = new Map([
8
+ [Keyboard.SPACE, [" ", " "]], // 32
9
+ [Keyboard.APOSTROPHE, ["'", '"']], // 39
10
+ [Keyboard.COMMA, [",", "<"]], // 44
11
+ [Keyboard.MINUS, ["-", "_"]], // 45
12
+ [Keyboard.PERIOD, [".", ">"]], // 46
13
+ [Keyboard.SLASH, ["/", "?"]], // 47
14
+
15
+ [Keyboard.ZERO, ["0", ")"]], // 48
16
+ [Keyboard.ONE, ["1", "!"]], // 49
17
+ [Keyboard.TWO, ["2", "@"]], // 50
18
+ [Keyboard.THREE, ["3", "#"]], // 51
19
+ [Keyboard.FOUR, ["4", "$"]], // 52
20
+ [Keyboard.FIVE, ["5", "%"]], // 53
21
+ [Keyboard.SIX, ["6", "^"]], // 54
22
+ [Keyboard.SEVEN, ["7", "&"]], // 55
23
+ [Keyboard.EIGHT, ["8", "*"]], // 56
24
+ [Keyboard.NINE, ["9", "("]], // 57
25
+
26
+ [Keyboard.SEMICOLON, [";", ":"]], // 59
27
+ [Keyboard.EQUAL, ["=", "+"]], // 61
28
+
29
+ [Keyboard.A, ["a", "A"]], // 65
30
+ [Keyboard.B, ["b", "B"]], // 66
31
+ [Keyboard.C, ["c", "C"]], // 67
32
+ [Keyboard.D, ["d", "D"]], // 68
33
+ [Keyboard.E, ["e", "E"]], // 69
34
+ [Keyboard.F, ["f", "F"]], // 70
35
+ [Keyboard.G, ["g", "G"]], // 71
36
+ [Keyboard.H, ["h", "H"]], // 72
37
+ [Keyboard.I, ["i", "I"]], // 73
38
+ [Keyboard.J, ["j", "J"]], // 74
39
+ [Keyboard.K, ["k", "K"]], // 75
40
+ [Keyboard.L, ["l", "L"]], // 76
41
+ [Keyboard.M, ["m", "M"]], // 77
42
+ [Keyboard.N, ["n", "N"]], // 78
43
+ [Keyboard.O, ["o", "O"]], // 79
44
+ [Keyboard.P, ["p", "P"]], // 80
45
+ [Keyboard.Q, ["q", "Q"]], // 81
46
+ [Keyboard.R, ["r", "R"]], // 82
47
+ [Keyboard.S, ["s", "S"]], // 83
48
+ [Keyboard.T, ["t", "T"]], // 84
49
+ [Keyboard.U, ["u", "U"]], // 85
50
+ [Keyboard.V, ["v", "V"]], // 86
51
+ [Keyboard.W, ["w", "W"]], // 87
52
+ [Keyboard.X, ["x", "X"]], // 88
53
+ [Keyboard.Y, ["y", "Y"]], // 89
54
+ [Keyboard.Z, ["z", "Z"]], // 90
55
+
56
+ [Keyboard.KP_0, ["0", "0"]], // 320
57
+ [Keyboard.KP_1, ["1", "1"]], // 321
58
+ [Keyboard.KP_2, ["2", "2"]], // 322
59
+ [Keyboard.KP_3, ["3", "3"]], // 323
60
+ [Keyboard.KP_4, ["4", "4"]], // 324
61
+ [Keyboard.KP_5, ["5", "5"]], // 325
62
+ [Keyboard.KP_6, ["6", "6"]], // 326
63
+ [Keyboard.KP_7, ["7", "7"]], // 327
64
+ [Keyboard.KP_8, ["8", "8"]], // 328
65
+ [Keyboard.KP_9, ["9", "9"]], // 329
66
+
67
+ [Keyboard.KP_DECIMAL, [".", "."]], // 330
68
+ [Keyboard.KP_DIVIDE, ["/", "/"]], // 331
69
+ [Keyboard.KP_MULTIPLY, ["*", "*"]], // 332
70
+ [Keyboard.KP_SUBTRACT, ["-", "-"]], // 333
71
+ [Keyboard.KP_ADD, ["+", "+"]], // 334
72
+
73
+ [Keyboard.LEFT_BRACKET, ["[", "{"]], // 91
74
+ [Keyboard.BACKSLASH, ["\\", "|"]], // 92
75
+ [Keyboard.RIGHT_BRACKET, ["]", "}"]], // 93
76
+ [Keyboard.GRAVE_ACCENT, ["`", "~"]], // 96
77
+ ]);
@@ -50,6 +50,7 @@ import { postPickupStateChangedRegister } from "../callbacks/subscriptions/postP
50
50
  import { postPitRenderRegister } from "../callbacks/subscriptions/postPitRender";
51
51
  import { postPitUpdateRegister } from "../callbacks/subscriptions/postPitUpdate";
52
52
  import { postPlayerChangeHealthRegister } from "../callbacks/subscriptions/postPlayerChangeHealth";
53
+ import { postPlayerChangeStatRegister } from "../callbacks/subscriptions/postPlayerChangeStat";
53
54
  import { postPlayerChangeTypeRegister } from "../callbacks/subscriptions/postPlayerChangeType";
54
55
  import { postPlayerCollectibleAddedRegister } from "../callbacks/subscriptions/postPlayerCollectibleAdded";
55
56
  import { postPlayerCollectibleRemovedRegister } from "../callbacks/subscriptions/postPlayerCollectibleRemoved";
@@ -155,6 +156,7 @@ export const CALLBACK_REGISTER_FUNCTIONS: {
155
156
  [ModCallbackCustom.POST_PIT_RENDER]: postPitRenderRegister,
156
157
  [ModCallbackCustom.POST_PIT_UPDATE]: postPitUpdateRegister,
157
158
  [ModCallbackCustom.POST_PLAYER_CHANGE_HEALTH]: postPlayerChangeHealthRegister,
159
+ [ModCallbackCustom.POST_PLAYER_CHANGE_STAT]: postPlayerChangeStatRegister,
158
160
  [ModCallbackCustom.POST_PLAYER_CHANGE_TYPE]: postPlayerChangeTypeRegister,
159
161
  [ModCallbackCustom.POST_PLAYER_COLLECTIBLE_ADDED]:
160
162
  postPlayerCollectibleAddedRegister,
@@ -4,6 +4,7 @@ import { SerializationBrand } from "../enums/private/SerializationBrand";
4
4
  export const ISAAC_API_CLASS_TYPE_TO_BRAND: {
5
5
  readonly [key in CopyableIsaacAPIClassType]: SerializationBrand;
6
6
  } = {
7
+ [CopyableIsaacAPIClassType.BIT_SET_128]: SerializationBrand.BIT_SET_128,
7
8
  [CopyableIsaacAPIClassType.COLOR]: SerializationBrand.COLOR,
8
9
  [CopyableIsaacAPIClassType.K_COLOR]: SerializationBrand.K_COLOR,
9
10
  [CopyableIsaacAPIClassType.RNG]: SerializationBrand.RNG,
@@ -1,6 +1,12 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
 
3
3
  import { CopyableIsaacAPIClassType } from "../enums/private/CopyableIsaacAPIClassType";
4
+ import {
5
+ copyBitSet128,
6
+ deserializeBitSet128,
7
+ isSerializedBitSet128,
8
+ serializeBitSet128,
9
+ } from "../functions/bitSet128";
4
10
  import {
5
11
  copyColor,
6
12
  deserializeColor,
@@ -36,6 +42,12 @@ interface IsaacAPIClassTypeFunctions {
36
42
  export const ISAAC_API_CLASS_TYPE_TO_FUNCTIONS: {
37
43
  readonly [key in CopyableIsaacAPIClassType]: IsaacAPIClassTypeFunctions;
38
44
  } = {
45
+ [CopyableIsaacAPIClassType.BIT_SET_128]: {
46
+ isSerialized: isSerializedBitSet128,
47
+ copy: copyBitSet128,
48
+ serialize: serializeBitSet128,
49
+ deserialize: deserializeBitSet128,
50
+ },
39
51
  [CopyableIsaacAPIClassType.COLOR]: {
40
52
  isSerialized: isSerializedColor,
41
53
  copy: copyColor,
@@ -1,3 +1,8 @@
1
+ /**
2
+ * A type union that matches `Entity`, `EntityBomb`, `EntityEffect`, and so on.
3
+ *
4
+ * This is useful for building generic functions that should accept any kind of entity.
5
+ */
1
6
  export type AnyEntity =
2
7
  | Entity
3
8
  | EntityBomb
@@ -1,3 +1,8 @@
1
+ /**
2
+ * A type union that matches `GridEntity`, `GridEntityDoor`, `GridEntityPit`, and so on.
3
+ *
4
+ * This is useful for building generic functions that should accept any kind of grid entity.
5
+ */
1
6
  export type AnyGridEntity =
2
7
  | GridEntity
3
8
  | GridEntityDoor
@@ -1,7 +1,8 @@
1
1
  /**
2
- * `CollectibleIndex` is a specific type of string; see the documentation for the
3
- * `getCollectibleIndex` function. Mods can signify that data structures handle collectibles by
4
- * using this type.
2
+ * `CollectibleIndex` is a specific type of string that represents a unique identifier for a
3
+ * collectible. Mods can signify that data structures handle collectibles by using this type.
4
+ *
5
+ * For more information, see the documentation for the `getCollectibleIndex` function.
5
6
  *
6
7
  * For example:
7
8
  *
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Immutable is a type that will make the given array/map/set/object recursively read-only.
2
+ * Immutable is a utility type that will make the given array/map/set/object recursively read-only.
3
+ *
4
+ * You can use this type to easily build safe data structures.
3
5
  *
4
6
  * From: https://stackoverflow.com/questions/41879327/deepreadonly-object-typescript
5
7
  */
@@ -1,6 +1,8 @@
1
1
  /**
2
- * `PickupIndex` is a specific type of string; see the documentation for the `getPickupIndex`
3
- * function. Mods can signify that data structures handle collectibles by using this type.
2
+ * `PickupIndex` is a specific type of number that represents a unique identifier for a pickup. Mods
3
+ * can signify that data structures handle collectibles by using this type.
4
+ *
5
+ * For more information, see the documentation for the `getPickupIndex` function.
4
6
  *
5
7
  * For example:
6
8
  *
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * `PlayerIndex` is a specific type of number that represents a unique identifier for a player. Mods
3
- * can signify that data structures handle `EntityPlayer` by using this type. For more information,
4
- * see the documentation for the `getPlayerIndex` function.
3
+ * can signify that data structures handle `EntityPlayer` by using this type.
4
+ *
5
+ * For more information, see the documentation for the `getPlayerIndex` function.
5
6
  *
6
7
  * For example:
7
8
  *
@@ -1,3 +1,9 @@
1
+ /**
2
+ * This is a type representing an Isaac API class like `Color` or `RNG` that has been written to the
3
+ * "save#.dat" file. It is used by the save data manager when reading and writing to that file.
4
+ *
5
+ * For the list of supported classes, see the `CopyableIsaacAPIClassType` enum.
6
+ */
1
7
  export type SerializedIsaacAPIClass = LuaMap<string, unknown> & {
2
8
  readonly __serializedIsaacAPIClassBrand: symbol;
3
9
  };
@@ -1,3 +1,8 @@
1
+ /**
2
+ * This is a type representing a user-created class from TypeScript code.
3
+ *
4
+ * This type is used by the save data manager to when copying, serializing, and deserializing.
5
+ */
1
6
  export type TSTLClass = LuaMap<AnyNotNil, unknown> & {
2
7
  readonly __tstlClassBrand: symbol;
3
8
  };
@@ -1,5 +1,8 @@
1
1
  import { LevelStage, StageType } from "isaac-typescript-definitions";
2
2
 
3
+ /**
4
+ * This is the type that you need to specify when using the `spawnCustomTrapdoor` helper function.
5
+ */
3
6
  export type TrapdoorDestination =
4
7
  | [stage: LevelStage, stageType: StageType]
5
8
  | [customStageName: string, floorNum: int];
@@ -1,24 +0,0 @@
1
- import { CacheFlag, CollectibleType } from "isaac-typescript-definitions";
2
- export declare function collectibleHasCacheFlag(collectibleType: CollectibleType, cacheFlag: CacheFlag): boolean;
3
- /**
4
- * Returns a set containing every collectible type with the given cache flag, including modded
5
- * collectibles.
6
- */
7
- export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType>;
8
- /**
9
- * Returns an array containing every collectible type that the player has that matches the provided
10
- * CacheFlag.
11
- *
12
- * For example, if the cache flag is `CacheFlag.FLYING`, and the player has one Lord of the Pit and
13
- * two Dead Doves, then this function would return:
14
- *
15
- * ```ts
16
- * [
17
- * CollectibleType.LORD_OF_THE_PIT,
18
- * CollectibleType.DEAD_DOVE,
19
- * CollectibleType.DEAD_DOVE,
20
- * ]
21
- * ```
22
- */
23
- export declare function getPlayerCollectiblesForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): CollectibleType[];
24
- //# sourceMappingURL=collectibleCacheFlag.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collectibleCacheFlag.d.ts","sourceRoot":"","sources":["../../src/functions/collectibleCacheFlag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AA2B1E,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,eAAe,CAAC,CAYtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,GACnB,eAAe,EAAE,CAYnB"}