Make announcer play nice with variable playback speed
This commit is contained in:
		@@ -10,8 +10,9 @@ aura_env.debug = false
 | 
				
			|||||||
BaseCooldown = {
 | 
					BaseCooldown = {
 | 
				
			||||||
	---@param id number
 | 
						---@param id number
 | 
				
			||||||
	---@param name string
 | 
						---@param name string
 | 
				
			||||||
 | 
						---@param playbackSpeed number?
 | 
				
			||||||
	---@return BaseCooldown
 | 
						---@return BaseCooldown
 | 
				
			||||||
	new = function(id, name)
 | 
						new = function(id, name, playbackSpeed)
 | 
				
			||||||
		local self = setmetatable({}, {
 | 
							local self = setmetatable({}, {
 | 
				
			||||||
			__index = BaseCooldown
 | 
								__index = BaseCooldown
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
@@ -20,6 +21,11 @@ BaseCooldown = {
 | 
				
			|||||||
		name = string.gsub(name, " ", "_")
 | 
							name = string.gsub(name, " ", "_")
 | 
				
			||||||
		name = string.gsub(name, "'", "")
 | 
							name = string.gsub(name, "'", "")
 | 
				
			||||||
		self.filename = 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.isOnCooldown = false
 | 
				
			||||||
		self.announced = false
 | 
							self.announced = false
 | 
				
			||||||
		self.remaining = 0
 | 
							self.remaining = 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,6 @@
 | 
				
			|||||||
function(e, file)
 | 
					function(e, file)
 | 
				
			||||||
	local success = PlaySoundFile(file, "Master")
 | 
						local success = PlaySoundFile(file, "Master")
 | 
				
			||||||
	if not success then
 | 
						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
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
		Reference in New Issue
	
	Block a user