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

local function doFadeWipe(state)
    fadeWipe = celeste.FadeWipe(engine.Scene, state, nil)
    engine.Scene:Add(fadeWipe)
    fadeWipe.duration = 2
    fadeWipe.EndTimer = 1
  end

function onBegin()
	if getFlag("deeperwell_appletreeend") then
		doFadeWipe(true)
		wait(1.2)
		coroutine.yield(luaCutscenesUtils.SayWithDifferentFont("OMORI_GAME", "CBR_DeeperWell_AppleTreeSacrifice"))
		setFlag("deeperwell_appletreeend", false)
		enableMovement()
		enablePause()
	end
end

function onEnd(room, wasSkipped)
	enableMovement()
 end