local result
local exitresult

function onTalk()
	makeUnskippable()
    disableRetry()
    disableMovement()
    player.ForceCameraUpdate = true
	celeste.Audio.SetMusicParam("dialog", 1.0)
	celeste.Audio.SetMusicParam("kick", 0.0)
    local luanet = _G.luanet    
    player.Facing = luanet.enum(luanet.import_type("Celeste.Facings"), "Left")
	
repeat
    exitresult = 0
    if not getFlag("TNT-Nova-endintro") then
        say("TNT_Nova_endintro")
        setFlag("TNT-Nova-endintro")
    end
    result = choice("TNT_Nova_endqrevenge", "TNT_Nova_endqthanks", "TNT_Nova_endqcredits", "TNT_Nova_endqnext", "TNT_Nova_endqgoodbye")
    if result == 1 then
        say("TNT_Nova_endarevenge")
    elseif result == 2 then
        say("TNT_Nova_endathanks")
    elseif result == 3 then
        say("TNT_Nova_endacredits")
    elseif result == 4 then
        say("TNT_Nova_endanext")
    elseif result == 5 then
        say("TNT_Nova_endagoodbye")
        exitresult = 1
    end
until exitresult == 1
end
	
function onEnd()
    player.ForceCameraUpdate = false
	celeste.Audio.SetMusicParam("kick", 1.0)
	celeste.Audio.SetMusicParam("dialog", 0.0)
    enableRetry()
    enableMovement()
end