diff --git a/mods/lord/Game/lord_forms/init.lua b/mods/lord/Game/lord_forms/init.lua index e3fff41f7..bdd5f8505 100644 --- a/mods/lord/Game/lord_forms/init.lua +++ b/mods/lord/Game/lord_forms/init.lua @@ -1,6 +1,7 @@ minetest.mod(function(mod) + local spec = minetest.formspec default.gui_bg = 'bgcolor[#080808BB;true]' default.gui_bg_img = 'background9[5,5;1,1;gui_formbg.png;true;10]' @@ -10,14 +11,13 @@ minetest.mod(function(mod) default.gui_bg .. default.gui_bg_img .. default.gui_slots .. - 'style_type[button;' .. - 'bgimg=button_bg.png;' .. - 'bgimg_middle=4;' .. - 'font=bold;' .. - 'textcolor=#fffb;' .. - 'padding=0' .. - ']' .. - '' + spec.style_type('button', { + bgimg = 'button_bg.png', + bgimg_middle = 4, + font = 'bold', + textcolor = '#fffc', + padding = '0', + }) minetest.register_on_joinplayer(function(player) diff --git a/mods/lord/Player/lord_inventory/locale/lord_inventory.en.tr b/mods/lord/Player/lord_inventory/locale/lord_inventory.en.tr index b74dfa65d..e7e3906b7 100644 --- a/mods/lord/Player/lord_inventory/locale/lord_inventory.en.tr +++ b/mods/lord/Player/lord_inventory/locale/lord_inventory.en.tr @@ -3,6 +3,7 @@ # Tabs: Main=Main Bags=Bags +About=About # Main Tab: @@ -11,3 +12,8 @@ crafting_image=lord_inventory_crafting.en.png # Bags Tab: All Bags=All Bags Bag=Bag + +# About Tab: +About.btn=About +Rules.btn=Rules +# TODO #1709 diff --git a/mods/lord/Player/lord_inventory/locale/lord_inventory.ru.tr b/mods/lord/Player/lord_inventory/locale/lord_inventory.ru.tr index 13b7c0684..9ee7a5e9a 100644 --- a/mods/lord/Player/lord_inventory/locale/lord_inventory.ru.tr +++ b/mods/lord/Player/lord_inventory/locale/lord_inventory.ru.tr @@ -3,6 +3,7 @@ # Tabs: Main=Основное Bags=Сумки +About=О сервере # Main Tab: @@ -11,3 +12,8 @@ crafting_image=lord_inventory_crafting.ru.png # Bags Tab: All Bags=Все Сумки Bag=Сумка + +# About Tab: +About.btn=О сервере +Rules.btn=Правила +# TODO #1709 diff --git a/mods/lord/Player/lord_inventory/locale/template.txt b/mods/lord/Player/lord_inventory/locale/template.txt index fc550659c..9a9ea661b 100644 --- a/mods/lord/Player/lord_inventory/locale/template.txt +++ b/mods/lord/Player/lord_inventory/locale/template.txt @@ -1,6 +1,18 @@ # textdomain: lord_inventory -Back= -Bag= +# Tabs: Main= Bags= + + +# Main Tab: +crafting_image= + +# Bags Tab: +All Bags= +Bag= + +# About Tab: +About.btn= +Rules.btn= +# TODO #1709 diff --git a/mods/lord/Player/lord_inventory/src/inventory/Form.lua b/mods/lord/Player/lord_inventory/src/inventory/Form.lua index b850da390..61087a118 100644 --- a/mods/lord/Player/lord_inventory/src/inventory/Form.lua +++ b/mods/lord/Player/lord_inventory/src/inventory/Form.lua @@ -1,6 +1,6 @@ local MainTab = require('inventory.Form.MainTab') local BagsTab = require('inventory.Form.BagsTab') ---local AboutTab = require('inventory.Form.AboutTab') TODO #1701 +local AboutTab = require('inventory.Form.AboutTab') --- @class inventory.Form: base_classes.Form.Mixin.WithTabs @@ -43,7 +43,7 @@ function Form:instantiate(player) self :add_tab(MainTab:new(self)) :add_tab(BagsTab:new(self)) - --:add_tab(AboutTab:new(self)) + :add_tab(AboutTab:new(self)) :refresh() end diff --git a/mods/lord/Player/lord_inventory/src/inventory/Form/AboutTab.lua b/mods/lord/Player/lord_inventory/src/inventory/Form/AboutTab.lua index a44b46bcc..4c6518b59 100644 --- a/mods/lord/Player/lord_inventory/src/inventory/Form/AboutTab.lua +++ b/mods/lord/Player/lord_inventory/src/inventory/Form/AboutTab.lua @@ -1,4 +1,46 @@ -local S = minetest.get_translator('lord_inventory') +local S = minetest.get_translator('lord_inventory') +local spec = minetest.formspec + + +-- TODO #1709 + +--- @alias lord_inventory.Form.AboutTab.resource { name:string, title:string, url:string } + +--- @type lord_inventory.Form.AboutTab.resource[] +local resources = { + { name = 'site' , title = 'Website', url = 'https://lord-server.ru/' }, + { name = 'discord', title = 'Discord', url = 'https://www.discord.gg/YcT5FuQwUT' }, + { name = 'youtube', title = 'YouTube', url = 'https://www.youtube.com/@lord-server' }, + { name = 'vk' , title = 'group ', url = 'https://vk.com/minetest_lord' }, + { name = 'github' , title = 'GitHub ', url = 'https://github.com/lord-server/lord' }, +} +--- @type { title:string, sub_title:string, sub_title_dx:number, desc:string }[] +local descriptions = { + site = { + title = 'Наш сайт', + sub_title = 'Карта мира', sub_title_dx = 1.06, + desc = 'Информация об Игроках, Спаунах и Кланах', + }, + discord = { + title = 'Наш Discord', + sub_title = 'Болтаем и дружим', sub_title_dx = 1.38, + desc = 'Выкладываем новости, договариваемся об Ивентах', + }, + youtube = { + title = 'Наш YouTube', + sub_title = 'Видео и стримы', sub_title_dx = 1.51, + desc = 'Записи Ивентов, Let\'s play-ев, Строительства', + }, + vk = { + title = 'Страница ВКонтакте', + desc = 'Новости и заметки о жизни сервера', + }, + github = { + title = 'Репозиторий', + sub_title = 'Open source', sub_title_dx = 1.48, + desc = 'Сообщи об ошибке. Присоединяйся к команде', + }, +} --- @class inventory.Form.AboutTab: base_classes.Form.Element.Tab @@ -6,9 +48,95 @@ local AboutTab = base_classes.Form.Element.Tab:extended({ title = S('About'), }) +--- @param x number +--- @param y number +--- @param name string +--- @param title string +local function icon_button(x, y, name, title, url) + return '' + .. spec.button_url(x, y, 2, 1, name, title, url) + .. spec.image(x+.2, y+.24, 0.4, 0.4, 'lord_inventory_icon_'..name..'.png') +end + +--- @param x number +--- @param y number +--- @param text string +--- @param font_size string see minetest.FormSpec.Style.font_size . Default: `"+7"` +local function title(x, y, text, font_size) + font_size = font_size or '+7' + + return '' + .. spec.style_type('label', { font = 'bold', font_size = font_size }) + .. spec.label(x, y, text) + .. spec.style_type('label', { font = 'normal', font_size = '+0' }) +end + +--- @param x number +--- @param y number +--- @param text string +local function slogan(x, y, text) + return '' + .. spec.style_type('label', { font = 'italic', textcolor = '#ccc' }) + .. spec.label(x, y, text) + .. spec.style_type('label', { font = 'normal', textcolor = '#fff' }) +end + +--- @param x number +--- @param y number +--- @param res lord_inventory.Form.AboutTab.resource +local function resource(x, y, res) + local description = descriptions[res.name] + local sdx = description.sub_title_dx + + return '' + .. spec.style_type('label', { font = 'bold', textcolor = '#fffe' }) + .. spec.label(x, y + .08, description.title) + .. (description.sub_title and ( + spec.style_type('label', { font = 'bold', textcolor = '#d4d4d4', font_size = '-1' }) .. + spec.label(x + sdx, y + .07, '(' .. description.sub_title .. ')') + ) or '') + .. spec.style_type('label', { font = 'normal', textcolor = '#ddd', font_size = '-1' }) + .. spec.label(x, y + .34, description.desc) + .. spec.style_type('label', { font = 'normal', textcolor = '#fff', font_size = '+0' }) + .. icon_button(x + 5.2, y, res.name, res.title, res.url) +end + +--- @param x number +--- @param y number +--- @param resources_list lord_inventory.Form.AboutTab.resource[] +local function all_resources(x, y, resources_list) + local res_strings = {} + local dx = 0 + local dy = 0 + for _, res in pairs(resources_list) do + table.insert(res_strings, resource(dx, dy, res)) + dy = dy + 0.9 + end + return '' + .. spec.container(x, y) + .. spec.style_type('button_url', { padding= '20,0,0,0' }) + .. table.concat(res_strings) + .. spec.container_end() +end + +--- @return string function AboutTab:get_spec() return '' + .. title(2.75, 0, 'L.O.R.D. Server') + .. spec.label(0.3, 0.5, 'по мотивам легендариума Дж. Толкина ("Властелин Колец", "Хоббит", ...)') + .. slogan(2.15, 0.9, 'можно копать... можно не копать...') + + .. spec.button_url(2, 1.4, 2, 1, 'about', S('About.btn'), 'https://lord-server.ru/about') + .. spec.button_url(4, 1.4, 2, 1, 'rules', S('Rules.btn'), 'https://lord-server.ru/rules') + + .. all_resources(.4, 2.6, resources) + + .. spec.style_type('label', { font = 'bold', textcolor = '#fffd' }) + .. spec.label(2.25, 7.3, 'Поддержать развитие проекта') + .. spec.style('donate', { bgimg = 'lord_inventory_boosty.png', border = 'false' }) + .. spec.style('donate:hovered', { bgimg = 'lord_inventory_boosty_hovered.png', border = 'false' }) + .. spec.button_url(2.5, 7.75, 3, 1, 'donate', '', 'https://boosty.to/lord-server') end diff --git a/mods/lord/Player/lord_inventory/textures/about/lord_inventory_boosty.png b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_boosty.png new file mode 100644 index 000000000..7d7699ac4 Binary files /dev/null and b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_boosty.png differ diff --git a/mods/lord/Player/lord_inventory/textures/about/lord_inventory_boosty_hovered.png b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_boosty_hovered.png new file mode 100644 index 000000000..7168d12a0 Binary files /dev/null and b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_boosty_hovered.png differ diff --git a/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_discord.png b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_discord.png new file mode 100644 index 000000000..b82624d73 Binary files /dev/null and b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_discord.png differ diff --git a/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_github.png b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_github.png new file mode 100644 index 000000000..a8e65f31a Binary files /dev/null and b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_github.png differ diff --git a/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_site.png b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_site.png new file mode 100644 index 000000000..7342367c3 Binary files /dev/null and b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_site.png differ diff --git a/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_vk.png b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_vk.png new file mode 100644 index 000000000..3db6c979d Binary files /dev/null and b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_vk.png differ diff --git a/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_youtube.png b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_youtube.png new file mode 100644 index 000000000..44179f678 Binary files /dev/null and b/mods/lord/Player/lord_inventory/textures/about/lord_inventory_icon_youtube.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_bags_button.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_bags_button.png index c26f07531..d45f46e3a 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_bags_button.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_bags_button.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_crafting.en.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_crafting.en.png index e2609af3f..906628156 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_crafting.en.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_crafting.en.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_crafting.ru.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_crafting.ru.png index a641c68a8..9f79ee43a 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_crafting.ru.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_crafting.ru.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_boots.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_boots.png index 87aab5b84..127fd9609 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_boots.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_boots.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_chestplate.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_chestplate.png index 275dae19a..7f2691262 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_chestplate.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_chestplate.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_cloak.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_cloak.png index 08f1801ef..aec1670e3 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_cloak.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_cloak.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_helmet.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_helmet.png index a7ba718ce..d97e7d017 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_helmet.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_helmet.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_leggings.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_leggings.png index 612480992..54bd05cb8 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_leggings.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_leggings.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shield.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shield.png index c6c6acbc4..1fbfd1e43 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shield.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shield.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shirt.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shirt.png index 81eddab8c..eb6393e19 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shirt.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shirt.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shoes.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shoes.png index 7d898cdbd..46adcb0c8 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shoes.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_shoes.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_trousers.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_trousers.png index c59215f1c..4170b4a75 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_trousers.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_slot_trousers.png differ diff --git a/mods/lord/Player/lord_inventory/textures/lord_inventory_trash_slot.png b/mods/lord/Player/lord_inventory/textures/lord_inventory_trash_slot.png index 615f97902..186d5d8e3 100644 Binary files a/mods/lord/Player/lord_inventory/textures/lord_inventory_trash_slot.png and b/mods/lord/Player/lord_inventory/textures/lord_inventory_trash_slot.png differ