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
@@ -88,9 +88,9 @@ function renderSprite(self, customStage, sprite, position)
88
88
  local adjustment = 0
89
89
  local scale = VectorOne
90
90
  repeat
91
- local ____switch26 = animation
92
- local ____cond26 = ____switch26 == UIStreakAnimation.TEXT
93
- if ____cond26 then
91
+ local ____switch27 = animation
92
+ local ____cond27 = ____switch27 == UIStreakAnimation.TEXT
93
+ if ____cond27 then
94
94
  do
95
95
  if frame < TEXT_STAY_FRAME then
96
96
  adjustment = TEXT_IN_ADJUSTMENTS[frame + 1] or 0
@@ -103,16 +103,16 @@ function renderSprite(self, customStage, sprite, position)
103
103
  break
104
104
  end
105
105
  end
106
- ____cond26 = ____cond26 or ____switch26 == UIStreakAnimation.TEXT_IN
107
- if ____cond26 then
106
+ ____cond27 = ____cond27 or ____switch27 == UIStreakAnimation.TEXT_IN
107
+ if ____cond27 then
108
108
  do
109
109
  adjustment = TEXT_IN_ADJUSTMENTS[frame + 1] or 0
110
110
  scale = TEXT_IN_SCALES[frame + 1] or VectorOne
111
111
  break
112
112
  end
113
113
  end
114
- ____cond26 = ____cond26 or ____switch26 == UIStreakAnimation.TEXT_OUT
115
- if ____cond26 then
114
+ ____cond27 = ____cond27 or ____switch27 == UIStreakAnimation.TEXT_OUT
115
+ if ____cond27 then
116
116
  do
117
117
  adjustment = TEXT_OUT_ADJUSTMENTS[frame + 1] or 0
118
118
  scale = TEXT_OUT_SCALES[frame + 1] or VectorOne
@@ -127,7 +127,6 @@ function renderSprite(self, customStage, sprite, position)
127
127
  until true
128
128
  local adjustedX = centeredX + adjustment
129
129
  local adjustedY = position.Y + STREAK_TEXT_BOTTOM_Y_OFFSET
130
- sprite:RenderLayer(0, position)
131
130
  font:DrawStringScaled(
132
131
  name,
133
132
  adjustedX,
@@ -203,11 +202,16 @@ TEXT_OUT_SCALES = {
203
202
  Vector(3, 0.2)
204
203
  }
205
204
  topStreakSprite = Sprite()
206
- topStreakSprite:Load("resources/gfx/ui/ui_streak.anm2", false)
207
- topStreakSprite.PlaybackSpeed = TEXT_PLAYBACK_SPEED
208
205
  bottomStreakSprite = Sprite()
209
- bottomStreakSprite:Load("resources/gfx/ui/ui_streak.anm2", false)
210
- bottomStreakSprite.PlaybackSpeed = TEXT_PLAYBACK_SPEED
206
+ --- We must load the sprites in an init function to prevent issues with mods that replace the vanilla
207
+ -- files. (For some reason, loading the sprites will cause the overwrite to no longer apply on the
208
+ -- second and subsequent runs.)
209
+ function ____exports.streakTextInit(self)
210
+ topStreakSprite:Load("resources/gfx/ui/ui_streak.anm2", false)
211
+ topStreakSprite.PlaybackSpeed = TEXT_PLAYBACK_SPEED
212
+ bottomStreakSprite:Load("resources/gfx/ui/ui_streak.anm2", false)
213
+ bottomStreakSprite.PlaybackSpeed = TEXT_PLAYBACK_SPEED
214
+ end
211
215
  function ____exports.streakTextPostRender(self)
212
216
  checkEndTopStreakText(nil)
213
217
  trackMapInputPressed(nil)
@@ -1,4 +1,10 @@
1
1
  import { CustomStage } from "../../interfaces/CustomStage";
2
+ /**
3
+ * We must load the sprites in an init function to prevent issues with mods that replace the vanilla
4
+ * files. (For some reason, loading the sprites will cause the overwrite to no longer apply on the
5
+ * second and subsequent runs.)
6
+ */
7
+ export declare function versusScreenInit(): void;
2
8
  export declare function playVersusScreenAnimation(customStage: CustomStage): void;
3
9
  export declare function versusScreenPostRender(): void;
4
10
  //# sourceMappingURL=versusScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAiF3D,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAuDxE;AA+ED,wBAAgB,sBAAsB,IAAI,IAAI,CAoC7C"}
1
+ {"version":3,"file":"versusScreen.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/versusScreen.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAqE3D;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAavC;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAuDxE;AA+ED,wBAAgB,sBAAsB,IAAI,IAAI,CAoC7C"}
@@ -107,17 +107,22 @@ PNG_PATH_PREFIX = "gfx/ui/boss"
107
107
  PLAYER_PORTRAIT_PNG_PATH_PREFIX = "gfx/ui/stage"
108
108
  local VANILLA_VERSUS_PLAYBACK_SPEED = 0.5
109
109
  local versusScreenSprite = Sprite()
110
- versusScreenSprite:Load("gfx/ui/boss/versusscreen.anm2", false)
111
- versusScreenSprite:ReplaceSpritesheet(OVERLAY_ANM2_LAYER, ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/overlay.png")
112
- versusScreenSprite:LoadGraphics()
113
110
  --- Unfortunately, we must split the background layer into an entirely different sprite so that we
114
111
  -- can color it with the `Color` property.
115
112
  local versusScreenBackgroundSprite = Sprite()
116
- versusScreenBackgroundSprite:Load("gfx/ui/boss/versusscreen.anm2", true)
117
113
  --- Unfortunately, we must split the dirt layer into an entirely different sprite so that we can
118
114
  -- color it with the `Color` property.
119
115
  local versusScreenDirtSpotSprite = Sprite()
120
- versusScreenDirtSpotSprite:Load("gfx/ui/boss/versusscreen.anm2", true)
116
+ --- We must load the sprites in an init function to prevent issues with mods that replace the vanilla
117
+ -- files. (For some reason, loading the sprites will cause the overwrite to no longer apply on the
118
+ -- second and subsequent runs.)
119
+ function ____exports.versusScreenInit(self)
120
+ versusScreenSprite:Load("gfx/ui/boss/versusscreen.anm2", false)
121
+ versusScreenSprite:ReplaceSpritesheet(OVERLAY_ANM2_LAYER, ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/overlay.png")
122
+ versusScreenSprite:LoadGraphics()
123
+ versusScreenBackgroundSprite:Load("gfx/ui/boss/versusscreen.anm2", true)
124
+ versusScreenDirtSpotSprite:Load("gfx/ui/boss/versusscreen.anm2", true)
125
+ end
121
126
  function ____exports.playVersusScreenAnimation(self, customStage)
122
127
  local room = game:GetRoom()
123
128
  local roomType = room:GetType()
@@ -0,0 +1,2 @@
1
+ export declare function drawBlackSprite(): void;
2
+ //# sourceMappingURL=blackSprite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blackSprite.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/blackSprite.ts"],"names":[],"mappings":"AASA,wBAAgB,eAAe,IAAI,IAAI,CAMtC"}
@@ -0,0 +1,19 @@
1
+ local ____exports = {}
2
+ local ____constants = require("constants")
3
+ local VectorZero = ____constants.VectorZero
4
+ local ____StageTravelState = require("enums.private.StageTravelState")
5
+ local StageTravelState = ____StageTravelState.StageTravelState
6
+ local ____customStageConstants = require("features.customStage.customStageConstants")
7
+ local ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH = ____customStageConstants.ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH
8
+ local ____v = require("features.customTrapdoor.v")
9
+ local v = ____v.default
10
+ local sprite = Sprite()
11
+ sprite:Load(ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/black.anm2", true)
12
+ sprite:SetFrame("Default", 0)
13
+ function ____exports.drawBlackSprite(self)
14
+ if v.run.state ~= StageTravelState.PAUSING_ON_BLACK then
15
+ return
16
+ end
17
+ sprite:RenderLayer(0, VectorZero)
18
+ end
19
+ return ____exports
@@ -0,0 +1,15 @@
1
+ import { GridEntityType } from "isaac-typescript-definitions";
2
+ export declare const CUSTOM_TRAPDOOR_FEATURE_NAME = "customTrapdoor";
3
+ export declare const GridEntityTypeCustom: {
4
+ readonly TRAPDOOR_CUSTOM: GridEntityType;
5
+ };
6
+ /** This also applies to crawl spaces. The value was determined through trial and error. */
7
+ export declare const TRAPDOOR_OPEN_DISTANCE = 60;
8
+ export declare const TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS: number;
9
+ export declare const TRAPDOOR_BOSS_REACTION_FRAMES = 30;
10
+ export declare const TRAPDOOR_TOUCH_DISTANCE = 16.5;
11
+ export declare const ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL: ReadonlySet<string>;
12
+ export declare const PIXELATION_TO_BLACK_FRAMES = 52;
13
+ export declare const OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6;
14
+ export declare const OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5;
15
+ //# sourceMappingURL=customTrapdoorConstants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customTrapdoorConstants.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/customTrapdoorConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAO,MAAM,4BAA4B,mBAAmB,CAAC;AAE7D,eAAO,MAAM,oBAAoB;;CAEvB,CAAC;AAEX,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,iCAAiC,QAA+B,CAAC;AAC9E,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,eAAO,MAAM,oCAAoC,EAAE,WAAW,CAAC,MAAM,CAClC,CAAC;AAEpC,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C,eAAO,MAAM,4CAA4C,IAAI,CAAC;AAC9D,eAAO,MAAM,+CAA+C,IAAI,CAAC"}
@@ -0,0 +1,16 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local ____exports = {}
5
+ ____exports.CUSTOM_TRAPDOOR_FEATURE_NAME = "customTrapdoor"
6
+ ____exports.GridEntityTypeCustom = {TRAPDOOR_CUSTOM = 1000}
7
+ --- This also applies to crawl spaces. The value was determined through trial and error.
8
+ ____exports.TRAPDOOR_OPEN_DISTANCE = 60
9
+ ____exports.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____exports.TRAPDOOR_OPEN_DISTANCE * 2.5
10
+ ____exports.TRAPDOOR_BOSS_REACTION_FRAMES = 30
11
+ ____exports.TRAPDOOR_TOUCH_DISTANCE = 16.5
12
+ ____exports.ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL = __TS__New(Set, {"Happy", "Sad", "Jump"})
13
+ ____exports.PIXELATION_TO_BLACK_FRAMES = 52
14
+ ____exports.OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6
15
+ ____exports.OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5
16
+ return ____exports
@@ -0,0 +1,29 @@
1
+ import { LevelStage, StageType } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to spawn a trapdoor grid entity that will have one or more of the following
4
+ * attributes:
5
+ *
6
+ * - custom destination (or custom logic for after the player enters)
7
+ * - custom graphics
8
+ * - custom logic for opening/closing
9
+ * - TODO: player jumping animation?
10
+ *
11
+ * You can use this function to take the player to your custom stage.
12
+ *
13
+ * Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
14
+ * respawned every time the player re-enters the room.
15
+ *
16
+ * @param gridIndexOrPosition The location in the room to spawn the trapdoor.
17
+ * @param destination Optional. Used to specify where the player will go after jumping into the
18
+ * trapdoor. Can either be a tuple containing the stage and stage type, or a
19
+ * string containing the name of a custom stage. If not specified at all, then
20
+ * the "normal" destination corresponding to the current stage and room will be
21
+ * used (e.g. the next floor).
22
+ * @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
23
+ * of "gfx/grid/door_11_trapdoor.anm2" will be used. The specified anm2 file must
24
+ * have animations called "Opened", "Closed", and "Open Animation".
25
+ * @param spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. By default,
26
+ * behavior will be used that emulates a vanilla trapdoor.
27
+ */
28
+ export declare function spawnCustomTrapdoor(gridIndexOrPosition: int | Vector, destination?: [stage: LevelStage, stageType: StageType] | string, anm2Path?: string, spawnOpen?: boolean): GridEntity;
29
+ //# sourceMappingURL=exports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAgBtC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CACjC,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,MAAM,EAChE,QAAQ,SAAmC,EAC3C,SAAS,CAAC,EAAE,OAAO,GAClB,UAAU,CAwCZ"}
@@ -0,0 +1,93 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Map = ____lualib.Map
3
+ local ____exports = {}
4
+ local getDefaultDestination
5
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
+ local GridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.GridCollisionClass
7
+ local ____cachedClasses = require("cachedClasses")
8
+ local game = ____cachedClasses.game
9
+ local ____TrapdoorAnimation = require("enums.private.TrapdoorAnimation")
10
+ local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
11
+ local ____featuresInitialized = require("featuresInitialized")
12
+ local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
13
+ local ____nextStage = require("functions.nextStage")
14
+ local getNextStage = ____nextStage.getNextStage
15
+ local getNextStageType = ____nextStage.getNextStageType
16
+ local ____roomData = require("functions.roomData")
17
+ local getRoomListIndex = ____roomData.getRoomListIndex
18
+ local ____vector = require("functions.vector")
19
+ local isVector = ____vector.isVector
20
+ local ____customGridEntity = require("features.customGridEntity")
21
+ local spawnCustomGridEntity = ____customGridEntity.spawnCustomGridEntity
22
+ local ____customTrapdoorConstants = require("features.customTrapdoor.customTrapdoorConstants")
23
+ local CUSTOM_TRAPDOOR_FEATURE_NAME = ____customTrapdoorConstants.CUSTOM_TRAPDOOR_FEATURE_NAME
24
+ local GridEntityTypeCustom = ____customTrapdoorConstants.GridEntityTypeCustom
25
+ local ____openClose = require("features.customTrapdoor.openClose")
26
+ local shouldTrapdoorSpawnOpen = ____openClose.shouldTrapdoorSpawnOpen
27
+ local ____v = require("features.customTrapdoor.v")
28
+ local v = ____v.default
29
+ function getDefaultDestination(self)
30
+ local nextStage = getNextStage(nil)
31
+ local nextStageType = getNextStageType(nil)
32
+ return {nextStage, nextStageType}
33
+ end
34
+ --- Helper function to spawn a trapdoor grid entity that will have one or more of the following
35
+ -- attributes:
36
+ --
37
+ -- - custom destination (or custom logic for after the player enters)
38
+ -- - custom graphics
39
+ -- - custom logic for opening/closing
40
+ -- - TODO: player jumping animation?
41
+ --
42
+ -- You can use this function to take the player to your custom stage.
43
+ --
44
+ -- Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
45
+ -- respawned every time the player re-enters the room.
46
+ --
47
+ -- @param gridIndexOrPosition The location in the room to spawn the trapdoor.
48
+ -- @param destination Optional. Used to specify where the player will go after jumping into the
49
+ -- trapdoor. Can either be a tuple containing the stage and stage type, or a
50
+ -- string containing the name of a custom stage. If not specified at all, then
51
+ -- the "normal" destination corresponding to the current stage and room will be
52
+ -- used (e.g. the next floor).
53
+ -- @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
54
+ -- of "gfx/grid/door_11_trapdoor.anm2" will be used. The specified anm2 file must
55
+ -- have animations called "Opened", "Closed", and "Open Animation".
56
+ -- @param spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. By default,
57
+ -- behavior will be used that emulates a vanilla trapdoor.
58
+ function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition, destination, anm2Path, spawnOpen)
59
+ if anm2Path == nil then
60
+ anm2Path = "gfx/grid/door_11_trapdoor.anm2"
61
+ end
62
+ errorIfFeaturesNotInitialized(nil, CUSTOM_TRAPDOOR_FEATURE_NAME)
63
+ local room = game:GetRoom()
64
+ local roomFrameCount = room:GetFrameCount()
65
+ local roomListIndex = getRoomListIndex(nil)
66
+ local gridIndex = isVector(nil, gridIndexOrPosition) and room:GetGridIndex(gridIndexOrPosition) or gridIndexOrPosition
67
+ local gridEntity = spawnCustomGridEntity(
68
+ nil,
69
+ GridEntityTypeCustom.TRAPDOOR_CUSTOM,
70
+ gridIndexOrPosition,
71
+ GridCollisionClass.NONE,
72
+ anm2Path,
73
+ TrapdoorAnimation.OPENED
74
+ )
75
+ local firstSpawn = roomFrameCount ~= 0
76
+ local ____temp_0
77
+ if spawnOpen == nil then
78
+ ____temp_0 = shouldTrapdoorSpawnOpen(nil, gridEntity, firstSpawn)
79
+ else
80
+ ____temp_0 = spawnOpen
81
+ end
82
+ local open = ____temp_0
83
+ local destinationToUse = destination == nil and getDefaultDestination(nil) or destination
84
+ local roomTrapdoorMap = v.level.trapdoors:getAndSetDefault(roomListIndex)
85
+ local customTrapdoorDescription = {open = open, destination = destinationToUse, firstSpawn = firstSpawn}
86
+ roomTrapdoorMap:set(gridIndex, customTrapdoorDescription)
87
+ if not open then
88
+ local sprite = gridEntity:GetSprite()
89
+ sprite:Play(TrapdoorAnimation.CLOSED, true)
90
+ end
91
+ return gridEntity
92
+ end
93
+ return ____exports
@@ -0,0 +1,3 @@
1
+ import { ModUpgraded } from "../../classes/ModUpgraded";
2
+ export declare function customTrapdoorInit(mod: ModUpgraded): void;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAwBxD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAUzD"}
@@ -0,0 +1,174 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
3
+ local Map = ____lualib.Map
4
+ local ____exports = {}
5
+ local postRender, checkAllPlayersJumpComplete, checkPixelationToBlackComplete, checkPausingOnBlackComplete, checkAllPlayersLayingDownComplete, goToCustomDestination, anyPlayerPlayingExtraAnimation, postPEffectUpdate, checkJumpComplete, postGridEntityCustomUpdateTrapdoor
6
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
+ local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
8
+ local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
9
+ local RoomTransitionAnim = ____isaac_2Dtypescript_2Ddefinitions.RoomTransitionAnim
10
+ local ____cachedClasses = require("cachedClasses")
11
+ local game = ____cachedClasses.game
12
+ local ____ModCallbackCustom = require("enums.ModCallbackCustom")
13
+ local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
14
+ local ____StageTravelState = require("enums.private.StageTravelState")
15
+ local StageTravelState = ____StageTravelState.StageTravelState
16
+ local ____playerCenter = require("functions.playerCenter")
17
+ local movePlayersToCenter = ____playerCenter.movePlayersToCenter
18
+ local ____playerIndex = require("functions.playerIndex")
19
+ local getAllPlayers = ____playerIndex.getAllPlayers
20
+ local ____roomData = require("functions.roomData")
21
+ local getRoomGridIndex = ____roomData.getRoomGridIndex
22
+ local getRoomListIndex = ____roomData.getRoomListIndex
23
+ local ____stage = require("functions.stage")
24
+ local setStage = ____stage.setStage
25
+ local ____types = require("functions.types")
26
+ local isString = ____types.isString
27
+ local ____exports = require("features.customStage.exports")
28
+ local setCustomStage = ____exports.setCustomStage
29
+ local ____streakText = require("features.customStage.streakText")
30
+ local topStreakTextStart = ____streakText.topStreakTextStart
31
+ local ____disableInputs = require("features.disableInputs")
32
+ local enableAllInputs = ____disableInputs.enableAllInputs
33
+ local ____runInNFrames = require("features.runInNFrames")
34
+ local runNextGameFrame = ____runInNFrames.runNextGameFrame
35
+ local ____runNextRoom = require("features.runNextRoom")
36
+ local runNextRoom = ____runNextRoom.runNextRoom
37
+ local ____exports = require("features.saveDataManager.exports")
38
+ local saveDataManager = ____exports.saveDataManager
39
+ local ____blackSprite = require("features.customTrapdoor.blackSprite")
40
+ local drawBlackSprite = ____blackSprite.drawBlackSprite
41
+ local ____customTrapdoorConstants = require("features.customTrapdoor.customTrapdoorConstants")
42
+ local CUSTOM_TRAPDOOR_FEATURE_NAME = ____customTrapdoorConstants.CUSTOM_TRAPDOOR_FEATURE_NAME
43
+ local GridEntityTypeCustom = ____customTrapdoorConstants.GridEntityTypeCustom
44
+ local PIXELATION_TO_BLACK_FRAMES = ____customTrapdoorConstants.PIXELATION_TO_BLACK_FRAMES
45
+ local ____openClose = require("features.customTrapdoor.openClose")
46
+ local checkCustomTrapdoorOpenClose = ____openClose.checkCustomTrapdoorOpenClose
47
+ local ____touched = require("features.customTrapdoor.touched")
48
+ local checkCustomTrapdoorPlayerTouched = ____touched.checkCustomTrapdoorPlayerTouched
49
+ local ____v = require("features.customTrapdoor.v")
50
+ local v = ____v.default
51
+ function postRender(self)
52
+ checkAllPlayersJumpComplete(nil)
53
+ checkPixelationToBlackComplete(nil)
54
+ checkPausingOnBlackComplete(nil)
55
+ checkAllPlayersLayingDownComplete(nil)
56
+ drawBlackSprite(nil)
57
+ end
58
+ function checkAllPlayersJumpComplete(self)
59
+ if v.run.state ~= StageTravelState.PLAYERS_JUMPING_DOWN then
60
+ return
61
+ end
62
+ if anyPlayerPlayingExtraAnimation(nil) then
63
+ return
64
+ end
65
+ local renderFrameCount = Isaac.GetFrameCount()
66
+ local roomGridIndex = getRoomGridIndex(nil)
67
+ v.run.state = StageTravelState.PIXELATION_TO_BLACK
68
+ v.run.stateRenderFrame = renderFrameCount
69
+ game:StartRoomTransition(roomGridIndex, Direction.NO_DIRECTION, RoomTransitionAnim.PIXELATION)
70
+ end
71
+ function checkPixelationToBlackComplete(self)
72
+ if v.run.state ~= StageTravelState.PIXELATION_TO_BLACK or v.run.stateRenderFrame == nil then
73
+ return
74
+ end
75
+ local hud = game:GetHUD()
76
+ local renderFrameCount = Isaac.GetFrameCount()
77
+ local roomGridIndex = getRoomGridIndex(nil)
78
+ local renderFrameScreenBlack = v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES
79
+ if renderFrameCount < renderFrameScreenBlack then
80
+ return
81
+ end
82
+ v.run.state = StageTravelState.PAUSING_ON_BLACK
83
+ v.run.stateRenderFrame = renderFrameCount
84
+ hud:SetVisible(false)
85
+ goToCustomDestination(nil)
86
+ game:StartRoomTransition(roomGridIndex, Direction.NO_DIRECTION, RoomTransitionAnim.PIXELATION)
87
+ end
88
+ function checkPausingOnBlackComplete(self)
89
+ if v.run.state ~= StageTravelState.PAUSING_ON_BLACK or v.run.stateRenderFrame == nil then
90
+ return
91
+ end
92
+ local hud = game:GetHUD()
93
+ local renderFrameCount = Isaac.GetFrameCount()
94
+ local renderFrameScreenBlack = v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES
95
+ if renderFrameCount < renderFrameScreenBlack then
96
+ return
97
+ end
98
+ v.run.state = StageTravelState.PIXELATION_TO_ROOM
99
+ hud:SetVisible(true)
100
+ runNextRoom(
101
+ nil,
102
+ function()
103
+ movePlayersToCenter(nil)
104
+ v.run.state = StageTravelState.PLAYERS_LAYING_DOWN
105
+ for ____, player in ipairs(getAllPlayers(nil)) do
106
+ player:AnimateAppear()
107
+ end
108
+ end
109
+ )
110
+ runNextGameFrame(
111
+ nil,
112
+ function()
113
+ topStreakTextStart(nil)
114
+ end
115
+ )
116
+ end
117
+ function checkAllPlayersLayingDownComplete(self)
118
+ if v.run.state ~= StageTravelState.PLAYERS_LAYING_DOWN then
119
+ return
120
+ end
121
+ if anyPlayerPlayingExtraAnimation(nil) then
122
+ return
123
+ end
124
+ v.run.state = StageTravelState.NONE
125
+ enableAllInputs(nil, CUSTOM_TRAPDOOR_FEATURE_NAME)
126
+ end
127
+ function goToCustomDestination(self)
128
+ if v.run.destination == nil then
129
+ return
130
+ end
131
+ if isString(nil, v.run.destination) then
132
+ setCustomStage(nil, "Slaughterhouse")
133
+ else
134
+ local stage, stageType = table.unpack(v.run.destination)
135
+ setStage(nil, stage, stageType)
136
+ end
137
+ end
138
+ function anyPlayerPlayingExtraAnimation(self)
139
+ local players = getAllPlayers(nil)
140
+ return __TS__ArraySome(
141
+ players,
142
+ function(____, player) return not player:IsExtraAnimationFinished() end
143
+ )
144
+ end
145
+ function postPEffectUpdate(self, player)
146
+ checkJumpComplete(nil, player)
147
+ end
148
+ function checkJumpComplete(self, player)
149
+ if v.run.state ~= StageTravelState.PLAYERS_JUMPING_DOWN then
150
+ return
151
+ end
152
+ local sprite = player:GetSprite()
153
+ if sprite:IsFinished("Trapdoor") then
154
+ player.Visible = false
155
+ end
156
+ end
157
+ function postGridEntityCustomUpdateTrapdoor(self, gridEntity)
158
+ local roomListIndex = getRoomListIndex(nil)
159
+ local gridIndex = gridEntity:GetGridIndex()
160
+ local roomTrapdoorMap = v.level.trapdoors:getAndSetDefault(roomListIndex)
161
+ local trapdoorDescription = roomTrapdoorMap:get(gridIndex)
162
+ if trapdoorDescription == nil then
163
+ return
164
+ end
165
+ checkCustomTrapdoorOpenClose(nil, gridEntity, trapdoorDescription)
166
+ checkCustomTrapdoorPlayerTouched(nil, gridEntity, trapdoorDescription)
167
+ end
168
+ function ____exports.customTrapdoorInit(self, mod)
169
+ saveDataManager(nil, CUSTOM_TRAPDOOR_FEATURE_NAME, v)
170
+ mod:AddCallback(ModCallback.POST_RENDER, postRender)
171
+ mod:AddCallback(ModCallback.POST_PEFFECT_UPDATE, postPEffectUpdate)
172
+ mod:AddCallbackCustom(ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_UPDATE, postGridEntityCustomUpdateTrapdoor, GridEntityTypeCustom.TRAPDOOR_CUSTOM)
173
+ end
174
+ return ____exports
@@ -0,0 +1,5 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ import { CustomTrapdoorDescription } from "../../interfaces/private/CustomTrapdoorDescription";
3
+ export declare function checkCustomTrapdoorOpenClose(gridEntity: GridEntity, trapdoorDescription: CustomTrapdoorDescription): void;
4
+ export declare function shouldTrapdoorSpawnOpen(gridEntity: GridEntity, firstSpawn: boolean): boolean;
5
+ //# sourceMappingURL=openClose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openClose.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/openClose.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAQ/F,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,yBAAyB,GAC7C,IAAI,CASN;AAoDD,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,OAAO,GAClB,OAAO,CAuBT"}
@@ -0,0 +1,60 @@
1
+ local ____exports = {}
2
+ local shouldTrapdoorOpen, isPlayerCloseAfterBoss, shouldBeClosedFromStartingInRoomWithEnemies, open
3
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
4
+ local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
5
+ local ____cachedClasses = require("cachedClasses")
6
+ local game = ____cachedClasses.game
7
+ local ____TrapdoorAnimation = require("enums.private.TrapdoorAnimation")
8
+ local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
9
+ local ____positionVelocity = require("functions.positionVelocity")
10
+ local anyPlayerCloserThan = ____positionVelocity.anyPlayerCloserThan
11
+ local ____roomClearFrame = require("features.roomClearFrame")
12
+ local getRoomClearGameFrame = ____roomClearFrame.getRoomClearGameFrame
13
+ local ____customTrapdoorConstants = require("features.customTrapdoor.customTrapdoorConstants")
14
+ local TRAPDOOR_BOSS_REACTION_FRAMES = ____customTrapdoorConstants.TRAPDOOR_BOSS_REACTION_FRAMES
15
+ local TRAPDOOR_OPEN_DISTANCE = ____customTrapdoorConstants.TRAPDOOR_OPEN_DISTANCE
16
+ local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____customTrapdoorConstants.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS
17
+ function shouldTrapdoorOpen(self, gridEntity, firstSpawn)
18
+ local room = game:GetRoom()
19
+ local roomClear = room:IsClear()
20
+ return not anyPlayerCloserThan(nil, gridEntity.Position, TRAPDOOR_OPEN_DISTANCE) and not isPlayerCloseAfterBoss(nil, gridEntity.Position) and not shouldBeClosedFromStartingInRoomWithEnemies(nil, firstSpawn, roomClear)
21
+ end
22
+ function isPlayerCloseAfterBoss(self, position)
23
+ local gameFrameCount = game:GetFrameCount()
24
+ local room = game:GetRoom()
25
+ local roomType = room:GetType()
26
+ local roomClearGameFrame = getRoomClearGameFrame(nil)
27
+ if roomType ~= RoomType.BOSS or roomClearGameFrame == nil or gameFrameCount >= roomClearGameFrame + TRAPDOOR_BOSS_REACTION_FRAMES then
28
+ return false
29
+ end
30
+ return anyPlayerCloserThan(nil, position, TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS)
31
+ end
32
+ function shouldBeClosedFromStartingInRoomWithEnemies(self, firstSpawn, roomClear)
33
+ return firstSpawn and not roomClear
34
+ end
35
+ function open(self, gridEntity, trapdoorDescription)
36
+ trapdoorDescription.open = true
37
+ local sprite = gridEntity:GetSprite()
38
+ sprite:Play(TrapdoorAnimation.OPEN_ANIMATION, true)
39
+ end
40
+ function ____exports.checkCustomTrapdoorOpenClose(self, gridEntity, trapdoorDescription)
41
+ if trapdoorDescription.open then
42
+ return
43
+ end
44
+ if shouldTrapdoorOpen(nil, gridEntity, trapdoorDescription.firstSpawn) then
45
+ open(nil, gridEntity, trapdoorDescription)
46
+ end
47
+ end
48
+ function ____exports.shouldTrapdoorSpawnOpen(self, gridEntity, firstSpawn)
49
+ local room = game:GetRoom()
50
+ local roomFrameCount = room:GetFrameCount()
51
+ local roomClear = room:IsClear()
52
+ if roomFrameCount > 0 then
53
+ return false
54
+ end
55
+ if not roomClear then
56
+ return false
57
+ end
58
+ return shouldTrapdoorOpen(nil, gridEntity, firstSpawn)
59
+ end
60
+ return ____exports
@@ -0,0 +1,4 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ import { CustomTrapdoorDescription } from "../../interfaces/private/CustomTrapdoorDescription";
3
+ export declare function checkCustomTrapdoorPlayerTouched(gridEntity: GridEntity, trapdoorDescription: CustomTrapdoorDescription): void;
4
+ //# sourceMappingURL=touched.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"touched.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/touched.ts"],"names":[],"mappings":";AAgBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAa/F,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,yBAAyB,GAC7C,IAAI,CA8BN"}