From 6954dc33290d086cf64ec90afb6d2c0491bd699b Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 8 Mar 2024 15:26:02 +0100 Subject: [PATCH] Make announcer play nice with variable playback speed --- FreshShit/PersonalAnnouncer/init.lua | 8 +++++++- FreshShit/_GlobalSoundPlayer/event.lua | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/FreshShit/PersonalAnnouncer/init.lua b/FreshShit/PersonalAnnouncer/init.lua index ca321c0..8154503 100644 --- a/FreshShit/PersonalAnnouncer/init.lua +++ b/FreshShit/PersonalAnnouncer/init.lua @@ -10,8 +10,9 @@ aura_env.debug = false BaseCooldown = { ---@param id number ---@param name string + ---@param playbackSpeed number? ---@return BaseCooldown - new = function(id, name) + new = function(id, name, playbackSpeed) local self = setmetatable({}, { __index = BaseCooldown }) @@ -20,6 +21,11 @@ BaseCooldown = { name = string.gsub(name, " ", "_") name = string.gsub(name, "'", "") self.filename = name + if playbackSpeed ~= nil then + self.filename = string.format("1x\\%s", self.filename) + else + self.filename = string.format("%dx\\%s", playbackSpeed, self.filename) + end self.isOnCooldown = false self.announced = false self.remaining = 0 diff --git a/FreshShit/_GlobalSoundPlayer/event.lua b/FreshShit/_GlobalSoundPlayer/event.lua index c564593..d682d15 100644 --- a/FreshShit/_GlobalSoundPlayer/event.lua +++ b/FreshShit/_GlobalSoundPlayer/event.lua @@ -2,6 +2,6 @@ function(e, file) local success = PlaySoundFile(file, "Master") if not success then - print(string.format("Failed to play sound file at %s", file)) + if aura_env.debug then print(string.format("Failed to play sound file at %s", file)) end end end \ No newline at end of file