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

View File

@@ -0,0 +1,205 @@
local PLUGIN = PLUGIN
function PLUGIN:CreateRadioMenu()
if (IsValid(self.radioMenu)) then
self.radioMenu:Remove()
end
local scrW, scrH = ScrW(), ScrH()
local frame = vgui.Create("DFrame")
frame:SetSize(500, 200)
frame:SetPos(scrW/2 - 250, scrH/2 - 100)
frame:SetTitle("")
frame:SetDraggable(false)
frame:ShowCloseButton(false)
frame:MakePopup()
frame.Paint = function(panel, w, h)
-- Фон
surface.SetDrawColor(Color(13, 13, 13, 240))
surface.DrawRect(0, 0, w, h)
-- Обводка
surface.SetDrawColor(Color(1, 67, 29))
surface.DrawOutlinedRect(0, 0, w, h, 2)
-- Верхняя панель
surface.SetDrawColor(Color(1, 67, 29))
surface.DrawRect(0, 0, w, 40)
-- Заголовок
draw.SimpleText("НАСТРОЙКИ РАЦИИ", "ixMenuButtonFont", w/2, 20, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
self.radioMenu = frame
local currentFreq = self:GetFrequency(LocalPlayer())
local freqLabel = frame:Add("DLabel")
freqLabel:SetPos(50, 60)
freqLabel:SetSize(400, 25)
freqLabel:SetText("Текущая частота: " .. currentFreq)
freqLabel:SetFont("ixSmallFont")
freqLabel:SetTextColor(color_white)
local freqSlider = frame:Add("DNumSlider")
freqSlider:SetPos(-231, 90)
freqSlider:SetSize(680, 40)
freqSlider:SetText("")
freqSlider:SetMin(self.minFrequency)
freqSlider:SetMax(self.maxFrequency)
freqSlider:SetDecimals(self.frequencyPrecision)
freqSlider:SetValue(currentFreq)
-- Стилизация слайдера
freqSlider.Slider.Paint = function(panel, w, h)
surface.SetDrawColor(Color(23, 23, 23))
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(Color(1, 67, 29))
surface.DrawOutlinedRect(0, 0, w, h, 1)
local progress = (freqSlider:GetValue() - freqSlider:GetMin()) / (freqSlider:GetMax() - freqSlider:GetMin())
local barWidth = w * progress
surface.SetDrawColor(Color(1, 67, 29))
surface.DrawRect(0, 0, barWidth, h)
end
freqSlider.Label:SetTextColor(color_white)
freqSlider.Label:SetFont("ixSmallFont")
freqSlider.TextArea:SetTextColor(color_white)
freqSlider.TextArea:SetFont("ixSmallFont")
freqSlider.TextArea.Paint = function(panel, w, h)
surface.SetDrawColor(Color(23, 23, 23))
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(Color(1, 67, 29))
surface.DrawOutlinedRect(0, 0, w, h, 1)
panel:DrawTextEntryText(color_white, Color(30, 130, 255), color_white)
end
freqSlider.OnValueChanged = function(_, value)
local format = "%0." .. PLUGIN.frequencyPrecision .. "f"
freqLabel:SetText("Текущая частота: " .. string.format(format, value))
end
-- Кнопка закрытия
local closeBtn = frame:Add("DButton")
closeBtn:SetPos(50, 150)
closeBtn:SetSize(150, 35)
closeBtn:SetText("")
closeBtn.Paint = function(panel, w, h)
surface.SetDrawColor(Color(1, 67, 29))
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(Color(29, 29, 29))
surface.DrawOutlinedRect(0, 0, w, h, 2)
draw.SimpleText("ЗАКРЫТЬ", "ixSmallFont", w/2, h/2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
if panel:IsHovered() then
surface.SetDrawColor(Color(255, 255, 255, 30))
surface.DrawRect(0, 0, w, h)
end
end
closeBtn.DoClick = function()
frame:Remove()
end
-- Кнопка применения
local applyBtn = frame:Add("DButton")
applyBtn:SetPos(300, 150)
applyBtn:SetSize(150, 35)
applyBtn:SetText("")
applyBtn.Paint = function(panel, w, h)
surface.SetDrawColor(Color(1, 67, 29))
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(Color(29, 29, 29))
surface.DrawOutlinedRect(0, 0, w, h, 2)
draw.SimpleText("ПРИМЕНИТЬ", "ixSmallFont", w/2, h/2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
if panel:IsHovered() then
surface.SetDrawColor(Color(255, 255, 255, 30))
surface.DrawRect(0, 0, w, h)
end
end
applyBtn.DoClick = function()
net.Start("ixRadioSetFrequency")
net.WriteFloat(freqSlider:GetValue())
net.SendToServer()
frame:Remove()
-- Уведомление об успешном применении
LocalPlayer():Notify("Частота рации изменена на: " .. string.format("%0." .. PLUGIN.frequencyPrecision .. "f", freqSlider:GetValue()))
end
end
-- Комбинации клавиш отключены - используйте Context Menu (C) для управления рацией
--[[
local lastPress = {
listen = 0,
transmit = 0,
menu = 0
}
local pressCooldown = 0.2
hook.Add("PlayerButtonDown", "ixRadioBinds", function(ply, button)
if (ply != LocalPlayer()) then
return
end
if (vgui.GetKeyboardFocus()) then
return
end
local ct = CurTime()
if (button == KEY_F2) then
if (ct - lastPress.menu < pressCooldown) then
return
end
lastPress.menu = ct
PLUGIN:CreateRadioMenu()
elseif if (button == KEY_O and input.IsKeyDown(KEY_LSHIFT)) then
if (ct - lastPress.listen < pressCooldown) then
return
end
lastPress.listen = ct
net.Start("ixRadioToggleListen")
net.SendToServer()
-- Уведомление о переключении режима прослушивания
local status = ix.plugin.list["radio"]:IsListening(LocalPlayer()) and "включено" or "выключено"
LocalPlayer():Notify("Прослушивание рации " .. status)
elseif (button == KEY_P and input.IsKeyDown(KEY_LSHIFT)) then
if (ct - lastPress.transmit < pressCooldown) then
return
end
lastPress.transmit = ct
net.Start("ixRadioToggleTransmit")
net.SendToServer()
-- Уведомление о переключении режима передачи
local status = ix.plugin.list["radio"]:IsTransmitting(LocalPlayer()) and "включена" or "выключена"
LocalPlayer():Notify("Передача рации " .. status)
end
end)
--]]
-- Команды для биндов
concommand.Add("radio_menu", function()
PLUGIN:CreateRadioMenu()
end)
concommand.Add("radio_listen", function()
net.Start("ixRadioToggleListen")
net.SendToServer()
end)
concommand.Add("radio_transmit", function()
net.Start("ixRadioToggleTransmit")
net.SendToServer()
end)