From bab8a360273511115f7efa6108dad0fd11295208 Mon Sep 17 00:00:00 2001 From: Azumgi <4zumgi@gmail.com> Date: Sat, 1 Sep 2018 19:15:29 +0300 Subject: [PATCH] Remove pre1.2 VT2 compatibility --- vmf/scripts/mods/vmf/modules/core/chat.lua | 7 +- vmf/scripts/mods/vmf/modules/core/network.lua | 7 +- .../modules/ui/options/vmf_options_view.lua | 98 ------------------- 3 files changed, 4 insertions(+), 108 deletions(-) diff --git a/vmf/scripts/mods/vmf/modules/core/chat.lua b/vmf/scripts/mods/vmf/modules/core/chat.lua index 3f0db08..4562a62 100644 --- a/vmf/scripts/mods/vmf/modules/core/chat.lua +++ b/vmf/scripts/mods/vmf/modules/core/chat.lua @@ -9,15 +9,12 @@ local IS_SYSTEM_MESSAGE = false local POP_CHAT = true local IS_DEV = true --- @TODO: remove it after VT2 1.2 release -local OLD_RPC_CHAT_MESSAGE = VT1 or (tonumber(script_data.settings.content_revision) <= 120239) - -- ##################################################################################################################### -- ##### Local functions ############################################################################################### -- ##################################################################################################################### local function send_system_message(peer_id, message) - if OLD_RPC_CHAT_MESSAGE then + if VT1 then RPC.rpc_chat_message(peer_id, CHANNEL_ID, MESSAGE_SENDER, message, LOCALIZATION_PARAM, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV) else @@ -27,7 +24,7 @@ local function send_system_message(peer_id, message) end local function add_system_message_to_chat(chat_manager, message) - if OLD_RPC_CHAT_MESSAGE then + if VT1 then chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, message, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV) else chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, LOCAL_PLAYER_ID, message, IS_SYSTEM_MESSAGE, POP_CHAT, diff --git a/vmf/scripts/mods/vmf/modules/core/network.lua b/vmf/scripts/mods/vmf/modules/core/network.lua index 04059ed..aa3fdd2 100644 --- a/vmf/scripts/mods/vmf/modules/core/network.lua +++ b/vmf/scripts/mods/vmf/modules/core/network.lua @@ -17,9 +17,6 @@ local RPC_VMF_REQUEST_CHANNEL_ID = 3 local RPC_VMF_RESPONCE_CHANNEL_ID = 4 local RPC_VMF_UNKNOWN_CHANNEL_ID = 5 -- Note(Siku): No clue what 5 is supposed to mean. --- @TODO: delete it after VT2 1.2 release and replace all occurances with `VT1` -local OLD_RPC_CHAT_MESSAGE = VT1 or (tonumber(script_data.settings.content_revision) <= 120239) - -- #################################################################################################################### -- ##### Local functions ############################################################################################## -- #################################################################################################################### @@ -136,7 +133,7 @@ end local function rpc_chat_message(member, channel_id, message_sender, message, localization_param, is_system_message, pop_chat, is_dev) - if OLD_RPC_CHAT_MESSAGE then + if VT1 then RPC.rpc_chat_message(member, channel_id, message_sender, message, localization_param, is_system_message, pop_chat, is_dev) else @@ -253,7 +250,7 @@ vmf:hook("ChatManager", "rpc_chat_message", end local rpc_data1, rpc_data2 - if OLD_RPC_CHAT_MESSAGE then + if VT1 then rpc_data1 = arg1 rpc_data2 = arg2 else diff --git a/vmf/scripts/mods/vmf/modules/ui/options/vmf_options_view.lua b/vmf/scripts/mods/vmf/modules/ui/options/vmf_options_view.lua index 31b16f6..ae55425 100644 --- a/vmf/scripts/mods/vmf/modules/ui/options/vmf_options_view.lua +++ b/vmf/scripts/mods/vmf/modules/ui/options/vmf_options_view.lua @@ -4527,104 +4527,6 @@ local view_data = { } --- THIS BLOCK WILL BE DELETED AFTER VT2 1.2 IS OUT. IT'S HERE FOR TEMPORARY COMPATIBILITY -if not VT1 and (tonumber(script_data.settings.content_revision) <= 120239) then - - if not VT1 and not IngameView.umoes_is_hooked then - - local umoes_original_function = IngameView.update_menu_options_enabled_states - IngameView.update_menu_options_enabled_states = function(self) - umoes_original_function(self) - if self.active_button_data then - for _, menu_option in ipairs(self.active_button_data) do - if menu_option.transition == "vmf_options_view" then - menu_option.widget.content.button_hotspot.disable_button = menu_option.widget.content.button_hotspot.disabled - end - end - end - end - - IngameView.umoes_is_hooked = true - end - - -- disables/enables mods options buttons in the - local function change_mods_options_button_state(state) - - local ingame_menu_buttons_exist, ingame_menu_buttons - if VT1 then - ingame_menu_buttons_exist, ingame_menu_buttons = pcall(function () return Managers.player.network_manager.matchmaking_manager.matchmaking_ui.ingame_ui.ingame_menu.active_button_data end) - else - ingame_menu_buttons_exist, ingame_menu_buttons = pcall(function () return Managers.player.network_manager.matchmaking_manager._ingame_ui.views.ingame_menu.active_button_data end) - end - - if ingame_menu_buttons_exist and type(ingame_menu_buttons) == "table" then - for _, button_info in ipairs(ingame_menu_buttons) do - if button_info.transition == "vmf_options_view" then - - -- it's enough to enable/disable buttons in V1, but it doesn't do anything in V2 - -- there is special hook for V2 that updates button state every tick - -- and it uses this value to figure out if button is enabled - button_info.widget.content.disabled = (state == "disable") - button_info.widget.content.button_hotspot.disabled = (state == "disable") - end - end - end - end - - - vmf.initialize_vmf_options_view = function () - vmf:register_new_view(view_data) - change_mods_options_button_state("enable") - end - - vmf.disable_mods_options_button = function () - change_mods_options_button_state("disable") - end - - -- create mods options menu button in Esc-menu - vmf:hook(IngameView, "setup_button_layout", function (func, self, layout_data, ...) - - local mods_options_button = { - display_name = vmf:localize("mods_options"), - transition = "vmf_options_view", - fade = false - } - - for i = 1, #layout_data do - if layout_data[i].transition == "options_menu" and layout_data[i + 1].transition ~= "vmf_options_view" then - table.insert(layout_data, i + 1, mods_options_button) - break - end - end - - func(self, layout_data, ...) - - for _, button_info in ipairs(self.active_button_data) do - if button_info.transition == "vmf_options_view" then - - if VT1 then - button_info.widget.style.text.localize = false - button_info.widget.style.text_disabled.localize = false - button_info.widget.style.text_click.localize = false - button_info.widget.style.text_hover.localize = false - button_info.widget.style.text_selected.localize = false - else - button_info.widget.style.title_text.localize = false - button_info.widget.style.title_text_disabled.localize = false - button_info.widget.style.title_text_shadow.localize = false - end - - if not self.ingame_ui.views["vmf_options_view"] then - change_mods_options_button_state("disable") - end - end - end - end) - - return -end - - local _button_injection_data = vmf:persistent_table("button_injection_data")