From b90951d8febaff434ff5f51922174c830cf8cfa1 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 12 Sep 2024 19:37:17 +0200 Subject: [PATCH] end the tour when deleted --- src/core/tour/TourManager.ttslua | 7 +++++++ src/core/tour/TourStarter.ttslua | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/core/tour/TourManager.ttslua b/src/core/tour/TourManager.ttslua index 3e7d0d1d..b5965859 100644 --- a/src/core/tour/TourManager.ttslua +++ b/src/core/tour/TourManager.ttslua @@ -106,6 +106,13 @@ do end, 0.3) end + -- Ends the tour for all players + function TourManager.stopTourForAll() + for playerColor, data in pairs(tourState) do + stopTour(Player[playerColor]) + end + end + -- Updates the card UI for the script at the current index, moves the camera to the proper -- position, and shows the card. ---@param playerColor string Player color to show the current card for diff --git a/src/core/tour/TourStarter.ttslua b/src/core/tour/TourStarter.ttslua index cc8a9ee7..0891425a 100644 --- a/src/core/tour/TourStarter.ttslua +++ b/src/core/tour/TourStarter.ttslua @@ -32,3 +32,7 @@ end function deleteStarter(_, _, _) self.destruct() end + +function onDestroy() + tourManager.stopTourForAll() +end