Remove pre1.2 VT2 compatibility
This commit is contained in:
parent
59031d142c
commit
bab8a36027
3 changed files with 4 additions and 108 deletions
|
@ -9,15 +9,12 @@ local IS_SYSTEM_MESSAGE = false
|
||||||
local POP_CHAT = true
|
local POP_CHAT = true
|
||||||
local IS_DEV = 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 functions ###############################################################################################
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
local function send_system_message(peer_id, message)
|
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,
|
RPC.rpc_chat_message(peer_id, CHANNEL_ID, MESSAGE_SENDER, message, LOCALIZATION_PARAM, IS_SYSTEM_MESSAGE, POP_CHAT,
|
||||||
IS_DEV)
|
IS_DEV)
|
||||||
else
|
else
|
||||||
|
@ -27,7 +24,7 @@ local function send_system_message(peer_id, message)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function add_system_message_to_chat(chat_manager, message)
|
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)
|
chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, message, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV)
|
||||||
else
|
else
|
||||||
chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, LOCAL_PLAYER_ID, message, IS_SYSTEM_MESSAGE, POP_CHAT,
|
chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, LOCAL_PLAYER_ID, message, IS_SYSTEM_MESSAGE, POP_CHAT,
|
||||||
|
|
|
@ -17,9 +17,6 @@ local RPC_VMF_REQUEST_CHANNEL_ID = 3
|
||||||
local RPC_VMF_RESPONCE_CHANNEL_ID = 4
|
local RPC_VMF_RESPONCE_CHANNEL_ID = 4
|
||||||
local RPC_VMF_UNKNOWN_CHANNEL_ID = 5 -- Note(Siku): No clue what 5 is supposed to mean.
|
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 ##############################################################################################
|
-- ##### Local functions ##############################################################################################
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
@ -136,7 +133,7 @@ end
|
||||||
|
|
||||||
local function rpc_chat_message(member, channel_id, message_sender, message, localization_param,
|
local function rpc_chat_message(member, channel_id, message_sender, message, localization_param,
|
||||||
is_system_message, pop_chat, is_dev)
|
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,
|
RPC.rpc_chat_message(member, channel_id, message_sender, message, localization_param,
|
||||||
is_system_message, pop_chat, is_dev)
|
is_system_message, pop_chat, is_dev)
|
||||||
else
|
else
|
||||||
|
@ -253,7 +250,7 @@ vmf:hook("ChatManager", "rpc_chat_message",
|
||||||
end
|
end
|
||||||
|
|
||||||
local rpc_data1, rpc_data2
|
local rpc_data1, rpc_data2
|
||||||
if OLD_RPC_CHAT_MESSAGE then
|
if VT1 then
|
||||||
rpc_data1 = arg1
|
rpc_data1 = arg1
|
||||||
rpc_data2 = arg2
|
rpc_data2 = arg2
|
||||||
else
|
else
|
||||||
|
|
|
@ -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")
|
local _button_injection_data = vmf:persistent_table("button_injection_data")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue