Minor fix (#422)

* Re-enable disable_useless_things.lua

* Minor localization changes (sync with H2)

* Update language.lua & stats/init.lua

* Fix for HUD ammo zeros
* Language: Reorganizing items on menu
* Stats: Fix localized headers
This commit is contained in:
Vlad 2022-12-22 17:51:33 +03:00 committed by GitHub
parent 09bba63918
commit 917dd80625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 52 additions and 40 deletions

View File

@ -1,16 +1,17 @@
require("language") require("language")
require("background_effects") require("background_effects")
if (game:issingleplayer()) then if game:issingleplayer() then
require("sp_unlockall") require("sp_unlockall")
return return
end end
if (Engine.InFrontend()) then require("disable_useless_things")
if Engine.InFrontend() then
require("shader_dialog") require("shader_dialog")
require("gamemodes") require("gamemodes")
require("no_mode_switch") require("no_mode_switch")
require("disable_useless_things")
else else
require("scoreboard") require("scoreboard")
end end

View File

@ -1,12 +1,14 @@
-- Disable CP if Engine.InFrontend() then
Engine.SetDvarInt("ui_enable_cp", 0) -- Disable CP
Engine.SetDvarInt("ui_enable_cp", 0)
-- Disable CP store -- Disable CP store
Engine.SetDvarInt("ui_show_store", 0) Engine.SetDvarInt("ui_show_store", 0)
-- Remove CoD account button -- Remove CoD account button
if Engine.IsMultiplayer() and CoD.IsCoDAccountRegistrationAvailableInMyRegion() then if Engine.IsMultiplayer() and CoD.IsCoDAccountRegistrationAvailableInMyRegion() then
LUI.removemenubutton("pc_controls", 4) LUI.removemenubutton("pc_controls", 4)
end
end end
-- Remove social button -- Remove social button

View File

@ -30,8 +30,8 @@ end
LUI.addmenubutton("pc_controls", { LUI.addmenubutton("pc_controls", {
index = 4, index = 4,
text = "@MENU_LANGUAGE", text = "LUA_MENU_CHOOSE_LANGUAGE",
description = Engine.Localize("@LUA_MENU_CHOOSE_LANGUAGE"), description = Engine.Localize("LUA_MENU_CHOOSE_LANGUAGE_DESC"),
callback = function() callback = function()
LUI.FlowManager.RequestAddMenu(nil, "choose_language_menu") LUI.FlowManager.RequestAddMenu(nil, "choose_language_menu")
end end
@ -39,33 +39,11 @@ LUI.addmenubutton("pc_controls", {
LUI.MenuBuilder.registerType("choose_language_menu", function(a1) LUI.MenuBuilder.registerType("choose_language_menu", function(a1)
local menu = LUI.MenuTemplate.new(a1, { local menu = LUI.MenuTemplate.new(a1, {
menu_title = "@LUA_MENU_CHOOSE_LANGUAGE", menu_title = "LUA_MENU_CHOOSE_LANGUAGE",
menu_list_divider_top_offset = -(LUI.H1MenuTab.tabChangeHoldingElementHeight + H1MenuDims.spacing), menu_list_divider_top_offset = -(LUI.H1MenuTab.tabChangeHoldingElementHeight + H1MenuDims.spacing),
uppercase_title = true uppercase_title = true
}) })
function createdivider(menu, text)
local element = LUI.UIElement.new({
leftAnchor = true,
rightAnchor = false,
left = 10,
right = 0,
topAnchor = true,
bottomAnchor = false,
top = 0,
bottom = 33.33
})
element.scrollingToNext = true
element:addElement(LUI.MenuBuilder.BuildRegisteredType("h1_option_menu_titlebar", {
title_bar_text = text
}))
menu.list:addElement(element)
end
createdivider(menu, "^2" .. Engine.Localize("@LUA_MENU_DOWNLOAD") .. ": ^7https://docs.h1.gg/languages")
for i = 1, #available_languages do for i = 1, #available_languages do
if does_zone_folder_exists(available_languages[i]) then if does_zone_folder_exists(available_languages[i]) then
menu:AddButton(Engine.Localize(string.format("MENU_%s", available_languages[i])), function() menu:AddButton(Engine.Localize(string.format("MENU_%s", available_languages[i])), function()
@ -95,7 +73,33 @@ LUI.MenuBuilder.registerType("choose_language_menu", function(a1)
}) })
LUI.Options.AddOptionTextInfo(menu) LUI.Options.AddOptionTextInfo(menu)
menu:AddHelp({
name = "add_button_helper_text",
button_ref = "",
helper_text = "^2" .. Engine.Localize("@LUA_MENU_DOWNLOAD") .. ": ^7https://docs.h1.gg/languages",
side = "left",
priority = -9001,
clickable = false
})
menu:AddBackButton() menu:AddBackButton()
return menu return menu
end) end)
-- fix for ammo zeros
if not Engine.InFrontend() then
local weaponinfodef = LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"]
LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"] = function(...)
Engine.GetCurrentLanguage = function()
return 0
end
local res = weaponinfodef(...)
Engine.GetCurrentLanguage = function()
lang = Engine.GetDvarString("loc_language")
return lang
end
return res
end
end

View File

@ -36,7 +36,7 @@ LUI.MenuBuilder.registerType("stats_menu", function(a1)
menu_width = luiglobals.GenericMenuDims.OptionMenuWidth menu_width = luiglobals.GenericMenuDims.OptionMenuWidth
}) })
createdivider(menu, "@LUA_MENU_SETTINGS") createdivider(menu, "LUA_MENU_SETTINGS")
LUI.Options.CreateOptionButton(menu, "cg_unlockall_items", "@LUA_MENU_UNLOCKALL_ITEMS", LUI.Options.CreateOptionButton(menu, "cg_unlockall_items", "@LUA_MENU_UNLOCKALL_ITEMS",
"@LUA_MENU_UNLOCKALL_ITEMS_DESC", {{ "@LUA_MENU_UNLOCKALL_ITEMS_DESC", {{
@ -65,7 +65,7 @@ LUI.MenuBuilder.registerType("stats_menu", function(a1)
value = false value = false
}}, nil, nil) }}, nil, nil)
createdivider(menu, "@LUA_MENU_EDIT_STATS") createdivider(menu, "LUA_MENU_EDIT_STATS")
local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0 local prestige = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "prestige") or 0
local experience = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "experience") or 0 local experience = Engine.GetPlayerData(0, CoD.StatsGroup.Ranked, "experience") or 0

View File

@ -1,6 +1,6 @@
{ {
"LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Unlock All Missions and Intel", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Unlock All Missions and Intel",
"LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancel Unlock All Missions", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancel Unlock All Missions",
"LUA_MENU_CHOOSE_LANGUAGE": "Choose your language", "LUA_MENU_CHOOSE_LANGUAGE_DESC": "Choose your language.",
"MENU_APPLY_LANGUAGE_SETTINGS": "Apply language settings?" "MENU_APPLY_LANGUAGE_SETTINGS": "Apply language settings?"
} }

View File

@ -1,6 +1,6 @@
{ {
"LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Unlock All Missions and Intel", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Unlock All Missions and Intel",
"LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancel Unlock All Missions", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancel Unlock All Missions",
"LUA_MENU_CHOOSE_LANGUAGE": "Choose your language", "LUA_MENU_CHOOSE_LANGUAGE_DESC": "Choose your language.",
"MENU_APPLY_LANGUAGE_SETTINGS": "Apply language settings?" "MENU_APPLY_LANGUAGE_SETTINGS": "Apply language settings?"
} }

View File

@ -46,5 +46,6 @@
"LOCALE_SPANISH": "Espagnol", "LOCALE_SPANISH": "Espagnol",
"LOCALE_TRADITIONAL_CHINESE": "Chinois traditionnel", "LOCALE_TRADITIONAL_CHINESE": "Chinois traditionnel",
"LUA_MENU_CHOOSE_LANGUAGE": "Choisissez la langue" "LUA_MENU_CHOOSE_LANGUAGE": "Choisissez la langue",
"LUA_MENU_CHOOSE_LANGUAGE_DESC": "Choisissez la langue."
} }

View File

@ -8,6 +8,8 @@
"LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Открыть все задания и чит-коды", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Открыть все задания и чит-коды",
"LUA_MENU_CANCEL_UNLOCK_CAPS": "Вернуться к своему прогрессу прохождения", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Вернуться к своему прогрессу прохождения",
"LUA_MENU_CHOOSE_LANGUAGE": "Выбор языка",
"LUA_MENU_CHOOSE_LANGUAGE_DESC": "Поменять язык интерфейса и озвучки.",
"MENU_MODS": "МОДЫ", "MENU_MODS": "МОДЫ",
"MENU_MODS_DESC": "Запуск установленных модов.", "MENU_MODS_DESC": "Запуск установленных модов.",

View File

@ -30,6 +30,8 @@
"LUA_MENU_SETTINGS": "Параметры", "LUA_MENU_SETTINGS": "Параметры",
"LUA_MENU_EDIT_STATS": "Корректировка статистики", "LUA_MENU_EDIT_STATS": "Корректировка статистики",
"LUA_MENU_3RD_PARTY_CONTENT_DESC": "Согласны загрузить сторонний контент, необходимый для игры на этом сервере? (&&1)",
"LUA_MENU_MULTIPLAYER_CAPS": "H1-MOD: СЕТЕВАЯ ИГРА\n", "LUA_MENU_MULTIPLAYER_CAPS": "H1-MOD: СЕТЕВАЯ ИГРА\n",
"MENU_MULTIPLAYER_CAPS": "H1-MOD: СЕТЕВАЯ ИГРА", "MENU_MULTIPLAYER_CAPS": "H1-MOD: СЕТЕВАЯ ИГРА",