isaacscript-common 6.11.0 → 6.12.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 (253) hide show
  1. package/dist/callbacks/postFlip.lua +2 -2
  2. package/dist/callbacks/postGridEntityCustomRender.d.ts +2 -0
  3. package/dist/callbacks/postGridEntityCustomRender.d.ts.map +1 -0
  4. package/dist/callbacks/postGridEntityCustomRender.lua +36 -0
  5. package/dist/callbacks/postGridEntityCustomUpdate.d.ts +2 -0
  6. package/dist/callbacks/postGridEntityCustomUpdate.d.ts.map +1 -0
  7. package/dist/callbacks/postGridEntityCustomUpdate.lua +36 -0
  8. package/dist/callbacks/postNewRoomEarly.lua +2 -2
  9. package/dist/callbacks/postPickupInitFirst.lua +1 -20
  10. package/dist/callbacks/postPlayerFatalDamage.lua +1 -1
  11. package/dist/callbacks/postPlayerInitFirst.d.ts +2 -0
  12. package/dist/callbacks/postPlayerInitFirst.d.ts.map +1 -0
  13. package/dist/callbacks/postPlayerInitFirst.lua +42 -0
  14. package/dist/callbacks/postPlayerInitLate.lua +5 -5
  15. package/dist/callbacks/postPlayerReorderedCallbacks.d.ts +2 -0
  16. package/dist/callbacks/postPlayerReorderedCallbacks.d.ts.map +1 -0
  17. package/dist/callbacks/{postPlayerReordered.lua → postPlayerReorderedCallbacks.lua} +11 -37
  18. package/dist/callbacks/reorderedCallbacks.d.ts +5 -5
  19. package/dist/callbacks/reorderedCallbacks.d.ts.map +1 -1
  20. package/dist/callbacks/reorderedCallbacks.lua +5 -5
  21. package/dist/callbacks/subscriptions/postFirstFlip.d.ts +1 -1
  22. package/dist/callbacks/subscriptions/postFirstFlip.d.ts.map +1 -1
  23. package/dist/callbacks/subscriptions/postFirstFlip.lua +2 -2
  24. package/dist/callbacks/subscriptions/postFlip.d.ts +1 -1
  25. package/dist/callbacks/subscriptions/postFlip.d.ts.map +1 -1
  26. package/dist/callbacks/subscriptions/postFlip.lua +2 -2
  27. package/dist/callbacks/subscriptions/postGridEntityCustomRender.d.ts +6 -0
  28. package/dist/callbacks/subscriptions/postGridEntityCustomRender.d.ts.map +1 -0
  29. package/dist/callbacks/subscriptions/postGridEntityCustomRender.lua +29 -0
  30. package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.d.ts +6 -0
  31. package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.d.ts.map +1 -0
  32. package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.lua +29 -0
  33. package/dist/callbacks/subscriptions/{postPlayerInitReordered.d.ts → postPlayerInitFirst.d.ts} +2 -2
  34. package/dist/callbacks/subscriptions/postPlayerInitFirst.d.ts.map +1 -0
  35. package/dist/callbacks/subscriptions/{postPlayerInitReordered.lua → postPlayerInitFirst.lua} +3 -3
  36. package/dist/constants.d.ts +1 -5
  37. package/dist/constants.d.ts.map +1 -1
  38. package/dist/constants.lua +0 -7
  39. package/dist/constantsFirstLast.d.ts +5 -1
  40. package/dist/constantsFirstLast.d.ts.map +1 -1
  41. package/dist/constantsFirstLast.lua +6 -0
  42. package/dist/enums/ModCallbackCustom.d.ts +106 -81
  43. package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
  44. package/dist/enums/ModCallbackCustom.lua +63 -59
  45. package/dist/enums/private/StageTravelState.d.ts +9 -0
  46. package/dist/enums/private/StageTravelState.d.ts.map +1 -0
  47. package/dist/enums/private/StageTravelState.lua +15 -0
  48. package/dist/enums/private/TrapdoorAnimation.d.ts +6 -0
  49. package/dist/enums/private/TrapdoorAnimation.d.ts.map +1 -0
  50. package/dist/enums/private/TrapdoorAnimation.lua +6 -0
  51. package/dist/features/customGridEntity.d.ts +17 -5
  52. package/dist/features/customGridEntity.d.ts.map +1 -1
  53. package/dist/features/customGridEntity.lua +86 -17
  54. package/dist/features/customStage/exports.d.ts.map +1 -1
  55. package/dist/features/customStage/exports.lua +0 -13
  56. package/dist/features/customStage/init.d.ts.map +1 -1
  57. package/dist/features/customStage/init.lua +24 -2
  58. package/dist/features/customStage/streakText.d.ts +6 -0
  59. package/dist/features/customStage/streakText.d.ts.map +1 -1
  60. package/dist/features/customStage/streakText.lua +16 -12
  61. package/dist/features/customStage/versusScreen.d.ts +6 -0
  62. package/dist/features/customStage/versusScreen.d.ts.map +1 -1
  63. package/dist/features/customStage/versusScreen.lua +10 -5
  64. package/dist/features/customTrapdoor/blackSprite.d.ts +2 -0
  65. package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -0
  66. package/dist/features/customTrapdoor/blackSprite.lua +19 -0
  67. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +15 -0
  68. package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -0
  69. package/dist/features/customTrapdoor/customTrapdoorConstants.lua +16 -0
  70. package/dist/features/customTrapdoor/exports.d.ts +29 -0
  71. package/dist/features/customTrapdoor/exports.d.ts.map +1 -0
  72. package/dist/features/customTrapdoor/exports.lua +93 -0
  73. package/dist/features/customTrapdoor/init.d.ts +3 -0
  74. package/dist/features/customTrapdoor/init.d.ts.map +1 -0
  75. package/dist/features/customTrapdoor/init.lua +174 -0
  76. package/dist/features/customTrapdoor/openClose.d.ts +5 -0
  77. package/dist/features/customTrapdoor/openClose.d.ts.map +1 -0
  78. package/dist/features/customTrapdoor/openClose.lua +60 -0
  79. package/dist/features/customTrapdoor/touched.d.ts +4 -0
  80. package/dist/features/customTrapdoor/touched.d.ts.map +1 -0
  81. package/dist/features/customTrapdoor/touched.lua +159 -0
  82. package/dist/features/customTrapdoor/v.d.ts +18 -0
  83. package/dist/features/customTrapdoor/v.d.ts.map +1 -0
  84. package/dist/features/customTrapdoor/v.lua +17 -0
  85. package/dist/features/deployJSONRoom.d.ts +2 -2
  86. package/dist/features/deployJSONRoom.d.ts.map +1 -1
  87. package/dist/features/deployJSONRoom.lua +3 -3
  88. package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
  89. package/dist/features/extraConsoleCommands/init.lua +3 -1
  90. package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
  91. package/dist/features/extraConsoleCommands/listCommands.lua +6 -6
  92. package/dist/features/pause.d.ts +1 -1
  93. package/dist/features/pause.d.ts.map +1 -1
  94. package/dist/features/pause.lua +87 -8
  95. package/dist/features/persistentEntities.d.ts.map +1 -1
  96. package/dist/features/persistentEntities.lua +7 -7
  97. package/dist/features/pickupIndex.d.ts +19 -0
  98. package/dist/features/pickupIndex.d.ts.map +1 -0
  99. package/dist/features/pickupIndex.lua +197 -0
  100. package/dist/features/roomHistory.d.ts +24 -0
  101. package/dist/features/roomHistory.d.ts.map +1 -0
  102. package/dist/features/roomHistory.lua +89 -0
  103. package/dist/features/taintedLazarusPlayers.d.ts.map +1 -1
  104. package/dist/features/taintedLazarusPlayers.lua +13 -21
  105. package/dist/functions/{character.d.ts → characters.d.ts} +3 -1
  106. package/dist/functions/characters.d.ts.map +1 -0
  107. package/dist/functions/{character.lua → characters.lua} +12 -0
  108. package/dist/functions/collectibles.d.ts +26 -13
  109. package/dist/functions/collectibles.d.ts.map +1 -1
  110. package/dist/functions/collectibles.lua +26 -13
  111. package/dist/functions/entities.d.ts +3 -3
  112. package/dist/functions/entities.d.ts.map +1 -1
  113. package/dist/functions/entities.lua +8 -3
  114. package/dist/functions/gridEntities.d.ts +2 -2
  115. package/dist/functions/gridEntities.lua +2 -2
  116. package/dist/functions/isaacAPIClass.d.ts +64 -0
  117. package/dist/functions/isaacAPIClass.d.ts.map +1 -1
  118. package/dist/functions/isaacAPIClass.lua +84 -1
  119. package/dist/functions/log.lua +3 -3
  120. package/dist/functions/pickupVariants.d.ts +2 -2
  121. package/dist/functions/pickupVariants.d.ts.map +1 -1
  122. package/dist/functions/pickupVariants.lua +2 -2
  123. package/dist/functions/playerCenter.lua +2 -2
  124. package/dist/functions/playerIndex.d.ts +11 -5
  125. package/dist/functions/playerIndex.d.ts.map +1 -1
  126. package/dist/functions/playerIndex.lua +19 -26
  127. package/dist/functions/players.lua +4 -4
  128. package/dist/functions/revive.lua +2 -2
  129. package/dist/functions/roomData.d.ts +3 -2
  130. package/dist/functions/roomData.d.ts.map +1 -1
  131. package/dist/functions/roomData.lua +3 -2
  132. package/dist/functions/rooms.d.ts +6 -6
  133. package/dist/functions/rooms.lua +6 -6
  134. package/dist/functions/stage.d.ts +1 -0
  135. package/dist/functions/stage.d.ts.map +1 -1
  136. package/dist/functions/stage.lua +4 -0
  137. package/dist/functions/table.d.ts +1 -1
  138. package/dist/functions/table.d.ts.map +1 -1
  139. package/dist/index.d.ts +6 -2
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.lua +33 -2
  142. package/dist/initCustomCallbacks.d.ts.map +1 -1
  143. package/dist/initCustomCallbacks.lua +11 -2
  144. package/dist/initFeatures.d.ts +1 -2
  145. package/dist/initFeatures.d.ts.map +1 -1
  146. package/dist/initFeatures.lua +16 -2
  147. package/dist/interfaces/AddCallbackParameterCustom.d.ts +6 -2
  148. package/dist/interfaces/AddCallbackParameterCustom.d.ts.map +1 -1
  149. package/dist/interfaces/CustomGridEntityData.d.ts +6 -2
  150. package/dist/interfaces/CustomGridEntityData.d.ts.map +1 -1
  151. package/dist/interfaces/RoomDescription.d.ts +14 -0
  152. package/dist/interfaces/RoomDescription.d.ts.map +1 -0
  153. package/dist/interfaces/RoomDescription.lua +2 -0
  154. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +7 -0
  155. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -0
  156. package/dist/interfaces/private/CustomTrapdoorDescription.lua +2 -0
  157. package/dist/lib/jsonLua.lua +2 -0
  158. package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
  159. package/dist/objects/callbackRegisterFunctions.lua +9 -3
  160. package/dist/objects/characterDamageMultipliers.d.ts +6 -0
  161. package/dist/objects/characterDamageMultipliers.d.ts.map +1 -0
  162. package/dist/objects/characterDamageMultipliers.lua +49 -0
  163. package/dist/types/CollectibleIndex.d.ts +1 -1
  164. package/dist/types/PickupIndex.d.ts +17 -0
  165. package/dist/types/PickupIndex.d.ts.map +1 -0
  166. package/dist/types/PickupIndex.lua +2 -0
  167. package/dist/types/PlayerIndex.d.ts +1 -1
  168. package/dist/upgradeMod.lua +2 -4
  169. package/package.json +2 -2
  170. package/src/callbacks/customRevive.ts +3 -3
  171. package/src/callbacks/itemPickup.ts +3 -3
  172. package/src/callbacks/postAmbush.ts +3 -3
  173. package/src/callbacks/postEsauJr.ts +3 -3
  174. package/src/callbacks/postFlip.ts +6 -5
  175. package/src/callbacks/postGridEntity.ts +5 -5
  176. package/src/callbacks/postGridEntityCustomRender.ts +44 -0
  177. package/src/callbacks/postGridEntityCustomUpdate.ts +44 -0
  178. package/src/callbacks/postNewRoomEarly.ts +2 -2
  179. package/src/callbacks/postPickupInitFirst.ts +1 -32
  180. package/src/callbacks/postPlayerCollectible.ts +2 -2
  181. package/src/callbacks/postPlayerFatalDamage.ts +5 -0
  182. package/src/callbacks/postPlayerInitFirst.ts +57 -0
  183. package/src/callbacks/postPlayerInitLate.ts +9 -5
  184. package/src/callbacks/{postPlayerReordered.ts → postPlayerReorderedCallbacks.ts} +12 -32
  185. package/src/callbacks/postSlotInitUpdate.ts +5 -2
  186. package/src/callbacks/postSlotRender.ts +2 -2
  187. package/src/callbacks/reorderedCallbacks.ts +10 -9
  188. package/src/callbacks/subscriptions/postFirstFlip.ts +6 -3
  189. package/src/callbacks/subscriptions/postFlip.ts +6 -3
  190. package/src/callbacks/subscriptions/postGridEntityCustomRender.ts +41 -0
  191. package/src/callbacks/subscriptions/postGridEntityCustomUpdate.ts +41 -0
  192. package/src/callbacks/subscriptions/{postPlayerInitReordered.ts → postPlayerInitFirst.ts} +6 -6
  193. package/src/constants.ts +1 -9
  194. package/src/constantsFirstLast.ts +16 -0
  195. package/src/enums/ModCallbackCustom.ts +52 -25
  196. package/src/enums/private/StageTravelState.ts +8 -0
  197. package/src/enums/private/TrapdoorAnimation.ts +5 -0
  198. package/src/features/customGridEntity.ts +118 -12
  199. package/src/features/customStage/exports.ts +3 -22
  200. package/src/features/customStage/init.ts +30 -1
  201. package/src/features/customStage/streakText.ts +13 -5
  202. package/src/features/customStage/versusScreen.ts +20 -12
  203. package/src/features/customTrapdoor/blackSprite.ts +16 -0
  204. package/src/features/customTrapdoor/customTrapdoorConstants.ts +23 -0
  205. package/src/features/customTrapdoor/exports.ts +99 -0
  206. package/src/features/customTrapdoor/init.ts +217 -0
  207. package/src/features/customTrapdoor/openClose.ts +103 -0
  208. package/src/features/customTrapdoor/touched.ts +195 -0
  209. package/src/features/customTrapdoor/v.ts +26 -0
  210. package/src/features/deployJSONRoom.ts +10 -5
  211. package/src/features/extraConsoleCommands/init.ts +5 -2
  212. package/src/features/extraConsoleCommands/listCommands.ts +6 -8
  213. package/src/features/pause.ts +97 -7
  214. package/src/features/persistentEntities.ts +9 -8
  215. package/src/features/pickupIndex.ts +257 -0
  216. package/src/features/playerInventory.ts +2 -2
  217. package/src/features/roomHistory.ts +113 -0
  218. package/src/features/saveDataManager/main.ts +3 -3
  219. package/src/features/taintedLazarusPlayers.ts +37 -36
  220. package/src/functions/{character.ts → characters.ts} +13 -0
  221. package/src/functions/collectibles.ts +26 -13
  222. package/src/functions/deepCopy.ts +2 -2
  223. package/src/functions/entities.ts +7 -4
  224. package/src/functions/gridEntities.ts +2 -2
  225. package/src/functions/isaacAPIClass.ts +106 -1
  226. package/src/functions/pickupVariants.ts +2 -2
  227. package/src/functions/playerCenter.ts +2 -2
  228. package/src/functions/playerIndex.ts +26 -23
  229. package/src/functions/players.ts +1 -1
  230. package/src/functions/revive.ts +1 -1
  231. package/src/functions/rng.ts +1 -1
  232. package/src/functions/roomData.ts +3 -2
  233. package/src/functions/rooms.ts +6 -6
  234. package/src/functions/stage.ts +10 -1
  235. package/src/functions/table.ts +2 -2
  236. package/src/index.ts +9 -2
  237. package/src/initCustomCallbacks.ts +7 -1
  238. package/src/initFeatures.ts +13 -2
  239. package/src/interfaces/AddCallbackParameterCustom.ts +6 -2
  240. package/src/interfaces/CustomGridEntityData.ts +7 -2
  241. package/src/interfaces/RoomDescription.ts +19 -0
  242. package/src/interfaces/private/CustomTrapdoorDescription.ts +7 -0
  243. package/src/lib/jsonLua.lua +2 -0
  244. package/src/objects/callbackRegisterFunctions.ts +8 -3
  245. package/src/objects/characterDamageMultipliers.ts +49 -0
  246. package/src/types/CollectibleIndex.ts +1 -1
  247. package/src/types/PickupIndex.ts +15 -0
  248. package/src/types/PlayerIndex.ts +1 -1
  249. package/src/upgradeMod.ts +4 -4
  250. package/dist/callbacks/postPlayerReordered.d.ts +0 -2
  251. package/dist/callbacks/postPlayerReordered.d.ts.map +0 -1
  252. package/dist/callbacks/subscriptions/postPlayerInitReordered.d.ts.map +0 -1
  253. package/dist/functions/character.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - PRE_ITEM_PICKUP
3
- // - POST_ITEM_PICKUP
1
+ // This provides the logic for the following callbacks:
2
+ // - `PRE_ITEM_PICKUP`
3
+ // - `POST_ITEM_PICKUP`
4
4
 
5
5
  import {
6
6
  CollectibleType,
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - POST_AMBUSH_STARTED
3
- // - POST_AMBUSH_FINISHED
1
+ // This provides the logic for the following callbacks:
2
+ // - `POST_AMBUSH_STARTED`
3
+ // - `POST_AMBUSH_FINISHED`
4
4
 
5
5
  import { ModCallback, RoomType } from "isaac-typescript-definitions";
6
6
  import { game } from "../cachedClasses";
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - POST_ESAU_JR
3
- // - POST_FIRST_ESAU_JR
1
+ // This provides the logic for the following callbacks:
2
+ // - `POST_ESAU_JR`
3
+ // - `POST_FIRST_ESAU_JR`
4
4
 
5
5
  import {
6
6
  CollectibleType,
@@ -1,6 +1,6 @@
1
- // This provides the logic for:
2
- // - POST_FLIP
3
- // - POST_FIRST_FLIP
1
+ // This provides the logic for the following callbacks:
2
+ // - `POST_FLIP`
3
+ // - `POST_FIRST_FLIP`
4
4
 
5
5
  import {
6
6
  CollectibleType,
@@ -21,6 +21,7 @@ import {
21
21
 
22
22
  const v = {
23
23
  run: {
24
+ /** We don't consider the case of a multiplayer game with more than one Tainted Lazarus. */
24
25
  usedFlipAtLeastOnce: false,
25
26
  },
26
27
  };
@@ -63,10 +64,10 @@ function useItemFlip(
63
64
 
64
65
  if (!v.run.usedFlipAtLeastOnce) {
65
66
  v.run.usedFlipAtLeastOnce = true;
66
- postFirstFlipFire(newLazarus);
67
+ postFirstFlipFire(newLazarus, player);
67
68
  }
68
69
 
69
- postFlipFire(newLazarus);
70
+ postFlipFire(newLazarus, player);
70
71
 
71
72
  return undefined;
72
73
  }
@@ -1,9 +1,9 @@
1
1
  // This provides the logic for the following callbacks:
2
- // - PostGridEntityInit
3
- // - PostGridEntityUpdate
4
- // - PostGridEntityRemove
5
- // - PostGridEntityStateChanged
6
- // - PostGridEntityBroken
2
+ // - `POST_GRID_ENTITY_INIT`
3
+ // - `POST_GRID_ENTITY_UPDATE`
4
+ // - `POST_GRID_ENTITY_REMOVE`
5
+ // - `POST_GRID_ENTITY_STATE_CHANGED`
6
+ // - `POST_GRID_ENTITY_BROKEN`
7
7
 
8
8
  import { GridEntityType, ModCallback } from "isaac-typescript-definitions";
9
9
  import { ModUpgraded } from "../classes/ModUpgraded";
@@ -0,0 +1,44 @@
1
+ import { GridEntityType, ModCallback } from "isaac-typescript-definitions";
2
+ import { ModUpgraded } from "../classes/ModUpgraded";
3
+ import { getCustomGridEntities } from "../features/customGridEntity";
4
+ import { saveDataManager } from "../features/saveDataManager/exports";
5
+ import {
6
+ postGridEntityCustomRenderFire,
7
+ postGridEntityCustomRenderHasSubscriptions,
8
+ } from "./subscriptions/postGridEntityCustomRender";
9
+
10
+ type GridEntityTuple = [
11
+ gridEntityType: GridEntityType,
12
+ gridEntityVariant: int,
13
+ state: int,
14
+ ];
15
+
16
+ const v = {
17
+ room: {
18
+ /** Indexed by grid index. */
19
+ initializedGridEntities: new Map<int, GridEntityTuple>(),
20
+ },
21
+ };
22
+
23
+ /** @internal */
24
+ export function postGridEntityCustomRenderInit(mod: ModUpgraded): void {
25
+ saveDataManager("postGridEntityCustomRender", v, hasSubscriptions);
26
+
27
+ mod.AddCallback(ModCallback.POST_RENDER, postRender); // 2
28
+ }
29
+
30
+ function hasSubscriptions() {
31
+ return postGridEntityCustomRenderHasSubscriptions();
32
+ }
33
+
34
+ // ModCallback.POST_RENDER (2)
35
+ function postRender() {
36
+ if (!hasSubscriptions()) {
37
+ return;
38
+ }
39
+
40
+ const customGridEntities = getCustomGridEntities();
41
+ for (const [gridEntity, data] of customGridEntities) {
42
+ postGridEntityCustomRenderFire(gridEntity, data.gridEntityTypeCustom);
43
+ }
44
+ }
@@ -0,0 +1,44 @@
1
+ import { GridEntityType, ModCallback } from "isaac-typescript-definitions";
2
+ import { ModUpgraded } from "../classes/ModUpgraded";
3
+ import { getCustomGridEntities } from "../features/customGridEntity";
4
+ import { saveDataManager } from "../features/saveDataManager/exports";
5
+ import {
6
+ postGridEntityCustomUpdateFire,
7
+ postGridEntityCustomUpdateHasSubscriptions,
8
+ } from "./subscriptions/postGridEntityCustomUpdate";
9
+
10
+ type GridEntityTuple = [
11
+ gridEntityType: GridEntityType,
12
+ gridEntityVariant: int,
13
+ state: int,
14
+ ];
15
+
16
+ const v = {
17
+ room: {
18
+ /** Indexed by grid index. */
19
+ initializedGridEntities: new Map<int, GridEntityTuple>(),
20
+ },
21
+ };
22
+
23
+ /** @internal */
24
+ export function postGridEntityCustomUpdateInit(mod: ModUpgraded): void {
25
+ saveDataManager("postGridEntityCustomUpdate", v, hasSubscriptions);
26
+
27
+ mod.AddCallback(ModCallback.POST_UPDATE, postUpdate); // 1
28
+ }
29
+
30
+ function hasSubscriptions() {
31
+ return postGridEntityCustomUpdateHasSubscriptions();
32
+ }
33
+
34
+ // ModCallback.POST_UPDATE (1)
35
+ function postUpdate() {
36
+ if (!hasSubscriptions()) {
37
+ return;
38
+ }
39
+
40
+ const customGridEntities = getCustomGridEntities();
41
+ for (const [gridEntity, data] of customGridEntities) {
42
+ postGridEntityCustomUpdateFire(gridEntity, data.gridEntityTypeCustom);
43
+ }
44
+ }
@@ -67,7 +67,7 @@ function checkRoomChanged() {
67
67
  topLeftWall = spawnGridEntity(GridEntityType.WALL, topLeftWallGridIndex);
68
68
  if (topLeftWall === undefined) {
69
69
  logError(
70
- "Failed to spawn a new wall (1) for the PostNewRoomEarly callback.",
70
+ "Failed to spawn a new wall (1) for the POST_NEW_ROOM_EARLY callback.",
71
71
  );
72
72
  return;
73
73
  }
@@ -82,7 +82,7 @@ function checkRoomChanged() {
82
82
  );
83
83
  if (topLeftWall2 === undefined) {
84
84
  logError(
85
- "Failed to spawn a new wall (2) for the PostNewRoomEarly callback.",
85
+ "Failed to spawn a new wall (2) for the POST_NEW_ROOM_EARLY callback.",
86
86
  );
87
87
  return;
88
88
  }
@@ -1,31 +1,13 @@
1
- import {
2
- GameStateFlag,
3
- ModCallback,
4
- RoomType,
5
- } from "isaac-typescript-definitions";
1
+ import { ModCallback } from "isaac-typescript-definitions";
6
2
  import { game } from "../cachedClasses";
7
- import { saveDataManager } from "../features/saveDataManager/exports";
8
3
  import { getRoomVisitedCount } from "../functions/roomData";
9
4
  import {
10
5
  postPickupInitFirstFire,
11
6
  postPickupInitFirstHasSubscriptions,
12
7
  } from "./subscriptions/postPickupInitFirst";
13
8
 
14
- const POST_ASCENT_ROOM_TYPES: ReadonlySet<RoomType> = new Set([
15
- RoomType.TREASURE,
16
- RoomType.BOSS,
17
- ]);
18
-
19
- const v = {
20
- run: {
21
- postAscentPickupInitSeeds: new Set<int>(),
22
- },
23
- };
24
-
25
9
  /** @internal */
26
10
  export function postPickupInitFirstInit(mod: Mod): void {
27
- saveDataManager("postPickupInitFirst", v, hasSubscriptions);
28
-
29
11
  mod.AddCallback(ModCallback.POST_PICKUP_INIT, postPickupInit); // 34
30
12
  }
31
13
 
@@ -40,15 +22,8 @@ function postPickupInit(pickup: EntityPickup) {
40
22
  }
41
23
 
42
24
  const room = game.GetRoom();
43
- const roomType = room.GetType();
44
25
  const roomFrameCount = room.GetFrameCount();
45
26
 
46
- // First, keep track of pickups in rooms that could appear again in The Ascent.
47
- const previouslySeen = v.run.postAscentPickupInitSeeds.has(pickup.InitSeed);
48
- if (POST_ASCENT_ROOM_TYPES.has(roomType)) {
49
- v.run.postAscentPickupInitSeeds.add(pickup.InitSeed);
50
- }
51
-
52
27
  if (roomFrameCount > 0) {
53
28
  postPickupInitFirstFire(pickup);
54
29
  return;
@@ -59,12 +34,6 @@ function postPickupInit(pickup: EntityPickup) {
59
34
  return;
60
35
  }
61
36
 
62
- // Handle the special case of a post-Ascent Treasure Room or Boss Room.
63
- const onAscent = game.GetStateFlag(GameStateFlag.BACKWARDS_PATH);
64
- if (onAscent && POST_ASCENT_ROOM_TYPES.has(roomType) && previouslySeen) {
65
- return;
66
- }
67
-
68
37
  // We are entering a brand-new room.
69
38
  postPickupInitFirstFire(pickup);
70
39
  }
@@ -1,6 +1,6 @@
1
1
  // This provides the logic for the following callbacks:
2
- // - PostPlayerCollectibleAdded
3
- // - PostPlayerCollectibleRemoved
2
+ // - `POST_PLAYER_COLLECTIBLE_ADDED`
3
+ // - `POST_PLAYER_COLLECTIBLE_REMOVED`
4
4
 
5
5
  import { CollectibleType, ModCallback } from "isaac-typescript-definitions";
6
6
  import { DefaultMap } from "../classes/DefaultMap";
@@ -1,10 +1,12 @@
1
1
  import {
2
+ ActiveSlot,
2
3
  BossID,
3
4
  CollectibleType,
4
5
  DamageFlag,
5
6
  DamageFlagZero,
6
7
  EntityType,
7
8
  ModCallback,
9
+ UseFlag,
8
10
  } from "isaac-typescript-definitions";
9
11
  import { game } from "../cachedClasses";
10
12
  import { saveDataManager } from "../features/saveDataManager/exports";
@@ -113,6 +115,9 @@ function preUseItemBible(
113
115
  _collectibleType: CollectibleType,
114
116
  _rng: RNG,
115
117
  player: EntityPlayer,
118
+ _useFlags: BitFlags<UseFlag>,
119
+ _activeSlot: ActiveSlot,
120
+ _customVarData: int,
116
121
  ): boolean | undefined {
117
122
  if (!hasSubscriptions()) {
118
123
  return undefined;
@@ -0,0 +1,57 @@
1
+ import { ModUpgraded } from "../classes/ModUpgraded";
2
+ import { ModCallbackCustom } from "../enums/ModCallbackCustom";
3
+ import { getPlayers, isChildPlayer } from "../functions/playerIndex";
4
+ import { inGenesisRoom } from "../functions/rooms";
5
+ import {
6
+ postPlayerInitFirstFire,
7
+ postPlayerInitFirstHasSubscriptions,
8
+ } from "./subscriptions/postPlayerInitFirst";
9
+
10
+ /** @internal */
11
+ export function postPlayerInitFirstInit(mod: ModUpgraded): void {
12
+ mod.AddCallbackCustom(
13
+ ModCallbackCustom.POST_NEW_ROOM_REORDERED,
14
+ postNewRoomReordered,
15
+ );
16
+ mod.AddCallbackCustom(
17
+ ModCallbackCustom.POST_PLAYER_INIT_LATE,
18
+ postPlayerInitLate,
19
+ );
20
+ }
21
+
22
+ function hasSubscriptions() {
23
+ return postPlayerInitFirstHasSubscriptions();
24
+ }
25
+
26
+ // ModCallbackCustom.POST_NEW_ROOM_REORDERED
27
+ function postNewRoomReordered() {
28
+ if (!hasSubscriptions()) {
29
+ return;
30
+ }
31
+
32
+ // When a player uses the Genesis collectible, they will lose all of their collectibles, trinkets,
33
+ // pocket items, and stats, so they will need to be re-initialized like they would be at the
34
+ // beginning of a run. However, in this case, the `POST_PLAYER_INIT_FIRST` callback will not fire,
35
+ // because that only fires once per run. Thus, we explicitly handle this special case.
36
+ if (!inGenesisRoom()) {
37
+ return;
38
+ }
39
+
40
+ for (const player of getPlayers()) {
41
+ postPlayerInitFirstFire(player);
42
+ }
43
+ }
44
+
45
+ // ModCallback.POST_PEFFECT_UPDATE (4)
46
+ function postPlayerInitLate(player: EntityPlayer) {
47
+ if (!hasSubscriptions()) {
48
+ return;
49
+ }
50
+
51
+ // We want to exclude non-real players like the Strawman keeper.
52
+ if (isChildPlayer(player)) {
53
+ return;
54
+ }
55
+
56
+ postPlayerInitFirstFire(player);
57
+ }
@@ -1,4 +1,5 @@
1
- import { ModCallback } from "isaac-typescript-definitions";
1
+ import { ModUpgraded } from "../classes/ModUpgraded";
2
+ import { ModCallbackCustom } from "../enums/ModCallbackCustom";
2
3
  import { saveDataManager } from "../features/saveDataManager/exports";
3
4
  import { setAddPlayer, setHasPlayer } from "../functions/playerDataStructures";
4
5
  import { PlayerIndex } from "../types/PlayerIndex";
@@ -14,18 +15,21 @@ const v = {
14
15
  };
15
16
 
16
17
  /** @internal */
17
- export function postPlayerInitLateInit(mod: Mod): void {
18
+ export function postPlayerInitLateInit(mod: ModUpgraded): void {
18
19
  saveDataManager("postPlayerInitLate", v, hasSubscriptions);
19
20
 
20
- mod.AddCallback(ModCallback.POST_PLAYER_UPDATE, postPlayerUpdate); // 31
21
+ mod.AddCallbackCustom(
22
+ ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED,
23
+ postPEffectUpdateReordered,
24
+ );
21
25
  }
22
26
 
23
27
  function hasSubscriptions() {
24
28
  return postPlayerInitLateHasSubscriptions();
25
29
  }
26
30
 
27
- // ModCallback.POST_PLAYER_UPDATE (31)
28
- function postPlayerUpdate(player: EntityPlayer) {
31
+ // ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED
32
+ function postPEffectUpdateReordered(player: EntityPlayer) {
29
33
  if (!hasSubscriptions()) {
30
34
  return;
31
35
  }
@@ -1,3 +1,8 @@
1
+ // This handles logic for the following callbacks:
2
+ // - POST_PEFFECT_UPDATE_REORDERED
3
+ // - POST_PLAYER_RENDER_REORDERED
4
+ // - POST_PLAYER_UPDATE_REORDERED
5
+
1
6
  import { ModCallback } from "isaac-typescript-definitions";
2
7
  import { saveDataManager } from "../features/saveDataManager/exports";
3
8
  import { emptyArray } from "../functions/array";
@@ -7,10 +12,6 @@ import {
7
12
  postPEffectUpdateReorderedFire,
8
13
  postPEffectUpdateReorderedHasSubscriptions,
9
14
  } from "./subscriptions/postPEffectUpdateReordered";
10
- import {
11
- postPlayerInitReorderedFire,
12
- postPlayerInitReorderedHasSubscriptions,
13
- } from "./subscriptions/postPlayerInitReordered";
14
15
  import {
15
16
  postPlayerRenderReorderedFire,
16
17
  postPlayerRenderReorderedHasSubscriptions,
@@ -24,7 +25,6 @@ const v = {
24
25
  run: {
25
26
  postGameStartedFiredOnThisRun: false,
26
27
 
27
- postPlayerInitQueue: [] as PlayerIndex[],
28
28
  postPEffectUpdateQueue: [] as PlayerIndex[],
29
29
  postPlayerUpdateQueue: [] as PlayerIndex[],
30
30
  postPlayerRenderQueue: [] as PlayerIndex[],
@@ -36,16 +36,13 @@ export function postPlayerReorderedCallbacksInit(mod: Mod): void {
36
36
  saveDataManager("postPlayerReordered", v, hasSubscriptions);
37
37
 
38
38
  mod.AddCallback(ModCallback.POST_PEFFECT_UPDATE, postPEffectUpdate); // 4
39
- mod.AddCallback(ModCallback.POST_PLAYER_INIT, postPlayerInit); // 9
39
+ mod.AddCallback(ModCallback.POST_GAME_STARTED, postGameStarted); // 15
40
40
  mod.AddCallback(ModCallback.POST_PLAYER_UPDATE, postPlayerUpdate); // 31
41
41
  mod.AddCallback(ModCallback.POST_PLAYER_RENDER, postPlayerRender); // 32
42
-
43
- mod.AddCallback(ModCallback.POST_GAME_STARTED, postGameStarted); // 15
44
42
  }
45
43
 
46
44
  function hasSubscriptions() {
47
45
  return (
48
- postPlayerInitReorderedHasSubscriptions() ||
49
46
  postPEffectUpdateReorderedHasSubscriptions() ||
50
47
  postPlayerUpdateReorderedHasSubscriptions() ||
51
48
  postPlayerRenderReorderedHasSubscriptions()
@@ -61,27 +58,12 @@ function postPEffectUpdate(player: EntityPlayer) {
61
58
  if (v.run.postGameStartedFiredOnThisRun) {
62
59
  postPEffectUpdateReorderedFire(player);
63
60
  } else {
64
- // Defer callback execution until the PostGameStarted callback fires.
61
+ // Defer callback execution until the `POST_GAME_STARTED` callback fires.
65
62
  const playerIndex = getPlayerIndex(player);
66
63
  v.run.postPEffectUpdateQueue.push(playerIndex);
67
64
  }
68
65
  }
69
66
 
70
- // ModCallback.POST_PLAYER_INIT (9)
71
- function postPlayerInit(player: EntityPlayer) {
72
- if (!hasSubscriptions()) {
73
- return;
74
- }
75
-
76
- if (v.run.postGameStartedFiredOnThisRun) {
77
- postPlayerInitReorderedFire(player);
78
- } else {
79
- // Defer callback execution until the PostGameStarted callback fires.
80
- const playerIndex = getPlayerIndex(player);
81
- v.run.postPlayerInitQueue.push(playerIndex);
82
- }
83
- }
84
-
85
67
  // ModCallback.POST_PLAYER_UPDATE (31)
86
68
  function postPlayerUpdate(player: EntityPlayer) {
87
69
  if (!hasSubscriptions()) {
@@ -91,7 +73,7 @@ function postPlayerUpdate(player: EntityPlayer) {
91
73
  if (v.run.postGameStartedFiredOnThisRun) {
92
74
  postPlayerUpdateReorderedFire(player);
93
75
  } else {
94
- // Defer callback execution until the PostGameStarted callback fires.
76
+ // Defer callback execution until the `POST_GAME_STARTED` callback fires.
95
77
  const playerIndex = getPlayerIndex(player);
96
78
  v.run.postPlayerUpdateQueue.push(playerIndex);
97
79
  }
@@ -106,7 +88,7 @@ function postPlayerRender(player: EntityPlayer) {
106
88
  if (v.run.postGameStartedFiredOnThisRun) {
107
89
  postPlayerRenderReorderedFire(player);
108
90
  } else {
109
- // Defer callback execution until the PostGameStarted callback fires.
91
+ // Defer callback execution until the `POST_GAME_STARTED` callback fires.
110
92
  const playerIndex = getPlayerIndex(player);
111
93
  v.run.postPlayerRenderQueue.push(playerIndex);
112
94
  }
@@ -120,7 +102,7 @@ function postGameStarted() {
120
102
 
121
103
  v.run.postGameStartedFiredOnThisRun = true;
122
104
 
123
- dequeue(v.run.postPlayerInitQueue, postPlayerInitReorderedFire);
105
+ dequeue(v.run.postPEffectUpdateQueue, postPEffectUpdateReorderedFire);
124
106
  dequeue(v.run.postPlayerUpdateQueue, postPlayerUpdateReorderedFire);
125
107
  dequeue(v.run.postPlayerRenderQueue, postPlayerRenderReorderedFire);
126
108
  }
@@ -131,11 +113,9 @@ function dequeue(
131
113
  ) {
132
114
  for (const playerIndex of playerIndexes) {
133
115
  const player = getPlayerFromIndex(playerIndex);
134
- if (player === undefined) {
135
- continue;
116
+ if (player !== undefined) {
117
+ fireFunction(player);
136
118
  }
137
-
138
- fireFunction(player);
139
119
  }
140
120
 
141
121
  emptyArray(playerIndexes);
@@ -1,5 +1,8 @@
1
- // This provides the logic for the PostSlotInit and PostSlotUpdate callbacks. (The other slot
2
- // callbacks are handled in a different file.)
1
+ // This provides the logic for the following callbacks:
2
+ // - `POST_SLOT_INIT`
3
+ // - `POST_SLOT_UPDATE`
4
+
5
+ // (The other slot callbacks are handled in a different file.)
3
6
 
4
7
  import { ModCallback } from "isaac-typescript-definitions";
5
8
  import { ModUpgraded } from "../classes/ModUpgraded";
@@ -1,6 +1,6 @@
1
1
  // This provides the logic for the following callbacks:
2
- // - PostSlotRender
3
- // - PostSlotAnimationChanged
2
+ // - `POST_SLOT_RENDER`
3
+ // - `POST_SLOT_ANIMATION_CHANGED`
4
4
 
5
5
  import { ModCallback } from "isaac-typescript-definitions";
6
6
  import { DefaultMap } from "../classes/DefaultMap";
@@ -1,4 +1,4 @@
1
- // This provides the logic for:
1
+ // This provides the logic for the following callbacks:
2
2
  // - `POST_GAME_STARTED_REORDERED`
3
3
  // - `POST_NEW_LEVEL_REORDERED`
4
4
  // - `POST_NEW_ROOM_REORDERED`
@@ -61,7 +61,7 @@ function hasSubscriptions() {
61
61
  // CollectibleType.GLOWING_HOUR_GLASS (422)
62
62
  function useItemGlowingHourGlass(): boolean | undefined {
63
63
  // If Glowing Hour Glass is used on the first room of a floor, it will send the player to the
64
- // previous floor without triggering the PostNewLevel callback. Manually check for this.
64
+ // previous floor without triggering the `POST_NEW_LEVEL` callback. Manually check for this.
65
65
  usedGlowingHourGlass = true;
66
66
 
67
67
  return undefined;
@@ -88,7 +88,7 @@ function postNewLevelVanilla() {
88
88
  const gameFrameCount = game.GetFrameCount();
89
89
 
90
90
  if (gameFrameCount === 0 && !forceNewLevel) {
91
- // Wait for the PostGameStarted callback to fire.
91
+ // Wait for the `POST_GAME_STARTED` callback to fire.
92
92
  return;
93
93
  }
94
94
  forceNewLevel = false;
@@ -114,7 +114,8 @@ function postNewRoomVanilla() {
114
114
 
115
115
  if (currentStage !== stage || currentStageType !== stageType) {
116
116
  // The player has used the Glowing Hour Glass to take them to the previous floor (which does
117
- // not trigger the PostNewLevel callback). Emulate what happens in the PostNewLevel callback.
117
+ // not trigger the `POST_NEW_LEVEL` callback). Emulate what happens in the `POST_NEW_LEVEL`
118
+ // callback.
118
119
  recordCurrentStage();
119
120
  postNewLevelReorderedFire();
120
121
  postNewRoomReorderedFire();
@@ -149,9 +150,9 @@ function recordCurrentStage() {
149
150
  * callback.
150
151
  *
151
152
  * If some specific cases, mods can change the current level during run initialization on the 0th
152
- * frame. However, due to how the callback reordering works, the custom PostNewLevel callback will
153
- * never fire on the 0th frame. To get around this, call this function before changing levels to
154
- * temporarily force the callback to fire.
153
+ * frame. However, due to how the callback reordering works, the custom `POST_NEW_LEVEL` callback
154
+ * will never fire on the 0th frame. To get around this, call this function before changing levels
155
+ * to temporarily force the callback to fire.
155
156
  */
156
157
  export function forceNewLevelCallback(): void {
157
158
  forceNewLevel = true;
@@ -162,8 +163,8 @@ export function forceNewLevelCallback(): void {
162
163
  * callback.
163
164
  *
164
165
  * If some specific cases, mods can change the current room during run initialization on the 0th
165
- * frame. However, due to how the callback reordering works, the custom PostNewRoom callback will
166
- * never fire on the 0th frame. To get around this, call this function before changing rooms to
166
+ * frame. However, due to how the callback reordering works, the custom `POST_NEW_ROOM` callback
167
+ * will never fire on the 0th frame. To get around this, call this function before changing rooms to
167
168
  * temporarily force the callback to fire.
168
169
  */
169
170
  export function forceNewRoomCallback(): void {
@@ -1,5 +1,5 @@
1
1
  export type PostFirstFlipRegisterParameters = [
2
- callback: (player: EntityPlayer) => void,
2
+ callback: (newLazarus: EntityPlayer, oldLazarus: EntityPlayer) => void,
3
3
  ];
4
4
 
5
5
  const subscriptions: PostFirstFlipRegisterParameters[] = [];
@@ -17,8 +17,11 @@ export function postFirstFlipRegister(
17
17
  }
18
18
 
19
19
  /** @internal */
20
- export function postFirstFlipFire(player: EntityPlayer): void {
20
+ export function postFirstFlipFire(
21
+ newLazarus: EntityPlayer,
22
+ oldLazarus: EntityPlayer,
23
+ ): void {
21
24
  for (const [callback] of subscriptions) {
22
- callback(player);
25
+ callback(newLazarus, oldLazarus);
23
26
  }
24
27
  }
@@ -1,5 +1,5 @@
1
1
  export type PostFlipRegisterParameters = [
2
- callback: (player: EntityPlayer) => void,
2
+ callback: (newLazarus: EntityPlayer, oldLazarus: EntityPlayer) => void,
3
3
  ];
4
4
 
5
5
  const subscriptions: PostFlipRegisterParameters[] = [];
@@ -15,8 +15,11 @@ export function postFlipRegister(...args: PostFlipRegisterParameters): void {
15
15
  }
16
16
 
17
17
  /** @internal */
18
- export function postFlipFire(player: EntityPlayer): void {
18
+ export function postFlipFire(
19
+ newLazarus: EntityPlayer,
20
+ oldLazarus: EntityPlayer,
21
+ ): void {
19
22
  for (const [callback] of subscriptions) {
20
- callback(player);
23
+ callback(newLazarus, oldLazarus);
21
24
  }
22
25
  }
@@ -0,0 +1,41 @@
1
+ import { GridEntityType } from "isaac-typescript-definitions";
2
+
3
+ export type PostGridEntityCustomRenderRegisterParameters = [
4
+ callback: (
5
+ gridEntity: GridEntity,
6
+ gridEntityTypeCustom: GridEntityType,
7
+ ) => void,
8
+ gridEntityTypeCustom?: GridEntityType,
9
+ ];
10
+
11
+ const subscriptions: PostGridEntityCustomRenderRegisterParameters[] = [];
12
+
13
+ /** @internal */
14
+ export function postGridEntityCustomRenderHasSubscriptions(): boolean {
15
+ return subscriptions.length > 0;
16
+ }
17
+
18
+ /** @internal */
19
+ export function postGridEntityCustomRenderRegister(
20
+ ...args: PostGridEntityCustomRenderRegisterParameters
21
+ ): void {
22
+ subscriptions.push(args);
23
+ }
24
+
25
+ /** @internal */
26
+ export function postGridEntityCustomRenderFire(
27
+ gridEntity: GridEntity,
28
+ gridEntityTypeCustom: GridEntityType,
29
+ ): void {
30
+ for (const [callback, callbackGridEntityTypeCustom] of subscriptions) {
31
+ // Handle the optional 2nd callback argument.
32
+ if (
33
+ callbackGridEntityTypeCustom !== undefined &&
34
+ callbackGridEntityTypeCustom !== gridEntityTypeCustom
35
+ ) {
36
+ continue;
37
+ }
38
+
39
+ callback(gridEntity, gridEntityTypeCustom);
40
+ }
41
+ }