local luaCutscenesUtils = require("#Celeste.Mod.MaxHelpingHand.Module.LuaCutscenesUtils")

local isJumping = false

function onBegin()
    disableMovement()
	player.ForceCameraUpdate = true
	waitUntilOnGround()
	wait(0.15)
	coroutine.yield(luaCutscenesUtils.SayWithDifferentFont("OMORI_GAME", "CC_omori_library_jumpPrompt"))
	coroutine.yield(luaCutscenesUtils.ChoiceWithDifferentFont("OMORI_GAME", "CC_omori_library_yes","CC_omori_library_no"))
	if luaCutscenesUtils.GetChoice() == 1 then
		isJumping = true
		runTo(22772)
		jump(0.5)
		runTo(22820)
		wait(3.5)
		enableMovement()
		teleportTo(23268,-3066,"e-mari")
	else
		walkTo(22716)
		enableMovement()
	end
end

function onEnd(room,wasSkipped)
    enableMovement()
	if (wasSkipped) then
		if (isJumping) then
			setDarkness(0.39)
			teleportTo(23268,-3066,"e-mari")
		else
			teleportTo(22720,-3016,"e-library-03")
		end
	end
end