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

function onTalk()
    disableMovement()
	if getFlag("HK_CantOpenMap") then
		playSound("event:/ashleybl/SYS_quest_complete")
		wait(0.2)
		coroutine.yield(luaCutscenesUtils.SayWithDifferentFont("OMORI_GAME", "CC_omori_unlockmap"))
		setFlag("HK_CantOpenMap",false)
		setFlag("map_Base",true)
		setFlag("map_WaywardCompass",true)
		if not getFlag("dontShowKeysInMap") then
			setFlag("map_Keys",true)
		end
		endCutscene()
	else
		coroutine.yield(luaCutscenesUtils.SayWithDifferentFont("OMORI_GAME", "CC_omori_unlockmapMoreHints"))
	end
end

function onEnd(room,wasSkipped)
	if wasSkipped then
		setFlag("HK_CantOpenMap",false)
		setFlag("map_Base",true)
		setFlag("map_WaywardCompass",true)
		if not getFlag("dontShowKeysInMap") then
			setFlag("map_Keys",true)
		end
	end
    enableMovement()
end