Forgot to add chat.lua to commit with unsent messages
This commit is contained in:
parent
aad310e558
commit
31b69224b1
1 changed files with 32 additions and 0 deletions
32
vmf_source/scripts/mods/vmf/modules/chat.lua
Normal file
32
vmf_source/scripts/mods/vmf/modules/chat.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local vmf = get_mod("VMF")
|
||||
|
||||
-- ####################################################################################################################
|
||||
-- ##### Hooks Functions ##############################################################################################
|
||||
-- ####################################################################################################################
|
||||
|
||||
-- HOOK: [ChatManager.register_channel]
|
||||
local hook_send_unsent_messages = function (func, self, channel_id, members_func)
|
||||
|
||||
func(self, channel_id, members_func)
|
||||
|
||||
if channel_id == 1 then
|
||||
for _, message in ipairs(vmf.unsended_chat_messages) do
|
||||
self:add_local_system_message(1, message, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ####################################################################################################################
|
||||
-- ##### Event functions ##############################################################################################
|
||||
-- ####################################################################################################################
|
||||
|
||||
-- at the moment of loading VMF Chat Manager is not initialized yet,
|
||||
-- so it should be hooked with some delay
|
||||
vmf.hook_chat_manager = function()
|
||||
|
||||
if not vmf.is_chat_manager_hooked then
|
||||
vmf.is_chat_manager_hooked = true
|
||||
|
||||
vmf:hook("ChatManager.register_channel", hook_send_unsent_messages)
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue