isaacscript-common 7.5.1 → 7.6.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 (32) hide show
  1. package/dist/features/customStage/customStageGridEntities.d.ts.map +1 -1
  2. package/dist/features/customStage/customStageGridEntities.lua +9 -5
  3. package/dist/features/customTrapdoor/exports.d.ts +28 -16
  4. package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
  5. package/dist/features/customTrapdoor/exports.lua +45 -61
  6. package/dist/features/customTrapdoor/init.d.ts.map +1 -1
  7. package/dist/features/customTrapdoor/init.lua +12 -10
  8. package/dist/features/customTrapdoor/spawn.d.ts +6 -0
  9. package/dist/features/customTrapdoor/spawn.d.ts.map +1 -0
  10. package/dist/features/customTrapdoor/spawn.lua +52 -0
  11. package/dist/features/customTrapdoor/v.d.ts +2 -2
  12. package/dist/features/customTrapdoor/v.d.ts.map +1 -1
  13. package/dist/index.d.ts +172 -11148
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.lua +4 -4
  16. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +2 -2
  17. package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
  18. package/dist/interfaces/private/CustomTrapdoorDestination.d.ts +14 -0
  19. package/dist/interfaces/private/CustomTrapdoorDestination.d.ts.map +1 -0
  20. package/dist/{types/TrapdoorDestination.lua → interfaces/private/CustomTrapdoorDestination.lua} +0 -0
  21. package/package.json +1 -1
  22. package/src/features/customStage/customStageGridEntities.ts +20 -16
  23. package/src/features/customTrapdoor/exports.ts +60 -66
  24. package/src/features/customTrapdoor/init.ts +12 -11
  25. package/src/features/customTrapdoor/spawn.ts +54 -0
  26. package/src/features/customTrapdoor/v.ts +2 -2
  27. package/src/index.ts +2 -3
  28. package/src/interfaces/private/CustomTrapdoorDescription.ts +2 -2
  29. package/src/interfaces/private/CustomTrapdoorDestination.ts +14 -0
  30. package/dist/types/TrapdoorDestination.d.ts +0 -6
  31. package/dist/types/TrapdoorDestination.d.ts.map +0 -1
  32. package/src/types/TrapdoorDestination.ts +0 -8
@@ -1 +1 @@
1
- {"version":3,"file":"customStageGridEntities.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/customStageGridEntities.ts"],"names":[],"mappings":";AAiBA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAOnE,0CAA0C;AAC1C,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAuBN;AAED,oCAAoC;AACpC,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAyBN;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN;AAED,mCAAmC;AACnC,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAuBN;AAuDD,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN"}
1
+ {"version":3,"file":"customStageGridEntities.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/customStageGridEntities.ts"],"names":[],"mappings":";AAiBA,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AASnE,0CAA0C;AAC1C,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAuBN;AAED,oCAAoC;AACpC,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAyBN;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN;AAED,mCAAmC;AACnC,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAuBN;AAuDD,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAwBN;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN"}
@@ -25,6 +25,7 @@ local ____customGridEntity = require("features.customGridEntity")
25
25
  local isCustomGridEntity = ____customGridEntity.isCustomGridEntity
26
26
  local ____exports = require("features.customTrapdoor.exports")
27
27
  local spawnCustomTrapdoor = ____exports.spawnCustomTrapdoor
28
+ local spawnCustomTrapdoorToVanilla = ____exports.spawnCustomTrapdoorToVanilla
28
29
  local ____exports = require("features.customStage.exports")
29
30
  local DEFAULT_BASE_STAGE = ____exports.DEFAULT_BASE_STAGE
30
31
  local ____v = require("features.customStage.v")
@@ -238,11 +239,14 @@ function ____exports.convertVanillaTrapdoors(self, customStage, gridEntity)
238
239
  return
239
240
  end
240
241
  removeGridEntity(nil, gridEntity, true)
241
- local baseStage = customStage.baseStage == nil and DEFAULT_BASE_STAGE or customStage.baseStage
242
- local vanillaNextStage = baseStage + 2
243
- local vanillaNextStageType = calculateStageType(nil, vanillaNextStage)
244
- local destination = v.run.firstFloor and ({customStage.name, 2}) or ({vanillaNextStage, vanillaNextStageType})
245
- spawnCustomTrapdoor(nil, gridEntity.Position, destination)
242
+ if v.run.firstFloor then
243
+ spawnCustomTrapdoor(nil, gridEntity.Position, customStage.name, 2)
244
+ else
245
+ local baseStage = customStage.baseStage == nil and DEFAULT_BASE_STAGE or customStage.baseStage
246
+ local stage = baseStage + 2
247
+ local stageType = calculateStageType(nil, stage)
248
+ spawnCustomTrapdoorToVanilla(nil, gridEntity.Position, stage, stageType)
249
+ end
246
250
  end
247
251
  --- The rewards are based on the ones from the wiki:
248
252
  -- https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Urns
@@ -1,33 +1,45 @@
1
- /// <reference types="isaac-typescript-definitions" />
2
- /// <reference types="isaac-typescript-definitions" />
3
- /// <reference types="isaac-typescript-definitions" />
4
- import { TrapdoorDestination } from "../../types/TrapdoorDestination";
1
+ import { LevelStage, StageType } from "isaac-typescript-definitions";
5
2
  /**
6
- * Helper function to spawn a trapdoor grid entity that will have one or more of the following
7
- * attributes:
3
+ * Helper function to spawn a trapdoor grid entity that will take a player to a custom stage. If you
4
+ * want to create a custom trapdoor that goes to a vanilla stage instead, use the
5
+ * `spawnCustomTrapdoorToVanilla` helper function.
6
+ *
7
+ * Custom trapdoors can have one or more of the following attributes:
8
8
  *
9
9
  * - custom destination (or custom logic for after the player enters)
10
10
  * - custom graphics
11
11
  * - custom logic for opening/closing
12
12
  *
13
- * You can use this function to take the player to your custom stage.
14
- *
15
13
  * Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
16
14
  * respawned every time the player re-enters the room.
17
15
  *
18
16
  * @param gridIndexOrPosition The location in the room to spawn the trapdoor.
19
- * @param destination Optional. Used to specify where the player will go after jumping into the
20
- * trapdoor. Can either be a vanilla stage tuple, a custom stage tuple, or
21
- * undefined. For example, a destination of `[LevelStage.CAVES_1,
22
- * StageType.ORIGINAL]` corresponds to Caves 1, and a destination of
23
- * `["Slaughterhouse", 1]` corresponds to a custom stage of Slaughterhouse 1. If
24
- * the destination is undefined, then the "normal" destination corresponding to
25
- * the current stage and room will be used (e.g. the next floor, in most cases).
17
+ * @param customStageName The name of the custom stage.
18
+ * @param customStageFloorNum The floor of the custom stage. For most purposes, you should use 1 or
19
+ * 2.
20
+ * @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
21
+ * of "gfx/grid/door_11_trapdoor.anm2" will be used. The specified anm2 file must
22
+ * have animations called "Opened", "Closed", and "Open Animation".
23
+ * @param spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. By default,
24
+ * behavior will be used that emulates a vanilla trapdoor.
25
+ */
26
+ export declare function spawnCustomTrapdoor(gridIndexOrPosition: int | Vector, customStageName: string, customStageFloorNum: int, anm2Path?: string, spawnOpen?: boolean): GridEntity;
27
+ /**
28
+ * This is the same thing as the `spawnCustomTrapdoor` function, but instead of having a destination
29
+ * of a custom stage, it has a destination of a vanilla stage.
30
+ *
31
+ * For more information, see the `spawnCustomTrapdoor` function.
32
+ *
33
+ * @param gridIndexOrPosition The location in the room to spawn the trapdoor.
34
+ * @param stage Optional. The number of the vanilla stage to go to. If not provided, the "normal"
35
+ * next stage will be selected.
36
+ * @param stageType The stage type of the vanilla stage to go to. If not provided, the "normal" next
37
+ * stage type will be selected.
26
38
  * @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
27
39
  * of "gfx/grid/door_11_trapdoor.anm2" will be used. The specified anm2 file must
28
40
  * have animations called "Opened", "Closed", and "Open Animation".
29
41
  * @param spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. By default,
30
42
  * behavior will be used that emulates a vanilla trapdoor.
31
43
  */
32
- export declare function spawnCustomTrapdoor(gridIndexOrPosition: int | Vector, destination?: TrapdoorDestination, anm2Path?: string, spawnOpen?: boolean): GridEntity;
44
+ export declare function spawnCustomTrapdoorToVanilla(gridIndexOrPosition: int | Vector, stage?: LevelStage, stageType?: StageType, anm2Path?: string, spawnOpen?: boolean): GridEntity;
33
45
  //# sourceMappingURL=exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/exports.ts"],"names":[],"mappings":";;;AAYA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAStE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mBAAmB,CACjC,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,WAAW,CAAC,EAAE,mBAAmB,EACjC,QAAQ,SAAmC,EAC3C,SAAS,CAAC,EAAE,OAAO,GAClB,UAAU,CAwCZ"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAOrE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,mBAAmB,CACjC,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,eAAe,EAAE,MAAM,EACvB,mBAAmB,EAAE,GAAG,EACxB,QAAQ,SAAmC,EAC3C,SAAS,CAAC,EAAE,OAAO,GAClB,UAAU,CAcZ;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC1C,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,KAAK,CAAC,EAAE,UAAU,EAClB,SAAS,CAAC,EAAE,SAAS,EACrB,QAAQ,SAAmC,EAC3C,SAAS,CAAC,EAAE,OAAO,GAClB,UAAU,CAkBZ"}
@@ -1,94 +1,78 @@
1
- local ____lualib = require("lualib_bundle")
2
- local Map = ____lualib.Map
3
1
  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("core.cachedClasses")
8
- local game = ____cachedClasses.game
9
- local ____TrapdoorAnimation = require("enums.private.TrapdoorAnimation")
10
- local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
11
2
  local ____featuresInitialized = require("featuresInitialized")
12
3
  local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
13
4
  local ____nextStage = require("functions.nextStage")
14
5
  local getNextStage = ____nextStage.getNextStage
15
6
  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
7
  local ____customTrapdoorConstants = require("features.customTrapdoor.customTrapdoorConstants")
23
8
  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:
9
+ local ____spawn = require("features.customTrapdoor.spawn")
10
+ local spawnCustomTrapdoorToDestination = ____spawn.spawnCustomTrapdoorToDestination
11
+ --- Helper function to spawn a trapdoor grid entity that will take a player to a custom stage. If you
12
+ -- want to create a custom trapdoor that goes to a vanilla stage instead, use the
13
+ -- `spawnCustomTrapdoorToVanilla` helper function.
14
+ --
15
+ -- Custom trapdoors can have one or more of the following attributes:
36
16
  --
37
17
  -- - custom destination (or custom logic for after the player enters)
38
18
  -- - custom graphics
39
19
  -- - custom logic for opening/closing
40
20
  --
41
- -- You can use this function to take the player to your custom stage.
42
- --
43
21
  -- Under the hood, the custom trapdoor is represented by a decoration grid entity and is manually
44
22
  -- respawned every time the player re-enters the room.
45
23
  --
46
24
  -- @param gridIndexOrPosition The location in the room to spawn the trapdoor.
47
- -- @param destination Optional. Used to specify where the player will go after jumping into the
48
- -- trapdoor. Can either be a vanilla stage tuple, a custom stage tuple, or
49
- -- undefined. For example, a destination of `[LevelStage.CAVES_1,
50
- -- StageType.ORIGINAL]` corresponds to Caves 1, and a destination of
51
- -- `["Slaughterhouse", 1]` corresponds to a custom stage of Slaughterhouse 1. If
52
- -- the destination is undefined, then the "normal" destination corresponding to
53
- -- the current stage and room will be used (e.g. the next floor, in most cases).
25
+ -- @param customStageName The name of the custom stage.
26
+ -- @param customStageFloorNum The floor of the custom stage. For most purposes, you should use 1 or
27
+ -- 2.
54
28
  -- @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
55
29
  -- of "gfx/grid/door_11_trapdoor.anm2" will be used. The specified anm2 file must
56
30
  -- have animations called "Opened", "Closed", and "Open Animation".
57
31
  -- @param spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. By default,
58
32
  -- behavior will be used that emulates a vanilla trapdoor.
59
- function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition, destination, anm2Path, spawnOpen)
33
+ function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition, customStageName, customStageFloorNum, anm2Path, spawnOpen)
60
34
  if anm2Path == nil then
61
35
  anm2Path = "gfx/grid/door_11_trapdoor.anm2"
62
36
  end
63
37
  errorIfFeaturesNotInitialized(nil, CUSTOM_TRAPDOOR_FEATURE_NAME)
64
- local room = game:GetRoom()
65
- local roomFrameCount = room:GetFrameCount()
66
- local roomListIndex = getRoomListIndex(nil)
67
- local gridIndex = isVector(nil, gridIndexOrPosition) and room:GetGridIndex(gridIndexOrPosition) or gridIndexOrPosition
68
- local gridEntity = spawnCustomGridEntity(
38
+ local destination = {customStageName = customStageName, customStageFloorNum = customStageFloorNum}
39
+ return spawnCustomTrapdoorToDestination(
69
40
  nil,
70
- GridEntityTypeCustom.TRAPDOOR_CUSTOM,
71
41
  gridIndexOrPosition,
72
- GridCollisionClass.NONE,
42
+ destination,
73
43
  anm2Path,
74
- TrapdoorAnimation.OPENED
44
+ spawnOpen
75
45
  )
76
- local firstSpawn = roomFrameCount ~= 0
77
- local ____temp_0
78
- if spawnOpen == nil then
79
- ____temp_0 = shouldTrapdoorSpawnOpen(nil, gridEntity, firstSpawn)
80
- else
81
- ____temp_0 = spawnOpen
82
- end
83
- local open = ____temp_0
84
- local destinationToUse = destination == nil and getDefaultDestination(nil) or destination
85
- local roomTrapdoorMap = v.level.trapdoors:getAndSetDefault(roomListIndex)
86
- local customTrapdoorDescription = {open = open, destination = destinationToUse, firstSpawn = firstSpawn}
87
- roomTrapdoorMap:set(gridIndex, customTrapdoorDescription)
88
- if not open then
89
- local sprite = gridEntity:GetSprite()
90
- sprite:Play(TrapdoorAnimation.CLOSED, true)
46
+ end
47
+ --- This is the same thing as the `spawnCustomTrapdoor` function, but instead of having a destination
48
+ -- of a custom stage, it has a destination of a vanilla stage.
49
+ --
50
+ -- For more information, see the `spawnCustomTrapdoor` function.
51
+ --
52
+ -- @param gridIndexOrPosition The location in the room to spawn the trapdoor.
53
+ -- @param stage Optional. The number of the vanilla stage to go to. If not provided, the "normal"
54
+ -- next stage will be selected.
55
+ -- @param stageType The stage type of the vanilla stage to go to. If not provided, the "normal" next
56
+ -- stage type will be selected.
57
+ -- @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
58
+ -- of "gfx/grid/door_11_trapdoor.anm2" will be used. The specified anm2 file must
59
+ -- have animations called "Opened", "Closed", and "Open Animation".
60
+ -- @param spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. By default,
61
+ -- behavior will be used that emulates a vanilla trapdoor.
62
+ function ____exports.spawnCustomTrapdoorToVanilla(self, gridIndexOrPosition, stage, stageType, anm2Path, spawnOpen)
63
+ if anm2Path == nil then
64
+ anm2Path = "gfx/grid/door_11_trapdoor.anm2"
91
65
  end
92
- return gridEntity
66
+ errorIfFeaturesNotInitialized(nil, CUSTOM_TRAPDOOR_FEATURE_NAME)
67
+ local vanillaStage = stage == nil and getNextStage(nil) or stage
68
+ local vanillaStageType = stageType == nil and getNextStageType(nil) or stageType
69
+ local destination = {vanillaStage = vanillaStage, vanillaStageType = vanillaStageType}
70
+ return spawnCustomTrapdoorToDestination(
71
+ nil,
72
+ gridIndexOrPosition,
73
+ destination,
74
+ anm2Path,
75
+ spawnOpen
76
+ )
93
77
  end
94
78
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/init.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AA0BxD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAUzD"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/init.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAyBxD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAUzD"}
@@ -2,7 +2,7 @@ local ____lualib = require("lualib_bundle")
2
2
  local __TS__ArraySome = ____lualib.__TS__ArraySome
3
3
  local Map = ____lualib.Map
4
4
  local ____exports = {}
5
- local postRender, checkAllPlayersJumpComplete, checkPixelationToBlackComplete, checkSecondPixelationHalfWay, checkAllPlayersLayingDownComplete, goToCustomDestination, anyPlayerPlayingExtraAnimation, postPEffectUpdate, checkJumpComplete, postGridEntityCustomUpdateTrapdoor
5
+ local postRender, checkAllPlayersJumpComplete, checkPixelationToBlackComplete, checkSecondPixelationHalfWay, checkAllPlayersLayingDownComplete, goToCustomTrapdoorDestination, anyPlayerPlayingExtraAnimation, postPEffectUpdate, checkJumpComplete, postGridEntityCustomUpdateTrapdoor
6
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
7
  local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
8
8
  local EntityCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityCollisionClass
@@ -26,8 +26,6 @@ local ____roomTransition = require("functions.roomTransition")
26
26
  local teleport = ____roomTransition.teleport
27
27
  local ____stage = require("functions.stage")
28
28
  local setStage = ____stage.setStage
29
- local ____types = require("functions.types")
30
- local isString = ____types.isString
31
29
  local ____exports = require("features.customStage.exports")
32
30
  local disableCustomStage = ____exports.disableCustomStage
33
31
  local setCustomStage = ____exports.setCustomStage
@@ -93,7 +91,7 @@ function checkPixelationToBlackComplete(self)
93
91
  local futureRenderFrameCount = Isaac.GetFrameCount()
94
92
  v.run.state = StageTravelState.WAITING_FOR_SECOND_PIXELATION_TO_GET_HALF_WAY
95
93
  v.run.stateRenderFrame = futureRenderFrameCount
96
- goToCustomDestination(nil)
94
+ goToCustomTrapdoorDestination(nil)
97
95
  teleport(
98
96
  nil,
99
97
  startingRoomIndex,
@@ -145,17 +143,21 @@ function checkAllPlayersLayingDownComplete(self)
145
143
  v.run.state = StageTravelState.NONE
146
144
  enableAllInputs(nil, CUSTOM_TRAPDOOR_FEATURE_NAME)
147
145
  end
148
- function goToCustomDestination(self)
146
+ function goToCustomTrapdoorDestination(self)
149
147
  if v.run.destination == nil then
150
148
  return
151
149
  end
152
- local arg1, arg2 = table.unpack(v.run.destination)
153
- if isString(nil, arg1) then
154
- local firstFloor = arg2 == 1
150
+ local ____v_run_destination_0 = v.run.destination
151
+ local customStageName = ____v_run_destination_0.customStageName
152
+ local customStageFloorNum = ____v_run_destination_0.customStageFloorNum
153
+ local vanillaStage = ____v_run_destination_0.vanillaStage
154
+ local vanillaStageType = ____v_run_destination_0.vanillaStageType
155
+ if customStageName ~= nil and customStageFloorNum ~= nil then
156
+ local firstFloor = customStageFloorNum == 1
155
157
  setCustomStage(nil, "Slaughterhouse", firstFloor)
156
- else
158
+ elseif vanillaStage ~= nil and vanillaStageType ~= nil then
157
159
  disableCustomStage(nil)
158
- setStage(nil, arg1, arg2)
160
+ setStage(nil, vanillaStage, vanillaStageType)
159
161
  end
160
162
  end
161
163
  function anyPlayerPlayingExtraAnimation(self)
@@ -0,0 +1,6 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /// <reference types="isaac-typescript-definitions" />
3
+ /// <reference types="isaac-typescript-definitions" />
4
+ import { CustomTrapdoorDestination } from "../../interfaces/private/CustomTrapdoorDestination";
5
+ export declare function spawnCustomTrapdoorToDestination(gridIndexOrPosition: int | Vector, destination: CustomTrapdoorDestination, anm2Path: string, spawnOpen?: boolean): GridEntity;
6
+ //# sourceMappingURL=spawn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/spawn.ts"],"names":[],"mappings":";;;AAMA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAM/F,wBAAgB,gCAAgC,CAC9C,mBAAmB,EAAE,GAAG,GAAG,MAAM,EACjC,WAAW,EAAE,yBAAyB,EACtC,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,OAAO,GAClB,UAAU,CAoCZ"}
@@ -0,0 +1,52 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Map = ____lualib.Map
3
+ local ____exports = {}
4
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
5
+ local GridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.GridCollisionClass
6
+ local ____cachedClasses = require("core.cachedClasses")
7
+ local game = ____cachedClasses.game
8
+ local ____TrapdoorAnimation = require("enums.private.TrapdoorAnimation")
9
+ local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
10
+ local ____roomData = require("functions.roomData")
11
+ local getRoomListIndex = ____roomData.getRoomListIndex
12
+ local ____vector = require("functions.vector")
13
+ local isVector = ____vector.isVector
14
+ local ____customGridEntity = require("features.customGridEntity")
15
+ local spawnCustomGridEntity = ____customGridEntity.spawnCustomGridEntity
16
+ local ____customTrapdoorConstants = require("features.customTrapdoor.customTrapdoorConstants")
17
+ local GridEntityTypeCustom = ____customTrapdoorConstants.GridEntityTypeCustom
18
+ local ____openClose = require("features.customTrapdoor.openClose")
19
+ local shouldTrapdoorSpawnOpen = ____openClose.shouldTrapdoorSpawnOpen
20
+ local ____v = require("features.customTrapdoor.v")
21
+ local v = ____v.default
22
+ function ____exports.spawnCustomTrapdoorToDestination(self, gridIndexOrPosition, destination, anm2Path, spawnOpen)
23
+ local room = game:GetRoom()
24
+ local roomFrameCount = room:GetFrameCount()
25
+ local roomListIndex = getRoomListIndex(nil)
26
+ local gridIndex = isVector(nil, gridIndexOrPosition) and room:GetGridIndex(gridIndexOrPosition) or gridIndexOrPosition
27
+ local gridEntity = spawnCustomGridEntity(
28
+ nil,
29
+ GridEntityTypeCustom.TRAPDOOR_CUSTOM,
30
+ gridIndexOrPosition,
31
+ GridCollisionClass.NONE,
32
+ anm2Path,
33
+ TrapdoorAnimation.OPENED
34
+ )
35
+ local firstSpawn = roomFrameCount ~= 0
36
+ local ____temp_0
37
+ if spawnOpen == nil then
38
+ ____temp_0 = shouldTrapdoorSpawnOpen(nil, gridEntity, firstSpawn)
39
+ else
40
+ ____temp_0 = spawnOpen
41
+ end
42
+ local open = ____temp_0
43
+ local roomTrapdoorMap = v.level.trapdoors:getAndSetDefault(roomListIndex)
44
+ local customTrapdoorDescription = {open = open, destination = destination, firstSpawn = firstSpawn}
45
+ roomTrapdoorMap:set(gridIndex, customTrapdoorDescription)
46
+ if not open then
47
+ local sprite = gridEntity:GetSprite()
48
+ sprite:Play(TrapdoorAnimation.CLOSED, true)
49
+ end
50
+ return gridEntity
51
+ end
52
+ return ____exports
@@ -1,13 +1,13 @@
1
1
  import { DefaultMap } from "../../classes/DefaultMap";
2
2
  import { StageTravelState } from "../../enums/private/StageTravelState";
3
3
  import { CustomTrapdoorDescription } from "../../interfaces/private/CustomTrapdoorDescription";
4
- import { TrapdoorDestination } from "../../types/TrapdoorDestination";
4
+ import { CustomTrapdoorDestination } from "../../interfaces/private/CustomTrapdoorDestination";
5
5
  declare const v: {
6
6
  run: {
7
7
  state: StageTravelState;
8
8
  /** The render frame that this state was reached. */
9
9
  stateRenderFrame: number | null;
10
- destination: TrapdoorDestination | null;
10
+ destination: CustomTrapdoorDestination | null;
11
11
  };
12
12
  level: {
13
13
  /** Indexed by room list index and grid index. */
@@ -1 +1 @@
1
- {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,QAAA,MAAM,CAAC;;;QAIH,oDAAoD;;;;;QAOpD,iDAAiD;;;CAKpD,CAAC;AACF,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"v.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/v.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAC;AAE/F,QAAA,MAAM,CAAC;;;QAIH,oDAAoD;;;;;QAOpD,iDAAiD;;;CAKpD,CAAC;AACF,eAAe,CAAC,CAAC"}