isaacscript-common 15.6.1 → 15.6.2

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 (151) hide show
  1. package/dist/index.d.ts +15 -9
  2. package/dist/isaacscript-common.lua +70 -79
  3. package/dist/src/callbacks.d.ts +1 -1
  4. package/dist/src/callbacks.d.ts.map +1 -1
  5. package/dist/src/classes/DefaultMap.d.ts +1 -1
  6. package/dist/src/classes/DefaultMap.d.ts.map +1 -1
  7. package/dist/src/classes/ModUpgradedBase.lua +1 -1
  8. package/dist/src/classes/callbacks/PostCollectibleEmpty.d.ts +1 -1
  9. package/dist/src/classes/callbacks/PostCollectibleEmpty.d.ts.map +1 -1
  10. package/dist/src/classes/callbacks/PostCustomRevive.d.ts +1 -1
  11. package/dist/src/classes/callbacks/PostCustomRevive.d.ts.map +1 -1
  12. package/dist/src/classes/callbacks/PostDiceRoomActivated.d.ts +1 -1
  13. package/dist/src/classes/callbacks/PostDiceRoomActivated.d.ts.map +1 -1
  14. package/dist/src/classes/callbacks/PostGridEntityCollision.d.ts +1 -1
  15. package/dist/src/classes/callbacks/PostGridEntityCollision.d.ts.map +1 -1
  16. package/dist/src/classes/callbacks/PostGridEntityCustomCollision.d.ts +1 -1
  17. package/dist/src/classes/callbacks/PostGridEntityCustomCollision.d.ts.map +1 -1
  18. package/dist/src/classes/callbacks/PostGridEntityCustomRemove.d.ts +1 -1
  19. package/dist/src/classes/callbacks/PostGridEntityCustomRemove.d.ts.map +1 -1
  20. package/dist/src/classes/callbacks/PostGridEntityRemove.d.ts +1 -1
  21. package/dist/src/classes/callbacks/PostGridEntityRemove.d.ts.map +1 -1
  22. package/dist/src/classes/callbacks/PostItemDischarge.d.ts +3 -3
  23. package/dist/src/classes/callbacks/PostItemDischarge.d.ts.map +1 -1
  24. package/dist/src/classes/callbacks/PostPurchase.d.ts +1 -1
  25. package/dist/src/classes/callbacks/PostPurchase.d.ts.map +1 -1
  26. package/dist/src/classes/callbacks/PostRoomClearChanged.d.ts +1 -1
  27. package/dist/src/classes/callbacks/PostRoomClearChanged.d.ts.map +1 -1
  28. package/dist/src/classes/callbacks/PostTransformation.d.ts +1 -1
  29. package/dist/src/classes/callbacks/PostTransformation.d.ts.map +1 -1
  30. package/dist/src/classes/features/callbackLogic/CustomRevive.lua +1 -1
  31. package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.d.ts +1 -1
  32. package/dist/src/classes/features/callbackLogic/GridEntityUpdateDetection.d.ts.map +1 -1
  33. package/dist/src/classes/features/other/CustomHotkeys.lua +2 -2
  34. package/dist/src/classes/features/other/CustomStages.lua +4 -4
  35. package/dist/src/classes/features/other/PickupIndexCreation.d.ts +2 -2
  36. package/dist/src/classes/features/other/PickupIndexCreation.d.ts.map +1 -1
  37. package/dist/src/classes/features/other/PickupIndexCreation.lua +33 -48
  38. package/dist/src/classes/features/other/RoomHistory.d.ts +2 -2
  39. package/dist/src/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
  40. package/dist/src/classes/features/other/extraConsoleCommands/commands.lua +1 -1
  41. package/dist/src/classes/private/CustomCallback.d.ts +2 -2
  42. package/dist/src/classes/private/CustomCallback.d.ts.map +1 -1
  43. package/dist/src/core/upgradeMod.d.ts +1 -1
  44. package/dist/src/core/upgradeMod.d.ts.map +1 -1
  45. package/dist/src/functions/bitSet128.d.ts +1 -1
  46. package/dist/src/functions/bitSet128.d.ts.map +1 -1
  47. package/dist/src/functions/color.d.ts +1 -1
  48. package/dist/src/functions/color.d.ts.map +1 -1
  49. package/dist/src/functions/flag.lua +5 -1
  50. package/dist/src/functions/gridIndex.lua +1 -1
  51. package/dist/src/functions/input.d.ts +1 -1
  52. package/dist/src/functions/input.d.ts.map +1 -1
  53. package/dist/src/functions/input.lua +0 -3
  54. package/dist/src/functions/kColor.d.ts +1 -1
  55. package/dist/src/functions/kColor.d.ts.map +1 -1
  56. package/dist/src/functions/logEntities.lua +9 -9
  57. package/dist/src/functions/logMisc.lua +1 -4
  58. package/dist/src/functions/pills.d.ts +3 -3
  59. package/dist/src/functions/pills.lua +3 -3
  60. package/dist/src/functions/rng.d.ts +1 -1
  61. package/dist/src/functions/rng.d.ts.map +1 -1
  62. package/dist/src/functions/roomShapeWalls.lua +2 -2
  63. package/dist/src/functions/run.lua +1 -1
  64. package/dist/src/functions/ui.d.ts +1 -1
  65. package/dist/src/functions/ui.lua +1 -1
  66. package/dist/src/functions/vector.d.ts +7 -1
  67. package/dist/src/functions/vector.d.ts.map +1 -1
  68. package/dist/src/functions/vector.lua +4 -0
  69. package/dist/src/interfaces/CustomStageTSConfig.d.ts +1 -1
  70. package/dist/src/interfaces/CustomStageTSConfig.d.ts.map +1 -1
  71. package/dist/src/interfaces/PlayerHealth.d.ts +1 -1
  72. package/dist/src/interfaces/PlayerHealth.d.ts.map +1 -1
  73. package/dist/src/interfaces/SaveData.d.ts +12 -12
  74. package/dist/src/interfaces/SaveData.d.ts.map +1 -1
  75. package/dist/src/interfaces/private/CustomStage.d.ts +3 -3
  76. package/dist/src/interfaces/private/CustomStage.d.ts.map +1 -1
  77. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts +2 -2
  78. package/dist/src/objects/isaacAPIClassTypeToFunctions.d.ts.map +1 -1
  79. package/dist/src/types/AllButFirst.d.ts +1 -1
  80. package/dist/src/types/AllButFirst.d.ts.map +1 -1
  81. package/dist/src/types/AllButLast.d.ts +1 -1
  82. package/dist/src/types/AllButLast.d.ts.map +1 -1
  83. package/dist/src/types/AnyClass.d.ts +1 -1
  84. package/dist/src/types/AnyClass.d.ts.map +1 -1
  85. package/dist/src/types/AnyEntity.d.ts +1 -1
  86. package/dist/src/types/AnyEntity.d.ts.map +1 -1
  87. package/dist/src/types/AnyFunction.d.ts +1 -1
  88. package/dist/src/types/AnyFunction.d.ts.map +1 -1
  89. package/dist/src/types/AnyGridEntity.d.ts +1 -1
  90. package/dist/src/types/AnyGridEntity.d.ts.map +1 -1
  91. package/dist/src/types/CollectibleIndex.d.ts +1 -1
  92. package/dist/src/types/CollectibleIndex.d.ts.map +1 -1
  93. package/dist/src/types/ConversionHeartSubType.d.ts +1 -1
  94. package/dist/src/types/ConversionHeartSubType.d.ts.map +1 -1
  95. package/dist/src/types/EntityID.d.ts +1 -1
  96. package/dist/src/types/EntityID.d.ts.map +1 -1
  97. package/dist/src/types/FunctionTuple.d.ts +1 -1
  98. package/dist/src/types/FunctionTuple.d.ts.map +1 -1
  99. package/dist/src/types/GridEntityID.d.ts +1 -1
  100. package/dist/src/types/GridEntityID.d.ts.map +1 -1
  101. package/dist/src/types/HasAllEnumKeys.d.ts +1 -1
  102. package/dist/src/types/HasAllEnumKeys.d.ts.map +1 -1
  103. package/dist/src/types/HasFunction.d.ts +1 -1
  104. package/dist/src/types/HasFunction.d.ts.map +1 -1
  105. package/dist/src/types/Immutable.d.ts +6 -6
  106. package/dist/src/types/Immutable.d.ts.map +1 -1
  107. package/dist/src/types/LowercaseKeys.d.ts +1 -1
  108. package/dist/src/types/LowercaseKeys.d.ts.map +1 -1
  109. package/dist/src/types/ModUpgraded.d.ts +3 -3
  110. package/dist/src/types/ModUpgraded.d.ts.map +1 -1
  111. package/dist/src/types/PickingUpItem.d.ts +1 -1
  112. package/dist/src/types/PickingUpItem.d.ts.map +1 -1
  113. package/dist/src/types/PickupIndex.d.ts +1 -1
  114. package/dist/src/types/PickupIndex.d.ts.map +1 -1
  115. package/dist/src/types/PlayerIndex.d.ts +1 -1
  116. package/dist/src/types/PlayerIndex.d.ts.map +1 -1
  117. package/dist/src/types/PossibleStatType.d.ts +1 -1
  118. package/dist/src/types/PossibleStatType.d.ts.map +1 -1
  119. package/dist/src/types/PublicInterface.d.ts +1 -1
  120. package/dist/src/types/PublicInterface.d.ts.map +1 -1
  121. package/dist/src/types/StartsWithLowercase.d.ts +1 -1
  122. package/dist/src/types/StartsWithLowercase.d.ts.map +1 -1
  123. package/dist/src/types/StartsWithUppercase.d.ts +1 -1
  124. package/dist/src/types/StartsWithUppercase.d.ts.map +1 -1
  125. package/dist/src/types/TSTLClass.d.ts +1 -1
  126. package/dist/src/types/TSTLClass.d.ts.map +1 -1
  127. package/dist/src/types/TupleToIntersection.d.ts +1 -1
  128. package/dist/src/types/TupleToIntersection.d.ts.map +1 -1
  129. package/dist/src/types/TupleToUnion.d.ts +1 -1
  130. package/dist/src/types/TupleToUnion.d.ts.map +1 -1
  131. package/dist/src/types/UnionToIntersection.d.ts +1 -1
  132. package/dist/src/types/UnionToIntersection.d.ts.map +1 -1
  133. package/dist/src/types/UppercaseKeys.d.ts +1 -1
  134. package/dist/src/types/UppercaseKeys.d.ts.map +1 -1
  135. package/dist/src/types/WeightedArray.d.ts +1 -1
  136. package/dist/src/types/WeightedArray.d.ts.map +1 -1
  137. package/dist/src/types/Writable.d.ts +1 -1
  138. package/dist/src/types/Writable.d.ts.map +1 -1
  139. package/dist/src/types/private/AllButFirst.d.ts +1 -1
  140. package/dist/src/types/private/AllButFirst.d.ts.map +1 -1
  141. package/dist/src/types/private/CallbackTuple.d.ts +2 -2
  142. package/dist/src/types/private/CallbackTuple.d.ts.map +1 -1
  143. package/package.json +1 -1
  144. package/src/classes/features/other/PickupIndexCreation.ts +43 -53
  145. package/src/classes/features/other/RoomHistory.ts +2 -2
  146. package/src/classes/features/other/extraConsoleCommands/commands.ts +2 -0
  147. package/src/functions/flag.ts +1 -1
  148. package/src/functions/input.ts +1 -5
  149. package/src/functions/pills.ts +3 -3
  150. package/src/functions/ui.ts +1 -1
  151. package/src/functions/vector.ts +6 -0
@@ -1 +1 @@
1
- {"version":3,"file":"PublicInterface.d.ts","sourceRoot":"","sources":["../../../src/types/PublicInterface.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,oBAAY,eAAe,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"PublicInterface.d.ts","sourceRoot":"","sources":["../../../src/types/PublicInterface.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  /** Helper type to ensure that the given string starts with an lowercase letter. */
2
- export declare type StartsWithLowercase<S> = S extends string ? Extract<S, Uncapitalize<S>> : never;
2
+ export type StartsWithLowercase<S> = S extends string ? Extract<S, Uncapitalize<S>> : never;
3
3
  //# sourceMappingURL=StartsWithLowercase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StartsWithLowercase.d.ts","sourceRoot":"","sources":["../../../src/types/StartsWithLowercase.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACjD,OAAO,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC"}
1
+ {"version":3,"file":"StartsWithLowercase.d.ts","sourceRoot":"","sources":["../../../src/types/StartsWithLowercase.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACjD,OAAO,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC"}
@@ -1,3 +1,3 @@
1
1
  /** Helper type to ensure that the given string starts with an uppercase letter. */
2
- export declare type StartsWithUppercase<S> = S extends string ? Extract<S, Capitalize<S>> : never;
2
+ export type StartsWithUppercase<S> = S extends string ? Extract<S, Capitalize<S>> : never;
3
3
  //# sourceMappingURL=StartsWithUppercase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StartsWithUppercase.d.ts","sourceRoot":"","sources":["../../../src/types/StartsWithUppercase.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACjD,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,GACzB,KAAK,CAAC"}
1
+ {"version":3,"file":"StartsWithUppercase.d.ts","sourceRoot":"","sources":["../../../src/types/StartsWithUppercase.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACjD,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,GACzB,KAAK,CAAC"}
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * This type is used by the save data manager to when copying, serializing, and deserializing.
6
6
  */
7
- export declare type TSTLClass = LuaMap<AnyNotNil, unknown> & {
7
+ export type TSTLClass = LuaMap<AnyNotNil, unknown> & {
8
8
  readonly __tstlClassBrand: symbol;
9
9
  };
10
10
  //# sourceMappingURL=TSTLClass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TSTLClass.d.ts","sourceRoot":"","sources":["../../../src/types/TSTLClass.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,oBAAY,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG;IACnD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,CAAC"}
1
+ {"version":3,"file":"TSTLClass.d.ts","sourceRoot":"","sources":["../../../src/types/TSTLClass.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG;IACnD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare type TupleToIntersection<T extends unknown[]> = T extends [
1
+ export type TupleToIntersection<T extends unknown[]> = T extends [
2
2
  infer F,
3
3
  ...infer R
4
4
  ] ? F & TupleToIntersection<R> : unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"TupleToIntersection.d.ts","sourceRoot":"","sources":["../../../src/types/TupleToIntersection.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS;IAC/D,MAAM,CAAC;IACP,GAAG,MAAM,CAAC;CACX,GACG,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC"}
1
+ {"version":3,"file":"TupleToIntersection.d.ts","sourceRoot":"","sources":["../../../src/types/TupleToIntersection.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS;IAC/D,MAAM,CAAC;IACP,GAAG,MAAM,CAAC;CACX,GACG,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC"}
@@ -1,3 +1,3 @@
1
1
  /** Helper type to convert a tuple to a union. */
2
- export declare type TupleToUnion<T extends unknown[]> = T[number];
2
+ export type TupleToUnion<T extends unknown[]> = T[number];
3
3
  //# sourceMappingURL=TupleToUnion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TupleToUnion.d.ts","sourceRoot":"","sources":["../../../src/types/TupleToUnion.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,oBAAY,YAAY,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"TupleToUnion.d.ts","sourceRoot":"","sources":["../../../src/types/TupleToUnion.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  /** Helper type to convert a union to an intersection. */
2
- export declare type UnionToIntersection<U> = (U extends U ? (u: U) => 0 : never) extends (i: infer I) => 0 ? Extract<I, U> : never;
2
+ export type UnionToIntersection<U> = (U extends U ? (u: U) => 0 : never) extends (i: infer I) => 0 ? Extract<I, U> : never;
3
3
  //# sourceMappingURL=UnionToIntersection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnionToIntersection.d.ts","sourceRoot":"","sources":["../../../src/types/UnionToIntersection.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,oBAAY,mBAAmB,CAAC,CAAC,IAAI,CACnC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,CAClC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,GACvB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GACb,KAAK,CAAC"}
1
+ {"version":3,"file":"UnionToIntersection.d.ts","sourceRoot":"","sources":["../../../src/types/UnionToIntersection.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACnC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,CAClC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,GACvB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,GACb,KAAK,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { StartsWithUppercase } from "./StartsWithUppercase";
2
2
  /** Helper type to match all of the uppercase keys of an object. */
3
- export declare type UppercaseKeys<T> = StartsWithUppercase<keyof T>;
3
+ export type UppercaseKeys<T> = StartsWithUppercase<keyof T>;
4
4
  //# sourceMappingURL=UppercaseKeys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UppercaseKeys.d.ts","sourceRoot":"","sources":["../../../src/types/UppercaseKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,mEAAmE;AACnE,oBAAY,aAAa,CAAC,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"UppercaseKeys.d.ts","sourceRoot":"","sources":["../../../src/types/UppercaseKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,mEAAmE;AACnE,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /** An array where each element is paired with a number indicating that elements 'weight'. */
3
- export declare type WeightedArray<T> = Array<[T, float]>;
3
+ export type WeightedArray<T> = Array<[T, float]>;
4
4
  //# sourceMappingURL=WeightedArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WeightedArray.d.ts","sourceRoot":"","sources":["../../../src/types/WeightedArray.ts"],"names":[],"mappings":";AAAA,6FAA6F;AAC7F,oBAAY,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"WeightedArray.d.ts","sourceRoot":"","sources":["../../../src/types/WeightedArray.ts"],"names":[],"mappings":";AAAA,6FAA6F;AAC7F,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * This is the opposite of the built-in `Readonly` utility type.
5
5
  */
6
- export declare type Writeable<T> = {
6
+ export type Writeable<T> = {
7
7
  -readonly [P in keyof T]: T[P];
8
8
  };
9
9
  //# sourceMappingURL=Writable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Writable.d.ts","sourceRoot":"","sources":["../../../src/types/Writable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,SAAS,CAAC,CAAC,IAAI;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC"}
1
+ {"version":3,"file":"Writable.d.ts","sourceRoot":"","sources":["../../../src/types/Writable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare type AllButFirst<T extends unknown[]> = T extends [
1
+ export type AllButFirst<T extends unknown[]> = T extends [
2
2
  unknown,
3
3
  ...infer Tail
4
4
  ] ? Tail : unknown[];
@@ -1 +1 @@
1
- {"version":3,"file":"AllButFirst.d.ts","sourceRoot":"","sources":["../../../../src/types/private/AllButFirst.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS;IACvD,OAAO;IACP,GAAG,MAAM,IAAI;CACd,GACG,IAAI,GACJ,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"AllButFirst.d.ts","sourceRoot":"","sources":["../../../../src/types/private/AllButFirst.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS;IACvD,OAAO;IACP,GAAG,MAAM,IAAI;CACd,GACG,IAAI,GACJ,OAAO,EAAE,CAAC"}
@@ -6,7 +6,7 @@ import { AddCallbackParametersCustom } from "../../interfaces/private/AddCallbac
6
6
  * This is so that the respective callback functions can be added/removed on demand as subscribers
7
7
  * get added/removed.
8
8
  */
9
- export declare type CallbackTuple = {
9
+ export type CallbackTuple = {
10
10
  [K in ModCallback]: [K, AddCallbackParameters[K]];
11
11
  }[ModCallback];
12
12
  /**
@@ -14,7 +14,7 @@ export declare type CallbackTuple = {
14
14
  * arguments). This is so that the respective callback functions can be added/removed on demand as
15
15
  * subscribers get added/removed.
16
16
  */
17
- export declare type CustomCallbackTuple = {
17
+ export type CustomCallbackTuple = {
18
18
  [K in ModCallbackCustom]: [K, AddCallbackParametersCustom[K]];
19
19
  }[ModCallbackCustom];
20
20
  //# sourceMappingURL=CallbackTuple.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CallbackTuple.d.ts","sourceRoot":"","sources":["../../../../src/types/private/CallbackTuple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAEnG;;;;GAIG;AACH,oBAAY,aAAa,GAAG;KACzB,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;CAClD,CAAC,WAAW,CAAC,CAAC;AAEf;;;;GAIG;AACH,oBAAY,mBAAmB,GAAG;KAC/B,CAAC,IAAI,iBAAiB,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC;CAC9D,CAAC,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"CallbackTuple.d.ts","sourceRoot":"","sources":["../../../../src/types/private/CallbackTuple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAC;AAEnG;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;KACzB,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;CAClD,CAAC,WAAW,CAAC,CAAC;AAEf;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;KAC/B,CAAC,IAAI,iBAAiB,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC,CAAC,CAAC;CAC9D,CAAC,iBAAiB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "15.6.1",
3
+ "version": "15.6.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -6,9 +6,7 @@ import {
6
6
  import { game } from "../../../core/cachedClasses";
7
7
  import { Exported } from "../../../decorators";
8
8
  import { ISCFeature } from "../../../enums/ISCFeature";
9
- import { ModCallbackCustom } from "../../../enums/ModCallbackCustom";
10
9
  import { getEntityID } from "../../../functions/entities";
11
- import { getPickups } from "../../../functions/entitiesSpecific";
12
10
  import { getRoomListIndex } from "../../../functions/roomData";
13
11
  import { onAscent } from "../../../functions/stage";
14
12
  import { vectorEquals } from "../../../functions/vector";
@@ -60,40 +58,61 @@ export class PickupIndexCreation extends Feature {
60
58
  ], // 67
61
59
  ];
62
60
 
63
- this.customCallbacksUsed = [
64
- [ModCallbackCustom.POST_NEW_ROOM_REORDERED, [this.postNewRoomReordered]],
65
- ];
66
-
67
61
  this.roomHistory = roomHistory;
68
62
  }
69
63
 
70
64
  // ModCallback.POST_PICKUP_INIT (34)
71
65
  private postPickupInit = (pickup: EntityPickup) => {
72
- this.trySetPickupIndex(pickup);
66
+ this.setPickupIndex(pickup);
73
67
  };
74
68
 
75
- private trySetPickupIndex(pickup: EntityPickup): void {
69
+ private setPickupIndex(pickup: EntityPickup): void {
76
70
  const ptrHash = GetPtrHash(pickup);
77
71
 
78
- // In certain situations, pickups can be morphed, and this should not incur a new pickup
79
- // counter. (For example, the collectible rotation with Tainted Isaac.)
72
+ // In certain situations, pickups can be morphed, which will trigger the `POST_PICKUP_INIT`
73
+ // callback but should not incur a new pickup counter. (For example, the collectible rotation
74
+ // with Tainted Isaac.) For these situations, we will already be tracking an index for this
75
+ // pointer hash.
80
76
  if (this.v.room.pickupIndexes.has(ptrHash)) {
81
77
  return;
82
78
  }
83
79
 
84
- // If we are re-entering a room that previously had a pickup, then we don't need to make a new
85
- // index, because we will re-use the existing one.
80
+ // First, handle the special case of re-entering a room with a previously tracked pickup. If we
81
+ // find a match in the level pickup data, we will use the pickup index from the match.
82
+ const pickupIndexFromLevelData =
83
+ this.getPickupIndexFromPreviousData(pickup);
86
84
  const room = game.GetRoom();
87
85
  const isFirstVisit = room.IsFirstVisit();
88
86
  const roomFrameCount = room.GetFrameCount();
89
- if (!isFirstVisit && roomFrameCount <= 0) {
87
+ if (
88
+ pickupIndexFromLevelData !== undefined &&
89
+ !isFirstVisit &&
90
+ roomFrameCount <= 0
91
+ ) {
92
+ this.v.room.pickupIndexes.set(ptrHash, pickupIndexFromLevelData);
90
93
  return;
91
94
  }
92
95
 
96
+ // This is a brand new pickup that we have not previously seen on this run.
93
97
  this.v.run.pickupCounter++;
94
98
  this.v.room.pickupIndexes.set(ptrHash, this.v.run.pickupCounter);
95
99
  }
96
100
 
101
+ private getPickupIndexFromPreviousData(
102
+ pickup: EntityPickup,
103
+ ): PickupIndex | undefined {
104
+ const roomListIndex = getRoomListIndex();
105
+ const pickupDescriptions =
106
+ this.v.level.pickupData.getAndSetDefault(roomListIndex);
107
+
108
+ let pickupIndex = getStoredPickupIndex(pickup, pickupDescriptions);
109
+ if (pickupIndex === undefined) {
110
+ pickupIndex = this.getPostAscentPickupIndex(pickup);
111
+ }
112
+
113
+ return pickupIndex;
114
+ }
115
+
97
116
  // ModCallback.POST_ENTITY_REMOVE (67)
98
117
  // EntityType.PICKUP (5)
99
118
  private postEntityRemovePickup = (entity: Entity) => {
@@ -123,7 +142,7 @@ export class PickupIndexCreation extends Feature {
123
142
  pickupIndex: PickupIndex,
124
143
  ) {
125
144
  // The "latest" room description is really the previous room, because the `POST_NEW_ROOM`
126
- // callback was not fired yet.
145
+ // callback has not fired yet.
127
146
  const previousRoomDescription = this.roomHistory.getLatestRoomDescription();
128
147
  if (previousRoomDescription === undefined) {
129
148
  return;
@@ -167,39 +186,9 @@ export class PickupIndexCreation extends Feature {
167
186
  }
168
187
  }
169
188
 
170
- // ModCallbackCustom.POST_NEW_ROOM_REORDERED
171
- private postNewRoomReordered = () => {
172
- const room = game.GetRoom();
173
- const isFirstVisit = room.IsFirstVisit();
174
-
175
- if (isFirstVisit) {
176
- return;
177
- }
178
-
179
- const roomListIndex = getRoomListIndex();
180
- const pickupDescriptions =
181
- this.v.level.pickupData.getAndSetDefault(roomListIndex);
182
-
183
- for (const pickup of getPickups()) {
184
- let pickupIndex = getStoredPickupIndex(pickup, pickupDescriptions);
185
- if (pickupIndex === undefined) {
186
- pickupIndex = this.getPostAscentPickupIndex(pickup);
187
- }
188
-
189
- if (pickupIndex === undefined) {
190
- // At this point, if we do not already have an existing pickup index, we need to create a
191
- // new one in order to cover the cases where mods spawn items in the `POST_NEW_ROOM`
192
- // callback.
193
- this.v.run.pickupCounter++;
194
- pickupIndex = this.v.run.pickupCounter;
195
- }
196
-
197
- const ptrHash = GetPtrHash(pickup);
198
- this.v.room.pickupIndexes.set(ptrHash, pickupIndex);
199
- }
200
- };
201
-
202
- private getPostAscentPickupIndex(pickup: EntityPickup) {
189
+ private getPostAscentPickupIndex(
190
+ pickup: EntityPickup,
191
+ ): PickupIndex | undefined {
203
192
  // If we have not found the pickup index yet, we might be re-entering a post-Ascent Treasure
204
193
  // Room or Boss Room.
205
194
  if (!onAscent()) {
@@ -244,17 +233,18 @@ export class PickupIndexCreation extends Feature {
244
233
  public getPickupIndex(pickup: EntityPickup): PickupIndex {
245
234
  const ptrHash = GetPtrHash(pickup);
246
235
  const pickupIndexInitial = this.v.room.pickupIndexes.get(ptrHash);
247
- if (pickupIndexInitial === undefined) {
248
- this.trySetPickupIndex(pickup);
236
+ if (pickupIndexInitial !== undefined) {
237
+ return pickupIndexInitial;
249
238
  }
250
239
 
240
+ this.setPickupIndex(pickup);
251
241
  const pickupIndex = this.v.room.pickupIndexes.get(ptrHash);
252
- if (pickupIndex === undefined) {
253
- const entityID = getEntityID(pickup);
254
- error(`Failed to generate a new pickup index for pickup: ${entityID}`);
242
+ if (pickupIndex !== undefined) {
243
+ return pickupIndex;
255
244
  }
256
245
 
257
- return pickupIndex;
246
+ const entityID = getEntityID(pickup);
247
+ error(`Failed to generate a new pickup index for pickup: ${entityID}`);
258
248
  }
259
249
  }
260
250
 
@@ -120,8 +120,8 @@ export class RoomHistory extends Feature {
120
120
  /**
121
121
  * Helper function to detect if the game is in the state where the room index has changed to a new
122
122
  * room, but the entities from the previous room are currently in the process of despawning. (At
123
- * this point, the `POST_NEW_ROOM` callback will not have fired yet, and there will not be an
124
- * entry in the room history array for the current room.)
123
+ * this point, the `POST_NEW_ROOM` callback and the `POST_NEW_ROOM_EARLY` callback will not have
124
+ * fired yet, and there will not be an entry in the room history array for the current room.)
125
125
  *
126
126
  * This function is intended to be used in the `POST_ENTITY_REMOVE` callback to detect when an
127
127
  * entity is despawning.
@@ -652,6 +652,8 @@ export function getChallenge(): void {
652
652
  const challenge = Isaac.GetChallenge();
653
653
  const challengeName = Challenge[challenge];
654
654
  const challengeDescription =
655
+ // Handle modded challenges.
656
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
655
657
  challengeName === undefined
656
658
  ? `${challenge} (custom)`
657
659
  : `Challenge.${challengeName} (${challenge})`;
@@ -66,7 +66,7 @@ export function getFlagName<T extends BitFlag | BitFlag128>(
66
66
  flag: BitFlag,
67
67
  flagEnum: Record<string, T>,
68
68
  ): string | undefined {
69
- for (const [key, value] of pairs(flagEnum)) {
69
+ for (const [key, value] of Object.entries(flagEnum)) {
70
70
  if (value === flag) {
71
71
  return key;
72
72
  }
@@ -45,12 +45,8 @@ export const SHOOTING_ACTIONS_SET: ReadonlySet<ButtonAction> = new Set(
45
45
  * Helper function to get the enum name for the specified `Controller` value. Note that this will
46
46
  * trim off the "BUTTON_" prefix.
47
47
  */
48
- export function controllerToString(controller: Controller): string | undefined {
48
+ export function controllerToString(controller: Controller): string {
49
49
  const key = Controller[controller];
50
- if (key === undefined) {
51
- return undefined;
52
- }
53
-
54
50
  return trimPrefix(key, "BUTTON_");
55
51
  }
56
52
 
@@ -150,9 +150,9 @@ export function getPillEffectName(pillEffect: PillEffect): string {
150
150
 
151
151
  /**
152
152
  * Helper function to get a pill effect type from a PillEffect enum value. In this context, the type
153
- * is equal to positive, negative, or neutral. This is derived from the suffix of the the "class"
154
- * tag in the "pocketitems.xml" file. Use the `getPillEffectClass` helper function to determine the
155
- * "power" of the pill.
153
+ * is equal to positive, negative, or neutral. This is derived from the suffix of the "class" tag in
154
+ * the "pocketitems.xml" file. Use the `getPillEffectClass` helper function to determine the "power"
155
+ * of the pill.
156
156
  *
157
157
  * Due to limitations in the API, this function will not work properly for modded pill effects, and
158
158
  * will always return `DEFAULT_PILL_EFFECT_TYPE` in those cases.
@@ -52,7 +52,7 @@ export function getHeartRowLength(player: EntityPlayer): int {
52
52
  /**
53
53
  * Helper function to get the width of the first player's hearts on the UI. This is useful for
54
54
  * drawing UI elements to the right of where the player's hearts are. Make sure to use this in
55
- * combination with the the `getHUDOffsetVector` helper function.
55
+ * combination with the `getHUDOffsetVector` helper function.
56
56
  */
57
57
  export function getHeartsUIWidth(): int {
58
58
  const level = game.GetLevel();
@@ -117,6 +117,12 @@ export function serializeVector(vector: Vector): SerializedVector {
117
117
  return vectorTable as SerializedVector;
118
118
  }
119
119
 
120
+ /**
121
+ * Helper function to compare two vectors for equality.
122
+ *
123
+ * This function is useful because vectors are not directly comparable. In other words, `Vector(1.2)
124
+ * === Vector(1.2)` will be equal to false.
125
+ */
120
126
  export function vectorEquals(vector1: Vector, vector2: Vector): boolean {
121
127
  return isaacAPIClassEquals(vector1, vector2, KEYS);
122
128
  }