function getSlider(key)
    return engine.Scene.Session:GetSlider(key)
end

function onBegin()
    local keepGoing = false
    disableMovement()
    setPlayerState(17)
    player.Speed = vector2(0,0)
    choiceDialog({
        {"CommunityVoice_strawsim_ascend_confirm1", onChosen = function () keepGoing = true; closeChoiceDialog() end},
        {"CommunityVoice_strawsim_ascend_goback", onChosen = closeChoiceDialog}
    })

    if not keepGoing then
        return
    end

    if getSlider("berriesThisAscension") < 1000000000 then
        say("CommunityVoice_strawsim_ascend_notenough")
        return
    end

    say("CommunityVoice_strawsim_ascend_warning")

    choiceDialog({
        {"CommunityVoice_strawsim_ascend_confirm2", onChosen = function () setFlag("winCondition"); wait(5) end},
        {"CommunityVoice_strawsim_ascend_goback", onChosen = closeChoiceDialog}
    })
end

function onEnd(room, wasSkipped)
    enableMovement()
    setPlayerState(0)
end