From c2920339600abdffe32f6e1f43ed3f312c614fb4 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 5 Jul 2025 16:04:48 -0400 Subject: [PATCH] Return control to the menu after the cutscene finishes --- .../scripts/events/tosort/UnendingJourney.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/resources/scripts/events/tosort/UnendingJourney.lua b/resources/scripts/events/tosort/UnendingJourney.lua index b11404f..ee90943 100644 --- a/resources/scripts/events/tosort/UnendingJourney.lua +++ b/resources/scripts/events/tosort/UnendingJourney.lua @@ -5,17 +5,21 @@ SCENE_SHOW_MENU = 00000 SCENE_PLAY_CUTSCENE = 00001 function onTalk(target, player) - -- you cannot consult, which is good because we don't know how to implement this anyway player:play_scene(target, EVENT_ID, SCENE_SHOW_MENU, 8192, {0}) end function onReturn(scene, results, player) - -- A result of zero means the user exited the menu without playing anything. - if scene == 0 and results[1] ~= 0 then + local NO_SCENE = 0 + local decision = results[1] + + if scene == SCENE_SHOW_MENU and decision ~= NO_SCENE then -- TODO: we need to switch the player into viewingcutscene online status (on the Rust side?) player:play_scene(player.id, EVENT_ID, SCENE_PLAY_CUTSCENE, SET_BASE, results) - return - -- TODO: we cannot nest cutscenes right now, but control should return back to the UEJ menu when a cutscene finishes + elseif scene == SCENE_PLAY_CUTSCENE then + --[[ TODO: How can we make it fade back in smoothly after the cutscene finishes? + Could it be related to ActorControl(ViewingCutscene)? ]] + player:play_scene(player.id, EVENT_ID, SCENE_SHOW_MENU, 8192, {1}) + else + player:finish_event(EVENT_ID) end - player:finish_event(EVENT_ID) end