From 2826bd617a21ed3b19a41dd7fd81625990ea7d2a Mon Sep 17 00:00:00 2001 From: Proddy Date: Mon, 8 Jul 2024 18:37:19 +0100 Subject: [PATCH] Update Dialog.lua --- Randomiser/Resources/Modules/Audio/Dialog.lua | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Randomiser/Resources/Modules/Audio/Dialog.lua b/Randomiser/Resources/Modules/Audio/Dialog.lua index 4e8c7d8..47b4d01 100644 --- a/Randomiser/Resources/Modules/Audio/Dialog.lua +++ b/Randomiser/Resources/Modules/Audio/Dialog.lua @@ -126,7 +126,25 @@ local function HandleDialog(Path, Contents) return false end -RandomDialog:AddGenericHandler("*c_*_*_convinit*.rsd", HandleDialog) +RandomDialog:AddSPTHandler("sound/scripts/dialog*.spt", function(Path, SPT) + local DialogFileCount = 0 + for daSoundResourceData in SPT:GetClasses("daSoundResourceData") do + for filename in daSoundResourceData:GetMethods(false, "AddFilename") do + local filenameWithoutExtension = RemoveFileExtension(filename.Parameters[1]) + RandomDialog:AddGenericHandler(filenameWithoutExtension .. ".rsd", HandleDialog) + RandomDialog:AddGenericHandler(filenameWithoutExtension .. ".ogg", HandleDialog) + RandomDialog:AddGenericHandler(filenameWithoutExtension .. ".flac", HandleDialog) + + DialogFileCount = DialogFileCount + 1 + end + end + + print("Added handlers for " .. DialogFileCount .. " dialog files.") + + return false +end) + +--[[RandomDialog:AddGenericHandler("*c_*_*_convinit*.rsd", HandleDialog) RandomDialog:AddGenericHandler("*c_*_*_noboxconv*.rsd", HandleDialog) RandomDialog:AddGenericHandler("*c_*_*_tutorial*.rsd", HandleDialog) @@ -200,6 +218,6 @@ RandomDialog:AddGenericHandler("*w_ridereply*.rsd", HandleDialog) RandomDialog:AddGenericHandler("*w_springboard*.rsd", HandleDialog) RandomDialog:AddGenericHandler("*w_tail*.rsd", HandleDialog) RandomDialog:AddGenericHandler("*w_time*.rsd", HandleDialog) -RandomDialog:AddGenericHandler("*w_turbo*.rsd", HandleDialog) +RandomDialog:AddGenericHandler("*w_turbo*.rsd", HandleDialog)]] return RandomDialog \ No newline at end of file