-- Emote.lua

-- Cooldown tracking
local lastEmoteTime = 0
local COOLDOWN_SECONDS = 5 -- Cooldown in seconds to prevent emote spam

-- Play the incoming message emote
function Buzzer_PlayIncomingEmote(message)
    -- NEW: Check if emotes are muted
    if BuzzerSettings.emoteMuted then return end

    local now = GetTime()
    if now - lastEmoteTime < COOLDOWN_SECONDS then
        return
    end

    -- Ensure we have a message to display
    if not message or message == "" then
        return
    end

    -- Get the player's current radio model name
    local modelName = "Buzzer" -- Default name
    local modelIndex = BuzzerSettings and BuzzerSettings.model or 1
    if Buzzer_Models and Buzzer_Models[modelIndex] and Buzzer_Models[modelIndex].name then
        modelName = Buzzer_Models[modelIndex].name
    end

    -- Construct the new, static emote string
    local emoteText = "'s " .. modelName .. ' beeps and a voice is heard saying "' .. message .. '"'

    -- Send the emote to the chat
    SendChatMessage(emoteText, "EMOTE")
    lastEmoteTime = now
end