local ____lualib = require("lualib_bundle")
local __TS__New = ____lualib.__TS__New
local Map = ____lualib.Map
local __TS__Class = ____lualib.__TS__Class
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
local __TS__ArrayEntries = ____lualib.__TS__ArrayEntries
local __TS__Iterator = ____lualib.__TS__Iterator
local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
local __TS__ArraySome = ____lualib.__TS__ArraySome
local ____exports = {}
local anyPlayerPlayingExtraAnimation, shouldBeClosedFromStartingInRoomWithEnemies, openCustomTrapdoor, canPlayerInteractWithTrapdoor, setPlayerAttributes, dropTaintedForgotten, goToVanillaStage, ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local ButtonAction = ____isaac_2Dtypescript_2Ddefinitions.ButtonAction
local Direction = ____isaac_2Dtypescript_2Ddefinitions.Direction
local EntityCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityCollisionClass
local EntityGridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.EntityGridCollisionClass
local EntityPartition = ____isaac_2Dtypescript_2Ddefinitions.EntityPartition
local GridCollisionClass = ____isaac_2Dtypescript_2Ddefinitions.GridCollisionClass
local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
local RoomTransitionAnim = ____isaac_2Dtypescript_2Ddefinitions.RoomTransitionAnim
local RoomType = ____isaac_2Dtypescript_2Ddefinitions.RoomType
local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
local ____cachedClasses = require("core.cachedClasses")
local game = ____cachedClasses.game
local ____constants = require("core.constants")
local VectorZero = ____constants.VectorZero
local ____decorators = require("decorators")
local Exported = ____decorators.Exported
local ____ISCFeature = require("enums.ISCFeature")
local ISCFeature = ____ISCFeature.ISCFeature
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
local ____GridEntityTypeCustom = require("enums.private.GridEntityTypeCustom")
local GridEntityTypeCustom = ____GridEntityTypeCustom.GridEntityTypeCustom
local ____StageTravelState = require("enums.private.StageTravelState")
local StageTravelState = ____StageTravelState.StageTravelState
local ____TrapdoorAnimation = require("enums.private.TrapdoorAnimation")
local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
local ____easing = require("functions.easing")
local easeOutSine = ____easing.easeOutSine
local ____frames = require("functions.frames")
local isAfterRoomFrame = ____frames.isAfterRoomFrame
local isBeforeRenderFrame = ____frames.isBeforeRenderFrame
local onOrAfterRenderFrame = ____frames.onOrAfterRenderFrame
local ____log = require("functions.log")
local log = ____log.log
local ____playerCenter = require("functions.playerCenter")
local movePlayersToCenter = ____playerCenter.movePlayersToCenter
local ____playerIndex = require("functions.playerIndex")
local getAllPlayers = ____playerIndex.getAllPlayers
local getOtherPlayers = ____playerIndex.getOtherPlayers
local isChildPlayer = ____playerIndex.isChildPlayer
local ____players = require("functions.players")
local isCharacter = ____players.isCharacter
local ____positionVelocity = require("functions.positionVelocity")
local anyPlayerCloserThan = ____positionVelocity.anyPlayerCloserThan
local ____roomData = require("functions.roomData")
local getRoomGridIndex = ____roomData.getRoomGridIndex
local getRoomListIndex = ____roomData.getRoomListIndex
local ____roomTransition = require("functions.roomTransition")
local teleport = ____roomTransition.teleport
local ____stage = require("functions.stage")
local setStage = ____stage.setStage
local ____tstlClass = require("functions.tstlClass")
local getTSTLClassName = ____tstlClass.getTSTLClassName
local ____utils = require("functions.utils")
local assertDefined = ____utils.assertDefined
local ____vector = require("functions.vector")
local isVector = ____vector.isVector
local ____ReadonlySet = require("types.ReadonlySet")
local ReadonlySet = ____ReadonlySet.ReadonlySet
local ____DefaultMap = require("classes.DefaultMap")
local DefaultMap = ____DefaultMap.DefaultMap
local ____Feature = require("classes.private.Feature")
local Feature = ____Feature.Feature
local ____constants = require("classes.features.other.customStages.constants")
local CUSTOM_FLOOR_STAGE = ____constants.CUSTOM_FLOOR_STAGE
function anyPlayerPlayingExtraAnimation(self)
    local players = getAllPlayers(nil)
    return __TS__ArraySome(
        players,
        function(____, player) return not player:IsExtraAnimationFinished() end
    )
end
function shouldBeClosedFromStartingInRoomWithEnemies(self, firstSpawn, roomClear)
    return firstSpawn and not roomClear
end
function openCustomTrapdoor(self, gridEntity, trapdoorDescription)
    trapdoorDescription.open = true
    local sprite = gridEntity:GetSprite()
    sprite:Play(TrapdoorAnimation.OPEN_ANIMATION, true)
end
function canPlayerInteractWithTrapdoor(self, player)
    local sprite = player:GetSprite()
    local animation = sprite:GetAnimation()
    return not player:IsHoldingItem() and not ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL:has(animation)
end
function setPlayerAttributes(self, trapdoorPlayer, position)
    trapdoorPlayer.Position = position
    for ____, player in ipairs(getAllPlayers(nil)) do
        player.ControlsEnabled = false
        player.Velocity = VectorZero
        player.EntityCollisionClass = EntityCollisionClass.NONE
        player.GridCollisionClass = EntityGridCollisionClass.NONE
        player:StopExtraAnimation()
    end
end
function dropTaintedForgotten(self, player)
    if isCharacter(nil, player, PlayerType.FORGOTTEN_B) then
        local taintedSoul = player:GetOtherTwin()
        if taintedSoul ~= nil then
            taintedSoul:ThrowHeldEntity(VectorZero)
        end
    end
end
function goToVanillaStage(self, _destinationName, destinationStage, destinationStageType)
    setStage(nil, destinationStage, destinationStageType)
end
local DEBUG = false
--- This also applies to crawl spaces. The value was determined through trial and error.
local TRAPDOOR_OPEN_DISTANCE = 60
local TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS = TRAPDOOR_OPEN_DISTANCE * 2.5
local TRAPDOOR_BOSS_REACTION_FRAMES = 30
local TRAPDOOR_TOUCH_DISTANCE = 16.5
ANIMATIONS_THAT_PREVENT_STAGE_TRAVEL = __TS__New(ReadonlySet, {"Death", "Happy", "Sad", "Jump"})
local PIXELATION_TO_BLACK_FRAMES = 60
local OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES = 6
local OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES = 5
local v = {
    run = {state = StageTravelState.NONE, stateRenderFrame = nil, customTrapdoorActivated = nil},
    level = {trapdoors = __TS__New(
        DefaultMap,
        function() return __TS__New(Map) end
    )}
}
____exports.CustomTrapdoors = __TS__Class()
local CustomTrapdoors = ____exports.CustomTrapdoors
CustomTrapdoors.name = "CustomTrapdoors"
__TS__ClassExtends(CustomTrapdoors, Feature)
function CustomTrapdoors.prototype.____constructor(self, customGridEntities, disableInputs, ponyDetection, roomClearFrame, runInNFrames, runNextRoom, stageHistory)
    Feature.prototype.____constructor(self)
    self.destinationFuncMap = __TS__New(Map)
    self.v = v
    self.blackSprite = Sprite()
    self.postRender = function()
        self:checkAllPlayersJumpComplete()
        self:checkPixelationToBlackComplete()
        self:checkSecondPixelationHalfWay()
        self:checkAllPlayersLayingDownComplete()
        self:drawBlackSprite()
    end
    self.postGridEntityCustomUpdateTrapdoor = function(____, gridEntity)
        local roomListIndex = getRoomListIndex(nil)
        local gridIndex = gridEntity:GetGridIndex()
        local roomTrapdoorMap = v.level.trapdoors:getAndSetDefault(roomListIndex)
        local trapdoorDescription = roomTrapdoorMap:get(gridIndex)
        if trapdoorDescription == nil then
            return
        end
        self:checkCustomTrapdoorOpenClose(gridEntity, trapdoorDescription)
        self:checkCustomTrapdoorPlayerTouched(gridEntity, trapdoorDescription)
    end
    self.postPEffectUpdateReordered = function(____, player)
        self:checkJumpComplete(player)
    end
    self.featuresUsed = {
        ISCFeature.CUSTOM_GRID_ENTITIES,
        ISCFeature.DISABLE_INPUTS,
        ISCFeature.PONY_DETECTION,
        ISCFeature.ROOM_CLEAR_FRAME,
        ISCFeature.RUN_IN_N_FRAMES,
        ISCFeature.RUN_NEXT_ROOM,
        ISCFeature.STAGE_HISTORY
    }
    self.callbacksUsed = {{ModCallback.POST_RENDER, self.postRender}}
    self.customCallbacksUsed = {{ModCallbackCustom.POST_GRID_ENTITY_CUSTOM_UPDATE, self.postGridEntityCustomUpdateTrapdoor, {GridEntityTypeCustom.TRAPDOOR_CUSTOM}}, {ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED, self.postPEffectUpdateReordered}}
    self.customGridEntities = customGridEntities
    self.disableInputs = disableInputs
    self.ponyDetection = ponyDetection
    self.roomClearFrame = roomClearFrame
    self.runInNFrames = runInNFrames
    self.runNextRoom = runNextRoom
    self.stageHistory = stageHistory
end
function CustomTrapdoors.prototype.checkAllPlayersJumpComplete(self)
    if v.run.state ~= StageTravelState.PLAYERS_JUMPING_DOWN then
        return
    end
    if anyPlayerPlayingExtraAnimation(nil) then
        return
    end
    local renderFrameCount = Isaac.GetFrameCount()
    local roomGridIndex = getRoomGridIndex(nil)
    v.run.state = StageTravelState.PIXELATION_TO_BLACK
    v.run.stateRenderFrame = renderFrameCount
    self:logStateChanged()
    teleport(nil, roomGridIndex, Direction.NO_DIRECTION, RoomTransitionAnim.PIXELATION)
end
function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
    if v.run.state ~= StageTravelState.PIXELATION_TO_BLACK or v.run.stateRenderFrame == nil then
        return
    end
    local renderFrameScreenBlack = v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES
    if isBeforeRenderFrame(nil, renderFrameScreenBlack) then
        return
    end
    v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END
    self:logStateChanged()
    local hud = game:GetHUD()
    hud:SetVisible(false)
    self.runInNFrames:runNextGameFrame(function()
        local level = game:GetLevel()
        local startingRoomIndex = level:GetStartingRoomIndex()
        local futureRenderFrameCount = Isaac.GetFrameCount()
        v.run.state = StageTravelState.WAITING_FOR_SECOND_PIXELATION_TO_GET_HALF_WAY
        v.run.stateRenderFrame = futureRenderFrameCount
        self:goToCustomTrapdoorDestination()
        teleport(nil, startingRoomIndex, Direction.NO_DIRECTION, RoomTransitionAnim.PIXELATION)
    end)
end
function CustomTrapdoors.prototype.goToCustomTrapdoorDestination(self)
    if v.run.customTrapdoorActivated == nil then
        v.run.customTrapdoorActivated = {
            destinationName = nil,
            destinationStage = LevelStage.BASEMENT_1,
            destinationStageType = StageType.ORIGINAL,
            open = true,
            firstSpawn = true
        }
    end
    local destinationFunc = self:getDestinationFunc(v.run.customTrapdoorActivated)
    destinationFunc(nil, v.run.customTrapdoorActivated.destinationName, v.run.customTrapdoorActivated.destinationStage, v.run.customTrapdoorActivated.destinationStageType)
end
function CustomTrapdoors.prototype.getDestinationFunc(self, customTrapdoorDescription)
    if customTrapdoorDescription.destinationName == nil then
        return goToVanillaStage
    end
    local destinationFunc = self.destinationFuncMap:get(customTrapdoorDescription.destinationName)
    if destinationFunc == nil then
        return goToVanillaStage
    end
    return destinationFunc
end
function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
    if v.run.state ~= StageTravelState.WAITING_FOR_SECOND_PIXELATION_TO_GET_HALF_WAY or v.run.stateRenderFrame == nil then
        return
    end
    local renderFrameScreenBlack = v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES
    if isBeforeRenderFrame(nil, renderFrameScreenBlack) then
        return
    end
    v.run.state = StageTravelState.PIXELATION_TO_ROOM
    self:logStateChanged()
    local hud = game:GetHUD()
    hud:SetVisible(true)
    self.runNextRoom:runNextRoom(function()
        v.run.state = StageTravelState.PLAYERS_LAYING_DOWN
        self:logStateChanged()
        movePlayersToCenter(nil)
        for ____, player in ipairs(getAllPlayers(nil)) do
            player:AnimateAppear()
            player.EntityCollisionClass = EntityCollisionClass.ALL
            player.GridCollisionClass = EntityGridCollisionClass.GROUND
        end
        local level = game:GetLevel()
        local stage = level:GetStage()
        if stage ~= CUSTOM_FLOOR_STAGE then
            level:ShowName(false)
        end
    end)
end
function CustomTrapdoors.prototype.checkAllPlayersLayingDownComplete(self)
    if v.run.state ~= StageTravelState.PLAYERS_LAYING_DOWN then
        return
    end
    if anyPlayerPlayingExtraAnimation(nil) then
        return
    end
    v.run.state = StageTravelState.NONE
    self:logStateChanged()
    local tstlClassName = getTSTLClassName(nil, self)
    assertDefined(nil, tstlClassName, "Failed to find get the class name for the custom trapdoor feature.")
    self.disableInputs:enableAllInputs(tstlClassName)
end
function CustomTrapdoors.prototype.drawBlackSprite(self)
    if v.run.state ~= StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END and v.run.state ~= StageTravelState.WAITING_FOR_SECOND_PIXELATION_TO_GET_HALF_WAY then
        return
    end
    if not self.blackSprite:IsLoaded() then
        self.blackSprite:Load("gfx/ui/boss/versusscreen.anm2", true)
        self.blackSprite:SetFrame("Scene", 0)
        self.blackSprite.Scale = Vector(100, 100)
    end
    self.blackSprite:RenderLayer(0, VectorZero)
end
function CustomTrapdoors.prototype.checkCustomTrapdoorOpenClose(self, gridEntity, trapdoorDescription)
    if trapdoorDescription.open then
        return
    end
    if self:shouldTrapdoorOpen(gridEntity, trapdoorDescription.firstSpawn) then
        openCustomTrapdoor(nil, gridEntity, trapdoorDescription)
    end
end
function CustomTrapdoors.prototype.shouldTrapdoorOpen(self, gridEntity, firstSpawn)
    local room = game:GetRoom()
    local roomClear = room:IsClear()
    return not anyPlayerCloserThan(nil, gridEntity.Position, TRAPDOOR_OPEN_DISTANCE) and not self:isPlayerCloseAfterBoss(gridEntity.Position) and not shouldBeClosedFromStartingInRoomWithEnemies(nil, firstSpawn, roomClear)
end
function CustomTrapdoors.prototype.isPlayerCloseAfterBoss(self, position)
    local room = game:GetRoom()
    local roomType = room:GetType()
    local roomClearGameFrame = self.roomClearFrame:getRoomClearGameFrame()
    if roomType ~= RoomType.BOSS or roomClearGameFrame == nil or onOrAfterRenderFrame(nil, roomClearGameFrame + TRAPDOOR_BOSS_REACTION_FRAMES) then
        return false
    end
    return anyPlayerCloserThan(nil, position, TRAPDOOR_OPEN_DISTANCE_AFTER_BOSS)
end
function CustomTrapdoors.prototype.checkCustomTrapdoorPlayerTouched(self, gridEntity, trapdoorDescription)
    if v.run.state ~= StageTravelState.NONE then
        return
    end
    if not trapdoorDescription.open then
        return
    end
    local playersTouching = Isaac.FindInRadius(gridEntity.Position, TRAPDOOR_TOUCH_DISTANCE, EntityPartition.PLAYER)
    for ____, playerEntity in ipairs(playersTouching) do
        do
            local player = playerEntity:ToPlayer()
            if player == nil then
                goto __continue42
            end
            if not self.ponyDetection:isPlayerUsingPony(player) and not isChildPlayer(nil, player) and canPlayerInteractWithTrapdoor(nil, player) then
                self:playerTouchedCustomTrapdoor(gridEntity, trapdoorDescription, player)
                return
            end
        end
        ::__continue42::
    end
end
function CustomTrapdoors.prototype.playerTouchedCustomTrapdoor(self, gridEntity, trapdoorDescription, player)
    v.run.state = StageTravelState.PLAYERS_JUMPING_DOWN
    v.run.customTrapdoorActivated = trapdoorDescription
    self:logStateChanged()
    local tstlClassName = getTSTLClassName(nil, self)
    assertDefined(nil, tstlClassName, "Failed to find get the class name for the custom trapdoor feature.")
    local whitelist = __TS__New(ReadonlySet, {ButtonAction.CONSOLE})
    self.disableInputs:disableAllInputsExceptFor(tstlClassName, whitelist)
    setPlayerAttributes(nil, player, gridEntity.Position)
    dropTaintedForgotten(nil, player)
    player:PlayExtraAnimation("Trapdoor")
    local otherPlayers = getOtherPlayers(nil, player)
    for ____, ____value in __TS__Iterator(__TS__ArrayEntries(otherPlayers)) do
        local i = ____value[1]
        local otherPlayer = ____value[2]
        local gameFramesToWaitBeforeJumping = OTHER_PLAYER_TRAPDOOR_JUMP_DELAY_GAME_FRAMES * (i + 1)
        local otherPlayerPtr = EntityPtr(otherPlayer)
        self.runInNFrames:runInNGameFrames(
            function()
                self:startDelayedJump(otherPlayerPtr, gridEntity.Position)
            end,
            gameFramesToWaitBeforeJumping
        )
    end
end
function CustomTrapdoors.prototype.startDelayedJump(self, entityPtr, trapdoorPosition)
    local entity = entityPtr.Ref
    if entity == nil then
        return
    end
    local player = entity:ToPlayer()
    if player == nil then
        return
    end
    player:PlayExtraAnimation("Trapdoor")
    self:adjustPlayerPositionToTrapdoor(entityPtr, player.Position, trapdoorPosition)
end
function CustomTrapdoors.prototype.adjustPlayerPositionToTrapdoor(self, entityPtr, startPos, endPos)
    if v.run.state ~= StageTravelState.PLAYERS_JUMPING_DOWN then
        return
    end
    local entity = entityPtr.Ref
    if entity == nil then
        return
    end
    local player = entity:ToPlayer()
    if player == nil then
        return
    end
    self.runInNFrames:runNextRenderFrame(function()
        self:adjustPlayerPositionToTrapdoor(entityPtr, startPos, endPos)
    end)
    local sprite = player:GetSprite()
    if sprite:IsFinished("Trapdoor") then
        player.Position = endPos
        player.Velocity = VectorZero
        return
    end
    local frame = sprite:GetFrame()
    if frame >= OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES then
        player.Position = endPos
        player.Velocity = VectorZero
        return
    end
    local totalDifference = endPos - startPos
    local progress = frame / OTHER_PLAYER_TRAPDOOR_JUMP_DURATION_GAME_FRAMES
    local easeProgress = easeOutSine(nil, progress)
    local differenceForThisFrame = totalDifference * easeProgress
    local targetPosition = startPos + differenceForThisFrame
    player.Position = targetPosition
    player.Velocity = VectorZero
end
function CustomTrapdoors.prototype.checkJumpComplete(self, player)
    if v.run.state ~= StageTravelState.PLAYERS_JUMPING_DOWN then
        return
    end
    local sprite = player:GetSprite()
    if sprite:IsFinished("Trapdoor") then
        player.Visible = false
    end
end
function CustomTrapdoors.prototype.shouldTrapdoorSpawnOpen(self, gridEntity, firstSpawn)
    local room = game:GetRoom()
    local roomClear = room:IsClear()
    if isAfterRoomFrame(nil, 0) then
        return false
    end
    if not roomClear then
        return false
    end
    return self:shouldTrapdoorOpen(gridEntity, firstSpawn)
end
function CustomTrapdoors.prototype.logStateChanged(self)
    if DEBUG then
        log(((("Custom trapdoors state changed: " .. StageTravelState[v.run.state]) .. " (") .. tostring(v.run.state)) .. ")")
    end
end
function CustomTrapdoors.prototype.registerCustomTrapdoorDestination(self, destinationName, destinationFunc)
    if self.destinationFuncMap:has(destinationName) then
        error(("Failed to register a custom trapdoor type of " .. destinationName) .. " since this custom trapdoor type has already been registered.")
    end
    self.destinationFuncMap:set(destinationName, destinationFunc)
end
__TS__DecorateLegacy({Exported}, CustomTrapdoors.prototype, "registerCustomTrapdoorDestination", true)
function CustomTrapdoors.prototype.spawnCustomTrapdoor(self, gridIndexOrPosition, destinationName, destinationStage, destinationStageType, anm2Path, spawnOpen)
    if anm2Path == nil then
        anm2Path = "gfx/grid/door_11_trapdoor.anm2"
    end
    if destinationName ~= nil and not self.destinationFuncMap:has(destinationName) then
        error(("Failed to spawn a custom trapdoor with a destination of \"" .. destinationName) .. "\" since a destination with that name has not been registered with the \"registerCustomTrapdoorDestination\" function. (If you are trying to go to a custom stage, the custom stage library should automatically do this for you when your mod first boots.)")
    end
    if destinationStage == nil then
        destinationStage = self.stageHistory:getNextStageWithHistory()
    end
    if destinationStageType == nil then
        destinationStageType = self.stageHistory:getNextStageTypeWithHistory()
    end
    local room = game:GetRoom()
    local roomListIndex = getRoomListIndex(nil)
    local gridIndex = isVector(nil, gridIndexOrPosition) and room:GetGridIndex(gridIndexOrPosition) or gridIndexOrPosition
    local gridEntity = self.customGridEntities:spawnCustomGridEntity(
        GridEntityTypeCustom.TRAPDOOR_CUSTOM,
        gridIndexOrPosition,
        GridCollisionClass.NONE,
        anm2Path,
        TrapdoorAnimation.OPENED
    )
    local firstSpawn = isAfterRoomFrame(nil, 0)
    local ____spawnOpen_0 = spawnOpen
    if ____spawnOpen_0 == nil then
        ____spawnOpen_0 = self:shouldTrapdoorSpawnOpen(gridEntity, firstSpawn)
    end
    local open = ____spawnOpen_0
    local roomTrapdoorMap = v.level.trapdoors:getAndSetDefault(roomListIndex)
    local customTrapdoorDescription = {
        destinationName = destinationName,
        destinationStage = destinationStage,
        destinationStageType = destinationStageType,
        open = open,
        firstSpawn = firstSpawn
    }
    roomTrapdoorMap:set(gridIndex, customTrapdoorDescription)
    local sprite = gridEntity:GetSprite()
    local animation = open and TrapdoorAnimation.OPENED or TrapdoorAnimation.CLOSED
    sprite:Play(animation, true)
    return gridEntity
end
__TS__DecorateLegacy({Exported}, CustomTrapdoors.prototype, "spawnCustomTrapdoor", true)
return ____exports
