This commit is contained in:
lifestorm
2024-08-04 22:55:00 +03:00
parent 8064ba84d8
commit 73479cff9e
7338 changed files with 1718883 additions and 14 deletions

View File

@@ -0,0 +1,188 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PANEL = {}
AccessorFunc(PANEL, "font", "Font", FORCE_STRING)
AccessorFunc(PANEL, "maxLines", "MaxLines", FORCE_NUMBER)
function PANEL:Init()
if (IsValid(ix.gui.combine)) then
ix.gui.combine:Remove()
end
self.lines = {}
self:SetMaxLines(10)
self:SetFont("DebugFixedRadio")
self:SetPos(SScaleMin( 30 / 3 ), SScaleMin( 30 / 3 ))
self:SetSize(ScrW(), self.maxLines * SScaleMin( 20 / 2 ))
self:ParentToHUD()
ix.gui.combine = self
end
-- Adds a line to the combine display. Set expireTime to 0 if it should never be removed.
function PANEL:AddLine(text, color, location, ...)
self:ExpireLines()
if (#self.lines >= self.maxLines) then
for k, info in ipairs(self.lines) do
if (info.expireTime != 0) then
table.remove(self.lines, k)
break
end
end
end
-- check for any phrases and replace the text
if (text:utf8sub(1, 1) == "@") then
text = L(text:utf8sub(2), ...)
end
if (location) then
text = text.." dans "..location
end
table.insert(self.lines, {
text = "<:: " .. text .. "...",
color = color or color_white,
expireTime = CurTime() + 30,
character = 1,
font = "ImportantDisplayMessage"
})
end
function PANEL:AddImportantLine(text, color, location, ...)
self:ExpireLines()
if (#self.lines >= self.maxLines) then
for k, info in ipairs(self.lines) do
if (info.expireTime != 0) then
table.remove(self.lines, k)
break
end
end
end
-- check for any phrases and replace the text
if (text:utf8sub(1, 1) == "@") then
text = L(text:utf8sub(2), ...)
end
if (location) then
text = text.." dans "..string.upper(location)
end
table.insert(self.lines, {
text = "<:: " .. text .. "...",
color = color or color_white,
expireTime = CurTime() + 30,
character = 1,
important = true,
font = "ImportantDisplayMessage"
})
if (!LocalPlayer().HasActiveCombineMask or !LocalPlayer().IsDispatch) then return end
if (LocalPlayer():HasActiveCombineMask() or LocalPlayer():IsDispatch()) then
surface.PlaySound("buttons/blip1.wav")
end
end
function PANEL:ExpireLines()
local curTime = CurTime()
for i = #self.lines, 1, -1 do
if (self.lines[i].expireTime != 0 and curTime >= self.lines[i].expireTime) then
table.remove(self.lines, i)
continue
end
end
end
function PANEL:Think()
if (!IsValid(LocalPlayer())) then return end
if (LocalPlayer():HasActiveCombineMask() or LocalPlayer():IsDispatch()) then
local x, y = self:GetPos()
y = ix.bar.newTotalHeight or y
if (ix.option.Get("HUDPosition") != "Top Left") then
y = SScaleMin(10 / 3)
end
self:SetPos(x, y)
self:ExpireLines()
end
end
function PANEL:Paint(width, height)
if (!LocalPlayer():HasActiveCombineMask() and !LocalPlayer():IsDispatch()) then
return
end
local y = 0
surface.SetFont(self.font)
if (ix.plugin.list.combineutilities) then
local teams = ix.plugin.list.combineutilities.teams
for k, v in SortedPairs(teams) do
if (table.IsEmpty(v.members)) then continue end
surface.SetFont("ImportantDisplayMessage")
surface.SetTextColor(color_white)
surface.SetTextPos(0, y)
local owner = v.owner
local members = {}
for _, v1 in pairs(v.members) do
if (v1 == owner) then continue end
if (!IsValid(v1)) then continue end
members[#members + 1] = v1:GetName()
end
table.sort(members)
surface.DrawText(string.format("<:: PT-%d : %s%s; %s", k, IsValid(owner) and owner:GetName() or "no leader", IsValid(owner) and " (L)" or "", table.concat(members, ", ")))
local textHeight = draw.GetFontHeight("ImportantDisplayMessage")
y = y + textHeight + 5
end
end
if (!ix.config.Get("suitsNoConnection")) then
surface.SetFont("ImportantDisplayMessage")
surface.SetTextColor(Schema.colors[GetNetVar("visorColor", "blue")] or color_white)
surface.SetTextPos(0, y)
surface.DrawText(string.upper("<:: CURRENT SOCIO-STATUS CODE: " .. GetNetVar("visorStatus", "blue")))
local textHeight = draw.GetFontHeight("ImportantDisplayMessage")
y = y + textHeight + 5
end
for _, info in ipairs(self.lines) do
if (info.character < info.text:utf8len()) then
info.character = info.character + 1
end
surface.SetFont(info.font)
surface.SetTextColor(info.color)
surface.SetTextPos(0, y)
surface.DrawText(info.text:utf8sub(1, info.character))
local textHeight = draw.GetFontHeight(info.font)
y = y + textHeight + 5
end
surface.SetDrawColor(Color(0, 0, 0, 255))
end
vgui.Register("ixCombineDisplay", PANEL, "Panel")

View File

@@ -0,0 +1,156 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
surface.CreateFont("VisorScrolling", {
font = "Tahoma",
size = ScreenScale(24 / 3),
weight = 0,
antialias = true,
})
local PANEL = {}
function PANEL:Init()
self.scrollingmessage = "SOCIO-STABILITÉ INTACTE" -- Default Message
self.scrollspeed = 150 -- Default Scrollspeed
self.scrollingcolor = "blue" -- If Color Is Not Defined Fallback On This
self.width = ScrW() * 0.1823 -- Width Of The Box
self.open = false
self.closed = true
self:SetTall(0)
self:SetWidth(self.width)
self:SetPos(ScrW() - self.width / 2 - 50 - self.width / 2, 50)
ix.gui.visor = self
end
function PANEL:DrawScrollingText(w, h)
local text = self.scrollingmessage.." /// " -- So The Message Appears Like So, EX: JUDGEMENT WAIVER /// JUDGEMENT WAIVER
surface.SetFont("VisorScrolling") -- Set The Font
local textw, _ = surface.GetTextSize(text) -- Text Size From The Font
surface.SetTextColor(Schema.colors[self.scrollingcolor]) -- Set The Color To The Variable
local x = RealTime() * self.scrollspeed % textw * -1 -- Magic
while (x < w) do -- More Magic
surface.SetTextPos(x, 8.5)
surface.DrawText(text)
x = x + textw
end
end
function PANEL:DrawCorners(x, y, w, h)
local length = 12
local thickness = 3
surface.DrawRect(x, y, length, thickness) -- Top Left
surface.DrawRect(x, y, thickness, length)
surface.DrawRect(x + (w - length), y, length, thickness) -- Top Right
surface.DrawRect(x + (w - thickness), y, thickness, length)
surface.DrawRect(x, y + (h - length), thickness, length) -- Bottom Left
surface.DrawRect(x, y + (h - thickness), length, thickness)
surface.DrawRect(x + (w - thickness), y + (h - length), thickness, length) -- Bottom Right
surface.DrawRect(x + (w - length), y + (h - thickness), length, thickness)
end
function PANEL:Open()
if (self.open) then return end
-- check if close animation finished
if (!self.closed) then
self.shouldReopen = true
end
surface.PlaySound("ui/hint.wav")
self.open = CurTime() -- It's open so it's set to true.
self.closed = false
surface.SetFont("VisorScrolling")
local _, textH = surface.GetTextSize("000")
local x, y = self:GetPos()
self:SetAlpha(255) -- Make Sure Its Visible
self:SizeTo(-1, textH + 15.5, 0.3, 0) -- Animation
self:MoveTo(x, (y - (textH / 2)), 0.3, 0)
end
function PANEL:Close()
if (!self.open) then return end
self.open = false -- It's not open so it's set to false.
surface.SetFont("VisorScrolling") -- Get The Height/Width Of The Font So We Can Move It Accordingly
local _, textH = surface.GetTextSize("000")
local x, y = self:GetPos()
self:SizeTo(-1, 0, 0.3, 0, -1, function()
self.closed = true
if (self.shouldReopen) then
self.shouldReopen = nil
-- make sure to reopen with latest data
self.scrollingcolor = GetNetVar("visorColor", "blue")
self.scrollingmessage = GetNetVar("visorText", "SOCIO-STABILITÉ INTACTE")
self:Open()
end
end) -- Animation
self:MoveTo(x, (y + (textH / 2)), 0.3, 0)
end
function PANEL:Think()
if (!IsValid(LocalPlayer())) then return end
if (LocalPlayer():HasActiveCombineMask() or LocalPlayer():IsDispatch()) then
-- Close if blue and open for more than 10 seconds
if (self.open and (self.open < CurTime() - 10)) then
self:Close()
end
-- Check if text/colors needs to be updated
if (self.scrollingcolor != GetNetVar("visorColor", "blue") or self.scrollingmessage != GetNetVar("visorText", "SOCIO-STABILITÉ INTACTE")) then
-- If open for at least five seconds, close
-- If fully closed, update and open
if (self.open and (self.open < CurTime() - 5)) then
self:Close()
elseif (self.closed) then
self.scrollingcolor = GetNetVar("visorColor", "blue")
self.scrollingmessage = GetNetVar("visorText", "SOCIO-STABILITÉ INTACTE")
self:Open()
end
end
end
end
function PANEL:Paint(w, h)
if (!LocalPlayer():HasActiveCombineMask() and !LocalPlayer():IsDispatch()) then
return
end
if (self.closed) then
return
end
local color = Schema.colors[self.scrollingcolor]
surface.SetDrawColor(color.r, color.g, color.b, 25) -- Background
surface.DrawRect(0, 0, w, h)
self:DrawScrollingText(self.width, h) -- Scrolling Text
surface.SetDrawColor(color) -- Corners
self:DrawCorners(0, 0, w, h)
end
vgui.Register("ixVisorScroller", PANEL, Panel)