Unify indentation style
Except for hooks module.
This commit is contained in:
parent
7e2faac683
commit
2879193731
38 changed files with 251 additions and 251 deletions
|
@ -1,18 +1,18 @@
|
||||||
common = {
|
common = {
|
||||||
input = {
|
input = {
|
||||||
filename = "gui/vmf/vmf_atlas"
|
filename = "gui/vmf/vmf_atlas"
|
||||||
}
|
}
|
||||||
output = {
|
output = {
|
||||||
apply_processing = true
|
apply_processing = true
|
||||||
correct_gamma = true
|
correct_gamma = true
|
||||||
cut_alpha_threshold = 0.5
|
cut_alpha_threshold = 0.5
|
||||||
enable_cut_alpha_threshold = false
|
enable_cut_alpha_threshold = false
|
||||||
format = "A8R8G8B8"
|
format = "A8R8G8B8"
|
||||||
mipmap_filter = "kaiser"
|
mipmap_filter = "kaiser"
|
||||||
mipmap_filter_wrap_mode = "mirror"
|
mipmap_filter_wrap_mode = "mirror"
|
||||||
mipmap_keep_original = false
|
mipmap_keep_original = false
|
||||||
mipmap_num_largest_steps_to_discard = 0
|
mipmap_num_largest_steps_to_discard = 0
|
||||||
mipmap_num_smallest_steps_to_discard = 0
|
mipmap_num_smallest_steps_to_discard = 0
|
||||||
srgb = true
|
srgb = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
-- Image Source:
|
-- Image Source:
|
||||||
return {
|
return {
|
||||||
header_fav_arrow = {
|
header_fav_arrow = {
|
||||||
size = { 48, 48, },
|
size = { 48, 48, },
|
||||||
uv00 = { 0.181641, 0.880859, },
|
uv00 = { 0.181641, 0.880859, },
|
||||||
uv11 = { 0.228516, 0.974609, },
|
uv11 = { 0.228516, 0.974609, },
|
||||||
},
|
},
|
||||||
header_fav_icon = {
|
header_fav_icon = {
|
||||||
size = { 48, 48, },
|
size = { 48, 48, },
|
||||||
uv00 = { 0.130859, 0.880859, },
|
uv00 = { 0.130859, 0.880859, },
|
||||||
uv11 = { 0.177734, 0.974609, },
|
uv11 = { 0.177734, 0.974609, },
|
||||||
},
|
},
|
||||||
header_fav_icon_lit = {
|
header_fav_icon_lit = {
|
||||||
size = { 48, 48, },
|
size = { 48, 48, },
|
||||||
uv00 = { 0.052734, 0.880859, },
|
uv00 = { 0.052734, 0.880859, },
|
||||||
uv11 = { 0.099609, 0.974609, },
|
uv11 = { 0.099609, 0.974609, },
|
||||||
},
|
},
|
||||||
search_bar_icon = {
|
search_bar_icon = {
|
||||||
size = { 48, 48, },
|
size = { 48, 48, },
|
||||||
uv00 = { 0.001953, 0.880859, },
|
uv00 = { 0.001953, 0.880859, },
|
||||||
uv11 = { 0.048828, 0.974609, },
|
uv11 = { 0.048828, 0.974609, },
|
||||||
},
|
},
|
||||||
map_view_party_button = {
|
map_view_party_button = {
|
||||||
size = { 128, 128, },
|
size = { 128, 128, },
|
||||||
uv00 = { 0.130859, 0.623047, },
|
uv00 = { 0.130859, 0.623047, },
|
||||||
uv11 = { 0.255859, 0.873047, },
|
uv11 = { 0.255859, 0.873047, },
|
||||||
},
|
},
|
||||||
map_view_party_button_lit = {
|
map_view_party_button_lit = {
|
||||||
size = { 128, 128, },
|
size = { 128, 128, },
|
||||||
uv00 = { 0.001953, 0.623047, },
|
uv00 = { 0.001953, 0.623047, },
|
||||||
uv11 = { 0.126953, 0.873047, },
|
uv11 = { 0.126953, 0.873047, },
|
||||||
},
|
},
|
||||||
map_view_mutators_area = {
|
map_view_mutators_area = {
|
||||||
size = { 547, 313, },
|
size = { 547, 313, },
|
||||||
uv00 = { 0.001953, 0.003906, },
|
uv00 = { 0.001953, 0.003906, },
|
||||||
uv11 = { 0.536133, 0.615234, },
|
uv11 = { 0.536133, 0.615234, },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
vmf_atlas = {
|
vmf_atlas = {
|
||||||
material_contexts = {
|
material_contexts = {
|
||||||
surface_material = ""
|
surface_material = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
shader = "gui:DIFFUSE_MAP"
|
shader = "gui:DIFFUSE_MAP"
|
||||||
|
|
||||||
textures = {
|
textures = {
|
||||||
diffuse_map = "gui/vmf/vmf_atlas"
|
diffuse_map = "gui/vmf/vmf_atlas"
|
||||||
}
|
}
|
||||||
|
|
||||||
variables = {
|
variables = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vmf_atlas_masked = {
|
vmf_atlas_masked = {
|
||||||
material_contexts = {
|
material_contexts = {
|
||||||
surface_material = ""
|
surface_material = ""
|
||||||
}
|
}
|
||||||
shader = "gui_gradient:DIFFUSE_MAP:MASKED"
|
shader = "gui_gradient:DIFFUSE_MAP:MASKED"
|
||||||
textures = {
|
textures = {
|
||||||
diffuse_map = "gui/vmf/vmf_atlas"
|
diffuse_map = "gui/vmf/vmf_atlas"
|
||||||
}
|
}
|
||||||
variables = {
|
variables = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
mod = [
|
mod = [
|
||||||
"vmf"
|
"vmf"
|
||||||
]
|
]
|
||||||
|
|
||||||
package = [
|
package = [
|
||||||
"resource_packages/vmf"
|
"resource_packages/vmf"
|
||||||
]
|
]
|
||||||
|
|
||||||
material = [
|
material = [
|
||||||
"materials/vmf/*"
|
"materials/vmf/*"
|
||||||
]
|
]
|
||||||
|
|
||||||
lua = [
|
lua = [
|
||||||
|
@ -25,4 +25,4 @@ lua = [
|
||||||
"scripts/mods/vmf/modules/ui/mutators/*"
|
"scripts/mods/vmf/modules/ui/mutators/*"
|
||||||
|
|
||||||
"materials/vmf/vmf_atlas"
|
"materials/vmf/vmf_atlas"
|
||||||
]
|
]
|
||||||
|
|
|
@ -74,4 +74,4 @@ function VMFMod:chat_whisper(peer_id, message)
|
||||||
if chat and chat:has_channel(1) and chat.is_server and peer_id ~= chat.host_peer_id then
|
if chat and chat:has_channel(1) and chat.is_server and peer_id ~= chat.host_peer_id then
|
||||||
send_system_message(peer_id, message)
|
send_system_message(peer_id, message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -158,4 +158,4 @@ function vmf.run_command(command_name, ...)
|
||||||
else
|
else
|
||||||
vmf:error("(commands): command '%s' wasn't found.", command_name) -- Should never see this
|
vmf:error("(commands): command '%s' wasn't found.", command_name) -- Should never see this
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -157,4 +157,4 @@ function vmf.all_mods_loaded_event()
|
||||||
local mod = _mods[mod_name]
|
local mod = _mods[mod_name]
|
||||||
run_event(mod, event_name)
|
run_event(mod, event_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -426,8 +426,8 @@ end
|
||||||
|
|
||||||
vmf.apply_delayed_hooks = function(status, state)
|
vmf.apply_delayed_hooks = function(status, state)
|
||||||
if status == "enter" and state == "StateIngame" then
|
if status == "enter" and state == "StateIngame" then
|
||||||
_delaying_enabled = false
|
_delaying_enabled = false
|
||||||
end
|
end
|
||||||
if #_delayed > 0 then
|
if #_delayed > 0 then
|
||||||
vmf:info("Attempt to hook %s delayed hooks", #_delayed)
|
vmf: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
|
-- Go through the table in reverse so we don't get any issues removing entries inside the loop
|
||||||
|
@ -436,4 +436,4 @@ vmf.apply_delayed_hooks = function(status, state)
|
||||||
table.remove(_delayed, i)
|
table.remove(_delayed, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -379,4 +379,4 @@ end
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
-- In case mods reloading was performed right at the moment of entering 'StateInGame'.
|
-- In case mods reloading was performed right at the moment of entering 'StateInGame'.
|
||||||
vmf.create_keybinds_input_service()
|
vmf.create_keybinds_input_service()
|
||||||
|
|
|
@ -101,4 +101,4 @@ end
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
local localization_table = vmf:dofile("localization/vmf")
|
local localization_table = vmf:dofile("localization/vmf")
|
||||||
vmf.load_mod_localization(vmf, localization_table)
|
vmf.load_mod_localization(vmf, localization_table)
|
||||||
|
|
|
@ -10,13 +10,13 @@ local _logging_settings
|
||||||
local function add_chat_message(message)
|
local function add_chat_message(message)
|
||||||
local chat_manager = Managers.chat
|
local chat_manager = Managers.chat
|
||||||
local new_message = {
|
local new_message = {
|
||||||
channel_id = 1,
|
channel_id = 1,
|
||||||
message_sender = "System",
|
message_sender = "System",
|
||||||
message = message,
|
message = message,
|
||||||
is_system_message = VT1 and true,
|
is_system_message = VT1 and true,
|
||||||
type = not VT1 and Irc.SYSTEM_MSG, -- luacheck: ignore Irc
|
type = not VT1 and Irc.SYSTEM_MSG, -- luacheck: ignore Irc
|
||||||
pop_chat = true,
|
pop_chat = true,
|
||||||
is_dev = false
|
is_dev = false
|
||||||
}
|
}
|
||||||
|
|
||||||
table.insert(chat_manager.chat_messages, new_message)
|
table.insert(chat_manager.chat_messages, new_message)
|
||||||
|
@ -155,4 +155,4 @@ end
|
||||||
-- ##### Script ########################################################################################################
|
-- ##### Script ########################################################################################################
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
vmf.load_logging_settings()
|
vmf.load_logging_settings()
|
||||||
|
|
|
@ -26,4 +26,4 @@ function vmf.check_old_vmf()
|
||||||
error("Unfortunately, workshop mods and old-fashioned mods (VMF-pack or QoL) are incompatible. " ..
|
error("Unfortunately, workshop mods and old-fashioned mods (VMF-pack or QoL) are incompatible. " ..
|
||||||
"Either remove old mods or disable workshop mods.")
|
"Either remove old mods or disable workshop mods.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -104,4 +104,4 @@ end)
|
||||||
-- ##### Return ########################################################################################################
|
-- ##### Return ########################################################################################################
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
return set_lobby_data
|
return set_lobby_data
|
||||||
|
|
|
@ -502,4 +502,4 @@ end)
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
-- Testing
|
-- Testing
|
||||||
--vmf:dofile("scripts/mods/vmf/modules/core/mutators/test/mutators_test")
|
--vmf:dofile("scripts/mods/vmf/modules/core/mutators/test/mutators_test")
|
||||||
|
|
|
@ -12,10 +12,10 @@ mod_data.name = "Legendary"
|
||||||
mod_data.description = "Legendary description"
|
mod_data.description = "Legendary description"
|
||||||
mod_data.is_mutator = true
|
mod_data.is_mutator = true
|
||||||
mod_data.mutator_settings = {
|
mod_data.mutator_settings = {
|
||||||
incompatible_with_all = true,
|
incompatible_with_all = true,
|
||||||
compatible_with = {
|
compatible_with = {
|
||||||
"test_something"
|
"test_something"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vmf.initialize_mod_data(mod, mod_data)
|
vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("Legendary on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("Legendary on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
|
@ -30,10 +30,10 @@ mod_data = {}
|
||||||
mod_data.name = "Something"
|
mod_data.name = "Something"
|
||||||
mod_data.is_mutator = true
|
mod_data.is_mutator = true
|
||||||
mod_data.mutator_settings = {
|
mod_data.mutator_settings = {
|
||||||
incompatible_with = {
|
incompatible_with = {
|
||||||
"test_true_solo",
|
"test_true_solo",
|
||||||
"test_slayer"
|
"test_slayer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vmf.initialize_mod_data(mod, mod_data)
|
vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("Something on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("Something on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
|
@ -48,11 +48,11 @@ mod_data = {}
|
||||||
mod_data.name = "?Deathwish"
|
mod_data.name = "?Deathwish"
|
||||||
mod_data.is_mutator = true
|
mod_data.is_mutator = true
|
||||||
mod_data.mutator_settings = {
|
mod_data.mutator_settings = {
|
||||||
difficulty_levels = {
|
difficulty_levels = {
|
||||||
"hardest",
|
"hardest",
|
||||||
"survival_hardest"
|
"survival_hardest"
|
||||||
},
|
},
|
||||||
title_placement = "after"
|
title_placement = "after"
|
||||||
}
|
}
|
||||||
vmf.initialize_mod_data(mod, mod_data)
|
vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("?Deathwish on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("?Deathwish on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
|
@ -67,11 +67,11 @@ mod_data = {}
|
||||||
mod_data.name = "Slayer's Oath"
|
mod_data.name = "Slayer's Oath"
|
||||||
mod_data.is_mutator = true
|
mod_data.is_mutator = true
|
||||||
mod_data.mutator_settings = {
|
mod_data.mutator_settings = {
|
||||||
difficulty_levels = {
|
difficulty_levels = {
|
||||||
"survival_hard",
|
"survival_hard",
|
||||||
"survival_harder",
|
"survival_harder",
|
||||||
"survival_hardest"
|
"survival_hardest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vmf.initialize_mod_data(mod, mod_data)
|
vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("Slayer's Oath on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("Slayer's Oath on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
|
@ -86,8 +86,8 @@ mod_data = {}
|
||||||
mod_data.name = "True Solo"
|
mod_data.name = "True Solo"
|
||||||
mod_data.is_mutator = true
|
mod_data.is_mutator = true
|
||||||
mod_data.mutator_settings = {
|
mod_data.mutator_settings = {
|
||||||
compatible_with_all = true,
|
compatible_with_all = true,
|
||||||
title_placement = "before"
|
title_placement = "before"
|
||||||
}
|
}
|
||||||
vmf.initialize_mod_data(mod, mod_data)
|
vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("True Solo on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("True Solo on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
|
@ -113,12 +113,12 @@ mod = get_mod("test_one_hit_one_kill")
|
||||||
mod_data = {}
|
mod_data = {}
|
||||||
mod_data.name = "One Hit One Kill"
|
mod_data.name = "One Hit One Kill"
|
||||||
mod_data.description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt placerat" ..
|
mod_data.description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt placerat" ..
|
||||||
" nulla eget pharetra. Vivamus consequat tristique vestibulum. Nullam vitae feugiat arcu," ..
|
" nulla eget pharetra. Vivamus consequat tristique vestibulum. Nullam vitae feugiat arcu," ..
|
||||||
" non porta ante. Phasellus consequat facilisis quam quis dignissim"
|
" non porta ante. Phasellus consequat facilisis quam quis dignissim"
|
||||||
mod_data.is_mutator = true
|
mod_data.is_mutator = true
|
||||||
mod_data.mutator_settings = {
|
mod_data.mutator_settings = {
|
||||||
difficulty_levels = {"hardest"},
|
difficulty_levels = {"hardest"},
|
||||||
enable_after_these = {"test_more_rats_weapons"}
|
enable_after_these = {"test_more_rats_weapons"}
|
||||||
}
|
}
|
||||||
vmf.initialize_mod_data(mod, mod_data)
|
vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("One Hit One Kill on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("One Hit One Kill on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
|
@ -144,11 +144,11 @@ mod_data = {}
|
||||||
mod_data.name = "lmao"
|
mod_data.name = "lmao"
|
||||||
mod_data.is_mutator = true
|
mod_data.is_mutator = true
|
||||||
mod_data.mutator_settings = {
|
mod_data.mutator_settings = {
|
||||||
difficulty_levels = {"hardest"},
|
difficulty_levels = {"hardest"},
|
||||||
enable_after_these = {"ayyyy"},
|
enable_after_these = {"ayyyy"},
|
||||||
dice = {
|
dice = {
|
||||||
bonus = 2
|
bonus = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vmf.initialize_mod_data(mod, mod_data)
|
vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("lmao on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("lmao on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
|
@ -163,8 +163,8 @@ mod_data = {}
|
||||||
mod_data.name = "More Rat Weapons"
|
mod_data.name = "More Rat Weapons"
|
||||||
mod_data.is_mutator = true
|
mod_data.is_mutator = true
|
||||||
mod_data.mutator_settings = {
|
mod_data.mutator_settings = {
|
||||||
compatible_with_all = true,
|
compatible_with_all = true,
|
||||||
difficulty_levels = {"hardest"}
|
difficulty_levels = {"hardest"}
|
||||||
}
|
}
|
||||||
vmf.initialize_mod_data(mod, mod_data)
|
vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("More Rat Weapons on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
|
@ -258,4 +258,4 @@ vmf.initialize_mod_data(mod, mod_data)
|
||||||
mod.on_enabled = function(init_call) mod:echo("888 on_enabled(" .. (init_call and "init)" or ")")) end
|
mod.on_enabled = function(init_call) mod:echo("888 on_enabled(" .. (init_call and "init)" or ")")) end
|
||||||
mod.on_disabled = function(init_call) mod:echo("888 on_disabled(" .. (init_call and "init)" or ")")) end
|
mod.on_disabled = function(init_call) mod:echo("888 on_disabled(" .. (init_call and "init)" or ")")) end
|
||||||
vmf.initialize_mod_state(mod)
|
vmf.initialize_mod_state(mod)
|
||||||
--]]
|
--]]
|
||||||
|
|
|
@ -314,7 +314,7 @@ vmf:hook("ChatManager", "rpc_chat_message",
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
vmf:hook(PlayerManager, "add_remote_player", function (func, self, peer_id, player_controlled, ...)
|
vmf:hook(PlayerManager, "add_remote_player", function (func, self, peer_id, player_controlled, ...)
|
||||||
|
@ -408,4 +408,4 @@ end
|
||||||
-- ##### Script #######################################################################################################
|
-- ##### Script #######################################################################################################
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
vmf.load_network_settings()
|
vmf.load_network_settings()
|
||||||
|
|
|
@ -591,4 +591,4 @@ end
|
||||||
|
|
||||||
if type(vmf:get("options_menu_collapsed_widgets")) ~= "table" then
|
if type(vmf:get("options_menu_collapsed_widgets")) ~= "table" then
|
||||||
vmf:set("options_menu_collapsed_widgets", {})
|
vmf:set("options_menu_collapsed_widgets", {})
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,4 +32,4 @@ function VMFMod:persistent_table(table_name, default_table)
|
||||||
mod_tables[table_name] = mod_tables[table_name] or default_table or {}
|
mod_tables[table_name] = mod_tables[table_name] or default_table or {}
|
||||||
|
|
||||||
return mod_tables[table_name]
|
return mod_tables[table_name]
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,11 +10,11 @@ end
|
||||||
|
|
||||||
|
|
||||||
local function print_error_callstack(error_message)
|
local function print_error_callstack(error_message)
|
||||||
if type(error_message) == "table" and error_message.error then
|
if type(error_message) == "table" and error_message.error then
|
||||||
error_message = error_message.error
|
error_message = error_message.error
|
||||||
end
|
end
|
||||||
print("Error: " .. tostring(error_message) .. "\n" .. Script.callstack())
|
print("Error: " .. tostring(error_message) .. "\n" .. Script.callstack())
|
||||||
return error_message
|
return error_message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ end
|
||||||
|
|
||||||
function VMFMod:dofile(file_path)
|
function VMFMod:dofile(file_path)
|
||||||
local _, return_values = pack_pcall(vmf.safe_call_dofile(self, "(dofile)", file_path))
|
local _, return_values = pack_pcall(vmf.safe_call_dofile(self, "(dofile)", file_path))
|
||||||
return unpack(return_values, 1, return_values.n)
|
return unpack(return_values, 1, return_values.n)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
@ -52,7 +52,7 @@ function vmf.safe_call(mod, error_prefix_data, func, ...)
|
||||||
local success, return_values = pack_pcall(xpcall(func, print_error_callstack, ...))
|
local success, return_values = pack_pcall(xpcall(func, print_error_callstack, ...))
|
||||||
if not success then
|
if not success then
|
||||||
show_error(mod, error_prefix_data, return_values[1])
|
show_error(mod, error_prefix_data, return_values[1])
|
||||||
return success
|
return success
|
||||||
end
|
end
|
||||||
return success, unpack(return_values, 1, return_values.n)
|
return success, unpack(return_values, 1, return_values.n)
|
||||||
end
|
end
|
||||||
|
@ -80,10 +80,10 @@ end
|
||||||
|
|
||||||
-- Safe Call [dofile]
|
-- Safe Call [dofile]
|
||||||
function vmf.safe_call_dofile(mod, error_prefix_data, file_path)
|
function vmf.safe_call_dofile(mod, error_prefix_data, file_path)
|
||||||
if type(file_path) ~= "string" then
|
if type(file_path) ~= "string" then
|
||||||
show_error(mod, error_prefix_data, "file path should be a string.")
|
show_error(mod, error_prefix_data, "file path should be a string.")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return vmf.safe_call(mod, error_prefix_data, dofile, file_path)
|
return vmf.safe_call(mod, error_prefix_data, dofile, file_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -91,4 +91,4 @@ end
|
||||||
-- Format error message and throw error.
|
-- Format error message and throw error.
|
||||||
function vmf.throw_error(error_message, ...)
|
function vmf.throw_error(error_message, ...)
|
||||||
error(string.format(error_message, ...), 0)
|
error(string.format(error_message, ...), 0)
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,4 +86,4 @@ function vmf.mod_has_settings(mod)
|
||||||
if _mods_settings[mod:get_name()] then
|
if _mods_settings[mod:get_name()] then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -59,4 +59,4 @@ vmf.mod_state_changed = function (mod_name, is_enabled)
|
||||||
else
|
else
|
||||||
vmf.set_mod_state(mod, is_enabled, false)
|
vmf.set_mod_state(mod, is_enabled, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -98,4 +98,4 @@ end
|
||||||
-- ##### Script #######################################################################################################
|
-- ##### Script #######################################################################################################
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
vmf.load_dev_console_settings()
|
vmf.load_dev_console_settings()
|
||||||
|
|
|
@ -355,4 +355,4 @@ end
|
||||||
|
|
||||||
VMFMod.dtf = VMFMod.dump_to_file
|
VMFMod.dtf = VMFMod.dump_to_file
|
||||||
|
|
||||||
-- Managers.curl._requests crashes the game
|
-- Managers.curl._requests crashes the game
|
||||||
|
|
|
@ -292,4 +292,4 @@ end
|
||||||
-- ##### Script #######################################################################################################
|
-- ##### Script #######################################################################################################
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
vmf.load_custom_textures_settings()
|
vmf.load_custom_textures_settings()
|
||||||
|
|
|
@ -406,4 +406,4 @@ else
|
||||||
end
|
end
|
||||||
if ingame_ui_exists then
|
if ingame_ui_exists then
|
||||||
_ingame_ui = ingame_ui_return
|
_ingame_ui = ingame_ui_return
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,4 +43,4 @@ end
|
||||||
-- ##### Script #######################################################################################################
|
-- ##### Script #######################################################################################################
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
|
||||||
vmf.load_ui_scaling_settings()
|
vmf.load_ui_scaling_settings()
|
||||||
|
|
|
@ -168,4 +168,4 @@ vmf.initialize_mod_options_legacy = function (mod, widgets_definition)
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(vmf.options_widgets_data, mod_settings_list_widgets_definitions)
|
table.insert(vmf.options_widgets_data, mod_settings_list_widgets_definitions)
|
||||||
end
|
end
|
||||||
|
|
|
@ -184,10 +184,10 @@ vmf:hook("ChatGui", "_update_input", function(func, self, input_service, menu_in
|
||||||
-- ctrl + v
|
-- ctrl + v
|
||||||
if Keyboard.pressed(Keyboard.button_index("v")) and Keyboard.button(Keyboard.button_index("left ctrl")) == 1 then
|
if Keyboard.pressed(Keyboard.button_index("v")) and Keyboard.button(Keyboard.button_index("left ctrl")) == 1 then
|
||||||
local new_chat_message = self.chat_message
|
local new_chat_message = self.chat_message
|
||||||
|
|
||||||
-- remove carriage returns
|
-- remove carriage returns
|
||||||
local clipboard_data = tostring(Clipboard.get()):gsub("\r", "")
|
local clipboard_data = tostring(Clipboard.get()):gsub("\r", "")
|
||||||
|
|
||||||
-- remove invalid characters
|
-- remove invalid characters
|
||||||
if Utf8.valid(clipboard_data) then
|
if Utf8.valid(clipboard_data) then
|
||||||
new_chat_message = new_chat_message .. clipboard_data
|
new_chat_message = new_chat_message .. clipboard_data
|
||||||
|
@ -200,7 +200,7 @@ vmf:hook("ChatGui", "_update_input", function(func, self, input_service, menu_in
|
||||||
end)
|
end)
|
||||||
new_chat_message = new_chat_message .. valid_data
|
new_chat_message = new_chat_message .. valid_data
|
||||||
end
|
end
|
||||||
|
|
||||||
set_chat_message(self, new_chat_message)
|
set_chat_message(self, new_chat_message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -315,4 +315,4 @@ 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
|
||||||
initialize_drawing_function()
|
initialize_drawing_function()
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,16 +37,16 @@ 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
|
||||||
|
|
||||||
local function word_wrap(text, font_material, font_size, max_width)
|
local function word_wrap(text, font_material, font_size, max_width)
|
||||||
local whitespace = " "
|
local whitespace = " "
|
||||||
local soft_dividers = "-+&/*"
|
local soft_dividers = "-+&/*"
|
||||||
local return_dividers = "\n"
|
local return_dividers = "\n"
|
||||||
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,
|
return Gui.word_wrap(_gui, text, font_material, font_size, max_width * scale, whitespace,
|
||||||
|
@ -168,4 +168,4 @@ local function draw(commands_list, selected_command_index)
|
||||||
--end)
|
--end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return draw
|
return draw
|
||||||
|
|
|
@ -421,4 +421,4 @@ function vmf.reset_map_view()
|
||||||
change_map_view_look(map_view, false)
|
change_map_view_look(map_view, false)
|
||||||
show_mutator_list(map_view, false)
|
show_mutator_list(map_view, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -323,4 +323,4 @@ return {
|
||||||
party_button_widget_defenition = party_button_widget_defenition,
|
party_button_widget_defenition = party_button_widget_defenition,
|
||||||
no_mutators_text_widget = no_mutators_text_widget,
|
no_mutators_text_widget = no_mutators_text_widget,
|
||||||
create_mutator_widget = create_mutator_widget
|
create_mutator_widget = create_mutator_widget
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,4 +123,4 @@ end
|
||||||
|
|
||||||
vmf.disable_mods_options_button = function ()
|
vmf.disable_mods_options_button = function ()
|
||||||
_button_injection_data.mod_options_button_disabled = true
|
_button_injection_data.mod_options_button_disabled = true
|
||||||
end
|
end
|
||||||
|
|
|
@ -2755,11 +2755,11 @@ local _SCROLL_STEP
|
||||||
|
|
||||||
-- copypasted 'math.point_is_inside_2d_box' from VT2 source code, since VT1 and VT2 have different implementations
|
-- copypasted 'math.point_is_inside_2d_box' from VT2 source code, since VT1 and VT2 have different implementations
|
||||||
local function is_point_inside_2d_box(pos, lower_left_corner, size)
|
local function is_point_inside_2d_box(pos, lower_left_corner, size)
|
||||||
if lower_left_corner[1] < pos[1] and pos[1] < lower_left_corner[1] + size[1] and lower_left_corner[2] < pos[2] and pos[2] < lower_left_corner[2] + size[2] then
|
if lower_left_corner[1] < pos[1] and pos[1] < lower_left_corner[1] + size[1] and lower_left_corner[2] < pos[2] and pos[2] < lower_left_corner[2] + size[2] then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ####################################################################################################################
|
-- ####################################################################################################################
|
||||||
|
@ -4288,9 +4288,9 @@ return {
|
||||||
ingame = true
|
ingame = true
|
||||||
},
|
},
|
||||||
keybind_transitions = {
|
keybind_transitions = {
|
||||||
open_view_transition = "vmf_options_view",
|
open_view_transition = "vmf_options_view",
|
||||||
close_view_transition = "exit_menu",
|
close_view_transition = "exit_menu",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
view_transitions = {
|
view_transitions = {
|
||||||
vmf_options_view = function (self)
|
vmf_options_view = function (self)
|
||||||
|
@ -4298,4 +4298,4 @@ return {
|
||||||
self.menu_active = true
|
self.menu_active = true
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,4 +69,4 @@ function VMFMod:get_description()
|
||||||
end
|
end
|
||||||
function VMFMod:is_enabled()
|
function VMFMod:is_enabled()
|
||||||
return self._data.is_enabled
|
return self._data.is_enabled
|
||||||
end
|
end
|
||||||
|
|
|
@ -243,4 +243,4 @@ if not vmf:get("vmf_initialized") then
|
||||||
--vmf.load_vmf_options_view_settings()
|
--vmf.load_vmf_options_view_settings()
|
||||||
|
|
||||||
vmf:set("vmf_initialized", true)
|
vmf:set("vmf_initialized", true)
|
||||||
end
|
end
|
||||||
|
|
|
@ -182,4 +182,4 @@ function vmf.unload_all_resource_packages()
|
||||||
_loading_package.mod:unload_package(package_name)
|
_loading_package.mod:unload_package(package_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,44 +11,44 @@ local vmf_mod_object = {}
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
function vmf_mod_object:init()
|
function vmf_mod_object:init()
|
||||||
dofile("scripts/mods/vmf/modules/vmf_mod_data")
|
dofile("scripts/mods/vmf/modules/vmf_mod_data")
|
||||||
dofile("scripts/mods/vmf/modules/vmf_mod_manager")
|
dofile("scripts/mods/vmf/modules/vmf_mod_manager")
|
||||||
dofile("scripts/mods/vmf/modules/vmf_package_manager")
|
dofile("scripts/mods/vmf/modules/vmf_package_manager")
|
||||||
dofile("scripts/mods/vmf/modules/core/safe_calls")
|
dofile("scripts/mods/vmf/modules/core/safe_calls")
|
||||||
dofile("scripts/mods/vmf/modules/core/events")
|
dofile("scripts/mods/vmf/modules/core/events")
|
||||||
dofile("scripts/mods/vmf/modules/core/settings")
|
dofile("scripts/mods/vmf/modules/core/settings")
|
||||||
dofile("scripts/mods/vmf/modules/core/logging")
|
dofile("scripts/mods/vmf/modules/core/logging")
|
||||||
dofile("scripts/mods/vmf/modules/core/misc")
|
dofile("scripts/mods/vmf/modules/core/misc")
|
||||||
dofile("scripts/mods/vmf/modules/core/persistent_tables")
|
dofile("scripts/mods/vmf/modules/core/persistent_tables")
|
||||||
dofile("scripts/mods/vmf/modules/debug/dev_console")
|
dofile("scripts/mods/vmf/modules/debug/dev_console")
|
||||||
dofile("scripts/mods/vmf/modules/debug/table_dump")
|
dofile("scripts/mods/vmf/modules/debug/table_dump")
|
||||||
dofile("scripts/mods/vmf/modules/core/hooks")
|
dofile("scripts/mods/vmf/modules/core/hooks")
|
||||||
dofile("scripts/mods/vmf/modules/core/toggling")
|
dofile("scripts/mods/vmf/modules/core/toggling")
|
||||||
dofile("scripts/mods/vmf/modules/core/keybindings")
|
dofile("scripts/mods/vmf/modules/core/keybindings")
|
||||||
dofile("scripts/mods/vmf/modules/core/chat")
|
dofile("scripts/mods/vmf/modules/core/chat")
|
||||||
dofile("scripts/mods/vmf/modules/core/localization")
|
dofile("scripts/mods/vmf/modules/core/localization")
|
||||||
dofile("scripts/mods/vmf/modules/core/options")
|
dofile("scripts/mods/vmf/modules/core/options")
|
||||||
dofile("scripts/mods/vmf/modules/legacy/options")
|
dofile("scripts/mods/vmf/modules/legacy/options")
|
||||||
dofile("scripts/mods/vmf/modules/core/network")
|
dofile("scripts/mods/vmf/modules/core/network")
|
||||||
dofile("scripts/mods/vmf/modules/core/commands")
|
dofile("scripts/mods/vmf/modules/core/commands")
|
||||||
dofile("scripts/mods/vmf/modules/gui/custom_textures")
|
dofile("scripts/mods/vmf/modules/gui/custom_textures")
|
||||||
dofile("scripts/mods/vmf/modules/gui/custom_views")
|
dofile("scripts/mods/vmf/modules/gui/custom_views")
|
||||||
dofile("scripts/mods/vmf/modules/gui/ui_scaling")
|
dofile("scripts/mods/vmf/modules/gui/ui_scaling")
|
||||||
dofile("scripts/mods/vmf/modules/ui/chat/chat_actions")
|
dofile("scripts/mods/vmf/modules/ui/chat/chat_actions")
|
||||||
dofile("scripts/mods/vmf/modules/ui/options/mod_options")
|
dofile("scripts/mods/vmf/modules/ui/options/mod_options")
|
||||||
dofile("scripts/mods/vmf/modules/vmf_options")
|
dofile("scripts/mods/vmf/modules/vmf_options")
|
||||||
|
|
||||||
if VT1 then
|
if VT1 then
|
||||||
dofile("scripts/mods/vmf/modules/core/mutators/mutators_manager")
|
dofile("scripts/mods/vmf/modules/core/mutators/mutators_manager")
|
||||||
dofile("scripts/mods/vmf/modules/ui/mutators/mutators_gui")
|
dofile("scripts/mods/vmf/modules/ui/mutators/mutators_gui")
|
||||||
end
|
end
|
||||||
|
|
||||||
vmf = get_mod("VMF")
|
vmf = get_mod("VMF")
|
||||||
vmf.delayed_chat_messages_hook()
|
vmf.delayed_chat_messages_hook()
|
||||||
vmf:hook(ModManager, "destroy", function(func, ...)
|
vmf:hook(ModManager, "destroy", function(func, ...)
|
||||||
vmf.mods_unload_event(true)
|
vmf.mods_unload_event(true)
|
||||||
func(...)
|
func(...)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
@ -56,62 +56,62 @@ end
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
function vmf_mod_object:update(dt)
|
function vmf_mod_object:update(dt)
|
||||||
vmf.update_package_manager()
|
vmf.update_package_manager()
|
||||||
vmf.mods_update_event(dt)
|
vmf.mods_update_event(dt)
|
||||||
vmf.check_keybinds()
|
vmf.check_keybinds()
|
||||||
vmf.execute_queued_chat_command()
|
vmf.execute_queued_chat_command()
|
||||||
if VT1 then vmf.check_mutators_state() end
|
if VT1 then vmf.check_mutators_state() end
|
||||||
|
|
||||||
if not vmf.all_mods_were_loaded and Managers.mod._state == "done" then
|
if not vmf.all_mods_were_loaded and Managers.mod._state == "done" then
|
||||||
|
|
||||||
vmf.generate_keybinds()
|
vmf.generate_keybinds()
|
||||||
vmf.initialize_vmf_options_view()
|
vmf.initialize_vmf_options_view()
|
||||||
vmf.create_network_dictionary()
|
vmf.create_network_dictionary()
|
||||||
vmf.ping_vmf_users()
|
vmf.ping_vmf_users()
|
||||||
|
|
||||||
if VT1 then vmf.modify_map_view() end
|
if VT1 then vmf.modify_map_view() end
|
||||||
if VT1 then vmf.mutators_delete_raw_config() end
|
if VT1 then vmf.mutators_delete_raw_config() end
|
||||||
|
|
||||||
vmf.all_mods_loaded_event()
|
vmf.all_mods_loaded_event()
|
||||||
|
|
||||||
vmf.all_mods_were_loaded = true
|
vmf.all_mods_were_loaded = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function vmf_mod_object:on_unload()
|
function vmf_mod_object:on_unload()
|
||||||
print("VMF:ON_UNLOAD()")
|
print("VMF:ON_UNLOAD()")
|
||||||
vmf.save_chat_history()
|
vmf.save_chat_history()
|
||||||
vmf.save_unsaved_settings_to_file()
|
vmf.save_unsaved_settings_to_file()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function vmf_mod_object:on_reload()
|
function vmf_mod_object:on_reload()
|
||||||
print("VMF:ON_RELOAD()")
|
print("VMF:ON_RELOAD()")
|
||||||
vmf.disable_mods_options_button()
|
vmf.disable_mods_options_button()
|
||||||
if VT1 then vmf.reset_map_view() end
|
if VT1 then vmf.reset_map_view() end
|
||||||
vmf.mods_unload_event(false)
|
vmf.mods_unload_event(false)
|
||||||
vmf.remove_custom_views()
|
vmf.remove_custom_views()
|
||||||
vmf.unload_all_resource_packages()
|
vmf.unload_all_resource_packages()
|
||||||
vmf.hooks_unload()
|
vmf.hooks_unload()
|
||||||
vmf.reset_guis()
|
vmf.reset_guis()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function vmf_mod_object:on_game_state_changed(status, state)
|
function vmf_mod_object:on_game_state_changed(status, state)
|
||||||
print("VMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state))
|
print("VMF:ON_GAME_STATE_CHANGED(), status: " .. tostring(status) .. ", state: " .. tostring(state))
|
||||||
if VT1 then vmf.check_old_vmf() end
|
if VT1 then vmf.check_old_vmf() end
|
||||||
vmf.mods_game_state_changed_event(status, state)
|
vmf.mods_game_state_changed_event(status, state)
|
||||||
vmf.save_unsaved_settings_to_file()
|
vmf.save_unsaved_settings_to_file()
|
||||||
vmf.apply_delayed_hooks(status, state)
|
vmf.apply_delayed_hooks(status, state)
|
||||||
|
|
||||||
if status == "enter" and state == "StateIngame" then
|
if status == "enter" and state == "StateIngame" then
|
||||||
vmf.create_keybinds_input_service()
|
vmf.create_keybinds_input_service()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
-- ##### Return ########################################################################################################
|
-- ##### Return ########################################################################################################
|
||||||
-- #####################################################################################################################
|
-- #####################################################################################################################
|
||||||
|
|
||||||
return vmf_mod_object
|
return vmf_mod_object
|
||||||
|
|
12
vmf/vmf.mod
12
vmf/vmf.mod
|
@ -1,9 +1,9 @@
|
||||||
local ret = {
|
local ret = {
|
||||||
run = function()
|
run = function()
|
||||||
return dofile("scripts/mods/vmf/vmf_loader")
|
return dofile("scripts/mods/vmf/vmf_loader")
|
||||||
end,
|
end,
|
||||||
packages = {
|
packages = {
|
||||||
"resource_packages/vmf"
|
"resource_packages/vmf"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
Loading…
Add table
Add a link
Reference in a new issue