add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,121 @@
local PLUGIN = PLUGIN
local PANEL = {}
function PANEL:Init()
ix.gui.chatTabCustomize = self
self:SetTitle(L("chatNewTab"))
self:SetSizable(true)
self:SetSize(ScrW() * 0.5, ScrH() * 0.5)
self.settings = self:Add("ixSettings")
self.settings:Dock(FILL)
self.settings:SetSearchEnabled(true)
self.settings:AddCategory(L("chatAllowedClasses"))
-- controls
local controlsPanel = self:Add("Panel")
controlsPanel:Dock(BOTTOM)
controlsPanel:DockMargin(0, 4, 0, 0)
controlsPanel:SetTall(32)
self.create = controlsPanel:Add("DButton")
self.create:SetText(L("create"))
self.create:SizeToContents()
self.create:Dock(FILL)
self.create:DockMargin(0, 0, 4, 0)
self.create.DoClick = ix.util.Bind(self, self.CreateClicked)
local uncheckAll = controlsPanel:Add("DButton")
uncheckAll:SetText(L("uncheckAll"))
uncheckAll:SizeToContents()
uncheckAll:Dock(RIGHT)
uncheckAll.DoClick = function()
self:SetAllValues(false)
end
local checkAll = controlsPanel:Add("DButton")
checkAll:SetText(L("checkAll"))
checkAll:SizeToContents()
checkAll:Dock(RIGHT)
checkAll:DockMargin(0, 0, 4, 0)
checkAll.DoClick = function()
self:SetAllValues(true)
end
-- chat class settings
self.name = self.settings:AddRow(ix.type.string)
self.name:SetText(L("chatTabName"))
self.name:SetValue(L("chatNewTabTitle"))
self.name:SetZPos(-1)
for k, _ in SortedPairs(ix.chat.classes) do
local panel = self.settings:AddRow(ix.type.bool, L("chatAllowedClasses"))
panel:SetText(k)
panel:SetValue(true, true)
end
self.settings:SizeToContents()
self:Center()
self:MakePopup()
end
function PANEL:PopulateFromTab(name, filter)
self.tab = name
self:SetTitle(L("chatCustomize"))
self.create:SetText(L("update"))
self.name:SetValue(name)
for _, v in ipairs(self.settings:GetRows()) do
if (filter[v:GetText()]) then
v:SetValue(false, true)
end
end
end
function PANEL:SetAllValues(bValue)
for _, v in ipairs(self.settings:GetRows()) do
if (v == self.name) then
continue
end
v:SetValue(tobool(bValue), true)
end
end
function PANEL:CreateClicked()
local name = self.tab and self.tab or self.name:GetValue()
if (self.tab != self.name:GetValue() and PLUGIN:TabExists(self.name:GetValue())) then
ix.util.Notify(L("chatTabExists"))
return
end
local filter = {}
for _, v in ipairs(self.settings:GetRows()) do
-- we only want to add entries for classes we don't want shown
if (!v:GetValue()) then
filter[v:GetText()] = true
end
end
if (self.tab) then
self:OnTabUpdated(name, filter, self.name:GetValue())
else
self:OnTabCreated(name, filter)
end
self:Remove()
end
function PANEL:OnTabCreated(id, filter)
end
function PANEL:OnTabUpdated(id, filter, newID)
end
vgui.Register("ixChatboxTabCustomize", PANEL, "DFrame")

View File

@@ -0,0 +1,205 @@
-- Переопределение стилей чатбокса под общий дизайн Military RP
local PLUGIN = PLUGIN
local gradient = surface.GetTextureID("vgui/gradient-u")
local gradientUp = surface.GetTextureID("vgui/gradient-d")
-- Цвета в стиле HUD
local Colors = {
green = Color(84, 147, 90),
dark_green = Color(52, 91, 60),
darker_green = Color(35, 53, 29),
gray = Color(193, 193, 193),
gray_dark = Color(94, 94, 94),
black = Color(0, 0, 0, 220),
black_light = Color(0, 0, 0, 150),
white = Color(255, 255, 255)
}
-- Переопределяем стандартные функции рисования чатбокса
local SKIN = derma.GetDefaultSkin()
-- Фон чатбокса
function SKIN:PaintChatboxBackground(panel, width, height)
-- Blur эффект
ix.util.DrawBlur(panel, 8)
-- Основной фон с градиентом
surface.SetDrawColor(Colors.black)
surface.DrawRect(0, 0, width, height)
if (panel:GetActive()) then
-- Зелёный градиент сверху когда чат активен
surface.SetDrawColor(Colors.dark_green.r, Colors.dark_green.g, Colors.dark_green.b, 120)
surface.SetTexture(gradientUp)
surface.DrawTexturedRect(0, panel.tabs.buttons:GetTall(), width, height * 0.25)
end
-- Обводка в стиле HUD
surface.SetDrawColor(Colors.darker_green)
surface.DrawOutlinedRect(0, 0, width, height)
-- Тонкая внутренняя обводка
surface.SetDrawColor(Colors.green.r, Colors.green.g, Colors.green.b, 60)
surface.DrawOutlinedRect(1, 1, width - 2, height - 2)
end
-- Кнопки табов
function SKIN:PaintChatboxTabButton(panel, width, height)
if (panel:GetActive()) then
-- Активная вкладка - зелёный градиент
surface.SetDrawColor(Colors.dark_green)
surface.DrawRect(0, 0, width, height)
surface.SetDrawColor(Colors.green.r, Colors.green.g, Colors.green.b, 100)
surface.SetTexture(gradient)
surface.DrawTexturedRect(0, 0, width, height)
else
-- Неактивная вкладка
surface.SetDrawColor(Colors.black_light)
surface.DrawRect(0, 0, width, height)
-- Индикатор непрочитанных сообщений
if (panel:GetUnread()) then
surface.SetDrawColor(ColorAlpha(Color(200, 200, 50), Lerp(panel.unreadAlpha, 0, 120)))
surface.SetTexture(gradient)
surface.DrawTexturedRect(0, 0, width, height - 1)
end
end
-- Разделитель вкладок
surface.SetDrawColor(Colors.darker_green)
surface.DrawRect(width - 1, 0, 1, height)
end
-- Панель табов
function SKIN:PaintChatboxTabs(panel, width, height, alpha)
-- Фон панели табов
surface.SetDrawColor(Colors.black_light)
surface.DrawRect(0, 0, width, height)
-- Градиент вниз
surface.SetDrawColor(Colors.darker_green.r, Colors.darker_green.g, Colors.darker_green.b, 150)
surface.SetTexture(gradient)
surface.DrawTexturedRect(0, height * 0.5, width, height * 0.5)
local tab = panel:GetActiveTab()
if (tab) then
local button = tab:GetButton()
local x, _ = button:GetPos()
-- Линия под активной вкладкой (зелёная)
surface.SetDrawColor(Colors.green)
surface.DrawRect(x, height - 2, button:GetWide(), 2)
-- Обводка панели табов
surface.SetDrawColor(Colors.darker_green)
surface.DrawRect(0, height - 1, x, 1) -- слева
surface.DrawRect(x + button:GetWide(), height - 1, width - x - button:GetWide(), 1) -- справа
end
end
-- Поле ввода текста
function SKIN:PaintChatboxEntry(panel, width, height)
-- Фон поля ввода
surface.SetDrawColor(Colors.darker_green.r, Colors.darker_green.g, Colors.darker_green.b, 100)
surface.DrawRect(0, 0, width, height)
-- Текст
panel:DrawTextEntryText(Colors.white, Colors.green, Colors.white)
-- Обводка
surface.SetDrawColor(Colors.dark_green)
surface.DrawOutlinedRect(0, 0, width, height)
-- Внутренний highlight когда активно
if panel:HasFocus() then
surface.SetDrawColor(Colors.green.r, Colors.green.g, Colors.green.b, 80)
surface.DrawOutlinedRect(1, 1, width - 2, height - 2)
end
end
-- Превью команды
function SKIN:DrawChatboxPreviewBox(x, y, text, color)
color = color or Colors.green
local textWidth, textHeight = surface.GetTextSize(text)
local width, height = textWidth + 8, textHeight + 8
-- Фон
surface.SetDrawColor(Colors.dark_green)
surface.DrawRect(x, y, width, height)
-- Градиент
surface.SetDrawColor(color.r, color.g, color.b, 60)
surface.SetTexture(gradient)
surface.DrawTexturedRect(x, y, width, height)
-- Текст
surface.SetTextColor(Colors.white)
surface.SetTextPos(x + width * 0.5 - textWidth * 0.5, y + height * 0.5 - textHeight * 0.5)
surface.DrawText(text)
-- Обводка
surface.SetDrawColor(Colors.darker_green)
surface.DrawOutlinedRect(x, y, width, height)
return width
end
-- Префикс команды
function SKIN:DrawChatboxPrefixBox(panel, width, height)
local color = panel:GetBackgroundColor() or Colors.green
-- Фон
surface.SetDrawColor(Colors.dark_green)
surface.DrawRect(0, 0, width, height)
-- Градиент
surface.SetDrawColor(color.r, color.g, color.b, 80)
surface.SetTexture(gradient)
surface.DrawTexturedRect(0, 0, width, height)
-- Обводка
surface.SetDrawColor(Colors.darker_green)
surface.DrawOutlinedRect(0, 0, width, height)
end
-- Автодополнение команд
function SKIN:PaintChatboxAutocompleteEntry(panel, width, height)
-- Выделенный фон
if (panel.highlightAlpha > 0) then
surface.SetDrawColor(Colors.dark_green.r, Colors.dark_green.g, Colors.dark_green.b, panel.highlightAlpha * 150)
surface.DrawRect(0, 0, width, height)
-- Градиент выделения
surface.SetDrawColor(Colors.green.r, Colors.green.g, Colors.green.b, panel.highlightAlpha * 60)
surface.SetTexture(gradient)
surface.DrawTexturedRect(0, 0, width, height)
end
-- Разделитель между командами
surface.SetDrawColor(Colors.darker_green.r, Colors.darker_green.g, Colors.darker_green.b, 100)
surface.DrawRect(0, height - 1, width, 1)
end
hook.Add("LoadFonts", "MilitaryRPChatFonts", function()
-- Переопределяем шрифты чата на Montserrat
local scale = ix.option.Get("chatFontScale", 1)
surface.CreateFont("ixChatFont", {
font = "Montserrat",
size = 17 * scale,
weight = 400,
extended = true
})
surface.CreateFont("ixChatFontItalics", {
font = "Montserrat",
size = 17 * scale,
weight = 400,
italic = true,
extended = true
})
end)

View File

@@ -0,0 +1,25 @@
NAME = "English"
LANGUAGE = {
-- Category
optChat = "Chat",
-- Settings
optChatNotices = "Chat Notices",
optChatNoticesDesc = "Show system notifications in chat",
optChatTimestamps = "Timestamps",
optChatTimestampsDesc = "Display message send time",
optChatFontScale = "Font Scale",
optChatFontScaleDesc = "Chat font scale (0.1-2)",
optChatOutline = "Text Outline",
optChatOutlineDesc = "Add outline to chat text for better readability",
optChatTabs = "Chat Tabs",
optChatTabsDesc = "Chat tabs configuration (JSON)",
optChatPosition = "Chat Position",
optChatPositionDesc = "Chat window position and size (JSON)",
}

View File

@@ -0,0 +1,25 @@
NAME = "Русский"
LANGUAGE = {
-- Category
optChat = "Чат",
-- Settings
optChatNotices = "Уведомления в чате",
optChatNoticesDesc = "Показывать системные уведомления в чате",
optChatTimestamps = "Временные метки",
optChatTimestampsDesc = "Отображать время отправки сообщений",
optChatFontScale = "Размер шрифта",
optChatFontScaleDesc = "Масштаб шрифта в чате (0.1-2)",
optChatOutline = "Обводка текста",
optChatOutlineDesc = "Добавить обводку к тексту чата для лучшей читаемости",
optChatTabs = "Вкладки чата",
optChatTabsDesc = "Конфигурация вкладок чата (JSON)",
optChatPosition = "Позиция чата",
optChatPositionDesc = "Позиция и размер окна чата (JSON)",
}

View File

@@ -0,0 +1,188 @@
local PLUGIN = PLUGIN
PLUGIN.name = "Chatbox"
PLUGIN.author = "`impulse"
PLUGIN.description = "Replaces the chatbox to enable customization, autocomplete, and useful info."
if (CLIENT) then
ix.util.Include("derma/cl_chatskin.lua")
ix.chat.history = ix.chat.history or {} -- array of strings the player has entered into the chatbox
ix.chat.currentCommand = ""
ix.chat.currentArguments = {}
ix.option.Add("chatNotices", ix.type.bool, false, {
category = "optChat",
name = "optChatNotices",
description = "optChatNoticesDesc"
})
ix.option.Add("chatTimestamps", ix.type.bool, false, {
category = "optChat",
name = "optChatTimestamps",
description = "optChatTimestampsDesc"
})
ix.option.Add("chatFontScale", ix.type.number, 1, {
category = "optChat",
name = "optChatFontScale",
description = "optChatFontScaleDesc",
min = 0.1, max = 2, decimals = 2,
OnChanged = function()
hook.Run("LoadFonts", ix.config.Get("font"), ix.config.Get("genericFont"))
PLUGIN:CreateChat()
end
})
ix.option.Add("chatOutline", ix.type.bool, false, {
category = "optChat",
name = "optChatOutline",
description = "optChatOutlineDesc"
})
-- tabs and their respective filters
ix.option.Add("chatTabs", ix.type.string, "", {
category = "optChat",
name = "optChatTabs",
description = "optChatTabsDesc",
hidden = function()
return true
end
})
-- chatbox size and position
ix.option.Add("chatPosition", ix.type.string, "", {
category = "optChat",
name = "optChatPosition",
description = "optChatPositionDesc",
hidden = function()
return true
end
})
function PLUGIN:CreateChat()
if (IsValid(self.panel)) then
self.panel:Remove()
end
self.panel = vgui.Create("ixChatbox")
self.panel:SetupTabs(util.JSONToTable(ix.option.Get("chatTabs", "")))
self.panel:SetupPosition(util.JSONToTable(ix.option.Get("chatPosition", "")))
hook.Run("ChatboxCreated")
end
function PLUGIN:TabExists(id)
if (!IsValid(self.panel)) then
return false
end
return self.panel.tabs:GetTabs()[id] != nil
end
function PLUGIN:SaveTabs()
local tabs = {}
for id, panel in pairs(self.panel.tabs:GetTabs()) do
tabs[id] = panel:GetFilter()
end
ix.option.Set("chatTabs", util.TableToJSON(tabs))
end
function PLUGIN:SavePosition()
local x, y = self.panel:GetPos()
local width, height = self.panel:GetSize()
ix.option.Set("chatPosition", util.TableToJSON({x, y, width, height}))
end
function PLUGIN:InitPostEntity()
self:CreateChat()
end
function PLUGIN:PlayerBindPress(client, bind, pressed)
bind = bind:lower()
if (bind:find("messagemode") and pressed) then
-- Запрещаем открывать чат если игрок мёртв
if !LocalPlayer():Alive() then
return true
end
self.panel:SetActive(true)
return true
end
end
function PLUGIN:OnPauseMenuShow()
if (!IsValid(ix.gui.chat) or !ix.gui.chat:GetActive()) then
return
end
ix.gui.chat:SetActive(false)
return false
end
function PLUGIN:HUDShouldDraw(element)
if (element == "CHudChat") then
return false
end
end
function PLUGIN:ScreenResolutionChanged(oldWidth, oldHeight)
self:CreateChat()
end
function PLUGIN:ChatText(index, name, text, messageType)
if (messageType == "none" and IsValid(self.panel)) then
self.panel:AddMessage(text)
end
end
-- luacheck: globals chat
chat.ixAddText = chat.ixAddText or chat.AddText
function chat.AddText(...)
if (IsValid(PLUGIN.panel)) then
PLUGIN.panel:AddMessage(...)
end
-- log chat message to console
local text = {}
for _, v in ipairs({...}) do
if (istable(v) or isstring(v)) then
text[#text + 1] = v
elseif (isentity(v) and v:IsPlayer()) then
text[#text + 1] = team.GetColor(v:Team())
text[#text + 1] = v:Name()
elseif (type(v) != "IMaterial") then
text[#text + 1] = tostring(v)
end
end
text[#text + 1] = "\n"
MsgC(unpack(text))
end
else
util.AddNetworkString("ixChatMessage")
net.Receive("ixChatMessage", function(length, client)
local text = net.ReadString()
if ((client.ixNextChat or 0) < CurTime() and isstring(text) and text:find("%S")) then
local maxLength = ix.config.Get("chatMax")
if (text:utf8len() > maxLength) then
text = text:utf8sub(0, maxLength)
end
hook.Run("PlayerSay", client, text)
client.ixNextChat = CurTime() + 0.5
end
end)
end