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


function onBegin()

  if not getFlag("talkbasil") then

    disablePause()
    disableMovement()
    waitUntilOnGround()
    walkTo(5092)
    player.Facing = getEnum("Celeste.Facings", "Right")
    wait(0.5)

    basil = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("basil")
    basil:SetHorizontalScale(-1)
    wait(0.5)

    coroutine.yield(luaCutscenesUtils.SayWithDifferentFont("OMORI_GAME", "CBR_BlackSpace_door2_room4_basil1"))
    wait(0.5)

    setFlag("treehouse")
    setFlag("basilfollow")
    wait(0.5)

    coroutine.yield(luaCutscenesUtils.SayWithDifferentFont("OMORI_GAME", "CBR_BlackSpace_door2_room4_basil2"))

    setFlag("talkbasil")
    enableMovement()
    enablePause()

  end

end