Changed the naming style for all internals across the project
Modules included: Commands, Keybindings, Network, Mutators, Settings, Localization, Persistant Tables, Toggling, Custom Textures, CommandList, Chat Actions
This commit is contained in:
parent
3116cb65e4
commit
38af31d854
11 changed files with 205 additions and 208 deletions
|
@ -7,7 +7,7 @@ local vmf = get_mod("VMF")
|
||||||
|
|
||||||
not sure about UI scaling
|
not sure about UI scaling
|
||||||
]]
|
]]
|
||||||
local _COMMANDS = {}
|
local _commands = {}
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### VMFMod #######################################################################################################
|
-- ##### VMFMod #######################################################################################################
|
||||||
|
@ -30,12 +30,12 @@ VMFMod.command = function (self, command_name, command_description, command_func
|
||||||
|
|
||||||
command_name = command_name:lower()
|
command_name = command_name:lower()
|
||||||
|
|
||||||
if _COMMANDS[command_name] and _COMMANDS[command_name].mod ~= self then
|
if _commands[command_name] and _commands[command_name].mod ~= self then
|
||||||
self:error("(command): command name '%s' is already used by another mod '%s'", command_name, _COMMANDS[command_name].mod:get_name())
|
self:error("(command): command name '%s' is already used by another mod '%s'", command_name, _commands[command_name].mod:get_name())
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
_COMMANDS[command_name] = {
|
_commands[command_name] = {
|
||||||
mod = self,
|
mod = self,
|
||||||
exec_function = command_function,
|
exec_function = command_function,
|
||||||
description = command_description,
|
description = command_description,
|
||||||
|
@ -50,7 +50,7 @@ VMFMod.command_remove = function (self, command_name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
_COMMANDS[command_name] = nil
|
_commands[command_name] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ VMFMod.command_disable = function (self, command_name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if _COMMANDS[command_name] then
|
if _commands[command_name] then
|
||||||
_COMMANDS[command_name].is_enabled = false
|
_commands[command_name].is_enabled = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -72,24 +72,24 @@ VMFMod.command_enable = function (self, command_name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if _COMMANDS[command_name] then
|
if _commands[command_name] then
|
||||||
_COMMANDS[command_name].is_enabled = true
|
_commands[command_name].is_enabled = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
VMFMod.remove_all_commands = function (self)
|
VMFMod.remove_all_commands = function (self)
|
||||||
|
|
||||||
for command_name, command_entry in pairs(_COMMANDS) do
|
for command_name, command_entry in pairs(_commands) do
|
||||||
if command_entry.mod == self then
|
if command_entry.mod == self then
|
||||||
_COMMANDS[command_name] = nil
|
_commands[command_name] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
VMFMod.disable_all_commands = function (self)
|
VMFMod.disable_all_commands = function (self)
|
||||||
for _, command_entry in pairs(_COMMANDS) do
|
for _, command_entry in pairs(_commands) do
|
||||||
if command_entry.mod == self then
|
if command_entry.mod == self then
|
||||||
command_entry.is_enabled = false
|
command_entry.is_enabled = false
|
||||||
end
|
end
|
||||||
|
@ -98,7 +98,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
VMFMod.enable_all_commands = function (self)
|
VMFMod.enable_all_commands = function (self)
|
||||||
for _, command_entry in pairs(_COMMANDS) do
|
for _, command_entry in pairs(_commands) do
|
||||||
if command_entry.mod == self then
|
if command_entry.mod == self then
|
||||||
command_entry.is_enabled = true
|
command_entry.is_enabled = true
|
||||||
end
|
end
|
||||||
|
@ -115,7 +115,7 @@ vmf.get_commands_list = function(name_contains, exact_match)
|
||||||
|
|
||||||
local commands_list = {}
|
local commands_list = {}
|
||||||
|
|
||||||
for command_name, command_entry in pairs(_COMMANDS) do
|
for command_name, command_entry in pairs(_commands) do
|
||||||
|
|
||||||
if exact_match then
|
if exact_match then
|
||||||
if command_name == name_contains and command_entry.is_enabled then
|
if command_name == name_contains and command_entry.is_enabled then
|
||||||
|
@ -137,7 +137,7 @@ end
|
||||||
|
|
||||||
vmf.run_command = function(command_name, ...)
|
vmf.run_command = function(command_name, ...)
|
||||||
|
|
||||||
local command_entry = _COMMANDS[command_name]
|
local command_entry = _commands[command_name]
|
||||||
if command_entry then
|
if command_entry then
|
||||||
local error_prefix = "(commands) " .. tostring(command_name)
|
local error_prefix = "(commands) " .. tostring(command_name)
|
||||||
vmf.xpcall_no_return_values(command_entry.mod, error_prefix, command_entry.exec_function, ...)
|
vmf.xpcall_no_return_values(command_entry.mod, error_prefix, command_entry.exec_function, ...)
|
||||||
|
|
|
@ -10,12 +10,12 @@ VMFModsKeyMap = {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ["mod_name"]["setting_name"] = {"action_name", {"primary_key", "special_key", "special_key", "special_key"}} (special_key - "ctrl"/"shift"/"alt")
|
-- ["mod_name"]["setting_name"] = {"action_name", {"primary_key", "special_key", "special_key", "special_key"}} (special_key - "ctrl"/"shift"/"alt")
|
||||||
local _RAW_KEYBINDS = {}
|
local _raw_keybinds = {}
|
||||||
|
|
||||||
-- ["primary_key"] = {{"mod_name", "action_name", ctrl_used(bool), alt_used(bool), shift_used(bool)}, {}, {}, ...}
|
-- ["primary_key"] = {{"mod_name", "action_name", ctrl_used(bool), alt_used(bool), shift_used(bool)}, {}, {}, ...}
|
||||||
local _OPTIMIZED_KEYBINDS = {}
|
local _optimized_keybinds = {}
|
||||||
|
|
||||||
local _ACTIVATED_PRESSED_KEY
|
local _activated_pressed_key
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### Local functions ##############################################################################################
|
-- ##### Local functions ##############################################################################################
|
||||||
|
@ -23,9 +23,9 @@ local _ACTIVATED_PRESSED_KEY
|
||||||
|
|
||||||
local function apply_keybinds()
|
local function apply_keybinds()
|
||||||
|
|
||||||
_OPTIMIZED_KEYBINDS = {}
|
_optimized_keybinds = {}
|
||||||
|
|
||||||
for mod_name, mod_keybinds in pairs(_RAW_KEYBINDS) do
|
for mod_name, mod_keybinds in pairs(_raw_keybinds) do
|
||||||
for _, keybind in pairs(mod_keybinds) do
|
for _, keybind in pairs(mod_keybinds) do
|
||||||
local action_name = keybind[1]
|
local action_name = keybind[1]
|
||||||
local primary_key = keybind[2][1]
|
local primary_key = keybind[2][1]
|
||||||
|
@ -46,8 +46,8 @@ local function apply_keybinds()
|
||||||
special_keys[special_key3] = true
|
special_keys[special_key3] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
_OPTIMIZED_KEYBINDS[primary_key] = _OPTIMIZED_KEYBINDS[primary_key] or {}
|
_optimized_keybinds[primary_key] = _optimized_keybinds[primary_key] or {}
|
||||||
table.insert(_OPTIMIZED_KEYBINDS[primary_key], {mod_name, action_name, special_keys["ctrl"], special_keys["alt"], special_keys["shift"]})
|
table.insert(_optimized_keybinds[primary_key], {mod_name, action_name, special_keys["ctrl"], special_keys["alt"], special_keys["shift"]})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -65,14 +65,14 @@ VMFMod.keybind = function (self, setting_name, action_name, keys)
|
||||||
|
|
||||||
if keys[1] then
|
if keys[1] then
|
||||||
|
|
||||||
local mod_keybinds = _RAW_KEYBINDS[self:get_name()] or {}
|
local mod_keybinds = _raw_keybinds[self:get_name()] or {}
|
||||||
|
|
||||||
mod_keybinds[setting_name] = {action_name, keys}
|
mod_keybinds[setting_name] = {action_name, keys}
|
||||||
|
|
||||||
_RAW_KEYBINDS[self:get_name()] = mod_keybinds
|
_raw_keybinds[self:get_name()] = mod_keybinds
|
||||||
else
|
else
|
||||||
|
|
||||||
local mod_keybinds = _RAW_KEYBINDS[self:get_name()]
|
local mod_keybinds = _raw_keybinds[self:get_name()]
|
||||||
|
|
||||||
if mod_keybinds and mod_keybinds[setting_name] then
|
if mod_keybinds and mod_keybinds[setting_name] then
|
||||||
mod_keybinds[setting_name] = nil
|
mod_keybinds[setting_name] = nil
|
||||||
|
@ -104,17 +104,17 @@ vmf.check_pressed_keybinds = function()
|
||||||
if input_service then
|
if input_service then
|
||||||
|
|
||||||
-- don't check for the pressed keybindings until player will release already pressed keybind
|
-- don't check for the pressed keybindings until player will release already pressed keybind
|
||||||
if _ACTIVATED_PRESSED_KEY then
|
if _activated_pressed_key then
|
||||||
if input_service:get(_ACTIVATED_PRESSED_KEY) then
|
if input_service:get(_activated_pressed_key) then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
_ACTIVATED_PRESSED_KEY = nil
|
_activated_pressed_key = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local key_has_active_keybind = false
|
local key_has_active_keybind = false
|
||||||
|
|
||||||
for key, key_bindings in pairs(_OPTIMIZED_KEYBINDS) do
|
for key, key_bindings in pairs(_optimized_keybinds) do
|
||||||
if input_service:get(key) then
|
if input_service:get(key) then
|
||||||
for _, binding_info in ipairs(key_bindings) do
|
for _, binding_info in ipairs(key_bindings) do
|
||||||
if (not binding_info[3] and not input_service:get("ctrl") or binding_info[3] and input_service:get("ctrl")) and
|
if (not binding_info[3] and not input_service:get("ctrl") or binding_info[3] and input_service:get("ctrl")) and
|
||||||
|
@ -128,7 +128,7 @@ vmf.check_pressed_keybinds = function()
|
||||||
vmf.mod_state_changed(mod:get_name(), not mod:is_enabled())
|
vmf.mod_state_changed(mod:get_name(), not mod:is_enabled())
|
||||||
|
|
||||||
key_has_active_keybind = true
|
key_has_active_keybind = true
|
||||||
_ACTIVATED_PRESSED_KEY = key
|
_activated_pressed_key = key
|
||||||
|
|
||||||
elseif mod:is_enabled() then
|
elseif mod:is_enabled() then
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ vmf.check_pressed_keybinds = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
key_has_active_keybind = true
|
key_has_active_keybind = true
|
||||||
_ACTIVATED_PRESSED_KEY = key
|
_activated_pressed_key = key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,8 +11,8 @@ Italian (it)
|
||||||
Polish (pl)
|
Polish (pl)
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local _LANGUAGE_ID = Application.user_setting("language_id")
|
local _language_id = Application.user_setting("language_id")
|
||||||
local _LOCALIZATION_DATABASE = {}
|
local _localization_database = {}
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### Local functions ##############################################################################################
|
-- ##### Local functions ##############################################################################################
|
||||||
|
@ -36,7 +36,7 @@ end
|
||||||
|
|
||||||
VMFMod.localize = function (self, text_id, ...)
|
VMFMod.localize = function (self, text_id, ...)
|
||||||
|
|
||||||
local mod_localization_table = _LOCALIZATION_DATABASE[self:get_name()]
|
local mod_localization_table = _localization_database[self:get_name()]
|
||||||
if mod_localization_table then
|
if mod_localization_table then
|
||||||
|
|
||||||
local text_translations = mod_localization_table[text_id]
|
local text_translations = mod_localization_table[text_id]
|
||||||
|
@ -44,9 +44,9 @@ VMFMod.localize = function (self, text_id, ...)
|
||||||
|
|
||||||
local message
|
local message
|
||||||
|
|
||||||
if text_translations[_LANGUAGE_ID] then
|
if text_translations[_language_id] then
|
||||||
|
|
||||||
message = safe_string_format(self, text_translations[_LANGUAGE_ID], ...)
|
message = safe_string_format(self, text_translations[_language_id], ...)
|
||||||
if message then
|
if message then
|
||||||
return message
|
return message
|
||||||
end
|
end
|
||||||
|
@ -78,11 +78,11 @@ vmf.load_mod_localization = function (mod, localization_table)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if _LOCALIZATION_DATABASE[mod:get_name()] then
|
if _localization_database[mod:get_name()] then
|
||||||
mod:warning("(localization): overwritting already loaded localization file")
|
mod:warning("(localization): overwritting already loaded localization file")
|
||||||
end
|
end
|
||||||
|
|
||||||
_LOCALIZATION_DATABASE[mod:get_name()] = localization_table
|
_localization_database[mod:get_name()] = localization_table
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
--]]
|
--]]
|
||||||
local vmf = get_mod("VMF")
|
local vmf = get_mod("VMF")
|
||||||
|
|
||||||
local _WERE_ENABLED_BEFORE = false
|
local _were_enabled_before = false
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### Local functions ##############################################################################################
|
-- ##### Local functions ##############################################################################################
|
||||||
|
@ -82,10 +82,10 @@ vmf:hook("MatchmakingStateHostGame.host_game", function(func, ...)
|
||||||
local names = add_enabled_mutators_titles_to_string(", ")
|
local names = add_enabled_mutators_titles_to_string(", ")
|
||||||
if names ~= "" then
|
if names ~= "" then
|
||||||
vmf:chat_broadcast(vmf:localize("broadcast_enabled_mutators") .. ": " .. names)
|
vmf:chat_broadcast(vmf:localize("broadcast_enabled_mutators") .. ": " .. names)
|
||||||
_WERE_ENABLED_BEFORE = true
|
_were_enabled_before = true
|
||||||
elseif _WERE_ENABLED_BEFORE then
|
elseif _were_enabled_before then
|
||||||
vmf:chat_broadcast(vmf:localize("broadcast_all_disabled"))
|
vmf:chat_broadcast(vmf:localize("broadcast_all_disabled"))
|
||||||
_WERE_ENABLED_BEFORE = false
|
_were_enabled_before = false
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
local vmf = get_mod("VMF")
|
local vmf = get_mod("VMF")
|
||||||
|
|
||||||
local _VMF_USERS = {}
|
local _vmf_users = {}
|
||||||
local _RPC_CALLBACKS = {}
|
local _rpc_callbacks = {}
|
||||||
|
|
||||||
local _LOCAL_MODS_MAP = {}
|
local _local_mods_map = {}
|
||||||
local _LOCAL_RPCS_MAP = {}
|
local _local_rpcs_map = {}
|
||||||
|
|
||||||
local _SHARED_MODS_MAP = ""
|
local _shared_mods_map = ""
|
||||||
local _SHARED_RPCS_MAP = ""
|
local _shared_rpcs_map = ""
|
||||||
|
|
||||||
local _NETWORK_MODULE_IS_INITIALIZED = false
|
local _network_module_is_initialized = false
|
||||||
|
local _network_debug = false
|
||||||
local _NETWORK_DEBUG = false
|
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### Local functions ##############################################################################################
|
-- ##### Local functions ##############################################################################################
|
||||||
|
@ -19,7 +18,7 @@ local _NETWORK_DEBUG = false
|
||||||
|
|
||||||
local function is_rpc_registered(mod_name, rpc_name)
|
local function is_rpc_registered(mod_name, rpc_name)
|
||||||
|
|
||||||
local success = pcall(function() return _RPC_CALLBACKS[mod_name][rpc_name] end)
|
local success = pcall(function() return _rpc_callbacks[mod_name][rpc_name] end)
|
||||||
return success
|
return success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ end
|
||||||
|
|
||||||
local function convert_names_to_numbers(peer_id, mod_name, rpc_name)
|
local function convert_names_to_numbers(peer_id, mod_name, rpc_name)
|
||||||
|
|
||||||
local user_rpcs_dictionary = _VMF_USERS[peer_id]
|
local user_rpcs_dictionary = _vmf_users[peer_id]
|
||||||
if user_rpcs_dictionary then
|
if user_rpcs_dictionary then
|
||||||
|
|
||||||
local mod_number = user_rpcs_dictionary[1][mod_name]
|
local mod_number = user_rpcs_dictionary[1][mod_name]
|
||||||
|
@ -45,10 +44,10 @@ end
|
||||||
|
|
||||||
local function convert_numbers_to_names(mod_number, rpc_number)
|
local function convert_numbers_to_names(mod_number, rpc_number)
|
||||||
|
|
||||||
local mod_name = _LOCAL_MODS_MAP[mod_number]
|
local mod_name = _local_mods_map[mod_number]
|
||||||
if mod_name then
|
if mod_name then
|
||||||
|
|
||||||
local rpc_name = _LOCAL_RPCS_MAP[mod_number][rpc_number]
|
local rpc_name = _local_rpcs_map[mod_number][rpc_number]
|
||||||
if rpc_name then
|
if rpc_name then
|
||||||
|
|
||||||
return mod_name, rpc_name
|
return mod_name, rpc_name
|
||||||
|
@ -84,7 +83,7 @@ end
|
||||||
|
|
||||||
local function network_debug(rpc_type, action_type, peer_id, mod_name, rpc_name, data)
|
local function network_debug(rpc_type, action_type, peer_id, mod_name, rpc_name, data)
|
||||||
|
|
||||||
if _NETWORK_DEBUG then
|
if _network_debug then
|
||||||
|
|
||||||
local debug_message = nil
|
local debug_message = nil
|
||||||
|
|
||||||
|
@ -131,7 +130,7 @@ end
|
||||||
local function send_rpc_vmf_pong(peer_id)
|
local function send_rpc_vmf_pong(peer_id)
|
||||||
|
|
||||||
network_debug("pong", "sent", peer_id)
|
network_debug("pong", "sent", peer_id)
|
||||||
RPC.rpc_chat_message(peer_id, 4, Network.peer_id(), _SHARED_MODS_MAP, _SHARED_RPCS_MAP, false, true, false)
|
RPC.rpc_chat_message(peer_id, 4, Network.peer_id(), _shared_mods_map, _shared_rpcs_map, false, true, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function send_rpc_vmf_data(peer_id, mod_name, rpc_name, ...)
|
local function send_rpc_vmf_data(peer_id, mod_name, rpc_name, ...)
|
||||||
|
@ -156,7 +155,7 @@ local function send_rpc_vmf_data_local(mod_name, rpc_name, ...)
|
||||||
network_debug("data", "local", nil, mod_name, rpc_name, {...})
|
network_debug("data", "local", nil, mod_name, rpc_name, {...})
|
||||||
|
|
||||||
local error_prefix = "(local rpc) " .. tostring(rpc_name)
|
local error_prefix = "(local rpc) " .. tostring(rpc_name)
|
||||||
vmf.xpcall_no_return_values(mod, error_prefix, _RPC_CALLBACKS[mod_name][rpc_name], Network.peer_id(), ...)
|
vmf.xpcall_no_return_values(mod, error_prefix, _rpc_callbacks[mod_name][rpc_name], Network.peer_id(), ...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -166,7 +165,7 @@ end
|
||||||
|
|
||||||
VMFMod.network_register = function (self, rpc_name, rpc_function)
|
VMFMod.network_register = function (self, rpc_name, rpc_function)
|
||||||
|
|
||||||
if _NETWORK_MODULE_IS_INITIALIZED then
|
if _network_module_is_initialized then
|
||||||
self:error("(network_register): you can't register new rpc after mod initialization")
|
self:error("(network_register): you can't register new rpc after mod initialization")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -176,9 +175,9 @@ VMFMod.network_register = function (self, rpc_name, rpc_function)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
_RPC_CALLBACKS[self:get_name()] = _RPC_CALLBACKS[self:get_name()] or {}
|
_rpc_callbacks[self:get_name()] = _rpc_callbacks[self:get_name()] or {}
|
||||||
|
|
||||||
_RPC_CALLBACKS[self:get_name()][rpc_name] = rpc_function
|
_rpc_callbacks[self:get_name()][rpc_name] = rpc_function
|
||||||
end
|
end
|
||||||
|
|
||||||
-- recipient = "all", "local", "others", peer_id
|
-- recipient = "all", "local", "others", peer_id
|
||||||
|
@ -192,7 +191,7 @@ VMFMod.network_send = function (self, rpc_name, recipient, ...)
|
||||||
|
|
||||||
if recipient == "all" then
|
if recipient == "all" then
|
||||||
|
|
||||||
for peer_id, _ in pairs(_VMF_USERS) do
|
for peer_id, _ in pairs(_vmf_users) do
|
||||||
send_rpc_vmf_data(peer_id, self:get_name(), rpc_name, ...)
|
send_rpc_vmf_data(peer_id, self:get_name(), rpc_name, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -200,7 +199,7 @@ VMFMod.network_send = function (self, rpc_name, recipient, ...)
|
||||||
|
|
||||||
elseif recipient == "others" then
|
elseif recipient == "others" then
|
||||||
|
|
||||||
for peer_id, _ in pairs(_VMF_USERS) do
|
for peer_id, _ in pairs(_vmf_users) do
|
||||||
send_rpc_vmf_data(peer_id, self:get_name(), rpc_name, ...)
|
send_rpc_vmf_data(peer_id, self:get_name(), rpc_name, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -225,7 +224,7 @@ vmf:hook("ChatManager.rpc_chat_message", function(func, self, sender, channel_id
|
||||||
func(self, sender, channel_id, message_sender, message, localization_param, ...)
|
func(self, sender, channel_id, message_sender, message, localization_param, ...)
|
||||||
else
|
else
|
||||||
|
|
||||||
if not _NETWORK_MODULE_IS_INITIALIZED then
|
if not _network_module_is_initialized then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -238,7 +237,7 @@ vmf:hook("ChatManager.rpc_chat_message", function(func, self, sender, channel_id
|
||||||
elseif channel_id == 4 then -- rpc_vmf_responce (@TODO: maybe I should protect it from sending by the player who's not in the game?)
|
elseif channel_id == 4 then -- rpc_vmf_responce (@TODO: maybe I should protect it from sending by the player who's not in the game?)
|
||||||
|
|
||||||
network_debug("pong", "received", sender)
|
network_debug("pong", "received", sender)
|
||||||
if _NETWORK_DEBUG then
|
if _network_debug then
|
||||||
vmf:info("[RECEIVED MODS TABLE]: " .. message)
|
vmf:info("[RECEIVED MODS TABLE]: " .. message)
|
||||||
vmf:info("[RECEIVED RPCS TABLE]: " .. localization_param)
|
vmf:info("[RECEIVED RPCS TABLE]: " .. localization_param)
|
||||||
end
|
end
|
||||||
|
@ -250,7 +249,7 @@ vmf:hook("ChatManager.rpc_chat_message", function(func, self, sender, channel_id
|
||||||
user_rpcs_dictionary[1] = cjson.decode(message) -- mods
|
user_rpcs_dictionary[1] = cjson.decode(message) -- mods
|
||||||
user_rpcs_dictionary[2] = cjson.decode(localization_param) -- rpcs
|
user_rpcs_dictionary[2] = cjson.decode(localization_param) -- rpcs
|
||||||
|
|
||||||
_VMF_USERS[sender] = user_rpcs_dictionary
|
_vmf_users[sender] = user_rpcs_dictionary
|
||||||
|
|
||||||
vmf:info("Added %s to the VMF users list.", sender)
|
vmf:info("Added %s to the VMF users list.", sender)
|
||||||
|
|
||||||
|
@ -281,7 +280,7 @@ vmf:hook("ChatManager.rpc_chat_message", function(func, self, sender, channel_id
|
||||||
vmf.xpcall_no_return_values(
|
vmf.xpcall_no_return_values(
|
||||||
get_mod(mod_name),
|
get_mod(mod_name),
|
||||||
error_prefix,
|
error_prefix,
|
||||||
function() _RPC_CALLBACKS[mod_name][rpc_name](sender, deserialize_data(localization_param)) end
|
function() _rpc_callbacks[mod_name][rpc_name](sender, deserialize_data(localization_param)) end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -299,7 +298,7 @@ end)
|
||||||
|
|
||||||
vmf:hook("PlayerManager.remove_player", function (func, self, peer_id, local_player_id)
|
vmf:hook("PlayerManager.remove_player", function (func, self, peer_id, local_player_id)
|
||||||
|
|
||||||
if _VMF_USERS[peer_id] then
|
if _vmf_users[peer_id] then
|
||||||
|
|
||||||
-- make sure it's not the bot
|
-- make sure it's not the bot
|
||||||
for _, player in pairs(Managers.player:human_players()) do
|
for _, player in pairs(Managers.player:human_players()) do
|
||||||
|
@ -308,14 +307,14 @@ vmf:hook("PlayerManager.remove_player", function (func, self, peer_id, local_pla
|
||||||
vmf:info("Removed %s from the VMF users list.", peer_id)
|
vmf:info("Removed %s from the VMF users list.", peer_id)
|
||||||
|
|
||||||
-- event
|
-- event
|
||||||
for mod_name, _ in pairs(_VMF_USERS[peer_id][1]) do
|
for mod_name, _ in pairs(_vmf_users[peer_id][1]) do
|
||||||
local mod = get_mod(mod_name)
|
local mod = get_mod(mod_name)
|
||||||
if mod then
|
if mod then
|
||||||
vmf.mod_user_left_the_game(mod, player)
|
vmf.mod_user_left_the_game(mod, player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_VMF_USERS[peer_id] = nil
|
_vmf_users[peer_id] = nil
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -330,34 +329,34 @@ end)
|
||||||
|
|
||||||
vmf.create_network_dictionary = function()
|
vmf.create_network_dictionary = function()
|
||||||
|
|
||||||
_SHARED_MODS_MAP = {}
|
_shared_mods_map = {}
|
||||||
_SHARED_RPCS_MAP = {}
|
_shared_rpcs_map = {}
|
||||||
|
|
||||||
local i = 0
|
local i = 0
|
||||||
for mod_name, mod_rpcs in pairs(_RPC_CALLBACKS) do
|
for mod_name, mod_rpcs in pairs(_rpc_callbacks) do
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
_SHARED_MODS_MAP[mod_name] = i
|
_shared_mods_map[mod_name] = i
|
||||||
_LOCAL_MODS_MAP[i] = mod_name
|
_local_mods_map[i] = mod_name
|
||||||
|
|
||||||
_SHARED_RPCS_MAP[i] = {}
|
_shared_rpcs_map[i] = {}
|
||||||
_LOCAL_RPCS_MAP[i] = {}
|
_local_rpcs_map[i] = {}
|
||||||
|
|
||||||
local j = 0
|
local j = 0
|
||||||
for rpc_name, _ in pairs(mod_rpcs) do
|
for rpc_name, _ in pairs(mod_rpcs) do
|
||||||
|
|
||||||
j = j + 1
|
j = j + 1
|
||||||
|
|
||||||
_SHARED_RPCS_MAP[i][rpc_name] = j
|
_shared_rpcs_map[i][rpc_name] = j
|
||||||
_LOCAL_RPCS_MAP[i][j] = rpc_name
|
_local_rpcs_map[i][j] = rpc_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_SHARED_MODS_MAP = cjson.encode(_SHARED_MODS_MAP)
|
_shared_mods_map = cjson.encode(_shared_mods_map)
|
||||||
_SHARED_RPCS_MAP = cjson.encode(_SHARED_RPCS_MAP)
|
_shared_rpcs_map = cjson.encode(_shared_rpcs_map)
|
||||||
|
|
||||||
_NETWORK_MODULE_IS_INITIALIZED = true
|
_network_module_is_initialized = true
|
||||||
end
|
end
|
||||||
|
|
||||||
vmf.ping_vmf_users = function()
|
vmf.ping_vmf_users = function()
|
||||||
|
@ -374,7 +373,7 @@ vmf.ping_vmf_users = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
vmf.load_network_settings = function()
|
vmf.load_network_settings = function()
|
||||||
_NETWORK_DEBUG = vmf:get("developer_mode") and vmf:get("show_network_debug_info")
|
_network_debug = vmf:get("developer_mode") and vmf:get("show_network_debug_info")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
|
@ -2,7 +2,7 @@ local vmf = get_mod("VMF")
|
||||||
|
|
||||||
Managers.vmf.persistent_tables = Managers.vmf.persistent_tables or {}
|
Managers.vmf.persistent_tables = Managers.vmf.persistent_tables or {}
|
||||||
|
|
||||||
local _PERSISTENT_TABLES = Managers.vmf.persistent_tables
|
local _persistent_tables = Managers.vmf.persistent_tables
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### VMFMod #######################################################################################################
|
-- ##### VMFMod #######################################################################################################
|
||||||
|
@ -15,11 +15,9 @@ VMFMod.persistent_table = function (self, table_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local mod_name = self:get_name()
|
local mod_name = self:get_name()
|
||||||
|
_persistent_tables[mod_name] = _persistent_tables[mod_name] or {}
|
||||||
|
|
||||||
_PERSISTENT_TABLES[mod_name] = _PERSISTENT_TABLES[mod_name] or {}
|
local mod_tables = _persistent_tables[mod_name]
|
||||||
|
|
||||||
local mod_tables = _PERSISTENT_TABLES[mod_name]
|
|
||||||
|
|
||||||
mod_tables[table_name] = mod_tables[table_name] or {}
|
mod_tables[table_name] = mod_tables[table_name] or {}
|
||||||
|
|
||||||
return mod_tables[table_name]
|
return mod_tables[table_name]
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
--]]
|
--]]
|
||||||
local vmf = get_mod("VMF")
|
local vmf = get_mod("VMF")
|
||||||
|
|
||||||
local _MODS_SETTINGS = Application.user_setting("mods_settings") or {}
|
local _mods_settings = Application.user_setting("mods_settings") or {}
|
||||||
|
|
||||||
local _THERE_ARE_UNSAVED_CHANGES = false
|
local _there_are_unsaved_changes = false
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### Local functions ##############################################################################################
|
-- ##### Local functions ##############################################################################################
|
||||||
|
@ -16,11 +16,11 @@ local _THERE_ARE_UNSAVED_CHANGES = false
|
||||||
|
|
||||||
local function save_all_settings()
|
local function save_all_settings()
|
||||||
|
|
||||||
if _THERE_ARE_UNSAVED_CHANGES then
|
if _there_are_unsaved_changes then
|
||||||
Application.set_user_setting("mods_settings", _MODS_SETTINGS)
|
Application.set_user_setting("mods_settings", _mods_settings)
|
||||||
Application.save_user_settings()
|
Application.save_user_settings()
|
||||||
|
|
||||||
_THERE_ARE_UNSAVED_CHANGES = false
|
_there_are_unsaved_changes = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,15 +37,15 @@ VMFMod.set = function (self, setting_name, setting_value, call_setting_changed_e
|
||||||
|
|
||||||
local mod_name = self:get_name()
|
local mod_name = self:get_name()
|
||||||
|
|
||||||
if not _MODS_SETTINGS[mod_name] then
|
if not _mods_settings[mod_name] then
|
||||||
_MODS_SETTINGS[mod_name] = {}
|
_mods_settings[mod_name] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local mod_settings = _MODS_SETTINGS[mod_name]
|
local mod_settings = _mods_settings[mod_name]
|
||||||
|
|
||||||
mod_settings[setting_name] = type(setting_value) == "table" and table.clone(setting_value) or setting_value
|
mod_settings[setting_name] = type(setting_value) == "table" and table.clone(setting_value) or setting_value
|
||||||
|
|
||||||
_THERE_ARE_UNSAVED_CHANGES = true
|
_there_are_unsaved_changes = true
|
||||||
|
|
||||||
if call_setting_changed_event then
|
if call_setting_changed_event then
|
||||||
vmf.mod_setting_changed_event(self, setting_name)
|
vmf.mod_setting_changed_event(self, setting_name)
|
||||||
|
@ -59,7 +59,7 @@ VMFMod.get = function (self, setting_name)
|
||||||
|
|
||||||
local mod_name = self:get_name()
|
local mod_name = self:get_name()
|
||||||
|
|
||||||
local mod_settings = _MODS_SETTINGS[mod_name]
|
local mod_settings = _mods_settings[mod_name]
|
||||||
|
|
||||||
local setting_value
|
local setting_value
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
local vmf = get_mod("VMF")
|
local vmf = get_mod("VMF")
|
||||||
|
|
||||||
local _DISABLED_MODS = vmf:get("disabled_mods_list") or {}
|
local _disabled_mods = vmf:get("disabled_mods_list") or {}
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### VMF internal functions and variables #########################################################################
|
-- ##### VMF internal functions and variables #########################################################################
|
||||||
|
@ -20,11 +20,11 @@ vmf.set_mod_state = function (mod, is_enabled, initial_call)
|
||||||
|
|
||||||
if not (initial_call or mod:is_mutator()) then
|
if not (initial_call or mod:is_mutator()) then
|
||||||
if is_enabled then
|
if is_enabled then
|
||||||
_DISABLED_MODS[mod:get_name()] = nil
|
_disabled_mods[mod:get_name()] = nil
|
||||||
else
|
else
|
||||||
_DISABLED_MODS[mod:get_name()] = true
|
_disabled_mods[mod:get_name()] = true
|
||||||
end
|
end
|
||||||
vmf:set("disabled_mods_list", _DISABLED_MODS)
|
vmf:set("disabled_mods_list", _disabled_mods)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ vmf.initialize_mod_state = function (mod)
|
||||||
end
|
end
|
||||||
vmf.set_mutator_state(mod, state, true)
|
vmf.set_mutator_state(mod, state, true)
|
||||||
else
|
else
|
||||||
state = not _DISABLED_MODS[mod:get_name()]
|
state = not _disabled_mods[mod:get_name()]
|
||||||
vmf.set_mod_state(mod, state, true)
|
vmf.set_mod_state(mod, state, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,12 +2,12 @@ local vmf = get_mod("VMF")
|
||||||
|
|
||||||
UI_RENDERERS = UI_RENDERERS or {}
|
UI_RENDERERS = UI_RENDERERS or {}
|
||||||
|
|
||||||
local _CUSTOM_NONE_ATLAS_TEXTURES = {}
|
local _custom_none_atlas_textures = {}
|
||||||
local _CUSTOM_UI_ATLAS_SETTINGS = {}
|
local _custom_ui_atlas_settings = {}
|
||||||
|
|
||||||
local _INJECTED_MATERIALS = {}
|
local _injected_materials = {}
|
||||||
|
|
||||||
local _SHOW_DEBUG_INFO = false
|
local _show_debug_info = false
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### Local functions ##############################################################################################
|
-- ##### Local functions ##############################################################################################
|
||||||
|
@ -28,13 +28,13 @@ local function check_texture_availability(mod, texture_name)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if _CUSTOM_NONE_ATLAS_TEXTURES[texture_name] then
|
if _custom_none_atlas_textures[texture_name] then
|
||||||
mod:error("(custom texture/atlas): texture name '%s' is already used by the mod '%s' as none atlas texture", texture_name, _CUSTOM_NONE_ATLAS_TEXTURES[texture_name])
|
mod:error("(custom texture/atlas): texture name '%s' is already used by the mod '%s' as none atlas texture", texture_name, _custom_none_atlas_textures[texture_name])
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if _CUSTOM_UI_ATLAS_SETTINGS[texture_name] then
|
if _custom_ui_atlas_settings[texture_name] then
|
||||||
texture_settings = _CUSTOM_UI_ATLAS_SETTINGS[texture_name]
|
texture_settings = _custom_ui_atlas_settings[texture_name]
|
||||||
mod:error("(custom texture/atlas): texture name '%s' is already used by the mod '%s' in atlas '%s'", texture_name, texture_settings.mod_name, tostring(texture_settings.material_name))
|
mod:error("(custom texture/atlas): texture name '%s' is already used by the mod '%s' in atlas '%s'", texture_name, texture_settings.mod_name, tostring(texture_settings.material_name))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -51,7 +51,7 @@ vmf.custom_textures = function (mod, ...)
|
||||||
for i, texture_name in ipairs({...}) do
|
for i, texture_name in ipairs({...}) do
|
||||||
if type(texture_name) == "string" then
|
if type(texture_name) == "string" then
|
||||||
if check_texture_availability(mod, texture_name) then
|
if check_texture_availability(mod, texture_name) then
|
||||||
_CUSTOM_NONE_ATLAS_TEXTURES[texture_name] = mod:get_name()
|
_custom_none_atlas_textures[texture_name] = mod:get_name()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
mod:error("(custom_textures): all arguments should have the string type, but the argument #%s is %s", i, type(texture_name))
|
mod:error("(custom_textures): all arguments should have the string type, but the argument #%s is %s", i, type(texture_name))
|
||||||
|
@ -86,7 +86,7 @@ vmf.custom_atlas = function (mod, material_settings_file, material_name, masked_
|
||||||
texture_settings.masked_point_sample_material_name = masked_point_sample_material_name
|
texture_settings.masked_point_sample_material_name = masked_point_sample_material_name
|
||||||
texture_settings.saturated_material_name = saturated_material_name
|
texture_settings.saturated_material_name = saturated_material_name
|
||||||
|
|
||||||
_CUSTOM_UI_ATLAS_SETTINGS[texture_name] = texture_settings
|
_custom_ui_atlas_settings[texture_name] = texture_settings
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ vmf.inject_materials = function (mod, ui_renderer_creator, ...)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local injected_materials_list = _INJECTED_MATERIALS[ui_renderer_creator] or {}
|
local injected_materials_list = _injected_materials[ui_renderer_creator] or {}
|
||||||
|
|
||||||
local can_inject
|
local can_inject
|
||||||
for i, new_injected_material in ipairs({...}) do
|
for i, new_injected_material in ipairs({...}) do
|
||||||
|
@ -126,7 +126,7 @@ vmf.inject_materials = function (mod, ui_renderer_creator, ...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_INJECTED_MATERIALS[ui_renderer_creator] = injected_materials_list
|
_injected_materials[ui_renderer_creator] = injected_materials_list
|
||||||
|
|
||||||
-- recreate GUIs with injected materials for ui_renderers created by 'ui_renderer_creator'
|
-- recreate GUIs with injected materials for ui_renderers created by 'ui_renderer_creator'
|
||||||
local vmf_data
|
local vmf_data
|
||||||
|
@ -190,8 +190,8 @@ vmf:hook("UIRenderer.create", function(func, world, ...)
|
||||||
|
|
||||||
local ui_renderer_materials = {...}
|
local ui_renderer_materials = {...}
|
||||||
|
|
||||||
if _INJECTED_MATERIALS[ui_renderer_creator] then
|
if _injected_materials[ui_renderer_creator] then
|
||||||
for _, injected_material in ipairs(_INJECTED_MATERIALS[ui_renderer_creator]) do
|
for _, injected_material in ipairs(_injected_materials[ui_renderer_creator]) do
|
||||||
table.insert(ui_renderer_materials, "material")
|
table.insert(ui_renderer_materials, "material")
|
||||||
table.insert(ui_renderer_materials, injected_material)
|
table.insert(ui_renderer_materials, injected_material)
|
||||||
end
|
end
|
||||||
|
@ -200,7 +200,7 @@ vmf:hook("UIRenderer.create", function(func, world, ...)
|
||||||
|
|
||||||
-- DEBUG INFO
|
-- DEBUG INFO
|
||||||
|
|
||||||
if _SHOW_DEBUG_INFO then
|
if _show_debug_info then
|
||||||
vmf:info("UI_RENDERER CREATED BY:")
|
vmf:info("UI_RENDERER CREATED BY:")
|
||||||
vmf:info(" %s", ui_renderer_creator)
|
vmf:info(" %s", ui_renderer_creator)
|
||||||
vmf:info("UI_RENDERER MATERIALS:")
|
vmf:info("UI_RENDERER MATERIALS:")
|
||||||
|
@ -235,7 +235,7 @@ end)
|
||||||
|
|
||||||
vmf:hook("UIAtlasHelper.has_atlas_settings_by_texture_name", function(func, texture_name)
|
vmf:hook("UIAtlasHelper.has_atlas_settings_by_texture_name", function(func, texture_name)
|
||||||
|
|
||||||
if _CUSTOM_UI_ATLAS_SETTINGS[texture_name] then
|
if _custom_ui_atlas_settings[texture_name] then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -245,12 +245,12 @@ end)
|
||||||
|
|
||||||
vmf:hook("UIAtlasHelper.get_atlas_settings_by_texture_name", function(func, texture_name)
|
vmf:hook("UIAtlasHelper.get_atlas_settings_by_texture_name", function(func, texture_name)
|
||||||
|
|
||||||
if _CUSTOM_NONE_ATLAS_TEXTURES[texture_name] then
|
if _custom_none_atlas_textures[texture_name] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if _CUSTOM_UI_ATLAS_SETTINGS[texture_name] then
|
if _custom_ui_atlas_settings[texture_name] then
|
||||||
return _CUSTOM_UI_ATLAS_SETTINGS[texture_name]
|
return _custom_ui_atlas_settings[texture_name]
|
||||||
end
|
end
|
||||||
|
|
||||||
return func(texture_name)
|
return func(texture_name)
|
||||||
|
@ -261,7 +261,7 @@ end)
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
vmf.load_custom_textures_settings = function()
|
vmf.load_custom_textures_settings = function()
|
||||||
_SHOW_DEBUG_INFO = vmf:get("developer_mode") and vmf:get("log_ui_renderers_info")
|
_show_debug_info = vmf:get("developer_mode") and vmf:get("log_ui_renderers_info")
|
||||||
end
|
end
|
||||||
|
|
||||||
vmf.reset_guis = function()
|
vmf.reset_guis = function()
|
||||||
|
|
|
@ -5,35 +5,35 @@
|
||||||
]]
|
]]
|
||||||
local vmf = get_mod("VMF")
|
local vmf = get_mod("VMF")
|
||||||
|
|
||||||
local _CHAT_OPENED = false
|
local _chat_opened = false
|
||||||
|
|
||||||
local _COMMANDS_LIST = {}
|
local _commands_list = {}
|
||||||
local _COMMAND_INDEX = 0 -- 0 => nothing selected
|
local _command_index = 0 -- 0 => nothing selected
|
||||||
|
|
||||||
local _COMMANDS_LIST_GUI_DRAW = nil
|
local _commands_list_gui_draw
|
||||||
|
|
||||||
local _CHAT_HISTORY = {}
|
local _chat_history = {}
|
||||||
local _CHAT_HISTORY_INDEX = 0
|
local _chat_history_index = 0
|
||||||
local _CHAT_HISTORY_ENABLED = true
|
local _chat_history_enabled = true
|
||||||
local _CHAT_HISTORY_SAVE = true
|
local _chat_history_save = true
|
||||||
local _CHAT_HISTORY_MAX = 50
|
local _chat_history_max = 50
|
||||||
local _CHAT_HISTORY_REMOVE_DUPS_LAST = false
|
local _chat_history_remove_dups_last = false
|
||||||
local _CHAT_HISTORY_REMOVE_DUPS_ALL = false
|
local _chat_history_remove_dups_all = false
|
||||||
local _CHAT_HISTORY_SAVE_COMMANDS_ONLY = false
|
local _chat_history_save_commands_only = false
|
||||||
|
|
||||||
local _QUEUED_COMMAND -- is a workaround for VT2 where raycast is blocked during ui update
|
local _queued_command -- is a workaround for VT2 where raycast is blocked during ui update
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
-- ##### Local functions ##############################################################################################
|
-- ##### Local functions ##############################################################################################
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
local function initialize_drawing_function()
|
local function initialize_drawing_function()
|
||||||
_COMMANDS_LIST_GUI_DRAW = dofile("scripts/mods/vmf/modules/ui/chat/commands_list_gui")
|
_commands_list_gui_draw = dofile("scripts/mods/vmf/modules/ui/chat/commands_list_gui")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function clean_chat_history()
|
local function clean_chat_history()
|
||||||
_CHAT_HISTORY = {}
|
_chat_history = {}
|
||||||
_CHAT_HISTORY_INDEX = 0
|
_chat_history_index = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_chat_message(chat_gui, message)
|
local function set_chat_message(chat_gui, message)
|
||||||
|
@ -60,7 +60,7 @@ end)
|
||||||
vmf:hook("ChatGui.block_input", function(func, ...)
|
vmf:hook("ChatGui.block_input", function(func, ...)
|
||||||
func(...)
|
func(...)
|
||||||
|
|
||||||
_CHAT_OPENED = true
|
_chat_opened = true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,21 +72,21 @@ vmf:hook("ChatGui._update_input", function(func, self, input_service, menu_input
|
||||||
if Keyboard.pressed(Keyboard.button_index("enter")) then
|
if Keyboard.pressed(Keyboard.button_index("enter")) then
|
||||||
|
|
||||||
-- chat history
|
-- chat history
|
||||||
if _CHAT_HISTORY_ENABLED
|
if _chat_history_enabled
|
||||||
and self.chat_message ~= ""
|
and self.chat_message ~= ""
|
||||||
and not (_CHAT_HISTORY_REMOVE_DUPS_LAST and (self.chat_message == _CHAT_HISTORY[1]))
|
and not (_chat_history_remove_dups_last and (self.chat_message == _chat_history[1]))
|
||||||
and (not _CHAT_HISTORY_SAVE_COMMANDS_ONLY or (_COMMAND_INDEX ~= 0)) then
|
and (not _chat_history_save_commands_only or (_command_index ~= 0)) then
|
||||||
table.insert(_CHAT_HISTORY, 1, self.chat_message)
|
table.insert(_chat_history, 1, self.chat_message)
|
||||||
|
|
||||||
if #_CHAT_HISTORY == _CHAT_HISTORY_MAX + 1 then
|
if #_chat_history == _chat_history_max + 1 then
|
||||||
table.remove(_CHAT_HISTORY, #_CHAT_HISTORY)
|
table.remove(_chat_history, #_chat_history)
|
||||||
end
|
end
|
||||||
|
|
||||||
if _CHAT_HISTORY_REMOVE_DUPS_ALL then
|
if _chat_history_remove_dups_all then
|
||||||
|
|
||||||
for i = 2, #_CHAT_HISTORY do
|
for i = 2, #_chat_history do
|
||||||
if _CHAT_HISTORY[i] == self.chat_message then
|
if _chat_history[i] == self.chat_message then
|
||||||
table.remove(_CHAT_HISTORY, i)
|
table.remove(_chat_history, i)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -94,20 +94,20 @@ vmf:hook("ChatGui._update_input", function(func, self, input_service, menu_input
|
||||||
end
|
end
|
||||||
|
|
||||||
-- command execution
|
-- command execution
|
||||||
if _COMMAND_INDEX ~= 0 then
|
if _command_index ~= 0 then
|
||||||
local args = {}
|
local args = {}
|
||||||
for arg in string.gmatch(self.chat_message, "%S+") do
|
for arg in string.gmatch(self.chat_message, "%S+") do
|
||||||
table.insert(args, arg)
|
table.insert(args, arg)
|
||||||
end
|
end
|
||||||
table.remove(args, 1)
|
table.remove(args, 1)
|
||||||
|
|
||||||
_QUEUED_COMMAND = {
|
_queued_command = {
|
||||||
name = _COMMANDS_LIST[_COMMAND_INDEX].name,
|
name = _commands_list[_command_index].name,
|
||||||
args = args
|
args = args
|
||||||
}
|
}
|
||||||
|
|
||||||
_COMMANDS_LIST = {}
|
_commands_list = {}
|
||||||
_COMMAND_INDEX = 0
|
_command_index = 0
|
||||||
|
|
||||||
set_chat_message(self, "")
|
set_chat_message(self, "")
|
||||||
|
|
||||||
|
@ -122,11 +122,11 @@ vmf:hook("ChatGui._update_input", function(func, self, input_service, menu_input
|
||||||
if chat_closed then
|
if chat_closed then
|
||||||
set_chat_message(self, "")
|
set_chat_message(self, "")
|
||||||
|
|
||||||
_CHAT_OPENED = false
|
_chat_opened = false
|
||||||
|
|
||||||
_COMMANDS_LIST = {}
|
_commands_list = {}
|
||||||
_COMMAND_INDEX = 0
|
_command_index = 0
|
||||||
_CHAT_HISTORY_INDEX = 0
|
_chat_history_index = 0
|
||||||
|
|
||||||
if command_executed then
|
if command_executed then
|
||||||
chat_closed = false
|
chat_closed = false
|
||||||
|
@ -134,7 +134,7 @@ vmf:hook("ChatGui._update_input", function(func, self, input_service, menu_input
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if _CHAT_OPENED then
|
if _chat_opened then
|
||||||
|
|
||||||
-- getting state of 'tab', 'arrow up' and 'arrow down' buttons
|
-- getting state of 'tab', 'arrow up' and 'arrow down' buttons
|
||||||
local tab_pressed = false
|
local tab_pressed = false
|
||||||
|
@ -152,7 +152,7 @@ vmf:hook("ChatGui._update_input", function(func, self, input_service, menu_input
|
||||||
end
|
end
|
||||||
|
|
||||||
-- chat history
|
-- chat history
|
||||||
if _CHAT_HISTORY_ENABLED then
|
if _chat_history_enabled then
|
||||||
|
|
||||||
-- reverse result of native chat history in VT2
|
-- reverse result of native chat history in VT2
|
||||||
if not VT1 and input_service.get(input_service, "chat_next_old_message") or input_service.get(input_service, "chat_previous_old_message") then
|
if not VT1 and input_service.get(input_service, "chat_next_old_message") or input_service.get(input_service, "chat_previous_old_message") then
|
||||||
|
@ -161,21 +161,21 @@ vmf:hook("ChatGui._update_input", function(func, self, input_service, menu_input
|
||||||
|
|
||||||
-- message was modified by player
|
-- message was modified by player
|
||||||
if self.chat_message ~= self.previous_chat_message then
|
if self.chat_message ~= self.previous_chat_message then
|
||||||
_CHAT_HISTORY_INDEX = 0
|
_chat_history_index = 0
|
||||||
end
|
end
|
||||||
if arrow_up_pressed or arrow_down_pressed then
|
if arrow_up_pressed or arrow_down_pressed then
|
||||||
|
|
||||||
local new_index = _CHAT_HISTORY_INDEX + (arrow_up_pressed and 1 or -1)
|
local new_index = _chat_history_index + (arrow_up_pressed and 1 or -1)
|
||||||
new_index = math.clamp(new_index, 0, #_CHAT_HISTORY)
|
new_index = math.clamp(new_index, 0, #_chat_history)
|
||||||
|
|
||||||
if _CHAT_HISTORY_INDEX ~= new_index then
|
if _chat_history_index ~= new_index then
|
||||||
if _CHAT_HISTORY[new_index] then
|
if _chat_history[new_index] then
|
||||||
|
|
||||||
set_chat_message(self, _CHAT_HISTORY[new_index])
|
set_chat_message(self, _chat_history[new_index])
|
||||||
|
|
||||||
self.previous_chat_message = self.chat_message
|
self.previous_chat_message = self.chat_message
|
||||||
|
|
||||||
_CHAT_HISTORY_INDEX = new_index
|
_chat_history_index = new_index
|
||||||
else -- new_index == 0
|
else -- new_index == 0
|
||||||
set_chat_message(self, "")
|
set_chat_message(self, "")
|
||||||
end
|
end
|
||||||
|
@ -200,11 +200,11 @@ vmf:hook("ChatGui._update_input", function(func, self, input_service, menu_input
|
||||||
if not string.find(self.chat_message, " ") -- if there's no space after '/part_of_command_name'
|
if not string.find(self.chat_message, " ") -- if there's no space after '/part_of_command_name'
|
||||||
and tab_pressed -- if TAB was pressed
|
and tab_pressed -- if TAB was pressed
|
||||||
and (string.len(self.chat_message) + 1) == self.chat_index -- if TAB was pressed with caret at the end of the string
|
and (string.len(self.chat_message) + 1) == self.chat_index -- if TAB was pressed with caret at the end of the string
|
||||||
and (#_COMMANDS_LIST > 0) then -- if there are any commands matching entered '/part_of_command_name'
|
and (#_commands_list > 0) then -- if there are any commands matching entered '/part_of_command_name'
|
||||||
|
|
||||||
_COMMAND_INDEX = _COMMAND_INDEX % #_COMMANDS_LIST + 1
|
_command_index = _command_index % #_commands_list + 1
|
||||||
|
|
||||||
set_chat_message(self, "/" .. _COMMANDS_LIST[_COMMAND_INDEX].name)
|
set_chat_message(self, "/" .. _commands_list[_command_index].name)
|
||||||
|
|
||||||
-- so the next block won't update the commands list
|
-- so the next block won't update the commands list
|
||||||
old_chat_message = self.chat_message
|
old_chat_message = self.chat_message
|
||||||
|
@ -217,27 +217,27 @@ vmf:hook("ChatGui._update_input", function(func, self, input_service, menu_input
|
||||||
local command_name_contains = self.chat_message:match("%S+"):sub(2, -1)
|
local command_name_contains = self.chat_message:match("%S+"):sub(2, -1)
|
||||||
|
|
||||||
if string.find(self.chat_message, " ") then
|
if string.find(self.chat_message, " ") then
|
||||||
_COMMANDS_LIST = vmf.get_commands_list(command_name_contains, true)
|
_commands_list = vmf.get_commands_list(command_name_contains, true)
|
||||||
else
|
else
|
||||||
_COMMANDS_LIST = vmf.get_commands_list(command_name_contains)
|
_commands_list = vmf.get_commands_list(command_name_contains)
|
||||||
end
|
end
|
||||||
|
|
||||||
_COMMAND_INDEX = 0
|
_command_index = 0
|
||||||
|
|
||||||
if #_COMMANDS_LIST > 0 and command_name_contains:lower() == _COMMANDS_LIST[1].name then
|
if #_commands_list > 0 and command_name_contains:lower() == _commands_list[1].name then
|
||||||
_COMMAND_INDEX = 1
|
_command_index = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- chat message was modified and doesn't start with '/'
|
-- chat message was modified and doesn't start with '/'
|
||||||
elseif self.chat_message ~= old_chat_message and #_COMMANDS_LIST > 0 then
|
elseif self.chat_message ~= old_chat_message and #_commands_list > 0 then
|
||||||
_COMMANDS_LIST = {}
|
_commands_list = {}
|
||||||
_COMMAND_INDEX = 0
|
_command_index = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if #_COMMANDS_LIST > 0 then
|
if #_commands_list > 0 then
|
||||||
_COMMANDS_LIST_GUI_DRAW(_COMMANDS_LIST, _COMMAND_INDEX)
|
_commands_list_gui_draw(_commands_list, _command_index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -250,20 +250,20 @@ end)
|
||||||
|
|
||||||
vmf.load_chat_history_settings = function(clean_chat_history_)
|
vmf.load_chat_history_settings = function(clean_chat_history_)
|
||||||
|
|
||||||
_CHAT_HISTORY_ENABLED = vmf:get("chat_history_enable")
|
_chat_history_enabled = vmf:get("chat_history_enable")
|
||||||
_CHAT_HISTORY_SAVE = vmf:get("chat_history_save")
|
_chat_history_save = vmf:get("chat_history_save")
|
||||||
_CHAT_HISTORY_MAX = vmf:get("chat_history_buffer_size")
|
_chat_history_max = vmf:get("chat_history_buffer_size")
|
||||||
_CHAT_HISTORY_REMOVE_DUPS_LAST = vmf:get("chat_history_remove_dups")
|
_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_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_save_commands_only = vmf:get("chat_history_commands_only")
|
||||||
|
|
||||||
if _CHAT_HISTORY_ENABLED then
|
if _chat_history_enabled then
|
||||||
vmf:command("clean_chat_history", vmf:localize("clean_chat_history"), clean_chat_history)
|
vmf:command("clean_chat_history", vmf:localize("clean_chat_history"), clean_chat_history)
|
||||||
else
|
else
|
||||||
vmf:command_remove("clean_chat_history")
|
vmf:command_remove("clean_chat_history")
|
||||||
end
|
end
|
||||||
|
|
||||||
if not _CHAT_HISTORY_SAVE then
|
if not _chat_history_save then
|
||||||
vmf:set("chat_history", nil)
|
vmf:set("chat_history", nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -273,15 +273,15 @@ vmf.load_chat_history_settings = function(clean_chat_history_)
|
||||||
end
|
end
|
||||||
|
|
||||||
vmf.save_chat_history = function()
|
vmf.save_chat_history = function()
|
||||||
if _CHAT_HISTORY_SAVE then
|
if _chat_history_save then
|
||||||
vmf:set("chat_history", _CHAT_HISTORY)
|
vmf:set("chat_history", _chat_history)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vmf.execute_queued_chat_command = function()
|
vmf.execute_queued_chat_command = function()
|
||||||
if _QUEUED_COMMAND then
|
if _queued_command then
|
||||||
vmf.run_command(_QUEUED_COMMAND.name, unpack(_QUEUED_COMMAND.args))
|
vmf.run_command(_queued_command.name, unpack(_queued_command.args))
|
||||||
_QUEUED_COMMAND = nil
|
_queued_command = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -291,8 +291,8 @@ end
|
||||||
|
|
||||||
vmf.load_chat_history_settings()
|
vmf.load_chat_history_settings()
|
||||||
|
|
||||||
if _CHAT_HISTORY_SAVE then
|
if _chat_history_save then
|
||||||
_CHAT_HISTORY = vmf:get("chat_history") or _CHAT_HISTORY
|
_chat_history = vmf:get("chat_history") or _chat_history
|
||||||
end
|
end
|
||||||
|
|
||||||
if Managers.world and Managers.world:has_world("top_ingame_view") then
|
if Managers.world and Managers.world:has_world("top_ingame_view") then
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
local vmf = get_mod("VMF") --@TODO: remove it?
|
local vmf = get_mod("VMF") --@TODO: remove it?
|
||||||
|
|
||||||
local _GUI
|
local _gui
|
||||||
|
|
||||||
if VT1 then
|
if VT1 then
|
||||||
-- @TODO: I don't think I need the 2nd texture
|
-- @TODO: I don't think I need the 2nd texture
|
||||||
_GUI = World.create_screen_gui(Managers.world:world("top_ingame_view"), "immediate", "material", "materials/fonts/gw_fonts", "material", "materials/ui/ui_1080p_ingame_common")
|
_gui = World.create_screen_gui(Managers.world:world("top_ingame_view"), "immediate", "material", "materials/fonts/gw_fonts", "material", "materials/ui/ui_1080p_ingame_common")
|
||||||
else
|
else
|
||||||
_GUI = World.create_screen_gui(Managers.world:world("top_ingame_view"), "material", "materials/fonts/gw_fonts", "immediate")
|
_gui = World.create_screen_gui(Managers.world:world("top_ingame_view"), "material", "materials/fonts/gw_fonts", "immediate")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- DebugScreen.gui = World.create_screen_gui(world, "material", "materials/fonts/gw_fonts", "material", "materials/menu/debug_screen", "immediate")
|
-- DebugScreen.gui = World.create_screen_gui(world, "material", "materials/fonts/gw_fonts", "material", "materials/menu/debug_screen", "immediate")
|
||||||
|
@ -33,7 +33,7 @@ local _WIDTH = 550
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
local function get_text_width(text, font_material, font_size)
|
local function get_text_width(text, font_material, font_size)
|
||||||
local text_extent_min, text_extent_max = Gui.text_extents(_GUI, text, font_material, font_size)
|
local text_extent_min, text_extent_max = Gui.text_extents(_gui, text, font_material, font_size)
|
||||||
local text_height = text_extent_max[1] - text_extent_min[1]
|
local text_height = text_extent_max[1] - text_extent_min[1]
|
||||||
return text_height
|
return text_height
|
||||||
end
|
end
|
||||||
|
@ -45,7 +45,7 @@ local function word_wrap(text, font_material, font_size, max_width)
|
||||||
local reuse_global_table = true
|
local reuse_global_table = true
|
||||||
local scale = RESOLUTION_LOOKUP.scale
|
local scale = RESOLUTION_LOOKUP.scale
|
||||||
|
|
||||||
return Gui.word_wrap(_GUI, text, font_material, font_size, max_width * scale, whitespace, soft_dividers, return_dividers, reuse_global_table)
|
return Gui.word_wrap(_gui, text, font_material, font_size, max_width * scale, whitespace, soft_dividers, return_dividers, reuse_global_table)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function draw(commands_list, selected_command_index)
|
local function draw(commands_list, selected_command_index)
|
||||||
|
@ -81,7 +81,7 @@ local function draw(commands_list, selected_command_index)
|
||||||
|
|
||||||
-- draw "/command_name" text
|
-- draw "/command_name" text
|
||||||
local string_position = Vector3((_OFFSET_X + _STRING_X_MARGIN) * scale, (_OFFSET_Y - _STRING_HEIGHT * (i + selected_strings_number - 1) + _STRING_Y_OFFSET) * scale, _OFFSET_Z + 2)
|
local string_position = Vector3((_OFFSET_X + _STRING_X_MARGIN) * scale, (_OFFSET_Y - _STRING_HEIGHT * (i + selected_strings_number - 1) + _STRING_Y_OFFSET) * scale, _OFFSET_Z + 2)
|
||||||
Gui.text(_GUI, command.name, font_material, font_size, font_name, string_position, Color(255, 100, 255, 100))
|
Gui.text(_gui, command.name, font_material, font_size, font_name, string_position, Color(255, 100, 255, 100))
|
||||||
|
|
||||||
local command_text_strings = word_wrap(command.full_text, font_material, font_size, _WIDTH - _STRING_X_MARGIN * 2)
|
local command_text_strings = word_wrap(command.full_text, font_material, font_size, _WIDTH - _STRING_X_MARGIN * 2)
|
||||||
local multistring = #command_text_strings > 1
|
local multistring = #command_text_strings > 1
|
||||||
|
@ -95,7 +95,7 @@ local function draw(commands_list, selected_command_index)
|
||||||
|
|
||||||
-- draw that [...] thing
|
-- draw that [...] thing
|
||||||
local multistring_indicator_position = Vector3((_OFFSET_X + _WIDTH) * scale - multistring_indicator_width, string_position.y, string_position.z)
|
local multistring_indicator_position = Vector3((_OFFSET_X + _WIDTH) * scale - multistring_indicator_width, string_position.y, string_position.z)
|
||||||
Gui.text(_GUI, _MULTISTRING_INDICATOR_TEXT, font_material, font_size, font_name, multistring_indicator_position, Color(255, 100, 100, 100))
|
Gui.text(_gui, _MULTISTRING_INDICATOR_TEXT, font_material, font_size, font_name, multistring_indicator_position, Color(255, 100, 100, 100))
|
||||||
end
|
end
|
||||||
first_description_string = string.sub(command_text_strings[1], #command.name + 2)
|
first_description_string = string.sub(command_text_strings[1], #command.name + 2)
|
||||||
else
|
else
|
||||||
|
@ -105,13 +105,13 @@ local function draw(commands_list, selected_command_index)
|
||||||
-- draw command description text (1st string)
|
-- draw command description text (1st string)
|
||||||
local first_description_string_width = get_text_width(command.name, font_material, font_size)
|
local first_description_string_width = get_text_width(command.name, font_material, font_size)
|
||||||
local first_description_string_position = Vector3(string_position.x + first_description_string_width, string_position.y, string_position.z)
|
local first_description_string_position = Vector3(string_position.x + first_description_string_width, string_position.y, string_position.z)
|
||||||
Gui.text(_GUI, first_description_string, font_material, font_size, font_name, first_description_string_position, Color(255, 255, 255, 255))
|
Gui.text(_gui, first_description_string, font_material, font_size, font_name, first_description_string_position, Color(255, 255, 255, 255))
|
||||||
|
|
||||||
-- draw command description text (2+ strings)
|
-- draw command description text (2+ strings)
|
||||||
if command.selected and multistring then
|
if command.selected and multistring then
|
||||||
for j = 2, selected_strings_number do
|
for j = 2, selected_strings_number do
|
||||||
string_position.y = string_position.y - _STRING_HEIGHT * scale
|
string_position.y = string_position.y - _STRING_HEIGHT * scale
|
||||||
Gui.text(_GUI, command_text_strings[j], font_material, font_size, font_name, string_position, Color(255, 255, 255, 255))
|
Gui.text(_gui, command_text_strings[j], font_material, font_size, font_name, string_position, Color(255, 255, 255, 255))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -123,7 +123,7 @@ local function draw(commands_list, selected_command_index)
|
||||||
local bg_position = Vector3(_OFFSET_X * scale, bg_pos_y * scale, _OFFSET_Z)
|
local bg_position = Vector3(_OFFSET_X * scale, bg_pos_y * scale, _OFFSET_Z)
|
||||||
local bg_size = Vector2(_WIDTH * scale, bg_height * scale)
|
local bg_size = Vector2(_WIDTH * scale, bg_height * scale)
|
||||||
local bg_color = Color(200, 10, 10, 10)
|
local bg_color = Color(200, 10, 10, 10)
|
||||||
Gui.rect(_GUI, bg_position, bg_size, bg_color)
|
Gui.rect(_gui, bg_position, bg_size, bg_color)
|
||||||
|
|
||||||
-- selection rectangle
|
-- selection rectangle
|
||||||
if selected_command_new_index > 0 then
|
if selected_command_new_index > 0 then
|
||||||
|
@ -133,7 +133,7 @@ local function draw(commands_list, selected_command_index)
|
||||||
local selection_position = Vector3(_OFFSET_X * scale, selection_pos_y * scale, _OFFSET_Z + 1)
|
local selection_position = Vector3(_OFFSET_X * scale, selection_pos_y * scale, _OFFSET_Z + 1)
|
||||||
local selection_size = Vector2(_WIDTH * scale, selection_height * scale)
|
local selection_size = Vector2(_WIDTH * scale, selection_height * scale)
|
||||||
local selection_color = Color(100, 120, 120, 120)
|
local selection_color = Color(100, 120, 120, 120)
|
||||||
Gui.rect(_GUI, selection_position, selection_size, selection_color)
|
Gui.rect(_gui, selection_position, selection_size, selection_color)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- "selected command number / total commands number" indicator
|
-- "selected command number / total commands number" indicator
|
||||||
|
@ -144,7 +144,7 @@ local function draw(commands_list, selected_command_index)
|
||||||
end
|
end
|
||||||
local total_number_indicator_width = get_text_width(total_number_indicator, font_material, font_size)
|
local total_number_indicator_width = get_text_width(total_number_indicator, font_material, font_size)
|
||||||
local total_number_indicator_position = Vector3((_WIDTH) * scale - total_number_indicator_width, (_OFFSET_Y + _STRING_Y_OFFSET) * scale, _OFFSET_Z + 2)
|
local total_number_indicator_position = Vector3((_WIDTH) * scale - total_number_indicator_width, (_OFFSET_Y + _STRING_Y_OFFSET) * scale, _OFFSET_Z + 2)
|
||||||
Gui.text(_GUI, total_number_indicator, font_material, font_size, font_name, total_number_indicator_position, Color(255, 100, 100, 100))
|
Gui.text(_gui, total_number_indicator, font_material, font_size, font_name, total_number_indicator_position, Color(255, 100, 100, 100))
|
||||||
end
|
end
|
||||||
--end)
|
--end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue