diff --git a/dmf/dmf.mod b/dmf/dmf.mod index 3111913..75324e0 100644 --- a/dmf/dmf.mod +++ b/dmf/dmf.mod @@ -1,5 +1,5 @@ return { run = function() - return Mods.file.dofile("dmf/scripts/mods/vmf/vmf_loader") + return Mods.file.dofile("dmf/scripts/mods/dmf/dmf_loader") end } diff --git a/dmf/localization/vmf.lua b/dmf/localization/dmf.lua similarity index 96% rename from dmf/localization/vmf.lua rename to dmf/localization/dmf.lua index 70158e5..7947aee 100644 --- a/dmf/localization/vmf.lua +++ b/dmf/localization/dmf.lua @@ -4,17 +4,17 @@ return { es = "Configuración de mods", ru = "Настройки модов", }, - open_vmf_options = { + open_dmf_options = { en = "Open Options Menu", es = "Abrir el menu de configuración", ru = "Открыть меню настроек", }, - open_vmf_options_description = { + open_dmf_options_description = { en = "Keybind for opening and closing mods options menu.", es = "Atajo para abrir/cerrar el menu de configuración de mods.", ru = "Клавиша / сочетание клавиш для открытия и закрытия меню настроек модов.", }, - vmf_options_scrolling_speed = { + dmf_options_scrolling_speed = { en = "Options Menu Scrolling Speed", es = "Velocidad de desplazamiento en el menu", ru = "Скорость прокрутки меню", @@ -38,9 +38,9 @@ return { ru = "Режим разработчика", }, developer_mode_description = { - en = "Allows you to reload VMF and mods (CTRL+SHIFT+R), gives you access to some debug features.", + en = "Allows you to reload DMF and mods (CTRL+SHIFT+R), gives you access to some debug features.", es = "Permite recargar los mods (CTRL+SHIFT+R) y configurar herramientas de depuración.", - ru = "Позволяет перезагружать VMF и моды (CTRL+SHIFT+R), даёт доступ к инструментам отладки.", + ru = "Позволяет перезагружать DMF и моды (CTRL+SHIFT+R), даёт доступ к инструментам отладки.", }, show_developer_console = { en = "Show Developer Console", @@ -63,11 +63,11 @@ return { ru = "Логирование сетевых вызовов", }, show_network_debug_info_description = { - en = "Log all the VMF network calls and all the data transfered with them.\n\n" .. + en = "Log all the DMF network calls and all the data transfered with them.\n\n" .. "The method 'info' is used for the logging.", - es = "Escribe en el registro todas las llamadas de red (RPCs) que se ejecuten a través de VMF.\n\n" .. + es = "Escribe en el registro todas las llamadas de red (RPCs) que se ejecuten a través de DMF.\n\n" .. "Esta información se registra en el nivel 'info'.", - ru = "Логирование всех сетевых вызовов VMF и передаваемых с ними данных.\n\n" .. + ru = "Логирование всех сетевых вызовов DMF и передаваемых с ними данных.\n\n" .. "Для логирования используется метод 'info'.", }, log_ui_renderers_info = { @@ -177,9 +177,9 @@ return { ru = "Сохранять историю ввода между сеансами игры", }, chat_history_save_description = { - en = "Your chat input history will be saved even after reloading your game (or just VMF).", - es = "El texto que introduzcas en el chat se guardara incluso al recargar el juego (o solo VMF)", - ru = "Когда игрок выключает игру (или перезагружает VMF), VMF cохраняет историю ввода в файл настроек, чтобы загрузить её при следующем запуске игры.", + en = "Your chat input history will be saved even after reloading your game (or just DMF).", + es = "El texto que introduzcas en el chat se guardara incluso al recargar el juego (o solo DMF)", + ru = "Когда игрок выключает игру (или перезагружает DMF), DMF cохраняет историю ввода в файл настроек, чтобы загрузить её при следующем запуске игры.", }, chat_history_buffer_size = { en = "Input History Buffer Size", diff --git a/dmf/scripts/mods/dmf/dmf_loader.lua b/dmf/scripts/mods/dmf/dmf_loader.lua new file mode 100644 index 0000000..e7af5cf --- /dev/null +++ b/dmf/scripts/mods/dmf/dmf_loader.lua @@ -0,0 +1,112 @@ +local dmf + +-- Global variable indicating which version of the game is currently running +VT1 = false + +-- Native mod object used by Fatshark mod manager +local dmf_mod_object = {} + +-- Global method to load a file through iowith a return +local mod_dofile = Mods.file.dofile + +-- ##################################################################################################################### +-- ##### Initialization ################################################################################################ +-- ##################################################################################################################### + +function dmf_mod_object:init() + mod_dofile("dmf/scripts/mods/dmf/modules/dmf_mod_data") + mod_dofile("dmf/scripts/mods/dmf/modules/dmf_mod_manager") + --mod_dofile("dmf/scripts/mods/dmf/modules/dmf_dummy") + mod_dofile("dmf/scripts/mods/dmf/modules/dmf_package_manager") + mod_dofile("dmf/scripts/mods/dmf/modules/core/safe_calls") + mod_dofile("dmf/scripts/mods/dmf/modules/core/events") + mod_dofile("dmf/scripts/mods/dmf/modules/core/settings") + mod_dofile("dmf/scripts/mods/dmf/modules/core/logging") + mod_dofile("dmf/scripts/mods/dmf/modules/core/misc") + mod_dofile("dmf/scripts/mods/dmf/modules/core/persistent_tables") + mod_dofile("dmf/scripts/mods/dmf/modules/debug/dev_console") + mod_dofile("dmf/scripts/mods/dmf/modules/debug/table_dump") + mod_dofile("dmf/scripts/mods/dmf/modules/core/hooks") + mod_dofile("dmf/scripts/mods/dmf/modules/core/require") + mod_dofile("dmf/scripts/mods/dmf/modules/core/toggling") + mod_dofile("dmf/scripts/mods/dmf/modules/core/keybindings") + mod_dofile("dmf/scripts/mods/dmf/modules/core/chat") + mod_dofile("dmf/scripts/mods/dmf/modules/core/localization") + mod_dofile("dmf/scripts/mods/dmf/modules/core/options") + mod_dofile("dmf/scripts/mods/dmf/modules/core/network") + mod_dofile("dmf/scripts/mods/dmf/modules/core/commands") + mod_dofile("dmf/scripts/mods/dmf/modules/gui/custom_textures") + mod_dofile("dmf/scripts/mods/dmf/modules/gui/custom_views") + mod_dofile("dmf/scripts/mods/dmf/modules/ui/chat/chat_actions") + mod_dofile("dmf/scripts/mods/dmf/modules/ui/options/mod_options") + mod_dofile("dmf/scripts/mods/dmf/modules/dmf_options") + mod_dofile("dmf/scripts/mods/dmf/modules/core/mutators/mutators_manager") + + dmf = get_mod("DMF") + dmf.delayed_chat_messages_hook() + dmf:hook(ModManager, "destroy", function(func, ...) + dmf.mods_unload_event(true) + func(...) + end) +end + +-- ##################################################################################################################### +-- ##### Events ######################################################################################################## +-- ##################################################################################################################### + +function dmf_mod_object:update(dt) + dmf.update_package_manager() + dmf.mods_update_event(dt) + dmf.check_keybinds() + dmf.execute_queued_chat_command() + + if not dmf.all_mods_were_loaded and Managers.mod._state == "done" then + + dmf.generate_keybinds() + dmf.initialize_dmf_options_view() + dmf.create_network_dictionary() + dmf.ping_dmf_users() + + dmf.all_mods_loaded_event() + + dmf.all_mods_were_loaded = true + end +end + + +function dmf_mod_object:on_unload() + print("DMF:ON_UNLOAD()") + dmf.save_chat_history() + dmf.save_unsaved_settings_to_file() + dmf.destroy_command_gui() +end + + +function dmf_mod_object:on_reload() + print("DMF:ON_RELOAD()") + dmf.mods_unload_event(false) + dmf.remove_custom_views() + dmf.unload_all_resource_packages() + dmf.hooks_unload() + dmf.reset_guis() + dmf.destroy_command_gui() +end + + +function dmf_mod_object:on_game_state_changed(status, state) + print("DMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state)) + dmf.mods_game_state_changed_event(status, state) + dmf.save_unsaved_settings_to_file() + dmf.apply_delayed_hooks(status, state) + dmf.destroy_command_gui() + + if status == "enter" and state == "StateIngame" then + dmf.create_keybinds_input_service() + end +end + +-- ##################################################################################################################### +-- ##### Return ######################################################################################################## +-- ##################################################################################################################### + +return dmf_mod_object diff --git a/dmf/scripts/mods/vmf/modules/core/chat.lua b/dmf/scripts/mods/dmf/modules/core/chat.lua similarity index 86% rename from dmf/scripts/mods/vmf/modules/core/chat.lua rename to dmf/scripts/mods/dmf/modules/core/chat.lua index dea76e4..709df46 100644 --- a/dmf/scripts/mods/vmf/modules/core/chat.lua +++ b/dmf/scripts/mods/dmf/modules/core/chat.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- ##################################################################################################################### -- ##### Local functions ############################################################################################### @@ -17,7 +17,7 @@ local function broadcast_message(message, channel_tag) end -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### --[[ @@ -25,7 +25,7 @@ end * message [string]: message to broadcast * channel_tag [string]: tag of target chat channel --]] -function VMFMod:chat_broadcast(message, channel_tag) +function DMFMod:chat_broadcast(message, channel_tag) broadcast_message(message, channel_tag) end @@ -34,7 +34,7 @@ end * peer_id [peer_id]: peer_id of the player who will recieve the message (can't be host's peer_id) * message [string] : message to send --]] -function VMFMod:chat_whisper(peer_id, message) +function DMFMod:chat_whisper(peer_id, message) -- @TODO: Rewrite for Darktide - vmf:notify("Chat whisper is not yet implemented!") + dmf:notify("Chat whisper is not yet implemented!") end diff --git a/dmf/scripts/mods/vmf/modules/core/commands.lua b/dmf/scripts/mods/dmf/modules/core/commands.lua similarity index 80% rename from dmf/scripts/mods/vmf/modules/core/commands.lua rename to dmf/scripts/mods/dmf/modules/core/commands.lua index 0b8f670..c605dd9 100644 --- a/dmf/scripts/mods/vmf/modules/core/commands.lua +++ b/dmf/scripts/mods/dmf/modules/core/commands.lua @@ -1,9 +1,9 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _commands = {} -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### --[[ @@ -12,10 +12,10 @@ local _commands = {} * command_description [string] : (optional) command's decription; can be multiline * command_function [function]: function, that will be executed, when chat command is activated; supports arguments --]] -function VMFMod:command(command_name, command_description, command_function) - if vmf.check_wrong_argument_type(self, "command", "command_name", command_name, "string") or - vmf.check_wrong_argument_type(self, "command", "command_description", command_description, "string", "nil") or - vmf.check_wrong_argument_type(self, "command", "command_function", command_function, "function") +function DMFMod:command(command_name, command_description, command_function) + if dmf.check_wrong_argument_type(self, "command", "command_name", command_name, "string") or + dmf.check_wrong_argument_type(self, "command", "command_description", command_description, "string", "nil") or + dmf.check_wrong_argument_type(self, "command", "command_function", command_function, "function") then return end @@ -47,8 +47,8 @@ end Removes registered chat command. * command_name [string]: command's name --]] -function VMFMod:command_remove(command_name) - if vmf.check_wrong_argument_type(self, "command_remove", "command_name", command_name, "string") then +function DMFMod:command_remove(command_name) + if dmf.check_wrong_argument_type(self, "command_remove", "command_name", command_name, "string") then return end @@ -60,8 +60,8 @@ end Disables registered chat command so it can be enabled later. * command_name [string]: command's name --]] -function VMFMod:command_disable(command_name) - if vmf.check_wrong_argument_type(self, "command_disable", "command_name", command_name, "string") then +function DMFMod:command_disable(command_name) + if dmf.check_wrong_argument_type(self, "command_disable", "command_name", command_name, "string") then return end @@ -75,8 +75,8 @@ end Enables disabled chat command. * command_name [string]: command's name --]] -function VMFMod:command_enable(command_name) - if vmf.check_wrong_argument_type(self, "command_enable", "command_name", command_name, "string") then +function DMFMod:command_enable(command_name) + if dmf.check_wrong_argument_type(self, "command_enable", "command_name", command_name, "string") then return end @@ -89,7 +89,7 @@ end --[[ Removes all registered chat commands for the mod. --]] -function VMFMod:remove_all_commands() +function DMFMod:remove_all_commands() for command_name, command_data in pairs(_commands) do if command_data.mod == self then _commands[command_name] = nil @@ -101,7 +101,7 @@ end --[[ Disables all registered chat commands for the mod. --]] -function VMFMod:disable_all_commands() +function DMFMod:disable_all_commands() for _, command_data in pairs(_commands) do if command_data.mod == self then command_data.is_enabled = false @@ -113,7 +113,7 @@ end --[[ Enables all disabled chat commands for the mod. --]] -function VMFMod:enable_all_commands() +function DMFMod:enable_all_commands() for _, command_data in pairs(_commands) do if command_data.mod == self then command_data.is_enabled = true @@ -122,13 +122,13 @@ function VMFMod:enable_all_commands() end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -- Returns a table with command data entries whose name contains 'name_contains' string. If `exact_match` is set -- to 'true', it will return a table with only one command, whose name fully matches 'name_contains' string. Returns -- empty table if nothing is found. -function vmf.get_commands_list(name_contains, exact_match) +function dmf.get_commands_list(name_contains, exact_match) name_contains = name_contains:lower() local commands_list = {} for command_name, command_data in pairs(_commands) do @@ -150,12 +150,12 @@ end -- Safely executes function bound to a command with a set name -function vmf.run_command(command_name, ...) +function dmf.run_command(command_name, ...) local command_data = _commands[command_name] if command_data then local error_prefix = "(commands) " .. tostring(command_name) - vmf.safe_call_nr(command_data.mod, error_prefix, command_data.exec_function, ...) + dmf.safe_call_nr(command_data.mod, error_prefix, command_data.exec_function, ...) else - vmf:error("(commands): command '%s' wasn't found.", command_name) -- Should never see this + dmf:error("(commands): command '%s' wasn't found.", command_name) -- Should never see this end end diff --git a/dmf/scripts/mods/vmf/modules/core/events.lua b/dmf/scripts/mods/dmf/modules/core/events.lua similarity index 81% rename from dmf/scripts/mods/vmf/modules/core/events.lua rename to dmf/scripts/mods/dmf/modules/core/events.lua index 7001e03..dd9bb8c 100644 --- a/dmf/scripts/mods/vmf/modules/core/events.lua +++ b/dmf/scripts/mods/dmf/modules/core/events.lua @@ -1,7 +1,7 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -local _mods = vmf.mods -local _mods_unloading_order = vmf.mods_unloading_order +local _mods = dmf.mods +local _mods_unloading_order = dmf.mods_unloading_order -- ##################################################################################################################### -- ##### Local functions ############################################################################################### @@ -10,12 +10,12 @@ local _mods_unloading_order = vmf.mods_unloading_order local function run_event(mod, event_name, ...) local event = mod[event_name] if event then - vmf.safe_call_nr(mod, "(event) " .. event_name, event, ...) + dmf.safe_call_nr(mod, "(event) " .. event_name, event, ...) end end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### --[[ @@ -24,7 +24,7 @@ end Is called every time the game unloads mods, which happends in 2 cases: mods reloading and exiting the game. * exit_game [boolean]: 'true' if it's unloading before game exit --]] -function vmf.mods_unload_event(exit_game) +function dmf.mods_unload_event(exit_game) local event_name = "on_unload" @@ -41,7 +41,7 @@ end Is called every game tick. * dt [float]: time passed since the last 'update' call (measured in seconds, but obvisouly, it never has integer part) --]] -function vmf.mods_update_event(dt) +function dmf.mods_update_event(dt) local event_name = "update" @@ -57,9 +57,9 @@ end Is called every time game enters or exits game state. * status [string]: "enter" or "exit" * state_name [string]: readable state name, which you can get by searching game log files - for "VMF:ON_GAME_STATE_CHANGED()" string after launching and closing the game with active VMF + for "DMF:ON_GAME_STATE_CHANGED()" string after launching and closing the game with active DMF --]] -function vmf.mods_game_state_changed_event(status, state_name) +function dmf.mods_game_state_changed_event(status, state_name) local event_name = "on_game_state_changed" @@ -73,10 +73,10 @@ end EVENT: on_setting_changed (setting_id) Is called on `mod:set` call with the 3rd parameter set to 'true'. All the mod's settings changes done under - the VMF's hood call this event. + the DMF's hood call this event. * setting_id [string]: name of the setting that was changed --]] -function vmf.mod_setting_changed_event(mod, setting_id) +function dmf.mod_setting_changed_event(mod, setting_id) local event_name = "on_setting_changed" @@ -91,7 +91,7 @@ end in their 'mod_data' to 'true'. * initial_call [boolean]: 'true' if this is the first call right after mod's initialization --]] -function vmf.mod_enabled_event(mod, initial_call) +function dmf.mod_enabled_event(mod, initial_call) local event_name = "on_enabled" @@ -106,7 +106,7 @@ end in their 'mod_data' to 'true'. * initial_call [boolean]: 'true' if this is the first call right after mod's initialization --]] -function vmf.mod_disabled_event(mod, initial_call) +function dmf.mod_disabled_event(mod, initial_call) local event_name = "on_disabled" @@ -121,7 +121,7 @@ end only for mods which registered at least 1 network call. * player [player]: player object of the player who joined the game --]] -function vmf.mod_user_joined_the_game(mod, player) +function dmf.mod_user_joined_the_game(mod, player) local event_name = "on_user_joined" @@ -136,7 +136,7 @@ end called only for mods which registered at least 1 network call. * player [player]: player object of the player who is about to leave the game --]] -function vmf.mod_user_left_the_game(mod, player) +function dmf.mod_user_left_the_game(mod, player) local event_name = "on_user_left" @@ -147,9 +147,9 @@ end --[[ EVENT: on_all_mods_loaded () - Is called when Vermintide mod manager finishes mods loading. + Is called when Darktide mod manager finishes mods loading. --]] -function vmf.all_mods_loaded_event() +function dmf.all_mods_loaded_event() local event_name = "on_all_mods_loaded" diff --git a/dmf/scripts/mods/vmf/modules/core/hooks.lua b/dmf/scripts/mods/dmf/modules/core/hooks.lua similarity index 92% rename from dmf/scripts/mods/vmf/modules/core/hooks.lua rename to dmf/scripts/mods/dmf/modules/core/hooks.lua index b68bc09..2c037a1 100644 --- a/dmf/scripts/mods/vmf/modules/core/hooks.lua +++ b/dmf/scripts/mods/dmf/modules/core/hooks.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- #################################################################################################################### -- ##### Locals and Variables ######################################################################################### @@ -8,7 +8,7 @@ local vmf = get_mod("VMF") local HOOK_TYPES = { hook = 1, hook_safe = 2, - hook_origin = 3 + hook_origin = 3, } -- Constants to ease on table lookups when not needed @@ -163,7 +163,7 @@ local function create_specialized_hook(mod, unique_id, hook_type) elseif hook_type == HOOK_TYPE_SAFE then func = function(...) if hook_data.active then - vmf.safe_call_nr(mod, "(safe_hook)", hook_data.handler, ...) + dmf.safe_call_nr(mod, "(safe_hook)", hook_data.handler, ...) end end end @@ -241,7 +241,7 @@ end -- #################################################################################################################### -- ##### GENERIC API ################################################################################################## -- #################################################################################################################### --- Singular functions that works on a generic basis so the VMFMod API can be tailored for user simplicity. +-- Singular functions that works on a generic basis so the DMFMod API can be tailored for user simplicity. -- These functions are mostly used for type-checking before sending the data to the appropriate internal functions. -- Valid styles: @@ -254,9 +254,9 @@ end -- mod, string (method), function (handler), nil, string (func_name) local function generic_hook(mod, obj, method, handler, func_name) - if vmf.check_wrong_argument_type(mod, func_name, "obj", obj, "string", "table") or - vmf.check_wrong_argument_type(mod, func_name, "method", method, "string", "function") or - vmf.check_wrong_argument_type(mod, func_name, "handler", handler, "function", "nil") + if dmf.check_wrong_argument_type(mod, func_name, "obj", obj, "string", "table") or + dmf.check_wrong_argument_type(mod, func_name, "method", method, "string", "function") or + dmf.check_wrong_argument_type(mod, func_name, "handler", handler, "function", "nil") then return end @@ -314,8 +314,8 @@ end local function generic_hook_toggle(mod, obj, method, enabled_state) local func_name = (enabled_state and "hook_enable") or "hook_disable" - if vmf.check_wrong_argument_type(mod, func_name, "obj", obj, "string", "table") or - vmf.check_wrong_argument_type(mod, func_name, "method", method, "string", "nil") then + if dmf.check_wrong_argument_type(mod, func_name, "obj", obj, "string", "table") or + dmf.check_wrong_argument_type(mod, func_name, "method", method, "string", "nil") then return end @@ -362,14 +362,14 @@ local function toggle_all_hooks_for_mod(mod, enabled_state) end -- #################################################################################################################### --- ##### VMFMod ####################################################################################################### +-- ##### DMFMod ####################################################################################################### -- #################################################################################################################### -- :hook_safe() provides callback after a function is called. You have no control over the execution of the -- original function, nor can you change its return values, making it much safer to use. -- The handler is never given the a "func" parameter. -- These will always be executed the original function and the hook chain. -function VMFMod:hook_safe(obj, method, handler) +function DMFMod:hook_safe(obj, method, handler) return generic_hook(self, obj, method, handler, "hook_safe") end @@ -377,7 +377,7 @@ end -- and control its execution. All hooks on the same function will be part of a chain, with the -- original function at the end. Your handler has to call the next function in the chain manually. -- The chain of event is determined by mod load order. -function VMFMod:hook(obj, method, handler) +function DMFMod:hook(obj, method, handler) return generic_hook(self, obj, method, handler, "hook") end @@ -387,7 +387,7 @@ end -- The handler is never given the a "func" parameter. -- This there is a limit of a single origin hook for any given function. -- This should only be used as a last resort due to its limitation and its potential to break the game if not careful. -function VMFMod:hook_origin(obj, method, handler) +function DMFMod:hook_origin(obj, method, handler) return generic_hook(self, obj, method, handler, "hook_origin") end @@ -396,19 +396,19 @@ end -- and control its execution. All hooks on the same function will be part of a chain, with the -- original function at the end. Your handler has to call the next function in the chain manually. -- The chain of event is determined by mod load order. -function VMFMod:hook_file(obj_str, method_str, handler) +function DMFMod:hook_file(obj_str, method_str, handler) -- Add hook create function to list for the file _hooks_by_file[obj_str] = _hooks_by_file[obj_str] or {} local hook_create_func = function(this_filepath, this_index) local dynamic_obj = - "vmf:get_require_store(\"" .. this_filepath .. "\")[" .. tostring(this_index) .. "]" + "dmf:get_require_store(\"" .. this_filepath .. "\")[" .. tostring(this_index) .. "]" return generic_hook(self, dynamic_obj, method_str, handler, "hook") end table.insert(_hooks_by_file[obj_str], hook_create_func) -- Add the new hook to every instance of the file - local all_file_instances = vmf:get_require_store(obj_str) + local all_file_instances = dmf:get_require_store(obj_str) if all_file_instances then for i, item in ipairs(all_file_instances) do if item then @@ -419,28 +419,28 @@ function VMFMod:hook_file(obj_str, method_str, handler) end -- Enable/disable functions for all hook types: -function VMFMod:hook_enable(obj, method) +function DMFMod:hook_enable(obj, method) generic_hook_toggle(self, obj, method, true) end -function VMFMod:hook_disable(obj, method) +function DMFMod:hook_disable(obj, method) generic_hook_toggle(self, obj, method, false) end -function VMFMod:enable_all_hooks() +function DMFMod:enable_all_hooks() toggle_all_hooks_for_mod(self, true) end -function VMFMod:disable_all_hooks() +function DMFMod:disable_all_hooks() toggle_all_hooks_for_mod(self, false) end -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### --- Remove all hooks when VMF is about to be reloaded -vmf.hooks_unload = function() +-- Remove all hooks when DMF is about to be reloaded +dmf.hooks_unload = function() for key, value in pairs(_origs) do -- origs[method] = orig if type(value) == "function" then @@ -454,12 +454,12 @@ vmf.hooks_unload = function() end end -vmf.apply_delayed_hooks = function(status, state) +dmf.apply_delayed_hooks = function(status, state) if status == "enter" and state == "StateIngame" then _delaying_enabled = false end if #_delayed > 0 then - vmf:info("Attempt to hook %s delayed hooks", #_delayed) + dmf:info("Attempt to hook %s delayed hooks", #_delayed) -- Go through the table in reverse so we don't get any issues removing entries inside the loop for i = #_delayed, 1, -1 do _delayed[i]() @@ -468,8 +468,8 @@ vmf.apply_delayed_hooks = function(status, state) end end -vmf.apply_hooks_to_file = function(filepath, store_index) - local all_file_instances = vmf:get_require_store(filepath) +dmf.apply_hooks_to_file = function(filepath, store_index) + local all_file_instances = dmf:get_require_store(filepath) local file_instance = all_file_instances and all_file_instances[store_index] local all_file_hooks = _hooks_by_file[filepath] diff --git a/dmf/scripts/mods/vmf/modules/core/keybindings.lua b/dmf/scripts/mods/dmf/modules/core/keybindings.lua similarity index 92% rename from dmf/scripts/mods/vmf/modules/core/keybindings.lua rename to dmf/scripts/mods/dmf/modules/core/keybindings.lua index 4a8ec88..763e808 100644 --- a/dmf/scripts/mods/vmf/modules/core/keybindings.lua +++ b/dmf/scripts/mods/dmf/modules/core/keybindings.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local PRIMARY_BINDABLE_KEYS = { KEYBOARD = { @@ -152,7 +152,7 @@ local OTHER_KEYS = { ["shift"] = {160, "Shift", "KEYBOARD", 161}, ["ctrl"] = {162, "Ctrl", "KEYBOARD", 163}, ["alt"] = {164, "Alt", "KEYBOARD", 165}, - -- hack for 'vmf.build_keybind_string' function + -- hack for 'dmf.build_keybind_string' function ["no_button"] = {-1, ""} } @@ -196,8 +196,8 @@ local ERRORS = { -- ##### Local functions ############################################################################################### -- ##################################################################################################################### -local function is_vmf_input_service_active() - -- @TODO: Implement check for active VMF input service +local function is_dmf_input_service_active() + -- @TODO: Implement check for active DMF input service return true end @@ -205,7 +205,7 @@ end -- Executes function for 'function_call' keybinds. local function call_function(mod, function_name, keybind_is_pressed) if type(mod[function_name]) == "function" then - vmf.safe_call_nr(mod, {ERRORS.PREFIX["function_call"], function_name}, mod[function_name], keybind_is_pressed) + dmf.safe_call_nr(mod, {ERRORS.PREFIX["function_call"], function_name}, mod[function_name], keybind_is_pressed) else mod:error(ERRORS.PREFIX["function_not_found"], function_name) end @@ -214,22 +214,22 @@ end -- If check of keybind's conditions is successful, performs keybind's action and returns 'true'. local function perform_keybind_action(data, is_pressed) - local can_perform_action = is_vmf_input_service_active() or data.global or data.release_action + local can_perform_action = is_dmf_input_service_active() or data.global or data.release_action if data.type == "mod_toggle" and can_perform_action and not data.mod:get_internal_data("is_mutator") then - vmf.mod_state_changed(data.mod:get_name(), not data.mod:is_enabled()) + dmf.mod_state_changed(data.mod:get_name(), not data.mod:is_enabled()) return true elseif data.type == "function_call" and can_perform_action and data.mod:is_enabled() then call_function(data.mod, data.function_name, is_pressed) return true elseif data.type == "view_toggle" and data.mod:is_enabled() then - vmf.keybind_toggle_view(data.mod, data.view_name, data.transition_data, can_perform_action, is_pressed) + dmf.keybind_toggle_view(data.mod, data.view_name, data.transition_data, can_perform_action, is_pressed) return true end end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -- Checks for pressed and released keybinds, performs keybind actions. @@ -237,7 +237,7 @@ end -- * If some keybind is pressed, won't check for other keybinds until this keybing is released. -- * If several mods bound the same keys, keybind action will be performed for all of them, when keybind is pressed. -- * Keybind is considered released, when its primary key is released. -function vmf.check_keybinds() +function dmf.check_keybinds() local ctrl_pressed = (Keyboard.button(KEYS_INFO["ctrl"][1]) + Keyboard.button(KEYS_INFO["ctrl"][4])) > 0 local alt_pressed = (Keyboard.button(KEYS_INFO["alt"][1]) + Keyboard.button(KEYS_INFO["alt"][4])) > 0 local shift_pressed = (Keyboard.button(KEYS_INFO["shift"][1]) + Keyboard.button(KEYS_INFO["shift"][4])) > 0 @@ -281,7 +281,7 @@ end -- Converts managable (raw) table of keybinds data to the table designed for the function checking for pressed and -- released keybinds. After initial call requires to be called every time some keybind is added/removed. -function vmf.generate_keybinds() +function dmf.generate_keybinds() _keybinds = {} for mod, mod_keybinds in pairs(_raw_keybinds_data) do @@ -318,7 +318,7 @@ end -- Adds/removes keybinds. -function vmf.add_mod_keybind(mod, setting_id, raw_keybind_data) +function dmf.add_mod_keybind(mod, setting_id, raw_keybind_data) if #raw_keybind_data.keys > 0 then _raw_keybinds_data[mod] = _raw_keybinds_data[mod] or {} _raw_keybinds_data[mod][setting_id] = raw_keybind_data @@ -327,29 +327,29 @@ function vmf.add_mod_keybind(mod, setting_id, raw_keybind_data) end -- Keybind is changed from Mod Options. - if vmf.all_mods_were_loaded then - vmf.generate_keybinds() + if dmf.all_mods_were_loaded then + dmf.generate_keybinds() end end --- Creates VMF input service. It is required to know when non-global keybinds can be triggered. +-- Creates DMF input service. It is required to know when non-global keybinds can be triggered. -- (Called every time a level is loaded, or on mods reload) -function vmf.create_keybinds_input_service() +function dmf.create_keybinds_input_service() -- @TODO: Link this input service to the player's input service and find some way to see if it's blocked --[[ - -- To create the VMF input service in Darktide + -- To create the DMF input service in Darktide local input_manager = Managers.input - local service_type = "VMF" + local service_type = "DMF" input_manager:add_setting(service_type, aliases, raw_key_table, filter_table, default_devices) input_manager:get_input_service(service_type) --]] end --- Converts key_index to readable key_id, which is used by VMF to idenify keys. +-- Converts key_index to readable key_id, which is used by DMF to idenify keys. -- (Used for capturing keybinds) -function vmf.get_key_id(device, key_index) +function dmf.get_key_id(device, key_index) local key_info = PRIMARY_BINDABLE_KEYS[device][key_index] return key_info and key_info[2] end @@ -357,14 +357,14 @@ end -- Simply tells if key with key_id can be binded as primary key. -- (Used for verifying keybind widgets) -function vmf.can_bind_as_primary_key(key_id) +function dmf.can_bind_as_primary_key(key_id) return KEYS_INFO[key_id] and not OTHER_KEYS[key_id] end -- Builds string with readable keys' names to look like "Primary Key + Ctrl + Alt + Shift". -- (Used in keybind widget) -function vmf.build_keybind_string(keys) +function dmf.build_keybind_string(keys) local readable_key_names = {} for _, key_id in ipairs(keys) do table.insert(readable_key_names, KEYS_INFO[key_id][2]) @@ -377,4 +377,4 @@ end -- ##################################################################################################################### -- In case mods reloading was performed right at the moment of entering 'StateInGame'. -vmf.create_keybinds_input_service() +dmf.create_keybinds_input_service() diff --git a/dmf/scripts/mods/vmf/modules/core/localization.lua b/dmf/scripts/mods/dmf/modules/core/localization.lua similarity index 86% rename from dmf/scripts/mods/vmf/modules/core/localization.lua rename to dmf/scripts/mods/dmf/modules/core/localization.lua index 0c6e8d4..9532b7d 100644 --- a/dmf/scripts/mods/vmf/modules/core/localization.lua +++ b/dmf/scripts/mods/dmf/modules/core/localization.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") --[[ English (en) @@ -30,7 +30,7 @@ local function safe_string_format(mod, str, ...) elseif mod then mod:error("(localize) \"%s\": %s", tostring(str), tostring(message)) else - vmf:error("(localize) \"%s\": %s", tostring(str), tostring(message)) + dmf:error("(localize) \"%s\": %s", tostring(str), tostring(message)) end end @@ -60,10 +60,10 @@ local function get_translated_or_english_message(mod, text_translations, ...) end -- #################################################################################################################### --- ##### VMFMod ####################################################################################################### +-- ##### DMFMod ####################################################################################################### -- #################################################################################################################### -VMFMod.localize = function (self, text_id, ...) +DMFMod.localize = function (self, text_id, ...) local message local mod_localization_table = _localization_database[self:get_name()] @@ -79,7 +79,7 @@ VMFMod.localize = function (self, text_id, ...) end -VMFMod.add_global_localize_strings = function (self, text_translations) +DMFMod.add_global_localize_strings = function (self, text_translations) for text_id, translations in ipairs(text_translations) do if not _global_localization_database[text_id] then _global_localization_database[text_id] = translations @@ -88,11 +88,11 @@ VMFMod.add_global_localize_strings = function (self, text_translations) end -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -- Handles the return of global localize text_ids -vmf:hook(_G, "Localize", function (func, text_id, ...) +dmf:hook(_G, "Localize", function (func, text_id, ...) local text_translations = text_id and _global_localization_database[text_id] local message = get_translated_or_english_message(nil, text_translations, ...) @@ -101,10 +101,10 @@ vmf:hook(_G, "Localize", function (func, text_id, ...) end) -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.initialize_mod_localization = function (mod, localization_table) +dmf.initialize_mod_localization = function (mod, localization_table) if type(localization_table) ~= "table" then mod:error("(localization): localization file should return table") @@ -121,7 +121,7 @@ vmf.initialize_mod_localization = function (mod, localization_table) end -- Localize without parameters and return nil instead of if nothing found -vmf.quick_localize = function (mod, text_id) +dmf.quick_localize = function (mod, text_id) local mod_localization_table = _localization_database[mod:get_name()] @@ -139,5 +139,5 @@ end -- ##### Script ####################################################################################################### -- #################################################################################################################### -local localization_table = vmf:dofile("dmf/localization/vmf") -vmf.initialize_mod_localization(vmf, localization_table) +local localization_table = dmf:dofile("dmf/localization/dmf") +dmf.initialize_mod_localization(dmf, localization_table) diff --git a/dmf/scripts/mods/vmf/modules/core/logging.lua b/dmf/scripts/mods/dmf/modules/core/logging.lua similarity index 86% rename from dmf/scripts/mods/vmf/modules/core/logging.lua rename to dmf/scripts/mods/dmf/modules/core/logging.lua index 0b6b6f2..41faaba 100644 --- a/dmf/scripts/mods/vmf/modules/core/logging.lua +++ b/dmf/scripts/mods/dmf/modules/core/logging.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _unsent_chat_messages = {} local _logging_settings @@ -104,63 +104,63 @@ local function log_message(self, msg_type, message, ...) end -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### -function VMFMod:notify(message, ...) +function DMFMod:notify(message, ...) if _logging_settings.notification.enabled then log_message(self, "notification", message, ...) end end -function VMFMod:echo(message, ...) +function DMFMod:echo(message, ...) if _logging_settings.echo.enabled then log_message(self, "echo", message, ...) end end -function VMFMod:echo_localized(localization_id, ...) +function DMFMod:echo_localized(localization_id, ...) if _logging_settings.echo.enabled then log_message(self, "echo", self:localize(localization_id, ...)) end end -function VMFMod:error(message, ...) +function DMFMod:error(message, ...) if _logging_settings.error.enabled then log_message(self, "error", message, ...) end end -function VMFMod:warning(message, ...) +function DMFMod:warning(message, ...) if _logging_settings.warning.enabled then log_message(self, "warning", message, ...) end end -function VMFMod:info(message, ...) +function DMFMod:info(message, ...) if _logging_settings.info.enabled then log_message(self, "info", message, ...) end end -function VMFMod:debug(message, ...) +function DMFMod:debug(message, ...) if _logging_settings.debug.enabled then log_message(self, "debug", message, ...) end end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -- Can't be hooked right away, since hooking module is not initialized yet -- Sends unsent messages to chat when chat channel is finally created -function vmf.delayed_chat_messages_hook() - vmf:hook_safe("VivoxManager", "join_chat_channel", function (self) +function dmf.delayed_chat_messages_hook() + dmf:hook_safe("VivoxManager", "join_chat_channel", function (self) if #_unsent_chat_messages > 0 and #self:connected_chat_channels() > 0 then for _, message in ipairs(_unsent_chat_messages) do add_chat_message(message) @@ -173,15 +173,15 @@ function vmf.delayed_chat_messages_hook() end) end -function vmf.load_logging_settings() +function dmf.load_logging_settings() _logging_settings = { - notification = vmf:get("logging_mode") == "custom" and vmf:get("output_mode_notification") or 5, - echo = vmf:get("logging_mode") == "custom" and vmf:get("output_mode_echo") or 4, - error = vmf:get("logging_mode") == "custom" and vmf:get("output_mode_error") or 4, - warning = vmf:get("logging_mode") == "custom" and vmf:get("output_mode_warning") or 4, - info = vmf:get("logging_mode") == "custom" and vmf:get("output_mode_info") or 1, - debug = vmf:get("logging_mode") == "custom" and vmf:get("output_mode_debug") or 0, + notification = dmf:get("logging_mode") == "custom" and dmf:get("output_mode_notification") or 5, + echo = dmf:get("logging_mode") == "custom" and dmf:get("output_mode_echo") or 4, + error = dmf:get("logging_mode") == "custom" and dmf:get("output_mode_error") or 4, + warning = dmf:get("logging_mode") == "custom" and dmf:get("output_mode_warning") or 4, + info = dmf:get("logging_mode") == "custom" and dmf:get("output_mode_info") or 1, + debug = dmf:get("logging_mode") == "custom" and dmf:get("output_mode_debug") or 0, } for method_name, logging_mode in pairs(_logging_settings) do @@ -198,4 +198,4 @@ end -- ##### Script ######################################################################################################## -- ##################################################################################################################### -vmf.load_logging_settings() +dmf.load_logging_settings() diff --git a/dmf/scripts/mods/vmf/modules/core/misc.lua b/dmf/scripts/mods/dmf/modules/core/misc.lua similarity index 78% rename from dmf/scripts/mods/vmf/modules/core/misc.lua rename to dmf/scripts/mods/dmf/modules/core/misc.lua index 092a56d..96bc5cf 100644 --- a/dmf/scripts/mods/vmf/modules/core/misc.lua +++ b/dmf/scripts/mods/dmf/modules/core/misc.lua @@ -1,10 +1,10 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -function vmf.check_wrong_argument_type(mod, vmf_function_name, argument_name, argument, ...) +function dmf.check_wrong_argument_type(mod, dmf_function_name, argument_name, argument, ...) local allowed_types = {...} local argument_type = type(argument) @@ -14,7 +14,7 @@ function vmf.check_wrong_argument_type(mod, vmf_function_name, argument_name, ar end end - mod:error("(%s): argument '%s' should have the '%s' type, not '%s'", vmf_function_name, argument_name, + mod:error("(%s): argument '%s' should have the '%s' type, not '%s'", dmf_function_name, argument_name, table.concat(allowed_types, "/"), argument_type) return true end diff --git a/dmf/scripts/mods/vmf/modules/core/mutators/mutators_default_config.lua b/dmf/scripts/mods/dmf/modules/core/mutators/mutators_default_config.lua similarity index 100% rename from dmf/scripts/mods/vmf/modules/core/mutators/mutators_default_config.lua rename to dmf/scripts/mods/dmf/modules/core/mutators/mutators_default_config.lua diff --git a/dmf/scripts/mods/vmf/modules/core/mutators/mutators_info.lua b/dmf/scripts/mods/dmf/modules/core/mutators/mutators_info.lua similarity index 93% rename from dmf/scripts/mods/vmf/modules/core/mutators/mutators_info.lua rename to dmf/scripts/mods/dmf/modules/core/mutators/mutators_info.lua index 5377dbd..d7bdc4b 100644 --- a/dmf/scripts/mods/vmf/modules/core/mutators/mutators_info.lua +++ b/dmf/scripts/mods/dmf/modules/core/mutators/mutators_info.lua @@ -1,7 +1,7 @@ --[[ Notify players of enabled mutators via chat and tab menu --]] -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- ##################################################################################################################### -- ##### Local functions ############################################################################################### @@ -10,12 +10,12 @@ local vmf = get_mod("VMF") -- Assembles a list of enabled mutators local function add_enabled_mutators_titles_to_string(separator, is_short) local enabled_mutators = {} - for _, mutator in ipairs(vmf.mutators) do + for _, mutator in ipairs(dmf.mutators) do if mutator:is_enabled() then table.insert(enabled_mutators, mutator) end end - return vmf.add_mutator_titles_to_string(enabled_mutators, separator, is_short) + return dmf.add_mutator_titles_to_string(enabled_mutators, separator, is_short) end diff --git a/dmf/scripts/mods/vmf/modules/core/mutators/mutators_manager.lua b/dmf/scripts/mods/dmf/modules/core/mutators/mutators_manager.lua similarity index 91% rename from dmf/scripts/mods/vmf/modules/core/mutators/mutators_manager.lua rename to dmf/scripts/mods/dmf/modules/core/mutators/mutators_manager.lua index 78853cb..ba66307 100644 --- a/dmf/scripts/mods/vmf/modules/core/mutators/mutators_manager.lua +++ b/dmf/scripts/mods/dmf/modules/core/mutators/mutators_manager.lua @@ -1,7 +1,7 @@ --[[ Manages everything related to mutators: loading order, enabling/disabling process, giving extra rewards etc. --]] -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- List of mods that are also mutators in order in which they should be enabled local _mutators = {} @@ -23,14 +23,14 @@ local _mutators_sorted = false local _all_mutators_disabled = false -- External modules -local reward_manager = vmf:dofile("dmf/scripts/mods/vmf/modules/core/mutators/mutators_reward") -local set_lobby_data = vmf:dofile("dmf/scripts/mods/vmf/modules/core/mutators/mutators_info") +local reward_manager = dmf:dofile("dmf/scripts/mods/dmf/modules/core/mutators/mutators_reward") +local set_lobby_data = dmf:dofile("dmf/scripts/mods/dmf/modules/core/mutators/mutators_info") -- Get default configuration -local _default_config = vmf:dofile("dmf/scripts/mods/vmf/modules/core/mutators/mutators_default_config") +local _default_config = dmf:dofile("dmf/scripts/mods/dmf/modules/core/mutators/mutators_default_config") --- List of enabled mutators in case VMF is reloaded in the middle of the game -local _enabled_mutators = vmf:persistent_table("enabled_mutators") +-- List of enabled mutators in case DMF is reloaded in the middle of the game +local _enabled_mutators = dmf:persistent_table("enabled_mutators") -- ##################################################################################################################### -- ##### Local functions ############################################################################################### @@ -91,7 +91,7 @@ local function sort_mutators() --[[ -- LOG -- - vmf:dump(_mutators_sequence, "seq", 5) + dmf:dump(_mutators_sequence, "seq", 5) for i, v in ipairs(mutators) do print(i, v:get_name()) end @@ -170,18 +170,18 @@ local function disable_impossible_mutators(is_broadcast, reason_text_id) for i = #_mutators, 1, -1 do local mutator = _mutators[i] if mutator:is_enabled() and not mutator_can_be_enabled(mutator) then - vmf.mod_state_changed(mutator:get_name(), false) + dmf.mod_state_changed(mutator:get_name(), false) table.insert(disabled_mutators, mutator) end end if #disabled_mutators > 0 then local disabled_mutators_text_id = is_broadcast and "broadcast_disabled_mutators" or "local_disabled_mutators" - local message = vmf:localize(disabled_mutators_text_id) .. " " .. vmf:localize(reason_text_id) .. ":" - message = message .. " " .. vmf.add_mutator_titles_to_string(disabled_mutators, ", ", false) + local message = dmf:localize(disabled_mutators_text_id) .. " " .. dmf:localize(reason_text_id) .. ":" + message = message .. " " .. dmf.add_mutator_titles_to_string(disabled_mutators, ", ", false) if is_broadcast then - vmf:chat_broadcast(message) + dmf:chat_broadcast(message) else - vmf:echo(message) + dmf:echo(message) end end end @@ -204,7 +204,7 @@ local function update_mutators_sequence(mutator) for _, other_mutator_name in ipairs(enable_before_these) do if _mutators_sequence[other_mutator_name] and table.contains(_mutators_sequence[other_mutator_name], mutator_name) then - vmf:error("(mutators): Mutators '%s' and '%s' are both set to load after each other.", mutator_name, + dmf:error("(mutators): Mutators '%s' and '%s' are both set to load after each other.", mutator_name, other_mutator_name) elseif not table.contains(_mutators_sequence[mutator_name], other_mutator_name) then table.insert(_mutators_sequence[mutator_name], other_mutator_name) @@ -217,7 +217,7 @@ local function update_mutators_sequence(mutator) _mutators_sequence[other_mutator_name] = _mutators_sequence[other_mutator_name] or {} if _mutators_sequence[mutator_name] and table.contains(_mutators_sequence[mutator_name], other_mutator_name) then - vmf:error("(mutators): Mutators '%s' and '%s' are both set to load after each other.", mutator_name, + dmf:error("(mutators): Mutators '%s' and '%s' are both set to load after each other.", mutator_name, other_mutator_name) elseif not table.contains(_mutators_sequence[other_mutator_name], mutator_name) then table.insert(_mutators_sequence[other_mutator_name], mutator_name) @@ -339,7 +339,7 @@ local function initialize_mutator_config(mutator, _raw_config) end if raw_config.short_title == "" then raw_config.short_title = nil end - vmf.set_internal_data(mutator, "mutator_config", {}) + dmf.set_internal_data(mutator, "mutator_config", {}) local config = mutator:get_internal_data("mutator_config") @@ -359,14 +359,14 @@ local function initialize_mutator_config(mutator, _raw_config) end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -vmf.mutators = _mutators +dmf.mutators = _mutators -- Appends, prepends and replaces the string with mutator titles -function vmf.add_mutator_titles_to_string(mutators, separator, is_short) +function dmf.add_mutator_titles_to_string(mutators, separator, is_short) if #mutators == 0 then return "" @@ -411,7 +411,7 @@ end -- Turns a mod into a mutator -function vmf.register_mod_as_mutator(mod, raw_config) +function dmf.register_mod_as_mutator(mod, raw_config) initialize_mutator_config(mod, raw_config) @@ -422,7 +422,7 @@ end -- Enables/disables mutator while preserving the sequence in which they were enabled -function vmf.set_mutator_state(mutator, state, initial_call) +function dmf.set_mutator_state(mutator, state, initial_call) -- Sort mutators if this is the first call if not _mutators_sorted then @@ -441,7 +441,7 @@ function vmf.set_mutator_state(mutator, state, initial_call) for j = #_mutators, i + 1, -1 do if _mutators[j]:is_enabled() and table.contains(enable_these_after, _mutators[j]:get_name()) then --print("Disabled ", _mutators[j]:get_name()) - vmf.set_mutator_state(_mutators[j], false, false) + dmf.set_mutator_state(_mutators[j], false, false) table.insert(disabled_mutators, 1, _mutators[j]) end end @@ -449,7 +449,7 @@ function vmf.set_mutator_state(mutator, state, initial_call) -- Enable/disable current mutator -- We're calling methods on the class object because we've overwritten them on the current one - vmf.set_mod_state(mutator, state, initial_call) + dmf.set_mod_state(mutator, state, initial_call) if state then _all_mutators_disabled = false on_enabled(mutator) @@ -462,14 +462,14 @@ function vmf.set_mutator_state(mutator, state, initial_call) if #disabled_mutators > 0 then for j = #disabled_mutators, 1, -1 do --print("Enabled ", disabled_mutators[j]:get_name()) - vmf.set_mutator_state(disabled_mutators[j], true, false) + dmf.set_mutator_state(disabled_mutators[j], true, false) end end end -- Checks if player is still hosting (on update) -function vmf.check_mutators_state() +function dmf.check_mutators_state() if not _all_mutators_disabled and not player_is_server() then disable_impossible_mutators(false, "disabled_reason_not_server") _all_mutators_disabled = true @@ -477,14 +477,14 @@ function vmf.check_mutators_state() end --- Is called only after VMF reloading to check if some mutators were enabled before reloading -function vmf.is_mutator_enabled(mutator_name) +-- Is called only after DMF reloading to check if some mutators were enabled before reloading +function dmf.is_mutator_enabled(mutator_name) return _enabled_mutators[mutator_name] end -- Removes all raw_configs which won't be used anymore -function vmf.mutators_delete_raw_config() +function dmf.mutators_delete_raw_config() for _, mutator in ipairs(_mutators) do mutator:get_internal_data("mutator_config").raw_config = nil end @@ -501,4 +501,4 @@ end -- ##################################################################################################################### -- Testing ---vmf:dofile("dmf/scripts/mods/vmf/modules/core/mutators/test/mutators_test") +--dmf:dofile("dmf/scripts/mods/dmf/modules/core/mutators/test/mutators_test") diff --git a/dmf/scripts/mods/vmf/modules/core/mutators/mutators_reward.lua b/dmf/scripts/mods/dmf/modules/core/mutators/mutators_reward.lua similarity index 98% rename from dmf/scripts/mods/vmf/modules/core/mutators/mutators_reward.lua rename to dmf/scripts/mods/dmf/modules/core/mutators/mutators_reward.lua index 236bf22..5afc672 100644 --- a/dmf/scripts/mods/vmf/modules/core/mutators/mutators_reward.lua +++ b/dmf/scripts/mods/dmf/modules/core/mutators/mutators_reward.lua @@ -1,7 +1,7 @@ --[[ Add additional reward to end game results --]] -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- Amounts of additional rewards to be added at level completion local _num_reward = { diff --git a/dmf/scripts/mods/vmf/modules/core/mutators/test/mutators_test.lua b/dmf/scripts/mods/dmf/modules/core/mutators/test/mutators_test.lua similarity index 99% rename from dmf/scripts/mods/vmf/modules/core/mutators/test/mutators_test.lua rename to dmf/scripts/mods/dmf/modules/core/mutators/test/mutators_test.lua index 32617ed..d2e1f8a 100644 --- a/dmf/scripts/mods/vmf/modules/core/mutators/test/mutators_test.lua +++ b/dmf/scripts/mods/dmf/modules/core/mutators/test/mutators_test.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local function create_test_mutator(mod_name, mod_data) return new_mod(mod_name, { diff --git a/dmf/scripts/mods/vmf/modules/core/network.lua b/dmf/scripts/mods/dmf/modules/core/network.lua similarity index 83% rename from dmf/scripts/mods/vmf/modules/core/network.lua rename to dmf/scripts/mods/dmf/modules/core/network.lua index 14cc4a5..c0f9c25 100644 --- a/dmf/scripts/mods/vmf/modules/core/network.lua +++ b/dmf/scripts/mods/dmf/modules/core/network.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _network_debug = false @@ -7,7 +7,7 @@ local _network_debug = false -- #################################################################################################################### -- #################################################################################################################### --- ##### VMFMod ####################################################################################################### +-- ##### DMFMod ####################################################################################################### -- #################################################################################################################### -- #################################################################################################################### @@ -15,23 +15,23 @@ local _network_debug = false -- #################################################################################################################### -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.create_network_dictionary = function() +dmf.create_network_dictionary = function() -- @TODO: Not implemented end -vmf.ping_vmf_users = function() +dmf.ping_dmf_users = function() -- @TODO: Not implemented end -vmf.load_network_settings = function() - _network_debug = vmf:get("developer_mode") and vmf:get("show_network_debug_info") +dmf.load_network_settings = function() + _network_debug = dmf:get("developer_mode") and dmf:get("show_network_debug_info") end -- #################################################################################################################### -- ##### Script ####################################################################################################### -- #################################################################################################################### -vmf.load_network_settings() +dmf.load_network_settings() diff --git a/dmf/scripts/mods/vmf/modules/core/options.lua b/dmf/scripts/mods/dmf/modules/core/options.lua similarity index 84% rename from dmf/scripts/mods/vmf/modules/core/options.lua rename to dmf/scripts/mods/dmf/modules/core/options.lua index 65a48a6..2ebc6d3 100644 --- a/dmf/scripts/mods/vmf/modules/core/options.lua +++ b/dmf/scripts/mods/dmf/modules/core/options.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- This variable is defined here and not in widget data initialization function because some error messages -- require it to be dumped to game log. @@ -23,13 +23,13 @@ local function initialize_collapsed_widgets(mod, collapsed_widgets) if type(collapsed_widget_name) == "string" then new_collapsed_widgets[collapsed_widget_name] = true else - vmf.throw_error("'collapsed_widgets[%d]' is not a string", i) + dmf.throw_error("'collapsed_widgets[%d]' is not a string", i) end end - local options_menu_collapsed_widgets = vmf:get("options_menu_collapsed_widgets") + local options_menu_collapsed_widgets = dmf:get("options_menu_collapsed_widgets") options_menu_collapsed_widgets[mod:get_name()] = new_collapsed_widgets - vmf:set("options_menu_collapsed_widgets", options_menu_collapsed_widgets) + dmf:set("options_menu_collapsed_widgets", options_menu_collapsed_widgets) end -- ################ @@ -48,9 +48,9 @@ local function initialize_header_data(mod, data) new_data.readable_mod_name = mod:get_readable_name() new_data.tooltip = mod:get_description() new_data.is_togglable = mod:get_internal_data("is_togglable") and not mod:get_internal_data("is_mutator") - new_data.is_collapsed = vmf:get("options_menu_collapsed_mods")[mod:get_name()] + new_data.is_collapsed = dmf:get("options_menu_collapsed_mods")[mod:get_name()] - for _, favorited_mod_name in ipairs(vmf:get("options_menu_favorite_mods")) do + for _, favorited_mod_name in ipairs(dmf:get("options_menu_favorite_mods")) do if favorited_mod_name == new_data.mod_name then new_data.is_favorited = true end @@ -67,26 +67,26 @@ local function validate_generic_widget_data(data) local setting_id = data.setting_id if type(setting_id) ~= "string" then - vmf:dump(_unfolded_raw_widgets_data, "widgets", 1) - vmf.throw_error("[widget#%d (%s)]: 'setting_id' field is required and must have 'string' type. " .. + dmf:dump(_unfolded_raw_widgets_data, "widgets", 1) + dmf.throw_error("[widget#%d (%s)]: 'setting_id' field is required and must have 'string' type. " .. "See dumped table in game log for reference.", data.index, data.type) end if not data.localize and not data.title then - vmf.throw_error("[widget \"%s\" (%s)]: lacks 'title' field (localization is disabled)", setting_id, data.type) + dmf.throw_error("[widget \"%s\" (%s)]: lacks 'title' field (localization is disabled)", setting_id, data.type) end if data.title and type(data.title) ~= "string" then - vmf.throw_error("[widget \"%s\" (%s)]: 'title' field must have 'string' type", setting_id, data.type) + dmf.throw_error("[widget \"%s\" (%s)]: 'title' field must have 'string' type", setting_id, data.type) end if data.tooltip and type(data.tooltip) ~= "string" then - vmf.throw_error("[widget \"%s\" (%s)]: 'tooltip' field must have 'string' type", setting_id, data.type) + dmf.throw_error("[widget \"%s\" (%s)]: 'tooltip' field must have 'string' type", setting_id, data.type) end if _defined_mod_settings[setting_id] then - vmf:dump(_unfolded_raw_widgets_data, "widgets", 1) - vmf.throw_error("Widgets %d and %d have the same setting_id (\"%s\"). See dumped table in game log for reference.", + dmf:dump(_unfolded_raw_widgets_data, "widgets", 1) + dmf.throw_error("Widgets %d and %d have the same setting_id (\"%s\"). See dumped table in game log for reference.", _defined_mod_settings[setting_id], data.index, setting_id) else _defined_mod_settings[setting_id] = data.index @@ -100,7 +100,7 @@ local function localize_generic_widget_data(mod, data) if data.tooltip then data.tooltip = mod:localize(data.tooltip) else - data.tooltip = vmf.quick_localize(mod, data.setting_id .. "_description") + data.tooltip = dmf.quick_localize(mod, data.setting_id .. "_description") end end end @@ -146,7 +146,7 @@ local function initialize_group_data(mod, data, localize, collapsed_widgets) local new_data = initialize_generic_widget_data(mod, data, localize) if not data.sub_widgets or not (#data.sub_widgets > 0) then - vmf.throw_error("[widget \"%s\" (group)]: must have at least 1 sub_widget", data.setting_id) + dmf.throw_error("[widget \"%s\" (group)]: must have at least 1 sub_widget", data.setting_id) end new_data.is_collapsed = collapsed_widgets[data.setting_id] @@ -160,7 +160,7 @@ end local function validate_checkbox_data(data) if type(data.default_value) ~= "boolean" then - vmf.throw_error("[widget \"%s\" (checkbox)]: 'default_value' field is required and must have 'boolean' type", + dmf.throw_error("[widget \"%s\" (checkbox)]: 'default_value' field is required and must have 'boolean' type", data.setting_id) end end @@ -188,17 +188,17 @@ local allowed_dropdown_values = { local function validate_dropdown_data(data) if not allowed_dropdown_values[type(data.default_value)] then - vmf.throw_error("[widget \"%s\" (dropdown)]: 'default_value' field is required and must have 'string', " .. + dmf.throw_error("[widget \"%s\" (dropdown)]: 'default_value' field is required and must have 'string', " .. "'number' or 'boolean' type", data.setting_id) end if type(data.options) ~= "table" then - vmf.throw_error("[widget \"%s\" (dropdown)]: 'options' field is required and must have 'table' type", + dmf.throw_error("[widget \"%s\" (dropdown)]: 'options' field is required and must have 'table' type", data.setting_id) end if #data.options < 2 then - vmf.throw_error("[widget \"%s\" (dropdown)]: 'options' table must have at least 2 elements", data.setting_id) + dmf.throw_error("[widget \"%s\" (dropdown)]: 'options' table must have at least 2 elements", data.setting_id) end local default_value = data.default_value @@ -208,22 +208,22 @@ local function validate_dropdown_data(data) local option_value = option.value if type(option.text) ~= "string" then - vmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'text' field is required and must have " .. + dmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'text' field is required and must have " .. "'string' type", data.setting_id, i) end if not allowed_dropdown_values[type(option_value)] then - vmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'value' field is required and must have " .. + dmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'value' field is required and must have " .. "'string', 'number' or 'boolean' type", data.setting_id, i) end if option.show_widgets and type(option.show_widgets) ~= "table" then - vmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'show_widgets' field must have 'table' type", + dmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]'-> 'show_widgets' field must have 'table' type", data.setting_id, i) end if used_values[option_value] then - vmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]' has 'value' field set to the same value " .. + dmf.throw_error("[widget \"%s\" (dropdown)]: 'options[%d]' has 'value' field set to the same value " .. "as one of previous options", data.setting_id, i) end @@ -235,7 +235,7 @@ local function validate_dropdown_data(data) end if not default_value_match then - vmf.throw_error("[widget \"%s\" (dropdown)]: 'default_value' field contains value not defined in 'options' field", + dmf.throw_error("[widget \"%s\" (dropdown)]: 'default_value' field contains value not defined in 'options' field", data.setting_id) end end @@ -264,7 +264,7 @@ local function initialize_dropdown_data(mod, data, localize, collapsed_widgets) validate_dropdown_data(new_data) localize_dropdown_data(mod, new_data) - -- Converting show_widgets from human-readable form to vmf-options-readable + -- Converting show_widgets from human-readable form to dmf-options-readable -- i.e. {[1] = 2, [2] = 3, [3] = 5} -> {[113] = true, [114] = true, [116] = true} -- Where the 2nd set of numbers are the real widget numbers of subwidgets if data.sub_widgets ~= nil then @@ -275,7 +275,7 @@ local function initialize_dropdown_data(mod, data, localize, collapsed_widgets) if data.sub_widgets[sub_widget_index] then new_show_widgets[data.sub_widgets[sub_widget_index].index] = true else - vmf.throw_error("[widget \"%s\" (dropdown)]: 'options -> [%d] -> show_widgets -> [%d] \"%s\"' points " .. + dmf.throw_error("[widget \"%s\" (dropdown)]: 'options -> [%d] -> show_widgets -> [%d] \"%s\"' points " .. "to non-existing sub_widget", data.setting_id, i, j, sub_widget_index) end end @@ -307,54 +307,54 @@ local allowed_modifier_keys = { } local function validate_keybind_data(data) if data.keybind_global and type(data.keybind_global) ~= "boolean" then - vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_global' field must have 'boolean' type", data.setting_id) + dmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_global' field must have 'boolean' type", data.setting_id) end if not allowed_keybind_triggers[data.keybind_trigger] then - vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_trigger' field is required and must contain string " .. + dmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_trigger' field is required and must contain string " .. "\"pressed\" or \"held\"", data.setting_id) end local keybind_type = data.keybind_type if not allowed_keybind_types[keybind_type] then - vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' field is required and must contain string " .. + dmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' field is required and must contain string " .. "\"function_call\", \"view_toggle\" or \"mod_toggle\"", data.setting_id) end if keybind_type == "function_call" and type(data.function_name) ~= "string" then - vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' is set to \"function_call\" so 'function_name' " .. + dmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' is set to \"function_call\" so 'function_name' " .. "field is required and must have 'string' type", data.setting_id) end if keybind_type == "view_toggle" then if type(data.view_name) ~= "string" then - vmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' is set to \"view_toggle\" so 'view_name' " .. + dmf.throw_error("[widget \"%s\" (keybind)]: 'keybind_type' is set to \"view_toggle\" so 'view_name' " .. "field is required and must have 'string' type", data.setting_id) end end local default_value = data.default_value if type(default_value) ~= "table" then - vmf.throw_error("[widget \"%s\" (keybind)]: 'default_value' field is required and must have 'table' type", + dmf.throw_error("[widget \"%s\" (keybind)]: 'default_value' field is required and must have 'table' type", data.setting_id) end if #default_value > 4 then - vmf.throw_error("[widget \"%s\" (keybind)]: table stored in 'default_value' field can't exceed 4 elements", + dmf.throw_error("[widget \"%s\" (keybind)]: table stored in 'default_value' field can't exceed 4 elements", data.setting_id) end - if default_value[1] and not vmf.can_bind_as_primary_key(default_value[1]) then - vmf.throw_error("[widget \"%s\" (keybind)]: 'default_value[1]' must be a valid key name", data.setting_id) + if default_value[1] and not dmf.can_bind_as_primary_key(default_value[1]) then + dmf.throw_error("[widget \"%s\" (keybind)]: 'default_value[1]' must be a valid key name", data.setting_id) end if default_value[2] and not allowed_modifier_keys[default_value[2]] or default_value[3] and not allowed_modifier_keys[default_value[3]] or default_value[4] and not allowed_modifier_keys[default_value[4]] then - vmf.throw_error("[widget \"%s\" (keybind)]: 'default_value [2], [3] and [4]' can be only strings: \"ctrl\", " .. + dmf.throw_error("[widget \"%s\" (keybind)]: 'default_value [2], [3] and [4]' can be only strings: \"ctrl\", " .. "\"alt\" and \"shift\" (in no particular order)", data.setting_id) end local used_keys = {} for _, key in ipairs(default_value) do if used_keys[key] then - vmf.throw_error("[widget \"%s\" (keybind)]: you can't define the same key in 'default_value' table twice", + dmf.throw_error("[widget \"%s\" (keybind)]: you can't define the same key in 'default_value' table twice", data.setting_id) end used_keys[key] = true @@ -382,41 +382,41 @@ end local function validate_numeric_data(data) if data.unit_text and type(data.unit_text) ~= "string" then - vmf.throw_error("[widget \"%s\" (numeric)]: 'unit_text' field must have 'string' type", data.setting_id) + dmf.throw_error("[widget \"%s\" (numeric)]: 'unit_text' field must have 'string' type", data.setting_id) end if type(data.decimals_number) ~= "number" then - vmf.throw_error("[widget \"%s\" (numeric)]: 'decimals_number' field must have 'number' type", data.setting_id) + dmf.throw_error("[widget \"%s\" (numeric)]: 'decimals_number' field must have 'number' type", data.setting_id) end if data.decimals_number < 0 then -- @TODO: eventually do max cap as well - vmf.throw_error("[widget \"%s\" (numeric)]: 'decimals_number' value can't be lower than zero", data.setting_id) + dmf.throw_error("[widget \"%s\" (numeric)]: 'decimals_number' value can't be lower than zero", data.setting_id) end local range = data.range if type(range) ~= "table" then - vmf.throw_error("[widget \"%s\" (numeric)]: 'range' field is required and must have 'table' type", data.setting_id) + dmf.throw_error("[widget \"%s\" (numeric)]: 'range' field is required and must have 'table' type", data.setting_id) end if #range ~= 2 then - vmf.throw_error("[widget \"%s\" (numeric)]: 'range' field must contain an array-like table with 2 elements", + dmf.throw_error("[widget \"%s\" (numeric)]: 'range' field must contain an array-like table with 2 elements", data.setting_id) end local range_min = range[1] local range_max = range[2] if type(range_min) ~= "number" or type(range_max) ~= "number" then - vmf.throw_error("[widget \"%s\" (numeric)]: table stored in 'range' field must contain only numbers", + dmf.throw_error("[widget \"%s\" (numeric)]: table stored in 'range' field must contain only numbers", data.setting_id) end if range_min > range_max then - vmf.throw_error("[widget \"%s\" (numeric)]: 'range[2]' must be bigger than 'range[1]'", data.setting_id) + dmf.throw_error("[widget \"%s\" (numeric)]: 'range[2]' must be bigger than 'range[1]'", data.setting_id) end local default_value = data.default_value if type(default_value) ~= "number" then - vmf.throw_error("[widget \"%s\" (numeric)]: 'default_value' field is required and must have 'number' type", + dmf.throw_error("[widget \"%s\" (numeric)]: 'default_value' field is required and must have 'number' type", data.setting_id) end if default_value < range_min or default_value > range_max then - vmf.throw_error("[widget \"%s\" (numeric)]: 'default_value' field must contain number fitting set 'range'", + dmf.throw_error("[widget \"%s\" (numeric)]: 'default_value' field must contain number fitting set 'range'", data.setting_id) end end @@ -483,14 +483,14 @@ local function unfold_table(unfolded_table, unfoldable_table, parent_index, dept if type(nested_table_sub_widgets) == "table" then unfold_table(unfolded_table, nested_table_sub_widgets, #unfolded_table, depth + 1) else - vmf:dump(unfolded_table, "widgets", 1) - vmf.throw_error("'sub_widgets' field of widget [%d] is not a table, it's %s. See dumped table in game log " .. + dmf:dump(unfolded_table, "widgets", 1) + dmf.throw_error("'sub_widgets' field of widget [%d] is not a table, it's %s. See dumped table in game log " .. "for reference.", #unfolded_table, type(nested_table_sub_widgets)) end end else - vmf:dump(unfolded_table, "widgets", 1) - vmf.throw_error("sub_widget#%d of widget [%d] is not a table, it's %s. " .. + dmf:dump(unfolded_table, "widgets", 1) + dmf.throw_error("sub_widget#%d of widget [%d] is not a table, it's %s. " .. "See dumped table in game log for reference.", i, parent_index, type(nested_table)) end end @@ -513,7 +513,7 @@ local function initialize_mod_options_widgets_data(mod, widgets_data, localize) -- Put data of all widgets in one-dimensional array in order they will be displayed in mod options. _unfolded_raw_widgets_data = unfold_table({header_widget_data}, widgets_data, 1, base_depth) -- Load info about widgets previously collapsed by user - local collapsed_widgets = vmf:get("options_menu_collapsed_widgets")[mod:get_name()] or {} + local collapsed_widgets = dmf:get("options_menu_collapsed_widgets")[mod:get_name()] or {} -- Before starting widgets data initialization, clear this table. It's used to detect if 2 widgets -- defined the same setting_id. @@ -524,8 +524,8 @@ local function initialize_mod_options_widgets_data(mod, widgets_data, localize) if initialized_widget_data then table.insert(initialized_data, initialized_widget_data) else - vmf:dump(_unfolded_raw_widgets_data, "widgets", 1) - vmf.throw_error("[widget#%d]: 'type' field must contain valid widget type name. " .. + dmf:dump(_unfolded_raw_widgets_data, "widgets", 1) + dmf.throw_error("[widget#%d]: 'type' field must contain valid widget type name. " .. "See dumped table in game log for reference.", widget_data.index, widget_data.type) end end @@ -544,7 +544,7 @@ local function initialize_default_settings_and_keybinds(mod, initialized_widgets mod:set(data.setting_id, data.default_value) end if data.type == "keybind" then - vmf.add_mod_keybind( + dmf.add_mod_keybind( mod, data.setting_id, { @@ -561,19 +561,19 @@ local function initialize_default_settings_and_keybinds(mod, initialized_widgets end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -- Is used in Mod Options to create options widgets -vmf.options_widgets_data = {} +dmf.options_widgets_data = {} -- Initializes mod's options data. If this function is called with 'options.widgets' not specified, it just creates -- widget data with single header with checkbox. -function vmf.initialize_mod_options(mod, options) +function dmf.initialize_mod_options(mod, options) options = options or {} -- If this is the first time user launches this mod, set collapsed widgets list to default one. - if options.collapsed_widgets and not vmf.mod_has_settings(mod) then + if options.collapsed_widgets and not dmf.mod_has_settings(mod) then initialize_collapsed_widgets(mod, options.collapsed_widgets) end @@ -586,21 +586,21 @@ function vmf.initialize_mod_options(mod, options) -- Insert initialized widgets data to the table which will be used by Mod Options to built options widgets list -- for this mod. - table.insert(vmf.options_widgets_data, initialized_widgets_data) + table.insert(dmf.options_widgets_data, initialized_widgets_data) end -- ##################################################################################################################### -- ##### Script ######################################################################################################## -- ##################################################################################################################### -if type(vmf:get("options_menu_favorite_mods")) ~= "table" then - vmf:set("options_menu_favorite_mods", {}) +if type(dmf:get("options_menu_favorite_mods")) ~= "table" then + dmf:set("options_menu_favorite_mods", {}) end -if type(vmf:get("options_menu_collapsed_mods")) ~= "table" then - vmf:set("options_menu_collapsed_mods", {}) +if type(dmf:get("options_menu_collapsed_mods")) ~= "table" then + dmf:set("options_menu_collapsed_mods", {}) end -if type(vmf:get("options_menu_collapsed_widgets")) ~= "table" then - vmf:set("options_menu_collapsed_widgets", {}) +if type(dmf:get("options_menu_collapsed_widgets")) ~= "table" then + dmf:set("options_menu_collapsed_widgets", {}) end diff --git a/dmf/scripts/mods/vmf/modules/core/persistent_tables.lua b/dmf/scripts/mods/dmf/modules/core/persistent_tables.lua similarity index 76% rename from dmf/scripts/mods/vmf/modules/core/persistent_tables.lua rename to dmf/scripts/mods/dmf/modules/core/persistent_tables.lua index 47cafc1..54e1b1f 100644 --- a/dmf/scripts/mods/vmf/modules/core/persistent_tables.lua +++ b/dmf/scripts/mods/dmf/modules/core/persistent_tables.lua @@ -1,17 +1,17 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- @TODO: move it to on_reload when it will be implemented in vt1 -Managers.vmf = Managers.vmf or { +Managers.dmf = Managers.dmf or { delete = function() return end } -Managers.vmf.persistent_tables = Managers.vmf.persistent_tables or {} +Managers.dmf.persistent_tables = Managers.dmf.persistent_tables or {} -local _persistent_tables = Managers.vmf.persistent_tables +local _persistent_tables = Managers.dmf.persistent_tables -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### --[[ @@ -22,10 +22,10 @@ local _persistent_tables = Managers.vmf.persistent_tables tables when using the same table_name * default_table [table] : (optional) table that will replace empty table created by default (on the 1st call) --]] -function VMFMod:persistent_table(table_name, default_table) +function DMFMod:persistent_table(table_name, default_table) - if vmf.check_wrong_argument_type(self, "persistent_table", "table_name", table_name, "string") or - vmf.check_wrong_argument_type(self, "persistent_table", "default_table", default_table, "table", "nil") + if dmf.check_wrong_argument_type(self, "persistent_table", "table_name", table_name, "string") or + dmf.check_wrong_argument_type(self, "persistent_table", "default_table", default_table, "table", "nil") then return end diff --git a/dmf/scripts/mods/vmf/modules/core/require.lua b/dmf/scripts/mods/dmf/modules/core/require.lua similarity index 87% rename from dmf/scripts/mods/vmf/modules/core/require.lua rename to dmf/scripts/mods/dmf/modules/core/require.lua index 15ea6b9..5910cb6 100644 --- a/dmf/scripts/mods/vmf/modules/core/require.lua +++ b/dmf/scripts/mods/dmf/modules/core/require.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _io_requires = {} @@ -32,29 +32,29 @@ local function original_require(path, ...) end -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### -- Add a file path to be loaded through io instead of require() -function VMFMod:add_require_path(path) +function DMFMod:add_require_path(path) add_io_require_path(path) end -- Remove a file path that was previously loaded through io instead of require() -function VMFMod:remove_require_path(path) +function DMFMod:remove_require_path(path) remove_io_require_path(path) end -- Get all instances of a file created through require() -function VMFMod:get_require_store(path) +function DMFMod:get_require_store(path) return get_require_store(path) end -- Get a file through the original, unhooked require() function -function VMFMod:original_require(path, ...) +function DMFMod:original_require(path, ...) return original_require(path, ...) end @@ -63,16 +63,16 @@ end -- ##################################################################################################################### -- Handles the swap to io for registered files -vmf:hook(_G, "require", function (func, path, ...) +dmf:hook(_G, "require", function (func, path, ...) if _io_requires[path] then - return vmf:dofile(path) + return dmf:dofile(path) else return func(path, ...) end end) -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -- ##################################################################################################################### diff --git a/dmf/scripts/mods/vmf/modules/core/safe_calls.lua b/dmf/scripts/mods/dmf/modules/core/safe_calls.lua similarity index 80% rename from dmf/scripts/mods/vmf/modules/core/safe_calls.lua rename to dmf/scripts/mods/dmf/modules/core/safe_calls.lua index 95bc058..5f6fede 100644 --- a/dmf/scripts/mods/vmf/modules/core/safe_calls.lua +++ b/dmf/scripts/mods/dmf/modules/core/safe_calls.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- Global method to load a file through io with a return local mod_dofile = Mods.file.dofile @@ -33,25 +33,25 @@ local function show_error(mod, error_prefix_data, error_message) end -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### -function VMFMod:pcall(...) - return vmf.safe_call(self, "(pcall)", ...) +function DMFMod:pcall(...) + return dmf.safe_call(self, "(pcall)", ...) end -function VMFMod:dofile(file_path) - local _, return_values = pack_pcall(vmf.safe_call_dofile(self, "(dofile)", file_path)) +function DMFMod:dofile(file_path) + local _, return_values = pack_pcall(dmf.safe_call_dofile(self, "(dofile)", file_path)) return unpack(return_values, 1, return_values.n) end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -- Safe Call -function vmf.safe_call(mod, error_prefix_data, func, ...) +function dmf.safe_call(mod, error_prefix_data, func, ...) local success, return_values = pack_pcall(xpcall(func, print_error_callstack, ...)) if not success then show_error(mod, error_prefix_data, return_values[1]) @@ -62,7 +62,7 @@ end -- Safe Call [No return values] -function vmf.safe_call_nr(mod, error_prefix_data, func, ...) +function dmf.safe_call_nr(mod, error_prefix_data, func, ...) local success, error_message = xpcall(func, print_error_callstack, ...) if not success then show_error(mod, error_prefix_data, error_message) @@ -72,7 +72,7 @@ end -- Safe Call [No return values and error callstack] -function vmf.safe_call_nrc(mod, error_prefix_data, func, ...) +function dmf.safe_call_nrc(mod, error_prefix_data, func, ...) local success, error_message = pcall(func, ...) if not success then show_error(mod, error_prefix_data, error_message) @@ -82,16 +82,16 @@ end -- Safe Call [dofile] -function vmf.safe_call_dofile(mod, error_prefix_data, file_path) +function dmf.safe_call_dofile(mod, error_prefix_data, file_path) if type(file_path) ~= "string" then show_error(mod, error_prefix_data, "file path should be a string.") return false end - return vmf.safe_call(mod, error_prefix_data, mod_dofile, file_path) + return dmf.safe_call(mod, error_prefix_data, mod_dofile, file_path) end -- Format error message and throw error. -function vmf.throw_error(error_message, ...) +function dmf.throw_error(error_message, ...) error(string.format(error_message, ...), 0) end diff --git a/dmf/scripts/mods/vmf/modules/core/settings.lua b/dmf/scripts/mods/dmf/modules/core/settings.lua similarity index 86% rename from dmf/scripts/mods/vmf/modules/core/settings.lua rename to dmf/scripts/mods/dmf/modules/core/settings.lua index 7382db4..2adc9d1 100644 --- a/dmf/scripts/mods/vmf/modules/core/settings.lua +++ b/dmf/scripts/mods/dmf/modules/core/settings.lua @@ -1,11 +1,11 @@ --[[ Settings manager. * Operates settings within the mod namespace (you can define settings with the same name for different mods) - * Settings location: "%AppData%\Roaming\Fatshark\Warhammer End Times Vermintide\user_settings.config" + * Settings location: "%AppData%\Roaming\Fatshark\Warhammer End Times Darktide\user_settings.config" * All settings are saved to the settings-file when game state changes, when options menu is closed, and on reload * Serializable settings types: number, string, boolean, table (array-like and map-like, but not mixed) --]] -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _mods_settings = Application.user_setting("mods_settings") or {} @@ -23,7 +23,7 @@ local function save_all_settings() if string.find(error, "number expected, got string") then error = "one of mods tried to save a mixed table" end - vmf:error("Vermintide Mod Framework failed to save mods settings: %s", tostring(error)) + dmf:error("Darktide Mod Framework failed to save mods settings: %s", tostring(error)) return end @@ -33,7 +33,7 @@ local function save_all_settings() end -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### --[[ @@ -43,7 +43,7 @@ end * setting_value [anything]: setting value (can be any SJSON serializable format) * notify_mod [bool] : if 'true', calls 'mod.on_setting_changed' event --]] -function VMFMod:set(setting_id, setting_value, notify_mod) +function DMFMod:set(setting_id, setting_value, notify_mod) local mod_name = self:get_name() if not _mods_settings[mod_name] then @@ -56,7 +56,7 @@ function VMFMod:set(setting_id, setting_value, notify_mod) _there_are_unsaved_changes = true if notify_mod then - vmf.mod_setting_changed_event(self, setting_id) + dmf.mod_setting_changed_event(self, setting_id) end end @@ -66,7 +66,7 @@ end call. * setting_id [string]: setting's identifier --]] -function VMFMod:get(setting_id) +function DMFMod:get(setting_id) local mod_name = self:get_name() local mod_settings = _mods_settings[mod_name] local setting_value = mod_settings and mod_settings[setting_id] @@ -75,14 +75,14 @@ function VMFMod:get(setting_id) end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -function vmf.save_unsaved_settings_to_file() +function dmf.save_unsaved_settings_to_file() save_all_settings() end -function vmf.mod_has_settings(mod) +function dmf.mod_has_settings(mod) if _mods_settings[mod:get_name()] then return true end diff --git a/dmf/scripts/mods/vmf/modules/core/toggling.lua b/dmf/scripts/mods/dmf/modules/core/toggling.lua similarity index 57% rename from dmf/scripts/mods/vmf/modules/core/toggling.lua rename to dmf/scripts/mods/dmf/modules/core/toggling.lua index c247b18..42eaa97 100644 --- a/dmf/scripts/mods/vmf/modules/core/toggling.lua +++ b/dmf/scripts/mods/dmf/modules/core/toggling.lua @@ -1,21 +1,21 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -local _disabled_mods = vmf:get("disabled_mods_list") or {} +local _disabled_mods = dmf:get("disabled_mods_list") or {} -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.set_mod_state = function (mod, is_enabled, initial_call) +dmf.set_mod_state = function (mod, is_enabled, initial_call) - vmf.set_internal_data(mod, "is_enabled", is_enabled) + dmf.set_internal_data(mod, "is_enabled", is_enabled) if is_enabled then mod:enable_all_hooks() - vmf.mod_enabled_event(mod, initial_call) + dmf.mod_enabled_event(mod, initial_call) else mod:disable_all_hooks() - vmf.mod_disabled_event(mod, initial_call) + dmf.mod_disabled_event(mod, initial_call) end if not (initial_call or mod:get_internal_data("is_mutator")) then @@ -24,29 +24,29 @@ vmf.set_mod_state = function (mod, is_enabled, initial_call) else _disabled_mods[mod:get_name()] = true end - vmf:set("disabled_mods_list", _disabled_mods) + dmf:set("disabled_mods_list", _disabled_mods) end end -- Called when mod is loaded for the first time using mod:initialize() -vmf.initialize_mod_state = function (mod) +dmf.initialize_mod_state = function (mod) local state if mod:get_internal_data("is_mutator") then - -- if VMF was reloaded and mutator was activated - if vmf.is_mutator_enabled(mod:get_name()) then + -- if DMF was reloaded and mutator was activated + if dmf.is_mutator_enabled(mod:get_name()) then state = true else state = false end - vmf.set_mutator_state(mod, state, true) + dmf.set_mutator_state(mod, state, true) else state = not _disabled_mods[mod:get_name()] - vmf.set_mod_state(mod, state, true) + dmf.set_mod_state(mod, state, true) end end -vmf.mod_state_changed = function (mod_name, is_enabled) +dmf.mod_state_changed = function (mod_name, is_enabled) local mod = get_mod(mod_name) @@ -55,8 +55,8 @@ vmf.mod_state_changed = function (mod_name, is_enabled) end if mod:get_internal_data("is_mutator") then - vmf.set_mutator_state(mod, is_enabled, false) + dmf.set_mutator_state(mod, is_enabled, false) else - vmf.set_mod_state(mod, is_enabled, false) + dmf.set_mod_state(mod, is_enabled, false) end end diff --git a/dmf/scripts/mods/vmf/modules/debug/dev_console.lua b/dmf/scripts/mods/dmf/modules/debug/dev_console.lua similarity index 80% rename from dmf/scripts/mods/vmf/modules/debug/dev_console.lua rename to dmf/scripts/mods/dmf/modules/debug/dev_console.lua index db4a37d..9e8f266 100644 --- a/dmf/scripts/mods/vmf/modules/debug/dev_console.lua +++ b/dmf/scripts/mods/dmf/modules/debug/dev_console.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -- Note(Siku): This file could definitely use the hooking system if we could figure out a way. -- It would requires hooks to be pushed higher in the loading order, but then we lose hooks printing to console @@ -7,7 +7,7 @@ local vmf = get_mod("VMF") -- Global backup of the ffi library local _ffi = Mods.lua.ffi -local _console_data = vmf:persistent_table("dev_console_data") +local _console_data = dmf:persistent_table("dev_console_data") if not _console_data.enabled then _console_data.enabled = false end if not _console_data.original_print then _console_data.original_print = print end @@ -46,7 +46,7 @@ local function close_dev_console() CommandWindow.close() -- CommandWindow won't close by itself, so it have to be closed manually - vmf:pcall(function() + dmf:pcall(function() _ffi.cdef([[ void* FindWindowA(const char* lpClassName, const char* lpWindowName); int64_t SendMessageA(void* hWnd, unsigned int Msg, uint64_t wParam, int64_t lParam); @@ -61,29 +61,29 @@ local function close_dev_console() end -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.toggle_developer_console = function () +dmf.toggle_developer_console = function () - if vmf:get("developer_mode") then + if dmf:get("developer_mode") then - local show_console = not vmf:get("show_developer_console") - vmf:set("show_developer_console", show_console) + local show_console = not dmf:get("show_developer_console") + dmf:set("show_developer_console", show_console) - vmf.load_dev_console_settings() + dmf.load_dev_console_settings() if show_console then - vmf:echo(vmf:localize("dev_console_opened")) + dmf:echo(dmf:localize("dev_console_opened")) else - vmf:echo(vmf:localize("dev_console_closed")) + dmf:echo(dmf:localize("dev_console_closed")) end end end -vmf.load_dev_console_settings = function() +dmf.load_dev_console_settings = function() - if vmf:get("developer_mode") and vmf:get("show_developer_console") then + if dmf:get("developer_mode") and dmf:get("show_developer_console") then open_dev_console() else close_dev_console() @@ -94,4 +94,4 @@ end -- ##### Script ####################################################################################################### -- #################################################################################################################### -vmf.load_dev_console_settings() +dmf.load_dev_console_settings() diff --git a/dmf/scripts/mods/vmf/modules/debug/table_dump.lua b/dmf/scripts/mods/dmf/modules/debug/table_dump.lua similarity index 95% rename from dmf/scripts/mods/vmf/modules/debug/table_dump.lua rename to dmf/scripts/mods/dmf/modules/debug/table_dump.lua index 83fa7f8..3b8642c 100644 --- a/dmf/scripts/mods/vmf/modules/debug/table_dump.lua +++ b/dmf/scripts/mods/dmf/modules/debug/table_dump.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") -- @TODO: remove it? +local dmf = get_mod("DMF") -- @TODO: remove it? -- Global backup of the io library @@ -45,10 +45,10 @@ local function table_dump(key, value, depth, max_depth) end end -VMFMod.dump = function (self, dumped_object, dumped_object_name, max_depth) +DMFMod.dump = function (self, dumped_object, dumped_object_name, max_depth) - if vmf.check_wrong_argument_type(self, "dump", "dumped_object_name", dumped_object_name, "string", "nil") or - vmf.check_wrong_argument_type(self, "dump", "max_depth", max_depth, "number") + if dmf.check_wrong_argument_type(self, "dump", "dumped_object_name", dumped_object_name, "string", "nil") or + dmf.check_wrong_argument_type(self, "dump", "max_depth", max_depth, "number") then return end @@ -332,10 +332,10 @@ local function table_dump_to_file(dumped_table, dumped_table_name, max_depth) end -VMFMod.dump_to_file = function (self, dumped_object, object_name, max_depth) +DMFMod.dump_to_file = function (self, dumped_object, object_name, max_depth) - if vmf.check_wrong_argument_type(self, "dump_to_file", "object_name", object_name, "string") or - vmf.check_wrong_argument_type(self, "dump_to_file", "max_depth", max_depth, "number") + if dmf.check_wrong_argument_type(self, "dump_to_file", "object_name", object_name, "string") or + dmf.check_wrong_argument_type(self, "dump_to_file", "max_depth", max_depth, "number") then return end @@ -359,6 +359,6 @@ VMFMod.dump_to_file = function (self, dumped_object, object_name, max_depth) end end -VMFMod.dtf = VMFMod.dump_to_file +DMFMod.dtf = DMFMod.dump_to_file -- Managers.curl._requests crashes the game diff --git a/dmf/scripts/mods/dmf/modules/dmf_dummy.lua b/dmf/scripts/mods/dmf/modules/dmf_dummy.lua new file mode 100644 index 0000000..ee26440 --- /dev/null +++ b/dmf/scripts/mods/dmf/modules/dmf_dummy.lua @@ -0,0 +1,4 @@ +local dmf = get_mod("DMF") + +-- Add dmf functions with a value of dummy_func if they need to be defined while a module is disabled. +local dummy_func = function() return end \ No newline at end of file diff --git a/dmf/scripts/mods/vmf/modules/vmf_mod_data.lua b/dmf/scripts/mods/dmf/modules/dmf_mod_data.lua similarity index 83% rename from dmf/scripts/mods/vmf/modules/vmf_mod_data.lua rename to dmf/scripts/mods/dmf/modules/dmf_mod_data.lua index bf512ab..809ec5b 100644 --- a/dmf/scripts/mods/vmf/modules/vmf_mod_data.lua +++ b/dmf/scripts/mods/dmf/modules/dmf_mod_data.lua @@ -7,15 +7,15 @@ local function set_internal_data(mod, key, value) end -- ##################################################################################################################### --- ##### VMFMod (not API) ############################################################################################## +-- ##### DMFMod (not API) ############################################################################################## -- ##################################################################################################################### --- Defining VMFMod class. -VMFMod = class("VMFMod") +-- Defining DMFMod class. +DMFMod = class("DMFMod") --- Creating mod data table when object of VMFMod class is created. -function VMFMod:init(mod_name) - if mod_name == "VMF" then +-- Creating mod data table when object of DMFMod class is created. +function DMFMod:init(mod_name) + if mod_name == "DMF" then self.set_internal_data = set_internal_data end @@ -36,17 +36,17 @@ function VMFMod:init(mod_name) set_internal_data(self, "workshop_name", vanilla_mod_data.name) set_internal_data(self, "mod_handle", vanilla_mod_data.handle) - print(string.format("Init VMF mod '%s' [workshop_name: '%s', workshop_id: %s]", mod_name, vanilla_mod_data.name, + print(string.format("Init DMF mod '%s' [workshop_name: '%s', workshop_id: %s]", mod_name, vanilla_mod_data.name, vanilla_mod_data.id)) end -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### --[[ Universal function for retrieving any internal mod data. Returned table values shouldn't be modified, because it can - lead to unexpected VMF behaviour. + lead to unexpected DMF behaviour. * key [string]: data entry name Possible entry names: @@ -58,7 +58,7 @@ end - is_mutator (if the mod is mutator) - mutator_config (mutator config) --]] -function VMFMod:get_internal_data(key) +function DMFMod:get_internal_data(key) return self._data[key] end @@ -66,15 +66,15 @@ end --[[ Predefined functions for retrieving specific internal mod data. --]] -function VMFMod:get_name() +function DMFMod:get_name() return self._data.name end -function VMFMod:get_readable_name() +function DMFMod:get_readable_name() return self._data.readable_name end -function VMFMod:get_description() +function DMFMod:get_description() return self._data.description end -function VMFMod:is_enabled() +function DMFMod:is_enabled() return self._data.is_enabled end diff --git a/dmf/scripts/mods/vmf/modules/vmf_mod_manager.lua b/dmf/scripts/mods/dmf/modules/dmf_mod_manager.lua similarity index 72% rename from dmf/scripts/mods/vmf/modules/vmf_mod_manager.lua rename to dmf/scripts/mods/dmf/modules/dmf_mod_manager.lua index b8a9c15..71f161b 100644 --- a/dmf/scripts/mods/vmf/modules/vmf_mod_manager.lua +++ b/dmf/scripts/mods/dmf/modules/dmf_mod_manager.lua @@ -1,4 +1,4 @@ -local vmf = nil +local dmf = nil local _mods = {} local _mods_unloading_order = {} @@ -6,24 +6,24 @@ local _mods_unloading_order = {} local ERRORS = { REGULAR = { -- create_mod: - duplicate_mod_name = "[VMF Mod Manager] (new_mod) Creating mod object: you can't use name '%s' for your mod " .. + duplicate_mod_name = "[DMF Mod Manager] (new_mod) Creating mod object: you can't use name '%s' for your mod " .. "because mod with the same name already exists.", -- new_mod: - mod_name_wrong_type = "[VMF Mod Manager] (new_mod): first argument ('mod_name') should be a string, not %s.", - mod_resources_wrong_type = "[VMF Mod Manager] (new_mod) '%s': second argument ('mod_resources') should be a " .. + mod_name_wrong_type = "[DMF Mod Manager] (new_mod): first argument ('mod_name') should be a string, not %s.", + mod_resources_wrong_type = "[DMF Mod Manager] (new_mod) '%s': second argument ('mod_resources') should be a " .. "table, not %s.", - too_late_for_mod_creation = "[VMF Mod Manager] (new_mod) '%s': you can't create mods after vanilla mod manager " .. + too_late_for_mod_creation = "[DMF Mod Manager] (new_mod) '%s': you can't create mods after vanilla mod manager " .. "finishes loading mod bundles.", - -- vmf.initialize_mod_data: - mod_data_wrong_type = "[VMF Mod Manager] (new_mod) 'mod_data' initialization: mod_data file should return " .. + -- dmf.initialize_mod_data: + mod_data_wrong_type = "[DMF Mod Manager] (new_mod) 'mod_data' initialization: mod_data file should return " .. "table, not %s.", - mod_options_initializing_failed = "[VMF Mod Manager] (new_mod) mod options initialization: could not initialize " .. + mod_options_initializing_failed = "[DMF Mod Manager] (new_mod) mod options initialization: could not initialize " .. "mod's options. %s", }, PREFIX = { - mod_localization_initialization = "[VMF Mod Manager] (new_mod) 'mod_localization' initialization", - mod_data_initialization = "[VMF Mod Manager] (new_mod) 'mod_data' initialization", - mod_script_initialization = "[VMF Mod Manager] (new_mod) 'mod_script' initialization", + mod_localization_initialization = "[DMF Mod Manager] (new_mod) 'mod_localization' initialization", + mod_data_initialization = "[DMF Mod Manager] (new_mod) 'mod_data' initialization", + mod_script_initialization = "[DMF Mod Manager] (new_mod) 'mod_script' initialization", }, } @@ -33,13 +33,13 @@ local ERRORS = { local function create_mod(mod_name) if _mods[mod_name] then - vmf:error(ERRORS.REGULAR.duplicate_mod_name, mod_name) + dmf:error(ERRORS.REGULAR.duplicate_mod_name, mod_name) return end table.insert(_mods_unloading_order, 1, mod_name) - local mod = VMFMod:new(mod_name) + local mod = DMFMod:new(mod_name) _mods[mod_name] = mod return mod @@ -50,9 +50,9 @@ local function resolve_resource(mod, error_prefix_data, resource, resource_value local type_value = type(resource_value) if type_value == "string" then - return vmf.safe_call_dofile(mod, error_prefix_data, resource_value) + return dmf.safe_call_dofile(mod, error_prefix_data, resource_value) elseif type_value == "function" then - return vmf.safe_call(mod, error_prefix_data, resource_value, mod) + return dmf.safe_call(mod, error_prefix_data, resource_value, mod) elseif type_value == "table" then return true, type_value end @@ -79,13 +79,13 @@ local function load_mod_resource(mod, mod_resources, resource) return false end - -- Check if there's a VMF initializator for this resource, and execute it if it exists. - local vmf_initializator = vmf["initialize_mod_" .. resource] - if not vmf_initializator then + -- Check if there's a DMF initializator for this resource, and execute it if it exists. + local dmf_initializator = dmf["initialize_mod_" .. resource] + if not dmf_initializator then return true end - return vmf_initializator(mod, return_value) + return dmf_initializator(mod, return_value) end -- ##################################################################################################################### @@ -94,16 +94,16 @@ end function new_mod(mod_name, mod_resources) if type(mod_name) ~= "string" then - vmf:error(ERRORS.REGULAR.mod_name_wrong_type, type(mod_name)) + dmf:error(ERRORS.REGULAR.mod_name_wrong_type, type(mod_name)) return end if type(mod_resources) ~= "table" then - vmf:error(ERRORS.REGULAR.mod_resources_wrong_type, mod_name, type(mod_resources)) + dmf:error(ERRORS.REGULAR.mod_resources_wrong_type, mod_name, type(mod_resources)) return end - if vmf.all_mods_were_loaded then - vmf:error(ERRORS.REGULAR.too_late_for_mod_creation, mod_name) + if dmf.all_mods_were_loaded then + dmf:error(ERRORS.REGULAR.too_late_for_mod_creation, mod_name) return end @@ -125,7 +125,7 @@ function new_mod(mod_name, mod_resources) -- Initialize mod state if mod:get_internal_data("is_togglable") then - vmf.initialize_mod_state(mod) + dmf.initialize_mod_state(mod) end return mod @@ -137,18 +137,18 @@ function get_mod(mod_name) end -- ##################################################################################################################### --- ##### VMF Initialization ############################################################################################ +-- ##### DMF Initialization ############################################################################################ -- ##################################################################################################################### -vmf = create_mod("VMF") +dmf = create_mod("DMF") -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -- MOD DATA INITIALIZATION -function vmf.initialize_mod_data(mod, mod_data) +function dmf.initialize_mod_data(mod, mod_data) if type(mod_data) ~= "table" then mod:error(ERRORS.REGULAR.mod_data_wrong_type, type(mod_data)) return @@ -156,21 +156,21 @@ function vmf.initialize_mod_data(mod, mod_data) -- Set internal mod data if mod_data.name then - vmf.set_internal_data(mod, "readable_name", mod_data.name) + dmf.set_internal_data(mod, "readable_name", mod_data.name) end - vmf.set_internal_data(mod, "description", mod_data.description) - vmf.set_internal_data(mod, "is_togglable", mod_data.is_togglable or mod_data.is_mutator) - vmf.set_internal_data(mod, "is_mutator", mod_data.is_mutator) - vmf.set_internal_data(mod, "allow_rehooking", mod_data.allow_rehooking) + dmf.set_internal_data(mod, "description", mod_data.description) + dmf.set_internal_data(mod, "is_togglable", mod_data.is_togglable or mod_data.is_mutator) + dmf.set_internal_data(mod, "is_mutator", mod_data.is_mutator) + dmf.set_internal_data(mod, "allow_rehooking", mod_data.allow_rehooking) -- Register mod as mutator @TODO: calling this after options initialization would be better, I guess? if mod_data.is_mutator then - vmf.register_mod_as_mutator(mod, mod_data.mutator_settings) + dmf.register_mod_as_mutator(mod, mod_data.mutator_settings) end -- Mod's options initialization if mod_data.options or ((mod_data.is_togglable and not mod_data.is_mutator) and not mod_data.options_widgets) then - local success, error_message = pcall(vmf.initialize_mod_options, mod, mod_data.options) + local success, error_message = pcall(dmf.initialize_mod_options, mod, mod_data.options) if not success then mod:error(ERRORS.REGULAR.mod_options_initializing_failed, error_message) return @@ -187,5 +187,5 @@ end -- VARIABLES -vmf.mods = _mods -vmf.mods_unloading_order = _mods_unloading_order +dmf.mods = _mods +dmf.mods_unloading_order = _mods_unloading_order diff --git a/dmf/scripts/mods/vmf/modules/vmf_options.lua b/dmf/scripts/mods/dmf/modules/dmf_options.lua similarity index 85% rename from dmf/scripts/mods/vmf/modules/vmf_options.lua rename to dmf/scripts/mods/dmf/modules/dmf_options.lua index fc34627..c9866bc 100644 --- a/dmf/scripts/mods/vmf/modules/vmf_options.lua +++ b/dmf/scripts/mods/dmf/modules/dmf_options.lua @@ -1,19 +1,19 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -local vmf_mod_data = {} -vmf_mod_data.name = "Darktide Mod Framework" -vmf_mod_data.options = { +local dmf_mod_data = {} +dmf_mod_data.name = "Darktide Mod Framework" +dmf_mod_data.options = { widgets = { { - setting_id = "open_vmf_options", + setting_id = "open_dmf_options", type = "keybind", default_value = {"f4"}, keybind_trigger = "pressed", keybind_type = "view_toggle", - view_name = "vmf_options_view" + view_name = "dmf_options_view" }, { - setting_id = "vmf_options_scrolling_speed", + setting_id = "dmf_options_scrolling_speed", type = "numeric", default_value = 100, range = {1, 1000}, @@ -194,36 +194,36 @@ vmf_mod_data.options = { } -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.on_setting_changed = function (setting_id) +dmf.on_setting_changed = function (setting_id) - if setting_id == "vmf_options_scrolling_speed" then + if setting_id == "dmf_options_scrolling_speed" then -- Not necessary until the view is loaded - if vmf.load_vmf_options_view_settings then - vmf.load_vmf_options_view_settings() + if dmf.load_dmf_options_view_settings then + dmf.load_dmf_options_view_settings() end elseif setting_id == "developer_mode" then - vmf.load_developer_mode_settings() - vmf.load_network_settings() - vmf.load_custom_textures_settings() - vmf.load_dev_console_settings() + dmf.load_developer_mode_settings() + dmf.load_network_settings() + dmf.load_custom_textures_settings() + dmf.load_dev_console_settings() elseif setting_id == "show_developer_console" then - vmf.load_dev_console_settings() + dmf.load_dev_console_settings() elseif setting_id == "show_network_debug_info" then - vmf.load_network_settings() + dmf.load_network_settings() elseif setting_id == "log_ui_renderers_info" then - vmf.load_custom_textures_settings() + dmf.load_custom_textures_settings() elseif setting_id == "logging_mode" or setting_id == "output_mode_notification" @@ -233,7 +233,7 @@ vmf.on_setting_changed = function (setting_id) or setting_id == "output_mode_info" or setting_id == "output_mode_debug" then - vmf.load_logging_settings() + dmf.load_logging_settings() elseif setting_id == "chat_history_enable" or setting_id == "chat_history_save" @@ -242,14 +242,14 @@ vmf.on_setting_changed = function (setting_id) or setting_id == "chat_history_remove_dups_mode" or setting_id == "chat_history_commands_only" then - vmf.load_chat_history_settings(setting_id == "chat_history_enable" or + dmf.load_chat_history_settings(setting_id == "chat_history_enable" or setting_id == "chat_history_buffer_size" or setting_id == "chat_history_commands_only") end end -vmf.load_developer_mode_settings = function () --@TODO: maybe move it to somewhere else? - Managers.mod._settings.developer_mode = vmf:get("developer_mode") +dmf.load_developer_mode_settings = function () --@TODO: maybe move it to somewhere else? + Managers.mod._settings.developer_mode = dmf:get("developer_mode") Application.set_user_setting("mod_settings", Managers.mod._settings) end @@ -257,23 +257,23 @@ end -- ##### Script ####################################################################################################### -- #################################################################################################################### -vmf.initialize_mod_data(vmf, vmf_mod_data) +dmf.initialize_mod_data(dmf, dmf_mod_data) --- first VMF initialization --- it will be run only 1 time, when the player launch the game with VMF for the first time -if not vmf:get("vmf_initialized") then +-- first DMF initialization +-- it will be run only 1 time, when the player launch the game with DMF for the first time +if not dmf:get("dmf_initialized") then - vmf.load_logging_settings() - vmf.load_developer_mode_settings() - vmf.load_network_settings() - vmf.load_custom_textures_settings() - vmf.load_dev_console_settings() - vmf.load_chat_history_settings() + dmf.load_logging_settings() + dmf.load_developer_mode_settings() + dmf.load_network_settings() + dmf.load_custom_textures_settings() + dmf.load_dev_console_settings() + dmf.load_chat_history_settings() -- Not necessary until the view is loaded - if vmf.load_vmf_options_view_settings then - vmf.load_vmf_options_view_settings() + if dmf.load_dmf_options_view_settings then + dmf.load_dmf_options_view_settings() end - vmf:set("vmf_initialized", true) + dmf:set("dmf_initialized", true) end diff --git a/dmf/scripts/mods/vmf/modules/vmf_package_manager.lua b/dmf/scripts/mods/dmf/modules/dmf_package_manager.lua similarity index 84% rename from dmf/scripts/mods/vmf/modules/vmf_package_manager.lua rename to dmf/scripts/mods/dmf/modules/dmf_package_manager.lua index 16e7aea..3c20598 100644 --- a/dmf/scripts/mods/vmf/modules/vmf_package_manager.lua +++ b/dmf/scripts/mods/dmf/modules/dmf_package_manager.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _packages = {} local _queued_packages = {} @@ -12,25 +12,25 @@ local PUBLIC_STATUSES = { local ERRORS = { REGULAR = { - -- VMFMod:load_package: - package_already_loaded = "[VMF Package Manager] (load_package): package '%s' has already been loaded.", - package_not_found = "[VMF Package Manager] (load_package): could not find package '%s'.", - package_already_queued = "[VMF Package Manager] (load_package): package '%s' is already queued for loading.", - -- VMFMod:unload_package: - package_not_loaded = "[VMF Package Manager] (unload_package): package '%s' has not been loaded.", - cant_unload_loading_package = "[VMF Package Manager] (unload_package): package '%s' can't be unloaded because " .. + -- DMFMod:load_package: + package_already_loaded = "[DMF Package Manager] (load_package): package '%s' has already been loaded.", + package_not_found = "[DMF Package Manager] (load_package): could not find package '%s'.", + package_already_queued = "[DMF Package Manager] (load_package): package '%s' is already queued for loading.", + -- DMFMod:unload_package: + package_not_loaded = "[DMF Package Manager] (unload_package): package '%s' has not been loaded.", + cant_unload_loading_package = "[DMF Package Manager] (unload_package): package '%s' can't be unloaded because " .. "it's currently loading." }, PREFIX = { - package_loaded_callback = "[VMF Package Manager] '%s' package loaded callback execution" + package_loaded_callback = "[DMF Package Manager] '%s' package loaded callback execution" } } local WARNINGS = { - force_unloading_package = "[VMF Package Manager] Force-unloading package '%s'. Please make sure to properly " .. + force_unloading_package = "[DMF Package Manager] Force-unloading package '%s'. Please make sure to properly " .. "release packages when the mod is unloaded", - still_loading_package = "[VMF Package Manager] Still loading package '%s'. Memory leaks may occur when unloading " .. + still_loading_package = "[DMF Package Manager] Still loading package '%s'. Memory leaks may occur when unloading " .. "while a package is loading." } @@ -51,7 +51,7 @@ local function flush_package(package_name) package_data.status = "loaded" local callback = package_data.callback if callback then - vmf.safe_call_nr(package_data.mod, {ERRORS.PREFIX.package_loaded_callback, package_name}, callback, package_name) + dmf.safe_call_nr(package_data.mod, {ERRORS.PREFIX.package_loaded_callback, package_name}, callback, package_name) end end end @@ -67,7 +67,7 @@ local function remove_package_from_queue(package_name) end -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### --[[ @@ -76,10 +76,10 @@ end * callback [function]: (optional) callback for when loading is done * sync [boolean] : (optional) load the packages synchronously, freezing the game until it is loaded --]] -function VMFMod:load_package(package_name, callback, sync) - if vmf.check_wrong_argument_type(self, "load_package", "package_name", package_name, "string") or - vmf.check_wrong_argument_type(self, "load_package", "callback", callback, "function", "nil") or - vmf.check_wrong_argument_type(self, "load_package", "sync", sync, "boolean", "nil") +function DMFMod:load_package(package_name, callback, sync) + if dmf.check_wrong_argument_type(self, "load_package", "package_name", package_name, "string") or + dmf.check_wrong_argument_type(self, "load_package", "callback", callback, "function", "nil") or + dmf.check_wrong_argument_type(self, "load_package", "sync", sync, "boolean", "nil") then return end @@ -137,8 +137,8 @@ end Unloads a loaded mod package. * package_name [string]: package name. needs to be the full path to the `.package` file without the extension --]] -function VMFMod:unload_package(package_name) - if vmf.check_wrong_argument_type(self, "unload_package", "package_name", package_name, "string") +function DMFMod:unload_package(package_name) + if dmf.check_wrong_argument_type(self, "unload_package", "package_name", package_name, "string") then return end @@ -165,8 +165,8 @@ end Returns package status string. * package_name [string]: package name. needs to be the full path to the `.package` file without the extension --]] -function VMFMod:package_status(package_name) - if vmf.check_wrong_argument_type(self, "package_status", "package_name", package_name, "string") +function DMFMod:package_status(package_name) + if dmf.check_wrong_argument_type(self, "package_status", "package_name", package_name, "string") then return end @@ -178,11 +178,11 @@ function VMFMod:package_status(package_name) end -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -- Loads queued packages one at a time. -function vmf.update_package_manager() +function dmf.update_package_manager() local queued_package_name = _queued_packages[1] if queued_package_name then local package_data = _packages[queued_package_name] @@ -202,7 +202,7 @@ end -- Forcefully unloads all not unloaded packages. -function vmf.unload_all_resource_packages() +function dmf.unload_all_resource_packages() for package_name, package_data in pairs(_packages) do local package_status = package_data.status diff --git a/dmf/scripts/mods/vmf/modules/gui/custom_textures.lua b/dmf/scripts/mods/dmf/modules/gui/custom_textures.lua similarity index 79% rename from dmf/scripts/mods/vmf/modules/gui/custom_textures.lua rename to dmf/scripts/mods/dmf/modules/gui/custom_textures.lua index c5eaee5..cfc2765 100644 --- a/dmf/scripts/mods/vmf/modules/gui/custom_textures.lua +++ b/dmf/scripts/mods/dmf/modules/gui/custom_textures.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _show_debug_info = false @@ -11,18 +11,18 @@ local function check_texture_availability(mod, texture_name) end -- #################################################################################################################### --- ##### VMFMod ####################################################################################################### +-- ##### DMFMod ####################################################################################################### -- #################################################################################################################### -vmf.custom_textures = function (mod, ...) +dmf.custom_textures = function (mod, ...) -- @TODO: Not implemented end -vmf.custom_atlas = function (mod, ...) +dmf.custom_atlas = function (mod, ...) -- @TODO: Not implemented end -vmf.inject_materials = function (mod, ...) +dmf.inject_materials = function (mod, ...) -- @TODO: Not implemented end @@ -31,19 +31,19 @@ end -- #################################################################################################################### -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.load_custom_textures_settings = function() - _show_debug_info = vmf:get("developer_mode") and vmf:get("log_ui_renderers_info") +dmf.load_custom_textures_settings = function() + _show_debug_info = dmf:get("developer_mode") and dmf:get("log_ui_renderers_info") end -vmf.reset_guis = function() - -- @TODO: Method to reset VMF-spawned guis +dmf.reset_guis = function() + -- @TODO: Method to reset DMF-spawned guis end -- #################################################################################################################### -- ##### Script ####################################################################################################### -- #################################################################################################################### -vmf.load_custom_textures_settings() +dmf.load_custom_textures_settings() diff --git a/dmf/scripts/mods/vmf/modules/gui/custom_views.lua b/dmf/scripts/mods/dmf/modules/gui/custom_views.lua similarity index 88% rename from dmf/scripts/mods/vmf/modules/gui/custom_views.lua rename to dmf/scripts/mods/dmf/modules/gui/custom_views.lua index 344a268..0e8dde3 100644 --- a/dmf/scripts/mods/vmf/modules/gui/custom_views.lua +++ b/dmf/scripts/mods/dmf/modules/gui/custom_views.lua @@ -1,6 +1,6 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -local _custom_view_data = vmf:persistent_table("custom_view_data") +local _custom_view_data = dmf:persistent_table("custom_view_data") local _ingame_ui local _views_data = {} @@ -75,21 +75,21 @@ local function inject_view(view_name) -- Check for collisions. @TODO: Check for collisions by mod --if _ingame_ui._view_list[view_name] then - -- vmf.throw_error(ERRORS.THROWABLE.view_already_exists, view_name) + -- dmf.throw_error(ERRORS.THROWABLE.view_already_exists, view_name) --end --for transition_name, _ in pairs(transitions) do -- if _ingame_ui_transitions[transition_name] then - -- vmf.throw_error(ERRORS.THROWABLE.transition_already_exists, transition_name) + -- dmf.throw_error(ERRORS.THROWABLE.transition_already_exists, transition_name) -- end --end -- Initialize and inject view. - local success = vmf.safe_call(mod, ERRORS.PREFIX.view_initializing, init_view_function, + local success = dmf.safe_call(mod, ERRORS.PREFIX.view_initializing, init_view_function, view_settings, {}) if success then _ingame_ui._view_list[view_name] = view_settings else - vmf.throw_error(ERRORS.THROWABLE.view_initializing_failed) + dmf.throw_error(ERRORS.THROWABLE.view_initializing_failed) end -- Inject view transitions. @@ -133,13 +133,13 @@ end local function validate_view_data(view_data) -- Basic checks. if type(view_data.view_name) ~= "string" then - vmf.throw_error(ERRORS.THROWABLE.view_name_wrong_type, type(view_data.view_name)) + dmf.throw_error(ERRORS.THROWABLE.view_name_wrong_type, type(view_data.view_name)) end if type(view_data.view_transitions) ~= "table" then - vmf.throw_error(ERRORS.THROWABLE.view_transitions_wrong_type, type(view_data.view_transitions)) + dmf.throw_error(ERRORS.THROWABLE.view_transitions_wrong_type, type(view_data.view_transitions)) end if type(view_data.view_settings) ~= "table" then - vmf.throw_error(ERRORS.THROWABLE.view_settings_wrong_type, type(view_data.view_settings)) + dmf.throw_error(ERRORS.THROWABLE.view_settings_wrong_type, type(view_data.view_settings)) end -- VIEW TRANSITIONS @@ -147,12 +147,12 @@ local function validate_view_data(view_data) local view_transitions = view_data.view_transitions for transition_name, transition_function in pairs(view_transitions) do if type(transition_function) ~= "function" then - vmf.throw_error(ERRORS.THROWABLE.transition_wrong_type, transition_name, type(transition_function)) + dmf.throw_error(ERRORS.THROWABLE.transition_wrong_type, transition_name, type(transition_function)) end for another_view_name, another_view_data in pairs(_views_data) do for another_transition_name, _ in pairs(another_view_data.view_transitions) do if transition_name == another_transition_name then - vmf.throw_error(ERRORS.THROWABLE.transition_name_taken, transition_name, another_view_data.mod:get_name(), + dmf.throw_error(ERRORS.THROWABLE.transition_name_taken, transition_name, another_view_data.mod:get_name(), another_view_name) end end @@ -168,24 +168,24 @@ local function validate_view_data(view_data) -- Verify everything. if type(view_settings.init_view_function) ~= "function" then - vmf.throw_error(ERRORS.THROWABLE.init_view_function_wrong_type, type(view_settings.init_view_function)) + dmf.throw_error(ERRORS.THROWABLE.init_view_function_wrong_type, type(view_settings.init_view_function)) end -- Verify active if present local active = view_settings.active if active then if type(active) ~= "table" then - vmf.throw_error(ERRORS.THROWABLE.active_wrong_type, type(active)) + dmf.throw_error(ERRORS.THROWABLE.active_wrong_type, type(active)) end if active.inn == nil or active.ingame == nil then - vmf.throw_error(ERRORS.THROWABLE.active_missing_element) + dmf.throw_error(ERRORS.THROWABLE.active_missing_element) end for level_name, value in pairs(active) do if level_name ~= "inn" and level_name ~= "ingame" then - vmf.throw_error(ERRORS.THROWABLE.active_element_wrong_name, level_name) + dmf.throw_error(ERRORS.THROWABLE.active_element_wrong_name, level_name) end if type(value) ~= "boolean" then - vmf.throw_error(ERRORS.THROWABLE.active_element_wrong_type, level_name, type(value)) + dmf.throw_error(ERRORS.THROWABLE.active_element_wrong_type, level_name, type(value)) end end end @@ -194,25 +194,25 @@ local function validate_view_data(view_data) local blocked_transitions = view_settings.blocked_transitions if blocked_transitions then if type(blocked_transitions) ~= "table" then - vmf.throw_error(ERRORS.THROWABLE.blocked_transitions_wrong_type, type(blocked_transitions)) + dmf.throw_error(ERRORS.THROWABLE.blocked_transitions_wrong_type, type(blocked_transitions)) end if not blocked_transitions.inn or not blocked_transitions.ingame then - vmf.throw_error(ERRORS.THROWABLE.blocked_transitions_missing_element) + dmf.throw_error(ERRORS.THROWABLE.blocked_transitions_missing_element) end for level_name, level_blocked_transitions in pairs(blocked_transitions) do if level_name ~= "inn" and level_name ~= "ingame" then - vmf.throw_error(ERRORS.THROWABLE.blocked_transitions_element_wrong_name, level_name) + dmf.throw_error(ERRORS.THROWABLE.blocked_transitions_element_wrong_name, level_name) end if type(level_blocked_transitions) ~= "table" then - vmf.throw_error(ERRORS.THROWABLE.blocked_transitions_element_wrong_type, level_name, + dmf.throw_error(ERRORS.THROWABLE.blocked_transitions_element_wrong_type, level_name, type(level_blocked_transitions)) end for transition_name, value in pairs(level_blocked_transitions) do if not view_transitions[transition_name] then - vmf.throw_error(ERRORS.THROWABLE.blocked_transition_invalid, transition_name, level_name) + dmf.throw_error(ERRORS.THROWABLE.blocked_transition_invalid, transition_name, level_name) end if value ~= true then - vmf.throw_error(ERRORS.THROWABLE.blocked_transition_wrong_value, level_name, transition_name) + dmf.throw_error(ERRORS.THROWABLE.blocked_transition_wrong_value, level_name, transition_name) end end end @@ -256,7 +256,7 @@ local function can_open_view(view_name) end -- ##################################################################################################################### --- ##### VMFMod ######################################################################################################## +-- ##### DMFMod ######################################################################################################## -- ##################################################################################################################### --[[ @@ -267,7 +267,7 @@ end * transition_params [anything]: parameter, which will be passed to callable transition function, 'on_exit' method of the old view and 'on_enter' method of the new view --]] -function VMFMod:handle_transition() +function DMFMod:handle_transition() return true end @@ -276,8 +276,8 @@ end Opens a file with a view data and validates it. Registers the view and returns 'true' if everything is correct. * view_data_file_path [string]: path to a file returning view_data table --]] -function VMFMod:register_view(view_data) - if vmf.check_wrong_argument_type(self, "register_view", "view_data", view_data, "table") then +function DMFMod:register_view(view_data) + if dmf.check_wrong_argument_type(self, "register_view", "view_data", view_data, "table") then return end @@ -290,7 +290,7 @@ function VMFMod:register_view(view_data) view_data.view_settings.close_on_hotkey_pressed = true end - if not vmf.safe_call_nrc(self, {ERRORS.PREFIX.register_view_validation, view_name}, validate_view_data, + if not dmf.safe_call_nrc(self, {ERRORS.PREFIX.register_view_validation, view_name}, validate_view_data, view_data) then return end @@ -303,7 +303,7 @@ function VMFMod:register_view(view_data) } if _ingame_ui then - if not vmf.safe_call_nrc(self, {ERRORS.PREFIX.register_view_injection, view_name}, inject_view, view_name) then + if not dmf.safe_call_nrc(self, {ERRORS.PREFIX.register_view_injection, view_name}, inject_view, view_name) then _views_data[view_data.view_name] = nil end end @@ -317,18 +317,18 @@ end -- Track the creation of the view loader -vmf:hook_safe(ViewLoader, "init", function() +dmf:hook_safe(ViewLoader, "init", function() _custom_view_data.loader_initialized = true end) -- Track the deletion of the view loader -vmf:hook_safe(ViewLoader, "destroy", function() +dmf:hook_safe(ViewLoader, "destroy", function() _custom_view_data.loader_initialized = false end) -- Track the loading of views, set the loader flag if class selection is reached -vmf:hook_safe(UIManager, "load_view", function(self, view_name) +dmf:hook_safe(UIManager, "load_view", function(self, view_name) if view_name == "class_selection_view" then _custom_view_data.loader_initialized = true end @@ -336,26 +336,26 @@ vmf:hook_safe(UIManager, "load_view", function(self, view_name) end) -- Track the unloading of views -vmf:hook_safe(UIManager, "unload_view", function(self, view_name) +dmf:hook_safe(UIManager, "unload_view", function(self, view_name) _loaded_views[view_name] = nil end) -- Store the view handler for later use and inject views -vmf:hook_safe(UIViewHandler, "init", function(self) +dmf:hook_safe(UIViewHandler, "init", function(self) _ingame_ui = self for view_name, _ in pairs(_views_data) do - if not vmf.safe_call_nrc(self, {ERRORS.PREFIX.ingameui_hook_injection, view_name}, inject_view, view_name) then + if not dmf.safe_call_nrc(self, {ERRORS.PREFIX.ingameui_hook_injection, view_name}, inject_view, view_name) then _views_data[view_name] = nil end end end) -- ##################################################################################################################### --- ##### VMF internal functions and variables ########################################################################## +-- ##### DMF internal functions and variables ########################################################################## -- ##################################################################################################################### -function vmf.remove_custom_views() +function dmf.remove_custom_views() if _ingame_ui then remove_injected_views(true) end @@ -364,7 +364,7 @@ end -- Opens/closes a view if all conditions are met. Since keybinds module can't do UI-related checks, all the cheks are -- done in this function. This function is called every time some view-toggling keybind is pressed. -function vmf.keybind_toggle_view(mod, view_name, keybind_transition_data, can_perform_action, is_keybind_pressed) +function dmf.keybind_toggle_view(mod, view_name, keybind_transition_data, can_perform_action, is_keybind_pressed) --[[ if _ingame_ui then local view_data = _views_data[view_name] @@ -456,5 +456,5 @@ end -- ##### Script ######################################################################################################## -- ##################################################################################################################### --- If VMF is reloaded mid-game, get ingame_ui. +-- If DMF is reloaded mid-game, get ingame_ui. _ingame_ui = Managers.ui and Managers.ui._view_handler diff --git a/dmf/scripts/mods/vmf/modules/ui/chat/chat_actions.lua b/dmf/scripts/mods/dmf/modules/ui/chat/chat_actions.lua similarity index 85% rename from dmf/scripts/mods/vmf/modules/ui/chat/chat_actions.lua rename to dmf/scripts/mods/dmf/modules/ui/chat/chat_actions.lua index 38e28bd..0432d23 100644 --- a/dmf/scripts/mods/vmf/modules/ui/chat/chat_actions.lua +++ b/dmf/scripts/mods/dmf/modules/ui/chat/chat_actions.lua @@ -3,7 +3,7 @@ * chat history * ctrl + c, ctrl + v ]] -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _chat_opened = false @@ -32,7 +32,7 @@ local _queued_command local function initialize_drawing_function() if not _commands_list_gui_draw then - local commands_list_gui = vmf:dofile("dmf/scripts/mods/vmf/modules/ui/chat/commands_list_gui") + local commands_list_gui = dmf:dofile("dmf/scripts/mods/dmf/modules/ui/chat/commands_list_gui") _commands_list_gui_draw = commands_list_gui.draw _commands_list_gui_destroy = commands_list_gui.destroy end @@ -76,7 +76,7 @@ end -- #################################################################################################################### -- Handle chat actions when the chat window is active -vmf:hook("ConstantElementChat", "_handle_active_chat_input", function(func, self, input_service, ui_renderer, ...) +dmf:hook("ConstantElementChat", "_handle_active_chat_input", function(func, self, input_service, ui_renderer, ...) initialize_drawing_function() local command_executed = false @@ -130,7 +130,7 @@ vmf:hook("ConstantElementChat", "_handle_active_chat_input", function(func, self command_executed = true elseif string.sub(_chat_message, 1, 1) == "/" then - vmf:notify(vmf:localize("chat_command_not_recognized") .. ": " .. _chat_message) + dmf:notify(dmf:localize("chat_command_not_recognized") .. ": " .. _chat_message) set_chat_message(self, "") return end @@ -224,14 +224,14 @@ vmf:hook("ConstantElementChat", "_handle_active_chat_input", function(func, self end - if not autocompleting or not vmf._commands_list_gui_draw then + if not autocompleting or not dmf._commands_list_gui_draw then -- get '/part_of_command_name' without '/' local command_name_contains = _chat_message:match("%S+"):sub(2, -1) if string.find(_chat_message, " ") then - _commands_list = vmf.get_commands_list(command_name_contains, true) + _commands_list = dmf.get_commands_list(command_name_contains, true) else - _commands_list = vmf.get_commands_list(command_name_contains) + _commands_list = dmf.get_commands_list(command_name_contains) end _command_index = 0 @@ -257,27 +257,27 @@ vmf:hook("ConstantElementChat", "_handle_active_chat_input", function(func, self end) -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.load_chat_history_settings = function(clean_chat_history_) +dmf.load_chat_history_settings = function(clean_chat_history_) - _chat_history_enabled = vmf:get("chat_history_enable") - _chat_history_save = vmf:get("chat_history_save") - _chat_history_max = vmf:get("chat_history_buffer_size") - _chat_history_remove_dups_last = vmf:get("chat_history_remove_dups") - _chat_history_remove_dups_all = vmf:get("chat_history_remove_dups") and - (vmf:get("chat_history_remove_dups_mode") == "all") - _chat_history_save_commands_only = vmf:get("chat_history_commands_only") + _chat_history_enabled = dmf:get("chat_history_enable") + _chat_history_save = dmf:get("chat_history_save") + _chat_history_max = dmf:get("chat_history_buffer_size") + _chat_history_remove_dups_last = dmf:get("chat_history_remove_dups") + _chat_history_remove_dups_all = dmf:get("chat_history_remove_dups") and + (dmf:get("chat_history_remove_dups_mode") == "all") + _chat_history_save_commands_only = dmf:get("chat_history_commands_only") if _chat_history_enabled then - vmf:command("clean_chat_history", vmf:localize("clean_chat_history"), clean_chat_history) + dmf:command("clean_chat_history", dmf:localize("clean_chat_history"), clean_chat_history) else - vmf:command_remove("clean_chat_history") + dmf:command_remove("clean_chat_history") end if not _chat_history_save then - vmf:set("chat_history", nil) + dmf:set("chat_history", nil) end if clean_chat_history_ then @@ -285,20 +285,20 @@ vmf.load_chat_history_settings = function(clean_chat_history_) end end -vmf.save_chat_history = function() +dmf.save_chat_history = function() if _chat_history_save then - vmf:set("chat_history", _chat_history) + dmf:set("chat_history", _chat_history) end end -vmf.execute_queued_chat_command = function() +dmf.execute_queued_chat_command = function() if _queued_command then - vmf.run_command(_queued_command.name, unpack(_queued_command.args)) + dmf.run_command(_queued_command.name, unpack(_queued_command.args)) _queued_command = nil end end -vmf.destroy_command_gui = function() +dmf.destroy_command_gui = function() destroy_command_gui() end @@ -306,11 +306,11 @@ end -- ##### Script ####################################################################################################### -- #################################################################################################################### -vmf.load_chat_history_settings() -vmf:command("clean_chat_notifications", vmf:localize("clean_chat_notifications"), clean_chat_notifications) +dmf.load_chat_history_settings() +dmf:command("clean_chat_notifications", dmf:localize("clean_chat_notifications"), clean_chat_notifications) if _chat_history_save then - _chat_history = vmf:get("chat_history") or _chat_history + _chat_history = dmf:get("chat_history") or _chat_history end initialize_drawing_function() \ No newline at end of file diff --git a/dmf/scripts/mods/vmf/modules/ui/chat/commands_list_gui.lua b/dmf/scripts/mods/dmf/modules/ui/chat/commands_list_gui.lua similarity index 98% rename from dmf/scripts/mods/vmf/modules/ui/chat/commands_list_gui.lua rename to dmf/scripts/mods/dmf/modules/ui/chat/commands_list_gui.lua index 8d0b72b..7aad8cf 100644 --- a/dmf/scripts/mods/vmf/modules/ui/chat/commands_list_gui.lua +++ b/dmf/scripts/mods/dmf/modules/ui/chat/commands_list_gui.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local MULTISTRING_INDICATOR_TEXT = "[...]" @@ -241,12 +241,12 @@ local function draw(commands_list, selected_command_index) end -- ##################################################################################################################### --- ##### VMF internal functions ######################################################################################## +-- ##### DMF internal functions ######################################################################################## -- ##################################################################################################################### -- A way for modders to change definitions. No safety checks. No guarantees definitions won't change. At least until -- global refactoring. -function vmf.update_commands_list_gui_definitions(new_definitions) +function dmf.update_commands_list_gui_definitions(new_definitions) MULTISTRING_INDICATOR_TEXT = new_definitions.MULTISTRING_INDICATOR_TEXT or MULTISTRING_INDICATOR_TEXT FONT_TYPE = new_definitions.FONT_TYPE or FONT_TYPE FONT_SIZE = new_definitions.FONT_SIZE or FONT_SIZE diff --git a/dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view.lua b/dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view.lua similarity index 90% rename from dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view.lua rename to dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view.lua index 0f0016a..e4e1aff 100644 --- a/dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view.lua +++ b/dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local _widgets_by_name @@ -7,25 +7,25 @@ local _widgets_by_name -- #################################################################################################################### local function load_scrolling_speed_setting() - if vmf:get("vmf_options_scrolling_speed") and _widgets_by_name and _widgets_by_name["scrollbar"] then - _widgets_by_name["scrollbar"].content.scroll_speed = vmf:get("vmf_options_scrolling_speed") + if dmf:get("dmf_options_scrolling_speed") and _widgets_by_name and _widgets_by_name["scrollbar"] then + _widgets_by_name["scrollbar"].content.scroll_speed = dmf:get("dmf_options_scrolling_speed") end end -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.load_vmf_options_view_settings = function() +dmf.load_dmf_options_view_settings = function() load_scrolling_speed_setting() end -- #################################################################################################################### --- ##### VMF Options View Class ####################################################################################### +-- ##### DMF Options View Class ####################################################################################### -- #################################################################################################################### -local _content_blueprints = vmf:dofile("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_content_blueprints") -local _view_settings = vmf:dofile("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_settings") +local _content_blueprints = dmf:dofile("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_content_blueprints") +local _view_settings = dmf:dofile("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_settings") local InputUtils = require("scripts/managers/input/input_utils") local ScriptWorld = require("scripts/foundation/utilities/script_world") @@ -39,19 +39,19 @@ local ViewElementKeybindPopup = require("scripts/ui/view_elements/view_element_k local CATEGORIES_GRID = 1 local SETTINGS_GRID = 2 -local VMFOptionsView = class("VMFOptionsView", "BaseView") +local DMFOptionsView = class("DMFOptionsView", "BaseView") -VMFOptionsView.init = function (self, settings) - local definitions = vmf:dofile("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_definitions") +DMFOptionsView.init = function (self, settings) + local definitions = dmf:dofile("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_definitions") - VMFOptionsView.super.init(self, definitions, settings) + DMFOptionsView.super.init(self, definitions, settings) self._pass_draw = false self:_setup_offscreen_gui() end -VMFOptionsView.on_enter = function (self) +DMFOptionsView.on_enter = function (self) _widgets_by_name = self._widgets_by_name if not self._options_templates then @@ -59,9 +59,9 @@ VMFOptionsView.on_enter = function (self) settings = {}, categories = {} } - vmf:create_mod_options_settings(self._options_templates) + dmf:create_mod_options_settings(self._options_templates) end - VMFOptionsView.super.on_enter(self) + DMFOptionsView.super.on_enter(self) self._default_category = nil self._using_cursor_navigation = Managers.ui:using_cursor_navigation() @@ -74,7 +74,7 @@ VMFOptionsView.on_enter = function (self) self:_update_grid_navigation_selection() end -VMFOptionsView._map_validations = function (self, config) +DMFOptionsView._map_validations = function (self, config) local config_categories = config.categories local categories = {} @@ -111,7 +111,7 @@ VMFOptionsView._map_validations = function (self, config) return categories end -VMFOptionsView.on_exit = function (self) +DMFOptionsView.on_exit = function (self) Managers.event:trigger("event_on_input_settings_changed") if self._input_legend_element then @@ -140,10 +140,10 @@ VMFOptionsView.on_exit = function (self) self._offscreen_world = nil end - VMFOptionsView.super.on_exit(self) + DMFOptionsView.super.on_exit(self) end -VMFOptionsView.cb_on_back_pressed = function (self) +DMFOptionsView.cb_on_back_pressed = function (self) local selected_navigation_column = self._selected_navigation_column_index local selected_settings_widget = self._selected_settings_widget @@ -152,12 +152,12 @@ VMFOptionsView.cb_on_back_pressed = function (self) elseif selected_navigation_column == SETTINGS_GRID then self:_change_navigation_column(selected_navigation_column - 1) else - local view_name = "vmf_options_view" + local view_name = "dmf_options_view" Managers.ui:close_view(view_name) end end -VMFOptionsView.cb_reset_category_to_default = function (self) +DMFOptionsView.cb_reset_category_to_default = function (self) local selected_category = self._selected_category local reset_functions_by_category = self._reset_functions_by_category local reset_function = reset_functions_by_category[selected_category] @@ -207,7 +207,7 @@ VMFOptionsView.cb_reset_category_to_default = function (self) end) end -VMFOptionsView._setup_input_legend = function (self) +DMFOptionsView._setup_input_legend = function (self) self._input_legend_element = self:_add_element(ViewElementInputLegend, "input_legend", 10) local legend_inputs = self._definitions.legend_inputs @@ -219,7 +219,7 @@ VMFOptionsView._setup_input_legend = function (self) end end -VMFOptionsView._setup_content_grid_scrollbar = function (self, grid, widget_id, grid_scenegraph_id, grid_pivot_scenegraph_id) +DMFOptionsView._setup_content_grid_scrollbar = function (self, grid, widget_id, grid_scenegraph_id, grid_pivot_scenegraph_id) local widgets_by_name = self._widgets_by_name local scrollbar_widget = widgets_by_name[widget_id] @@ -229,7 +229,7 @@ VMFOptionsView._setup_content_grid_scrollbar = function (self, grid, widget_id, grid:set_scrollbar_progress(0) end -VMFOptionsView._setup_offscreen_gui = function (self) +DMFOptionsView._setup_offscreen_gui = function (self) local ui_manager = Managers.ui local class_name = self.__class_name local timer_name = "ui" @@ -246,7 +246,7 @@ VMFOptionsView._setup_offscreen_gui = function (self) self._ui_offscreen_renderer = ui_manager:create_renderer(class_name .. "_ui_offscreen_renderer", self._offscreen_world) end -VMFOptionsView._setup_content_widgets = function (self, content, scenegraph_id, callback_name) +DMFOptionsView._setup_content_widgets = function (self, content, scenegraph_id, callback_name) local definitions = self._definitions local widget_definitions = {} local widgets = {} @@ -298,7 +298,7 @@ VMFOptionsView._setup_content_widgets = function (self, content, scenegraph_id, return widgets, alignment_list end -VMFOptionsView._draw_widgets = function (self, dt, t, input_service, ui_renderer) +DMFOptionsView._draw_widgets = function (self, dt, t, input_service, ui_renderer) local widgets_by_name = self._widgets_by_name local scrollbar_widget = widgets_by_name.scrollbar scrollbar_widget.content.visible = self._category_content_grid:can_scroll() @@ -310,19 +310,19 @@ VMFOptionsView._draw_widgets = function (self, dt, t, input_service, ui_renderer ui_renderer.input_service = input_service end - VMFOptionsView.super._draw_widgets(self, dt, t, input_service, ui_renderer) + DMFOptionsView.super._draw_widgets(self, dt, t, input_service, ui_renderer) end -VMFOptionsView._draw_elements = function (self, dt, t, ui_renderer, render_settings, input_service) +DMFOptionsView._draw_elements = function (self, dt, t, ui_renderer, render_settings, input_service) if self:_handling_keybinding() or self._selected_settings_widget then input_service = input_service:null_service() ui_renderer.input_service = input_service end - VMFOptionsView.super._draw_elements(self, dt, t, ui_renderer, render_settings, input_service) + DMFOptionsView.super._draw_elements(self, dt, t, ui_renderer, render_settings, input_service) end -VMFOptionsView.draw = function (self, dt, t, input_service, layer) +DMFOptionsView.draw = function (self, dt, t, input_service, layer) if self:_handling_keybinding() then input_service = input_service:null_service() end @@ -338,10 +338,10 @@ VMFOptionsView.draw = function (self, dt, t, input_service, layer) self:_draw_grid(self._settings_content_grid, self._settings_content_widgets, grid_interaction_widget, dt, t, input_service) end - VMFOptionsView.super.draw(self, dt, t, input_service, layer) + DMFOptionsView.super.draw(self, dt, t, input_service, layer) end -VMFOptionsView._draw_grid = function (self, grid, widgets, interaction_widget, dt, t, input_service) +DMFOptionsView._draw_grid = function (self, grid, widgets, interaction_widget, dt, t, input_service) local is_grid_hovered = not self._using_cursor_navigation or interaction_widget.content.hotspot.is_hover or false local null_input_service = input_service:null_service() local render_settings = self._render_settings @@ -379,7 +379,7 @@ VMFOptionsView._draw_grid = function (self, grid, widgets, interaction_widget, d UIRenderer.end_pass(ui_renderer) end -VMFOptionsView._setup_grid = function (self, widgets, alignment_list, grid_scenegraph_id, spacing, use_is_focused) +DMFOptionsView._setup_grid = function (self, widgets, alignment_list, grid_scenegraph_id, spacing, use_is_focused) local ui_scenegraph = self._ui_scenegraph local direction = "down" local grid = UIWidgetGrid:new(widgets, alignment_list, ui_scenegraph, grid_scenegraph_id, direction, spacing, nil, use_is_focused) @@ -390,8 +390,8 @@ VMFOptionsView._setup_grid = function (self, widgets, alignment_list, grid_scene return grid end -VMFOptionsView.set_render_scale = function (self, scale) - VMFOptionsView.super.set_render_scale(self, scale) +DMFOptionsView.set_render_scale = function (self, scale) + DMFOptionsView.super.set_render_scale(self, scale) self._category_content_grid:set_render_scale(self._render_scale) if self._settings_content_grid then @@ -399,7 +399,7 @@ VMFOptionsView.set_render_scale = function (self, scale) end end -VMFOptionsView.update = function (self, dt, t, input_service, view_data) +DMFOptionsView.update = function (self, dt, t, input_service, view_data) local drawing_view = view_data and view_data.drawing_view local using_cursor_navigation = Managers.ui:using_cursor_navigation() @@ -484,11 +484,11 @@ VMFOptionsView.update = function (self, dt, t, input_service, view_data) self._widgets_by_name.tooltip.content.visible = false end - return VMFOptionsView.super.update(self, dt, t, input_service) + return DMFOptionsView.super.update(self, dt, t, input_service) end -VMFOptionsView.on_resolution_modified = function (self) - VMFOptionsView.super.on_resolution_modified(self) +DMFOptionsView.on_resolution_modified = function (self) + DMFOptionsView.super.on_resolution_modified(self) local scale = self._render_scale @@ -501,15 +501,15 @@ VMFOptionsView.on_resolution_modified = function (self) self._grid_length = nil end -VMFOptionsView._on_navigation_input_changed = function (self) - VMFOptionsView.super._on_navigation_input_changed(self) +DMFOptionsView._on_navigation_input_changed = function (self) + DMFOptionsView.super._on_navigation_input_changed(self) if self._settings_content_widgets then self:_update_grid_navigation_selection() end end -VMFOptionsView._reset_options_view = function (self, reset_all) +DMFOptionsView._reset_options_view = function (self, reset_all) if reset_all then self._selected_category = nil self._selected_settings_widget = nil @@ -535,7 +535,7 @@ VMFOptionsView._reset_options_view = function (self, reset_all) self:_update_grid_navigation_selection() end -VMFOptionsView.settings_grid_length = function (self) +DMFOptionsView.settings_grid_length = function (self) local grid = self._settings_content_grid if grid then @@ -549,7 +549,7 @@ VMFOptionsView.settings_grid_length = function (self) return 0 end -VMFOptionsView.settings_scroll_amount = function (self) +DMFOptionsView.settings_scroll_amount = function (self) local grid = self._settings_content_grid if grid then @@ -562,11 +562,11 @@ VMFOptionsView.settings_scroll_amount = function (self) return 0 end -VMFOptionsView.set_exclusive_focus_on_grid_widget = function (self, widget_name) +DMFOptionsView.set_exclusive_focus_on_grid_widget = function (self, widget_name) self:_set_exclusive_focus_on_grid_widget(widget_name) end -VMFOptionsView._handle_input = function (self, input_service) +DMFOptionsView._handle_input = function (self, input_service) local selected_settings_widget = self._selected_settings_widget if selected_settings_widget then @@ -597,7 +597,7 @@ VMFOptionsView._handle_input = function (self, input_service) end end -VMFOptionsView._update_grid_navigation_selection = function (self) +DMFOptionsView._update_grid_navigation_selection = function (self) local selected_column_index = self._selected_navigation_column_index local selected_row_index = self._selected_navigation_row_index @@ -623,7 +623,7 @@ VMFOptionsView._update_grid_navigation_selection = function (self) end end -VMFOptionsView.present_category_widgets = function (self, category) +DMFOptionsView.present_category_widgets = function (self, category) self._selected_category = category local settings_category_widgets = self._settings_category_widgets local grid_data = settings_category_widgets[category] @@ -656,7 +656,7 @@ VMFOptionsView.present_category_widgets = function (self, category) end end -VMFOptionsView._setup_category_config = function (self, config) +DMFOptionsView._setup_category_config = function (self, config) if self._category_content_widgets then for i = 1, #self._category_content_widgets do local widget = self._category_content_widgets[i] @@ -730,7 +730,7 @@ VMFOptionsView._setup_category_config = function (self, config) } end -VMFOptionsView._setup_settings_config = function (self, config) +DMFOptionsView._setup_settings_config = function (self, config) if self._settings_category_widgets then for _, settings_data in pairs(self._settings_category_widgets) do for i = 1, #settings_data do @@ -782,7 +782,7 @@ VMFOptionsView._setup_settings_config = function (self, config) self._settings_category_widgets = category_widgets end -VMFOptionsView._update_category_content_widgets = function (self, dt, t) +DMFOptionsView._update_category_content_widgets = function (self, dt, t) local category_content_widgets = self._category_content_widgets if category_content_widgets then @@ -811,7 +811,7 @@ VMFOptionsView._update_category_content_widgets = function (self, dt, t) end end -VMFOptionsView._set_tooltip_data = function (self, widget) +DMFOptionsView._set_tooltip_data = function (self, widget) local current_widget = self._tooltip_data and self._tooltip_data.widget local display_text = nil local tooltip_text = widget.content.entry.tooltip_text @@ -859,7 +859,7 @@ VMFOptionsView._set_tooltip_data = function (self, widget) end end -VMFOptionsView._update_settings_content_widgets = function (self, dt, t, input_service) +DMFOptionsView._update_settings_content_widgets = function (self, dt, t, input_service) local settings_content_widgets = self._settings_content_widgets if settings_content_widgets then @@ -893,7 +893,7 @@ VMFOptionsView._update_settings_content_widgets = function (self, dt, t, input_s end end -VMFOptionsView._create_settings_widget_from_config = function (self, config, category, suffix, callback_name) +DMFOptionsView._create_settings_widget_from_config = function (self, config, category, suffix, callback_name) local scenegraph_id = "settings_grid_content_pivot" local default_value = config.default_value local default_value_type = type(default_value) @@ -964,7 +964,7 @@ VMFOptionsView._create_settings_widget_from_config = function (self, config, cat end end -VMFOptionsView._handle_keybind_rebind = function (self, dt, t, input_service) +DMFOptionsView._handle_keybind_rebind = function (self, dt, t, input_service) if self._handling_keybind then local input_manager = Managers.input local results = input_manager:key_watch_result() @@ -991,11 +991,11 @@ VMFOptionsView._handle_keybind_rebind = function (self, dt, t, input_service) end end -VMFOptionsView._handling_keybinding = function (self) +DMFOptionsView._handling_keybinding = function (self) return self._handling_keybind or self._close_keybind_popup_duration ~= nil end -VMFOptionsView.show_keybind_popup = function (self, widget, entry) +DMFOptionsView.show_keybind_popup = function (self, widget, entry) if not self:_handling_keybinding() then self._active_keybind_entry = entry self._active_keybind_widget = widget @@ -1028,7 +1028,7 @@ VMFOptionsView.show_keybind_popup = function (self, widget, entry) end end -VMFOptionsView.close_keybind_popup = function (self, force_close) +DMFOptionsView.close_keybind_popup = function (self, force_close) if force_close then Managers.input:stop_key_watch() @@ -1046,7 +1046,7 @@ VMFOptionsView.close_keybind_popup = function (self, force_close) self._active_keybind_widget = nil end -VMFOptionsView._set_warning_text = function (self) +DMFOptionsView._set_warning_text = function (self) local widgets_by_name = self._widgets_by_name local warning_text = widgets_by_name.warning_text local action = "TEST" @@ -1055,7 +1055,7 @@ VMFOptionsView._set_warning_text = function (self) warning_text.content.text = string.format("Warning! Input for action %s%s%s has been unassigned.", color_1, action, color_2) end -VMFOptionsView.cb_on_category_pressed = function (self, widget, entry) +DMFOptionsView.cb_on_category_pressed = function (self, widget, entry) local pressed_function = entry.pressed_function if pressed_function then @@ -1063,7 +1063,7 @@ VMFOptionsView.cb_on_category_pressed = function (self, widget, entry) end end -VMFOptionsView.cb_on_settings_pressed = function (self, widget, entry) +DMFOptionsView.cb_on_settings_pressed = function (self, widget, entry) if not self._can_close or self._selected_settings_widget or self._navigation_column_changed_this_frame then return end @@ -1081,13 +1081,13 @@ VMFOptionsView.cb_on_settings_pressed = function (self, widget, entry) end end -VMFOptionsView._enable_settings_overlay = function (self, enable) +DMFOptionsView._enable_settings_overlay = function (self, enable) local widgets_by_name = self._widgets_by_name local settings_overlay_widget = widgets_by_name.settings_overlay settings_overlay_widget.content.visible = enable end -VMFOptionsView._set_exclusive_focus_on_grid_widget = function (self, widget_name) +DMFOptionsView._set_exclusive_focus_on_grid_widget = function (self, widget_name) local widgets = self._settings_content_widgets local selected_widget = nil @@ -1116,7 +1116,7 @@ VMFOptionsView._set_exclusive_focus_on_grid_widget = function (self, widget_name return selected_widget end -VMFOptionsView._change_navigation_column = function (self, column_index) +DMFOptionsView._change_navigation_column = function (self, column_index) local navigation_widgets = self._navigation_widgets local num_columns = #navigation_widgets local success = false @@ -1162,7 +1162,7 @@ VMFOptionsView._change_navigation_column = function (self, column_index) end end -VMFOptionsView._set_default_navigation_widget = function (self) +DMFOptionsView._set_default_navigation_widget = function (self) local navigation_widgets = self._navigation_widgets for i = 1, #navigation_widgets do @@ -1172,7 +1172,7 @@ VMFOptionsView._set_default_navigation_widget = function (self) end end -VMFOptionsView._set_selected_navigation_widget = function (self, widget) +DMFOptionsView._set_selected_navigation_widget = function (self, widget) local widget_name = widget and widget.name local selected_row, selected_column = nil local navigation_widgets = self._navigation_widgets @@ -1202,7 +1202,7 @@ VMFOptionsView._set_selected_navigation_widget = function (self, widget) self._selected_navigation_column_index = selected_column end -VMFOptionsView._set_focused_grid_widget = function (self, widgets, widget_name) +DMFOptionsView._set_focused_grid_widget = function (self, widgets, widget_name) local selected_widget, selected_widget_index = nil for i = 1, #widgets do @@ -1224,7 +1224,7 @@ VMFOptionsView._set_focused_grid_widget = function (self, widgets, widget_name) return selected_widget, selected_widget_index end -VMFOptionsView._set_selected_grid_widget = function (self, widgets, widget_name) +DMFOptionsView._set_selected_grid_widget = function (self, widgets, widget_name) local selected_widget, selected_widget_index = nil for i = 1, #widgets do @@ -1246,4 +1246,4 @@ VMFOptionsView._set_selected_grid_widget = function (self, widgets, widget_name) return selected_widget, selected_widget_index end -return VMFOptionsView +return DMFOptionsView diff --git a/dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_content_blueprints.lua b/dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_content_blueprints.lua similarity index 99% rename from dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_content_blueprints.lua rename to dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_content_blueprints.lua index 64518d0..715a191 100644 --- a/dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_content_blueprints.lua +++ b/dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_content_blueprints.lua @@ -1,6 +1,6 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -local _view_settings = vmf:dofile("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_settings") +local _view_settings = dmf:dofile("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_settings") local ButtonPassTemplates = require("scripts/ui/pass_templates/button_pass_templates") local CheckboxPassTemplates = require("scripts/ui/pass_templates/checkbox_pass_templates") @@ -777,4 +777,4 @@ blueprints.description = { end } -return settings("VMFOptionsViewContentBlueprints", blueprints) +return settings("DMFOptionsViewContentBlueprints", blueprints) diff --git a/dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_definitions.lua b/dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_definitions.lua similarity index 97% rename from dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_definitions.lua rename to dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_definitions.lua index 8f970c1..4908a56 100644 --- a/dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_definitions.lua +++ b/dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_definitions.lua @@ -1,6 +1,6 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") -local _view_settings = vmf:dofile("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_settings") +local _view_settings = dmf:dofile("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_settings") local ScrollbarPassTemplates = require("scripts/ui/pass_templates/scrollbar_pass_templates") local UIFontSettings = require("scripts/managers/ui/ui_font_settings") @@ -317,7 +317,7 @@ local widget_definitions = { value_id = "text", style_id = "text", pass_type = "text", - value = vmf:localize("mods_options"), + value = dmf:localize("mods_options"), style = table.clone(UIFontSettings.header_1) } }, "title_text"), @@ -445,10 +445,10 @@ local legend_inputs = { } } -local VMFOptionsViewDefinitions = { +local DMFOptionsViewDefinitions = { legend_inputs = legend_inputs, widget_definitions = widget_definitions, scenegraph_definition = scenegraph_definition } -return settings("VMFOptionsViewDefinitions", VMFOptionsViewDefinitions) +return settings("DMFOptionsViewDefinitions", DMFOptionsViewDefinitions) diff --git a/dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_settings.lua b/dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_settings.lua similarity index 74% rename from dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_settings.lua rename to dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_settings.lua index 94c2636..c2802aa 100644 --- a/dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_settings.lua +++ b/dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_settings.lua @@ -1,4 +1,4 @@ -local vmf_options_view_settings = { +local dmf_options_view_settings = { scrollbar_width = 10, max_visible_dropdown_options = 5, indentation_spacing = 40, @@ -17,4 +17,4 @@ local vmf_options_view_settings = { } } -return settings("VMFOptionsViewSettings", vmf_options_view_settings) +return settings("DMFOptionsViewSettings", dmf_options_view_settings) diff --git a/dmf/scripts/mods/vmf/modules/ui/options/mod_options.lua b/dmf/scripts/mods/dmf/modules/ui/options/mod_options.lua similarity index 91% rename from dmf/scripts/mods/vmf/modules/ui/options/mod_options.lua rename to dmf/scripts/mods/dmf/modules/ui/options/mod_options.lua index 4fdd7b8..7cab580 100644 --- a/dmf/scripts/mods/vmf/modules/ui/options/mod_options.lua +++ b/dmf/scripts/mods/dmf/modules/ui/options/mod_options.lua @@ -1,4 +1,4 @@ -local vmf = get_mod("VMF") +local dmf = get_mod("DMF") local OptionsUtilities = require("scripts/utilities/ui/options") local InputUtils = require("scripts/managers/input/input_utils") @@ -145,7 +145,7 @@ _type_template_map["dropdown"] = create_dropdown_template local set_new_keybind = function (self, keybind_widget_content) - vmf.add_mod_keybind( + dmf.add_mod_keybind( get_mod(keybind_widget_content.mod_name), keybind_widget_content.setting_id, { @@ -196,7 +196,7 @@ local create_keybind_template = function (self, params) if cancel_key == new_value.main then -- Prevent unbinding the mod options menu - if params.setting_id ~= "open_vmf_options" then + if params.setting_id ~= "open_dmf_options" then params.keybind_text = "" params.keys = {} @@ -250,8 +250,8 @@ local function widget_data_to_template(self, data) if data and data.type and type(data.type) == "string" and _type_template_map[data.type] then return _type_template_map[data.type](self, data) else - vmf:dump(data, "widget", 1) - vmf.throw_error("[widget \"%s\"]: 'type' field must contain valid widget type name.", data.setting_id) + dmf:dump(data, "widget", 1) + dmf.throw_error("[widget \"%s\"]: 'type' field must contain valid widget type name.", data.setting_id) end end @@ -273,16 +273,16 @@ end -- #################################################################################################################### -- #################################################################################################################### --- ##### VMF internal functions and variables ######################################################################### +-- ##### DMF internal functions and variables ######################################################################### -- #################################################################################################################### -- Add mod settings to options view -vmf.create_mod_options_settings = function (self, options_templates) +dmf.create_mod_options_settings = function (self, options_templates) local categories = options_templates.categories local settings = options_templates.settings - for _, mod_data in ipairs(vmf.options_widgets_data) do + for _, mod_data in ipairs(dmf.options_widgets_data) do local category = create_mod_category(self, categories, mod_data[1]) for _, widget_data in ipairs(mod_data) do @@ -341,26 +341,26 @@ vmf.create_mod_options_settings = function (self, options_templates) end -vmf.initialize_vmf_options_view = function () - vmf:add_require_path("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view") - vmf:add_require_path("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_definitions") - vmf:add_require_path("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_settings") - vmf:add_require_path("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view_content_blueprints") +dmf.initialize_dmf_options_view = function () + dmf:add_require_path("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view") + dmf:add_require_path("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_definitions") + dmf:add_require_path("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_settings") + dmf:add_require_path("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view_content_blueprints") - vmf:register_view({ - view_name = "vmf_options_view", + dmf:register_view({ + view_name = "dmf_options_view", view_settings = { init_view_function = function (ingame_ui_context) return true end, - class = "VMFOptionsView", + class = "DMFOptionsView", disable_game_world = false, display_name = "loc_options_view_display_name", game_world_blur = 1.1, load_always = true, load_in_hub = true, package = "packages/ui/views/options_view/options_view", - path = "dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view", + path = "dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view", state_bound = true, enter_sound_events = { "wwise/events/ui/play_ui_enter_short" @@ -381,7 +381,7 @@ vmf.initialize_vmf_options_view = function () } }) - vmf:dofile("dmf/scripts/mods/vmf/modules/ui/options/vmf_options_view") + dmf:dofile("dmf/scripts/mods/dmf/modules/ui/options/dmf_options_view") end -- #################################################################################################################### diff --git a/dmf/scripts/mods/vmf/modules/vmf_dummy.lua b/dmf/scripts/mods/vmf/modules/vmf_dummy.lua deleted file mode 100644 index e04ff52..0000000 --- a/dmf/scripts/mods/vmf/modules/vmf_dummy.lua +++ /dev/null @@ -1,4 +0,0 @@ -local vmf = get_mod("VMF") - --- Add vmf functions with a value of dummy_func if they need to be defined while a module is disabled. -local dummy_func = function() return end \ No newline at end of file diff --git a/dmf/scripts/mods/vmf/vmf_loader.lua b/dmf/scripts/mods/vmf/vmf_loader.lua deleted file mode 100644 index 13f653e..0000000 --- a/dmf/scripts/mods/vmf/vmf_loader.lua +++ /dev/null @@ -1,112 +0,0 @@ -local vmf - --- Global variable indicating which version of the game is currently running -VT1 = false - --- Native mod object used by Fatshark mod manager -local vmf_mod_object = {} - --- Global method to load a file through iowith a return -local mod_dofile = Mods.file.dofile - --- ##################################################################################################################### --- ##### Initialization ################################################################################################ --- ##################################################################################################################### - -function vmf_mod_object:init() - mod_dofile("dmf/scripts/mods/vmf/modules/vmf_mod_data") - mod_dofile("dmf/scripts/mods/vmf/modules/vmf_mod_manager") - --mod_dofile("dmf/scripts/mods/vmf/modules/vmf_dummy") - mod_dofile("dmf/scripts/mods/vmf/modules/vmf_package_manager") - mod_dofile("dmf/scripts/mods/vmf/modules/core/safe_calls") - mod_dofile("dmf/scripts/mods/vmf/modules/core/events") - mod_dofile("dmf/scripts/mods/vmf/modules/core/settings") - mod_dofile("dmf/scripts/mods/vmf/modules/core/logging") - mod_dofile("dmf/scripts/mods/vmf/modules/core/misc") - mod_dofile("dmf/scripts/mods/vmf/modules/core/persistent_tables") - mod_dofile("dmf/scripts/mods/vmf/modules/debug/dev_console") - mod_dofile("dmf/scripts/mods/vmf/modules/debug/table_dump") - mod_dofile("dmf/scripts/mods/vmf/modules/core/hooks") - mod_dofile("dmf/scripts/mods/vmf/modules/core/require") - mod_dofile("dmf/scripts/mods/vmf/modules/core/toggling") - mod_dofile("dmf/scripts/mods/vmf/modules/core/keybindings") - mod_dofile("dmf/scripts/mods/vmf/modules/core/chat") - mod_dofile("dmf/scripts/mods/vmf/modules/core/localization") - mod_dofile("dmf/scripts/mods/vmf/modules/core/options") - mod_dofile("dmf/scripts/mods/vmf/modules/core/network") - mod_dofile("dmf/scripts/mods/vmf/modules/core/commands") - mod_dofile("dmf/scripts/mods/vmf/modules/gui/custom_textures") - mod_dofile("dmf/scripts/mods/vmf/modules/gui/custom_views") - mod_dofile("dmf/scripts/mods/vmf/modules/ui/chat/chat_actions") - mod_dofile("dmf/scripts/mods/vmf/modules/ui/options/mod_options") - mod_dofile("dmf/scripts/mods/vmf/modules/vmf_options") - mod_dofile("dmf/scripts/mods/vmf/modules/core/mutators/mutators_manager") - - vmf = get_mod("VMF") - vmf.delayed_chat_messages_hook() - vmf:hook(ModManager, "destroy", function(func, ...) - vmf.mods_unload_event(true) - func(...) - end) -end - --- ##################################################################################################################### --- ##### Events ######################################################################################################## --- ##################################################################################################################### - -function vmf_mod_object:update(dt) - vmf.update_package_manager() - vmf.mods_update_event(dt) - vmf.check_keybinds() - vmf.execute_queued_chat_command() - - if not vmf.all_mods_were_loaded and Managers.mod._state == "done" then - - vmf.generate_keybinds() - vmf.initialize_vmf_options_view() - vmf.create_network_dictionary() - vmf.ping_vmf_users() - - vmf.all_mods_loaded_event() - - vmf.all_mods_were_loaded = true - end -end - - -function vmf_mod_object:on_unload() - print("VMF:ON_UNLOAD()") - vmf.save_chat_history() - vmf.save_unsaved_settings_to_file() - vmf.destroy_command_gui() -end - - -function vmf_mod_object:on_reload() - print("VMF:ON_RELOAD()") - vmf.mods_unload_event(false) - vmf.remove_custom_views() - vmf.unload_all_resource_packages() - vmf.hooks_unload() - vmf.reset_guis() - vmf.destroy_command_gui() -end - - -function vmf_mod_object:on_game_state_changed(status, state) - print("VMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state)) - vmf.mods_game_state_changed_event(status, state) - vmf.save_unsaved_settings_to_file() - vmf.apply_delayed_hooks(status, state) - vmf.destroy_command_gui() - - if status == "enter" and state == "StateIngame" then - vmf.create_keybinds_input_service() - end -end - --- ##################################################################################################################### --- ##### Return ######################################################################################################## --- ##################################################################################################################### - -return vmf_mod_object