local monocle = require("#monocle")
local lua_helper = celeste.Mod.LuaCutscenes.LuaHelper
local save = require("#Celeste.Mod.CrossoverCollab.Code.PointsStuff.PointsModule")

function onBegin()
	disableRetry()
    wait(1.4)
	if not isflagtrue("GD_firstTime") then
		addflag("GD_firstTime")
	end
	wait(1)
	cutsceneEntity:Add(monocle.Coroutine(lua_helper.LuaCoroutineToIEnumerator(coroutine.create(neverStopRunning))))
	while true do
		wait()
		if (celeste.Input.Jump.Pressed or celeste.Input.DashPressed or celeste.Input.CrouchDashPressed or celeste.Input.MenuConfirm.Pressed) then
			playSound("event:/CrossoverCollab/Xelk1/SFX/LevelSelected")
			teleportTo(164,-16,"menu1","Transition")
			player.Facing = getEnum("Celeste.Facings", "Right")
		end
	end
end

function neverStopRunning()
  while true do
    run(32,true)
  end
end

function addflag(flag)
    save.SaveData:AddFlag(flag)
end

function isflagtrue(flag)
    return save.SaveData:IsFlagTrue(flag)
end
local monocle = require("#monocle")
local lua_helper = celeste.Mod.LuaCutscenes.LuaHelper
local save = require("#Celeste.Mod.CrossoverCollab.Code.PointsStuff.PointsModule")