All pastes #363988 Raw Edit

Rick

public text v1 · immutable
#363988 ·published 2007-02-19 21:13 UTC
rendered paste body
function ReceiveChat(sender, msg)
    sender = sender or "nil sender"
    if type(msg) == 'string' then
        msg = { text = msg }
    elseif type(msg) != 'table' then
        msg = { text = repr(msg) }
    end
    if msg.tauntid then
        if Prefs.GetOption("mp_taunt_head_enabled") == 'true' then
            local taunt = tauntFile[msg.taunthead][msg.tauntid]
            if taunt and taunt['vid'] then
                import('/lua/modules/ui/game/missiontext.lua').PlayMFDMovie({'/movies/'..taunt['vid'], taunt['bank'], taunt['cue'],},
                                                                            {"["..sender.."] "..LOC(taunt['text'])},
                                                                            true)
            end
        end
    else
        local text = '['..sender
        if msg.to then
            text = text .. ' to ' .. LOC(msg.to)
        end
        text = text .. '] ' .. msg.text
        chatBottomLine = table.getsize(chatHistory) + 1
        UpdateChat(text)
        local color = 'ffffffff'
        local armies = GetArmiesTable().armiesTable
        for i, v in armies do
            if v.nickname == sender then
                color = v.color
                break
            end
        end
        TransmissionLog.AddChatEntry({name = sender, text = msg.text, color = color})
    end
end