isaacscript-common 6.11.1 → 6.13.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.
- package/dist/callbacks/postFlip.lua +2 -2
- package/dist/callbacks/postGridEntityCustomRender.d.ts +2 -0
- package/dist/callbacks/postGridEntityCustomRender.d.ts.map +1 -0
- package/dist/callbacks/postGridEntityCustomRender.lua +36 -0
- package/dist/callbacks/postGridEntityCustomUpdate.d.ts +2 -0
- package/dist/callbacks/postGridEntityCustomUpdate.d.ts.map +1 -0
- package/dist/callbacks/postGridEntityCustomUpdate.lua +36 -0
- package/dist/callbacks/postNewRoomEarly.lua +2 -2
- package/dist/callbacks/postPickupInitFirst.lua +1 -20
- package/dist/callbacks/reorderedCallbacks.d.ts +5 -5
- package/dist/callbacks/reorderedCallbacks.d.ts.map +1 -1
- package/dist/callbacks/reorderedCallbacks.lua +5 -5
- package/dist/callbacks/subscriptions/postFirstFlip.d.ts +1 -1
- package/dist/callbacks/subscriptions/postFirstFlip.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postFirstFlip.lua +2 -2
- package/dist/callbacks/subscriptions/postFlip.d.ts +1 -1
- package/dist/callbacks/subscriptions/postFlip.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postFlip.lua +2 -2
- package/dist/callbacks/subscriptions/postGridEntityCustomRender.d.ts +6 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomRender.d.ts.map +1 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomRender.lua +29 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.d.ts +6 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.d.ts.map +1 -0
- package/dist/callbacks/subscriptions/postGridEntityCustomUpdate.lua +29 -0
- package/dist/constants.d.ts +1 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.lua +0 -7
- package/dist/constantsFirstLast.d.ts +5 -1
- package/dist/constantsFirstLast.d.ts.map +1 -1
- package/dist/constantsFirstLast.lua +6 -0
- package/dist/enums/ModCallbackCustom.d.ts +91 -68
- package/dist/enums/ModCallbackCustom.d.ts.map +1 -1
- package/dist/enums/ModCallbackCustom.lua +62 -58
- package/dist/enums/private/StageTravelState.d.ts +6 -1
- package/dist/enums/private/StageTravelState.d.ts.map +1 -1
- package/dist/enums/private/StageTravelState.lua +10 -0
- package/dist/enums/private/TrapdoorAnimation.d.ts +6 -0
- package/dist/enums/private/TrapdoorAnimation.d.ts.map +1 -0
- package/dist/enums/private/TrapdoorAnimation.lua +6 -0
- package/dist/features/collectibleItemPoolType.d.ts +2 -2
- package/dist/features/collectibleItemPoolType.lua +2 -2
- package/dist/features/customGridEntity.d.ts +17 -5
- package/dist/features/customGridEntity.d.ts.map +1 -1
- package/dist/features/customGridEntity.lua +78 -15
- package/dist/features/customStage/exports.d.ts.map +1 -1
- package/dist/features/customStage/exports.lua +0 -13
- package/dist/features/customStage/init.d.ts.map +1 -1
- package/dist/features/customStage/init.lua +16 -1
- package/dist/features/customStage/streakText.d.ts.map +1 -1
- package/dist/features/customStage/streakText.lua +0 -1
- package/dist/features/customTrapdoor/blackSprite.d.ts +2 -0
- package/dist/features/customTrapdoor/blackSprite.d.ts.map +1 -0
- package/dist/features/customTrapdoor/blackSprite.lua +19 -0
- package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts +8 -3
- package/dist/features/customTrapdoor/customTrapdoorConstants.d.ts.map +1 -1
- package/dist/features/customTrapdoor/customTrapdoorConstants.lua +9 -1
- package/dist/features/customTrapdoor/exports.d.ts +11 -19
- package/dist/features/customTrapdoor/exports.d.ts.map +1 -1
- package/dist/features/customTrapdoor/exports.lua +48 -82
- package/dist/features/customTrapdoor/init.d.ts +3 -0
- package/dist/features/customTrapdoor/init.d.ts.map +1 -0
- package/dist/features/customTrapdoor/init.lua +174 -0
- package/dist/features/customTrapdoor/openClose.d.ts +5 -0
- package/dist/features/customTrapdoor/openClose.d.ts.map +1 -0
- package/dist/features/customTrapdoor/openClose.lua +60 -0
- package/dist/features/customTrapdoor/touched.d.ts +4 -0
- package/dist/features/customTrapdoor/touched.d.ts.map +1 -0
- package/dist/features/customTrapdoor/touched.lua +159 -0
- package/dist/features/customTrapdoor/v.d.ts +16 -2
- package/dist/features/customTrapdoor/v.d.ts.map +1 -1
- package/dist/features/customTrapdoor/v.lua +8 -6
- package/dist/features/deployJSONRoom.d.ts +2 -2
- package/dist/features/deployJSONRoom.lua +2 -2
- package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/init.lua +14 -15
- package/dist/features/extraConsoleCommands/listCommands.d.ts +15 -19
- package/dist/features/extraConsoleCommands/listCommands.d.ts.map +1 -1
- package/dist/features/extraConsoleCommands/listCommands.lua +34 -42
- package/dist/features/pause.d.ts +1 -1
- package/dist/features/pause.d.ts.map +1 -1
- package/dist/features/pause.lua +87 -8
- package/dist/features/persistentEntities.d.ts.map +1 -1
- package/dist/features/persistentEntities.lua +7 -7
- package/dist/features/pickupIndex.d.ts +19 -0
- package/dist/features/pickupIndex.d.ts.map +1 -0
- package/dist/features/pickupIndex.lua +197 -0
- package/dist/features/roomHistory.d.ts +24 -0
- package/dist/features/roomHistory.d.ts.map +1 -0
- package/dist/features/roomHistory.lua +89 -0
- package/dist/features/taintedLazarusPlayers.d.ts.map +1 -1
- package/dist/features/taintedLazarusPlayers.lua +13 -21
- package/dist/functions/collectibles.d.ts +26 -13
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +26 -13
- package/dist/functions/entities.d.ts +3 -3
- package/dist/functions/entities.d.ts.map +1 -1
- package/dist/functions/entities.lua +8 -3
- package/dist/functions/gridEntities.d.ts +2 -2
- package/dist/functions/gridEntities.lua +2 -2
- package/dist/functions/isaacAPIClass.d.ts +64 -0
- package/dist/functions/isaacAPIClass.d.ts.map +1 -1
- package/dist/functions/isaacAPIClass.lua +84 -1
- package/dist/functions/log.lua +3 -3
- package/dist/functions/map.d.ts +2 -0
- package/dist/functions/map.d.ts.map +1 -1
- package/dist/functions/map.lua +7 -0
- package/dist/functions/pickupVariants.d.ts +2 -2
- package/dist/functions/pickupVariants.d.ts.map +1 -1
- package/dist/functions/pickupVariants.lua +2 -2
- package/dist/functions/playerCenter.lua +2 -2
- package/dist/functions/playerIndex.d.ts +5 -3
- package/dist/functions/playerIndex.d.ts.map +1 -1
- package/dist/functions/playerIndex.lua +15 -24
- package/dist/functions/roomData.d.ts +3 -2
- package/dist/functions/roomData.d.ts.map +1 -1
- package/dist/functions/roomData.lua +3 -2
- package/dist/functions/rooms.d.ts +6 -6
- package/dist/functions/rooms.lua +6 -6
- package/dist/functions/set.d.ts +2 -0
- package/dist/functions/set.d.ts.map +1 -1
- package/dist/functions/set.lua +6 -0
- package/dist/functions/stage.d.ts +1 -0
- package/dist/functions/stage.d.ts.map +1 -1
- package/dist/functions/stage.lua +4 -0
- package/dist/functions/table.d.ts +1 -1
- package/dist/functions/table.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.lua +23 -0
- package/dist/initCustomCallbacks.d.ts.map +1 -1
- package/dist/initCustomCallbacks.lua +6 -0
- package/dist/initFeatures.d.ts.map +1 -1
- package/dist/initFeatures.lua +9 -0
- package/dist/interfaces/AddCallbackParameterCustom.d.ts +4 -0
- package/dist/interfaces/AddCallbackParameterCustom.d.ts.map +1 -1
- package/dist/interfaces/CustomGridEntityData.d.ts +5 -1
- package/dist/interfaces/CustomGridEntityData.d.ts.map +1 -1
- package/dist/interfaces/RoomDescription.d.ts +14 -0
- package/dist/interfaces/RoomDescription.d.ts.map +1 -0
- package/dist/interfaces/RoomDescription.lua +2 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.d.ts +3 -0
- package/dist/interfaces/private/CustomTrapdoorDescription.d.ts.map +1 -1
- package/dist/objects/callbackRegisterFunctions.d.ts.map +1 -1
- package/dist/objects/callbackRegisterFunctions.lua +6 -0
- package/dist/types/CollectibleIndex.d.ts +1 -1
- package/dist/types/PickupIndex.d.ts +17 -0
- package/dist/types/PickupIndex.d.ts.map +1 -0
- package/dist/types/PickupIndex.lua +2 -0
- package/dist/types/PlayerIndex.d.ts +1 -1
- package/dist/upgradeMod.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/callbacks/postFlip.ts +3 -2
- package/src/callbacks/postGridEntityCustomRender.ts +44 -0
- package/src/callbacks/postGridEntityCustomUpdate.ts +44 -0
- package/src/callbacks/postNewRoomEarly.ts +2 -2
- package/src/callbacks/postPickupInitFirst.ts +3 -32
- package/src/callbacks/postPlayerReorderedCallbacks.ts +3 -3
- package/src/callbacks/reorderedCallbacks.ts +9 -8
- package/src/callbacks/subscriptions/postFirstFlip.ts +6 -3
- package/src/callbacks/subscriptions/postFlip.ts +6 -3
- package/src/callbacks/subscriptions/postGridEntityCustomRender.ts +41 -0
- package/src/callbacks/subscriptions/postGridEntityCustomUpdate.ts +41 -0
- package/src/constants.ts +1 -9
- package/src/constantsFirstLast.ts +16 -0
- package/src/enums/ModCallbackCustom.ts +35 -10
- package/src/enums/private/StageTravelState.ts +5 -1
- package/src/enums/private/TrapdoorAnimation.ts +5 -0
- package/src/features/collectibleItemPoolType.ts +3 -3
- package/src/features/customGridEntity.ts +93 -10
- package/src/features/customStage/exports.ts +3 -22
- package/src/features/customStage/init.ts +20 -0
- package/src/features/customStage/streakText.ts +0 -1
- package/src/features/customTrapdoor/blackSprite.ts +22 -0
- package/src/features/customTrapdoor/customTrapdoorConstants.ts +13 -3
- package/src/features/customTrapdoor/exports.ts +52 -121
- package/src/features/customTrapdoor/init.ts +217 -0
- package/src/features/customTrapdoor/openClose.ts +103 -0
- package/src/features/customTrapdoor/touched.ts +195 -0
- package/src/features/customTrapdoor/v.ts +16 -10
- package/src/features/deployJSONRoom.ts +5 -5
- package/src/features/extraConsoleCommands/init.ts +22 -16
- package/src/features/extraConsoleCommands/listCommands.ts +38 -43
- package/src/features/pause.ts +97 -7
- package/src/features/persistentEntities.ts +9 -8
- package/src/features/pickupIndex.ts +257 -0
- package/src/features/playerInventory.ts +2 -2
- package/src/features/roomHistory.ts +113 -0
- package/src/features/saveDataManager/main.ts +3 -3
- package/src/features/taintedLazarusPlayers.ts +37 -36
- package/src/functions/collectibles.ts +26 -13
- package/src/functions/deepCopy.ts +2 -2
- package/src/functions/entities.ts +7 -4
- package/src/functions/gridEntities.ts +2 -2
- package/src/functions/isaacAPIClass.ts +106 -1
- package/src/functions/map.ts +10 -0
- package/src/functions/pickupVariants.ts +2 -2
- package/src/functions/playerCenter.ts +2 -2
- package/src/functions/playerIndex.ts +20 -21
- package/src/functions/rng.ts +1 -1
- package/src/functions/roomData.ts +3 -2
- package/src/functions/rooms.ts +6 -6
- package/src/functions/set.ts +7 -1
- package/src/functions/stage.ts +10 -1
- package/src/functions/table.ts +2 -2
- package/src/index.ts +3 -0
- package/src/initCustomCallbacks.ts +4 -0
- package/src/initFeatures.ts +6 -0
- package/src/interfaces/AddCallbackParameterCustom.ts +4 -0
- package/src/interfaces/CustomGridEntityData.ts +6 -1
- package/src/interfaces/RoomDescription.ts +19 -0
- package/src/interfaces/private/CustomTrapdoorDescription.ts +4 -0
- package/src/objects/callbackRegisterFunctions.ts +6 -0
- package/src/types/CollectibleIndex.ts +1 -1
- package/src/types/PickupIndex.ts +15 -0
- package/src/types/PlayerIndex.ts +1 -1
- package/src/upgradeMod.ts +2 -1
|
@@ -1 +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,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,iCAAiC,QAA+B,CAAC;AAC9E,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,eAAO,MAAM,
|
|
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"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Set = ____lualib.Set
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
1
4
|
local ____exports = {}
|
|
2
5
|
____exports.CUSTOM_TRAPDOOR_FEATURE_NAME = "customTrapdoor"
|
|
6
|
+
____exports.GridEntityTypeCustom = {TRAPDOOR_CUSTOM = 1000}
|
|
3
7
|
--- This also applies to crawl spaces. The value was determined through trial and error.
|
|
4
8
|
____exports.TRAPDOOR_OPEN_DISTANCE = 60
|
|
5
9
|
____exports.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____exports.TRAPDOOR_OPEN_DISTANCE * 2.5
|
|
6
10
|
____exports.TRAPDOOR_BOSS_REACTION_FRAMES = 30
|
|
7
|
-
____exports.
|
|
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
|
|
8
16
|
return ____exports
|
|
@@ -6,7 +6,7 @@ import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
|
6
6
|
* - custom destination (or custom logic for after the player enters)
|
|
7
7
|
* - custom graphics
|
|
8
8
|
* - custom logic for opening/closing
|
|
9
|
-
* - TODO: animation
|
|
9
|
+
* - TODO: player jumping animation?
|
|
10
10
|
*
|
|
11
11
|
* You can use this function to take the player to your custom stage.
|
|
12
12
|
*
|
|
@@ -14,24 +14,16 @@ import { LevelStage, StageType } from "isaac-typescript-definitions";
|
|
|
14
14
|
* respawned every time the player re-enters the room.
|
|
15
15
|
*
|
|
16
16
|
* @param gridIndexOrPosition The location in the room to spawn the trapdoor.
|
|
17
|
-
* @param
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* function that returns one of these things. By default, the destination will
|
|
23
|
-
* be set to the next floor like that of a vanilla 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).
|
|
24
22
|
* @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
|
|
25
|
-
* of "gfx/grid/door_11_trapdoor.anm2" will be used.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @param _shouldCloseFunc Optional. If the trapdoor is currently open, this function will run on
|
|
30
|
-
* every frame to determine if it should close. By default, a function that
|
|
31
|
-
* emulates a vanilla trapdoor will be used.
|
|
32
|
-
* @param _spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. Can either be
|
|
33
|
-
* a boolean or a function returning a boolean. By default, a function that
|
|
34
|
-
* emulates a vanilla trapdoor will be used.
|
|
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.
|
|
35
27
|
*/
|
|
36
|
-
export declare function spawnCustomTrapdoor(gridIndexOrPosition: int | Vector,
|
|
28
|
+
export declare function spawnCustomTrapdoor(gridIndexOrPosition: int | Vector, destination?: [stage: LevelStage, stageType: StageType] | string, anm2Path?: string, spawnOpen?: boolean): GridEntity;
|
|
37
29
|
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/features/customTrapdoor/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,
|
|
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"}
|
|
@@ -1,78 +1,43 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
1
3
|
local ____exports = {}
|
|
2
|
-
local
|
|
4
|
+
local getDefaultDestination
|
|
3
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
6
|
local GridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.GridCollisionClass
|
|
5
|
-
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
|
|
6
7
|
local ____cachedClasses = require("cachedClasses")
|
|
7
8
|
local game = ____cachedClasses.game
|
|
9
|
+
local ____TrapdoorAnimation = require("enums.private.TrapdoorAnimation")
|
|
10
|
+
local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
|
|
8
11
|
local ____featuresInitialized = require("featuresInitialized")
|
|
9
12
|
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
10
13
|
local ____nextStage = require("functions.nextStage")
|
|
11
14
|
local getNextStage = ____nextStage.getNextStage
|
|
12
15
|
local getNextStageType = ____nextStage.getNextStageType
|
|
13
|
-
local
|
|
14
|
-
local
|
|
16
|
+
local ____roomData = require("functions.roomData")
|
|
17
|
+
local getRoomListIndex = ____roomData.getRoomListIndex
|
|
18
|
+
local ____vector = require("functions.vector")
|
|
19
|
+
local isVector = ____vector.isVector
|
|
15
20
|
local ____customGridEntity = require("features.customGridEntity")
|
|
16
21
|
local spawnCustomGridEntity = ____customGridEntity.spawnCustomGridEntity
|
|
17
|
-
local ____roomClearFrame = require("features.roomClearFrame")
|
|
18
|
-
local getRoomClearGameFrame = ____roomClearFrame.getRoomClearGameFrame
|
|
19
22
|
local ____customTrapdoorConstants = require("features.customTrapdoor.customTrapdoorConstants")
|
|
20
23
|
local CUSTOM_TRAPDOOR_FEATURE_NAME = ____customTrapdoorConstants.CUSTOM_TRAPDOOR_FEATURE_NAME
|
|
21
24
|
local GridEntityTypeCustom = ____customTrapdoorConstants.GridEntityTypeCustom
|
|
22
|
-
local
|
|
23
|
-
local
|
|
24
|
-
local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = ____customTrapdoorConstants.TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS
|
|
25
|
+
local ____openClose = require("features.customTrapdoor.openClose")
|
|
26
|
+
local shouldTrapdoorSpawnOpen = ____openClose.shouldTrapdoorSpawnOpen
|
|
25
27
|
local ____v = require("features.customTrapdoor.v")
|
|
26
|
-
local
|
|
27
|
-
function
|
|
28
|
+
local v = ____v.default
|
|
29
|
+
function getDefaultDestination(self)
|
|
28
30
|
local nextStage = getNextStage(nil)
|
|
29
31
|
local nextStageType = getNextStageType(nil)
|
|
30
32
|
return {nextStage, nextStageType}
|
|
31
33
|
end
|
|
32
|
-
function defaultShouldOpenFunc(self, gridEntity)
|
|
33
|
-
local trapdoorDescription = getCustomTrapdoorDescription(nil, gridEntity)
|
|
34
|
-
if trapdoorDescription == nil then
|
|
35
|
-
return false
|
|
36
|
-
end
|
|
37
|
-
local room = game:GetRoom()
|
|
38
|
-
local roomClear = room:IsClear()
|
|
39
|
-
return not anyPlayerCloserThan(nil, gridEntity.Position, TRAPDOOR_OPEN_DISTANCE) and not isPlayerCloseAfterBoss(nil, gridEntity.Position) and not shouldBeClosedFromStartingInRoomWithEnemies(nil, trapdoorDescription.firstSpawn, roomClear)
|
|
40
|
-
end
|
|
41
|
-
function isPlayerCloseAfterBoss(self, position)
|
|
42
|
-
local gameFrameCount = game:GetFrameCount()
|
|
43
|
-
local room = game:GetRoom()
|
|
44
|
-
local roomType = room:GetType()
|
|
45
|
-
local roomClearGameFrame = getRoomClearGameFrame(nil)
|
|
46
|
-
if roomType ~= RoomType.BOSS or roomClearGameFrame == nil or gameFrameCount >= roomClearGameFrame + TRAPDOOR_BOSS_REACTION_FRAMES then
|
|
47
|
-
return false
|
|
48
|
-
end
|
|
49
|
-
return anyPlayerCloserThan(nil, position, TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS)
|
|
50
|
-
end
|
|
51
|
-
function shouldBeClosedFromStartingInRoomWithEnemies(self, firstSpawn, roomClear)
|
|
52
|
-
return firstSpawn and not roomClear
|
|
53
|
-
end
|
|
54
|
-
function defaultShouldCloseFunc(self)
|
|
55
|
-
return false
|
|
56
|
-
end
|
|
57
|
-
function defaultShouldSpawnOpenFunc(self, gridEntity)
|
|
58
|
-
local room = game:GetRoom()
|
|
59
|
-
local roomFrameCount = room:GetFrameCount()
|
|
60
|
-
local roomClear = room:IsClear()
|
|
61
|
-
if roomFrameCount > 0 then
|
|
62
|
-
return false
|
|
63
|
-
end
|
|
64
|
-
if not roomClear then
|
|
65
|
-
return false
|
|
66
|
-
end
|
|
67
|
-
return defaultShouldOpenFunc(nil, gridEntity)
|
|
68
|
-
end
|
|
69
34
|
--- Helper function to spawn a trapdoor grid entity that will have one or more of the following
|
|
70
35
|
-- attributes:
|
|
71
36
|
--
|
|
72
37
|
-- - custom destination (or custom logic for after the player enters)
|
|
73
38
|
-- - custom graphics
|
|
74
39
|
-- - custom logic for opening/closing
|
|
75
|
-
-- - TODO: animation
|
|
40
|
+
-- - TODO: player jumping animation?
|
|
76
41
|
--
|
|
77
42
|
-- You can use this function to take the player to your custom stage.
|
|
78
43
|
--
|
|
@@ -80,48 +45,49 @@ end
|
|
|
80
45
|
-- respawned every time the player re-enters the room.
|
|
81
46
|
--
|
|
82
47
|
-- @param gridIndexOrPosition The location in the room to spawn the trapdoor.
|
|
83
|
-
-- @param
|
|
84
|
-
-- either be a tuple containing the stage and stage type, a
|
|
85
|
-
-- the name of a custom stage
|
|
86
|
-
--
|
|
87
|
-
--
|
|
88
|
-
-- function that returns one of these things. By default, the destination will
|
|
89
|
-
-- be set to the next floor like that of a vanilla 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).
|
|
90
53
|
-- @param anm2Path Optional. The path to the anm2 file to use. By default, the vanilla trapdoor anm2
|
|
91
|
-
-- of "gfx/grid/door_11_trapdoor.anm2" will be used.
|
|
92
|
-
--
|
|
93
|
-
--
|
|
94
|
-
-- emulates a vanilla trapdoor
|
|
95
|
-
|
|
96
|
-
-- every frame to determine if it should close. By default, a function that
|
|
97
|
-
-- emulates a vanilla trapdoor will be used.
|
|
98
|
-
-- @param _spawnOpen Optional. Whether or not to spawn the trapdoor in an open state. Can either be
|
|
99
|
-
-- a boolean or a function returning a boolean. By default, a function that
|
|
100
|
-
-- emulates a vanilla trapdoor will be used.
|
|
101
|
-
function ____exports.spawnCustomTrapdoor(self, gridIndexOrPosition, _destination, anm2Path, _shouldOpenFunc, _shouldCloseFunc, _spawnOpen)
|
|
102
|
-
if _destination == nil then
|
|
103
|
-
_destination = defaultDestinationFunc
|
|
104
|
-
end
|
|
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)
|
|
105
59
|
if anm2Path == nil then
|
|
106
60
|
anm2Path = "gfx/grid/door_11_trapdoor.anm2"
|
|
107
61
|
end
|
|
108
|
-
if _shouldOpenFunc == nil then
|
|
109
|
-
_shouldOpenFunc = defaultShouldOpenFunc
|
|
110
|
-
end
|
|
111
|
-
if _shouldCloseFunc == nil then
|
|
112
|
-
_shouldCloseFunc = defaultShouldCloseFunc
|
|
113
|
-
end
|
|
114
|
-
if _spawnOpen == nil then
|
|
115
|
-
_spawnOpen = defaultShouldSpawnOpenFunc
|
|
116
|
-
end
|
|
117
62
|
errorIfFeaturesNotInitialized(nil, CUSTOM_TRAPDOOR_FEATURE_NAME)
|
|
118
|
-
|
|
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(
|
|
119
68
|
nil,
|
|
120
69
|
GridEntityTypeCustom.TRAPDOOR_CUSTOM,
|
|
121
70
|
gridIndexOrPosition,
|
|
71
|
+
GridCollisionClass.NONE,
|
|
122
72
|
anm2Path,
|
|
123
|
-
|
|
124
|
-
GridCollisionClass.NONE
|
|
73
|
+
TrapdoorAnimation.OPENED
|
|
125
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
|
|
126
92
|
end
|
|
127
93
|
return ____exports
|
|
@@ -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"}
|