All unsent echo messages will be sent to the chat, when it will be available
This commit is contained in:
parent
905d1348b3
commit
6bdc4a280b
3 changed files with 19 additions and 4 deletions
|
@ -20,6 +20,7 @@ lua = [
|
|||
"scripts/mods/vmf/modules/dev_console"
|
||||
"scripts/mods/vmf/modules/mods"
|
||||
"scripts/mods/vmf/modules/hooks"
|
||||
"scripts/mods/vmf/modules/chat"
|
||||
"scripts/mods/vmf/modules/settings"
|
||||
"scripts/mods/vmf/modules/gui"
|
||||
"scripts/mods/vmf/modules/vmf_options_view"
|
||||
|
|
|
@ -42,11 +42,14 @@ VMFMod.echo = function (self, message, show_mod_name)
|
|||
|
||||
print("[ECHO][" .. self._name .. "] " .. message)
|
||||
|
||||
if Managers.chat and Managers.chat:has_channel(1) then
|
||||
if show_mod_name then
|
||||
message = "[" .. self._name .. "] " .. message
|
||||
end
|
||||
|
||||
if Managers.chat and Managers.chat:has_channel(1) then
|
||||
Managers.chat:add_local_system_message(1, message, true)
|
||||
else
|
||||
table.insert(vmf.unsended_chat_messages, message)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -75,11 +78,17 @@ VMFMod.dofile = function (self, script_path)
|
|||
return value
|
||||
end
|
||||
-- ####################################################################################################################
|
||||
-- ##### Event functions ##############################################################################################
|
||||
-- ##### VMF Initialization ###########################################################################################
|
||||
-- ####################################################################################################################
|
||||
|
||||
vmf = new_mod("VMF")
|
||||
|
||||
vmf.unsended_chat_messages = {}
|
||||
|
||||
-- ####################################################################################################################
|
||||
-- ##### Event functions ##############################################################################################
|
||||
-- ####################################################################################################################
|
||||
|
||||
-- call 'unload' for every mod which definded it
|
||||
vmf.mods_unload = function()
|
||||
for _, mod_name in pairs(MODS_UNLOADING_ORDER) do --@TODO: maybe ipairs?
|
||||
|
|
|
@ -4,6 +4,7 @@ return{
|
|||
dofile("scripts/mods/vmf/modules/dev_console")
|
||||
dofile("scripts/mods/vmf/modules/mods")
|
||||
dofile("scripts/mods/vmf/modules/hooks")
|
||||
dofile("scripts/mods/vmf/modules/chat")
|
||||
dofile("scripts/mods/vmf/modules/gui")
|
||||
dofile("scripts/mods/vmf/modules/settings")
|
||||
dofile("scripts/mods/vmf/modules/vmf_options_view")
|
||||
|
@ -38,5 +39,9 @@ return{
|
|||
print("VMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state))
|
||||
object.vmf.mods_game_state_changed(status, state)
|
||||
object.vmf.save_unsaved_settings_to_file()
|
||||
|
||||
if status == "exit" and state == "StateTitleScreen" then
|
||||
object.vmf.hook_chat_manager()
|
||||
end
|
||||
end
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue