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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,527 @@
--[[
| 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 screenMat = Material("vgui/terminal_yellow.png", "smooth")
local frameMat = Material("vgui/gradient-d", "smooth")
local cmbLabel = Material("willardnetworks/datafile/licensedisabled2.png", "smooth")
local cmbLogo = Material("vgui/icons/cmb_logo.png", "smooth")
local wnLogo = Material("vgui/icons/wi_logo.png", "smooth")
local defClr = Color(255, 223, 136)
local redClr = Color(200, 36, 36)
local greenClr = Color(36, 200, 61)
local backgroundColor = Color(9, 9, 9, 75)
local PANEL = {}
AccessorFunc(PANEL, "terminalEntity", "TerminalEntity")
AccessorFunc(PANEL, "usedBy", "UsedBy")
AccessorFunc(PANEL, "disc", "Disc")
local scrwSrn, scrhSrn = 1780, 870
local function CreateButton(name, text, path, font, alignment)
name:SetContentAlignment(alignment or 4)
name:SetTextInset(alignment and 0 or 10, 0)
name:SetFont(font or "WNTerminalMediumText")
name:SetText(string.utf8upper(text))
name.Paint = function(self, w, h)
surface.SetDrawColor(defClr)
surface.DrawRect(0, 0, w, h)
end
end
function PANEL:CreateDivider(parent, dock, bVertical)
local divider = parent:Add("Panel")
divider:Dock(dock)
divider:DockMargin(8, 8, 8, 8)
divider:SetHeight(10)
divider.bVertical = bVertical
divider.Paint = function(s, w, h)
surface.SetDrawColor(defClr)
if !bVertical then
surface.DrawLine(0, h * 0.5, w, h * 0.5)
else
surface.DrawLine(w * 0.5, 0, w * 0.5, h)
end
end
return divider
end
function PANEL:CreateAnimatedFrame(parent, dock, dockL, dockT, dockR, dockB, frameClr, callback)
local panel = parent:Add("Panel")
AccessorFunc(panel, "color", "Color")
panel:DockMargin(dockL, dockT, dockR, dockB)
panel:Dock(dock)
panel:InvalidateParent(true)
panel:SetColor(frameClr)
local wCoef = 0
local hCoef = 0
local anim = self:NewAnimation( 0.75, 0, -1)
anim.Think = function( s, pnl, fraction )
wCoef = fraction
end
local anim2 = self:NewAnimation( 0.8, 0.85, -1, function( s, pnl )
if callback then
callback()
end
end )
anim2.Think = function( s, pnl, fraction )
hCoef = fraction
end
panel.Paint = function(s, w, h)
w = w * wCoef
h = h * hCoef
local clr = s:GetColor()
clr.a = 100
surface.SetDrawColor(43, 42, 42, 200)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(clr)
surface.SetMaterial(frameMat)
surface.DrawTexturedRect(0, h * 0.95, w, h * 0.05)
surface.SetDrawColor(clr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
return panel
end
function PANEL:PurgeInnerContent()
for _, pnl in pairs(self.innerContent:GetChildren()) do
pnl:Remove()
end
end
function PANEL:CreateLock()
self.lockPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.lockPanel) then return end
self.lockPanel:ColorTo(redClr, 0.5)
self:GetTerminalEntity():EmitSound("buttons/button8.wav", 55, 100, 1, nil, 0, 11)
self.bottomWarning = self.lockPanel:Add("DLabel")
self.bottomWarning:SetFont("WNTerminalLargeText")
self.bottomWarning:SetText(string.utf8upper("Ce terminal est occupé"))
self.bottomWarning:SetTextColor(redClr)
self.bottomWarning:Dock(BOTTOM)
self.bottomWarning:DockMargin(0, 0, 0, 32)
self.bottomWarning:SetContentAlignment(5)
self.bottomWarning:SizeToContents()
self.bottomWarning:SetAlpha(0)
self.warningIcon = self.lockPanel:Add("DLabel")
self.warningIcon:SetFont("WNTerminalVeryLargeText")
self.warningIcon:SetTextColor(redClr)
self.warningIcon:SetText("!")
self.warningIcon:SetContentAlignment(5)
self.warningIcon:Center()
self.warningIcon:SetAlpha(0)
self.warningIcon:SizeToContents()
self.warningIcon.Paint = function(s, w, h)
surface.SetDrawColor(redClr)
surface.DrawCircle(26, 133, 75)
end
local alphishRedClr = redClr
alphishRedClr.a = 50
self.upperWarning = self.lockPanel:Add("DLabel")
self.upperWarning:Dock(TOP)
self.upperWarning:DockMargin(1, 64, 1, 0)
self.upperWarning:SetHeight(self:GetParent():GetTall() * 0.1)
self.upperWarning:SetContentAlignment(5)
self.upperWarning:SetFont("WNTerminalMediumText")
self.upperWarning:SetText(string.utf8upper("[SOYEZ PATIENT // ATTENDEZ VOTRE TOUR]"))
self.upperWarning:SetTextColor(defClr)
self.upperWarning.Paint = function(s, w, h)
surface.SetDrawColor(redClr)
surface.DrawRect(0, 0, w, h)
surface.SetMaterial(cmbLabel)
surface.SetDrawColor(alphishRedClr)
surface.DrawTexturedRect(0, 0, w, h)
end
self.upperWarning:SetAlpha(0)
for _, child in pairs(self.lockPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:InitializeBootupSequence()
self.wnLogo = self.innerContent:Add("Panel")
self.wnLogo:SetSize(500, 500)
self.wnLogo:CenterHorizontal(0.25)
self.wnLogo:CenterVertical(0.5)
self.wnLogo.Paint = function(s, w, h)
surface.SetMaterial(wnLogo)
surface.SetDrawColor(defClr)
surface.DrawTexturedRect(0, 0, w, h)
end
self.wnLogo:SetAlpha(0)
self.cmbLogo = self.innerContent:Add("Panel")
self.cmbLogo:SetSize(400, 500)
self.cmbLogo:CenterHorizontal(0.75)
self.cmbLogo:CenterVertical(0.5)
self.cmbLogo.Paint = function(s, w, h)
surface.SetMaterial(cmbLogo)
surface.SetDrawColor(defClr)
surface.DrawTexturedRect(0, 0, w, h)
end
self.cmbLogo:SetAlpha(0)
self.indicator = self.innerContent:Add("Panel")
self.indicator:SetWide(25)
self.indicator:SetHeight(self.innerContent:GetTall() - 2)
self.indicator:Center()
self.indicator:SetAlpha(0)
local defClrAlphish = defClr
defClrAlphish.a = 100
self.indicator.Paint = function(s, w, h)
surface.SetDrawColor(defClrAlphish)
surface.DrawRect(0, 0, w, h)
end
for _, child in pairs(self.innerContent:GetChildren()) do
child:AlphaTo(255, 0.25, 0, function()
self:GetTerminalEntity():EmitSound("wn_goi/terminal_turnon.mp3", 55, 100, 1, CHAN_VOICE, 0, 11)
end)
end
self.indicator:SizeTo(-1, 0, 1, 0.25, -1, function()
self.cmbLogo:MoveTo(self.innerContent:GetWide() / 2.72, self.cmbLogo:GetY(), 1)
self.cmbLogo:AlphaTo(0, 0.15, 0.5)
self.wnLogo:MoveTo(self.innerContent:GetWide() / 3, self.wnLogo:GetY(), 1, 0, -1, function()
self.wnLogo:AlphaTo(0, 0.25, 1.5, function()
for _, child in pairs(self.innerContent:GetChildren()) do
child:Remove()
end
self:Proceed()
end)
end)
end)
end
function PANEL:BuildEncodingPanel()
self.encodingPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.encodingPanel) then return end
self:GetTerminalEntity():EmitSound("buttons/combine_button7.wav", 55, 100, 1, nil, 0, 11)
local upperLabel = self.encodingPanel:Add("DLabel")
upperLabel:SetFont("WNTerminalLargeText")
upperLabel:SetText(string.utf8upper("Numérisation et encodage..."))
upperLabel:SetTextColor(defClr)
upperLabel:Dock(TOP)
upperLabel:DockMargin(0, 32, 0, 0)
upperLabel:SetContentAlignment(5)
upperLabel:SizeToContents()
upperLabel:SetAlpha(0)
local bottomLabel = self.encodingPanel:Add("DLabel")
bottomLabel:SetFont("WNTerminalMediumText")
bottomLabel:SetText(string.utf8upper("Ne mettez pas vos mains dans le dépôt du terminal"))
bottomLabel:SetTextColor(defClr)
bottomLabel:Dock(BOTTOM)
bottomLabel:DockMargin(0, 0, 0, 32)
bottomLabel:SetContentAlignment(5)
bottomLabel:SizeToContents()
bottomLabel:SetAlpha(0)
self:CreateDivider(self.encodingPanel, TOP)
self:CreateDivider(self.encodingPanel, BOTTOM)
local barPanel = self.encodingPanel:Add("Panel")
barPanel:Dock(FILL)
barPanel:DockMargin(32, 32, 32, 32)
barPanel.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
barPanel:SetAlpha(0)
local bar = barPanel:Add("Panel")
bar:Dock(FILL)
bar:DockMargin(16, 16, 16, 16)
bar.Paint = function(s, w, h)
surface.SetDrawColor(defClr)
surface.DrawRect(0, 0, w, h)
end
bar:SizeTo(0, -1, self:GetTerminalEntity().scanTimer - 2, 1, 1, function()
bar:SetAlpha(0)
self.encodingPanel:AlphaTo(0, 0.5, 0.5, function()
self:PurgeInnerContent()
self:Proceed()
end)
end)
for _, child in pairs(self.encodingPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:Encode()
self:PurgeInnerContent()
self:BuildEncodingPanel()
end
function PANEL:OnDiscAttach()
if self.discPanel then
self.discPanel:ColorTo(greenClr, 0.5, 0, function()
if (IsValid(self.bottomLabel) and IsValid(self.upperLabel)) then
self.bottomLabel:AlphaTo(0, 0.25)
self.upperLabel:AlphaTo(0, 0.25)
end
self:GetTerminalEntity():EmitSound("buttons/combine_button5.wav", 55, 100, 1, nil, 0, 11)
self.discPanel:AlphaTo(0, 0.5, 1, function()
self.discPanel:Remove()
self:ToInteraction()
end)
end)
end
end
function PANEL:OnDiscDetach()
self:SetDisc(nil)
self:PurgeInnerContent()
self:RequestDisc()
end
function PANEL:RequestDisc()
self.discPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.discPanel) then return end
self:GetTerminalEntity():EmitSound("buttons/combine_button1.wav", 55, 100, 1, nil, 0, 11)
self.bottomLabel = self.discPanel:Add("DLabel")
self.bottomLabel:SetFont("WNTerminalLargeText")
self.bottomLabel:SetText(string.utf8upper("Un disque de données vide est requis"))
self.bottomLabel:SetTextColor(defClr)
self.bottomLabel:Dock(BOTTOM)
self.bottomLabel:DockMargin(0, 0, 0, 32)
self.bottomLabel:SetContentAlignment(5)
self.bottomLabel:SizeToContents()
self.bottomLabel:SetAlpha(0)
local defClrAlphish = defClr
defClrAlphish.a = 100
self.upperLabel = self.discPanel:Add("DLabel")
self.upperLabel:Dock(TOP)
self.upperLabel:DockMargin(1, 64, 1, 0)
self.upperLabel:SetHeight(self:GetParent():GetTall() * 0.1)
self.upperLabel:SetContentAlignment(5)
self.upperLabel:SetFont("WNTerminalMediumText")
self.upperLabel:SetText(string.utf8upper("[INSÉREZ UN DISQUE DE DONNÉES VIDE POUR CONTINUER // ENCRIPTAGE DU CENTRE DE DONNÉES]"))
self.upperLabel:SetTextColor(defClr)
self.upperLabel.Paint = function(s, w, h)
surface.SetDrawColor(self.discPanel:GetColor())
surface.DrawRect(0, 0, w, h)
surface.SetMaterial(cmbLabel)
surface.SetDrawColor(self.discPanel:GetColor())
surface.DrawTexturedRect(0, 0, w, h)
end
self.upperLabel:SetAlpha(0)
self.cmbLogo = self.discPanel:Add("Panel")
self.cmbLogo:SetSize(400, 500)
self.cmbLogo:Center()
self.cmbLogo.Paint = function(s, w, h)
surface.SetMaterial(cmbLogo)
surface.SetDrawColor(self.discPanel:GetColor())
surface.DrawTexturedRect(0, 0, w, h)
end
self.cmbLogo:SetAlpha(0)
for _, child in pairs(self.discPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:Proceed()
if (!self:IsUsedByLocalPlayer()) then
self:CreateLock()
else
if (!self:GetDisc()) then
self:RequestDisc()
else
self:ToInteraction()
end
end
end
function PANEL:BuildInteraction(parent)
if self:GetDisc() != "" then
local errorLabel = parent:Add("DLabel")
errorLabel:Dock(FILL)
errorLabel:SetContentAlignment(5)
errorLabel:SetFont("WNTerminalMediumText")
errorLabel:SetText(string.utf8upper("Le disque inséré contient déjà \n un élément encodé"))
errorLabel:SetTextColor(defClr)
return
end
local upperLabel = parent:Add("DLabel")
upperLabel:Dock(TOP)
upperLabel:DockMargin(0, 8, 0, 0)
upperLabel:SetContentAlignment(5)
upperLabel:SetFont("WNTerminalMediumText")
upperLabel:SetText(string.utf8upper("processus d'encodage"))
upperLabel:SetTextColor(defClr)
self:CreateDivider(parent, TOP)
local bottomLabel = parent:Add("DLabel")
bottomLabel:Dock(BOTTOM)
bottomLabel:DockMargin(0, 0, 0, 16)
bottomLabel:SetContentAlignment(5)
bottomLabel:SetFont("WNTerminalMediumSmallerText")
bottomLabel:SetText(string.utf8upper("insérez l'article requis dans le terminal et confirmez le scan"))
bottomLabel:SetTextColor(defClr)
self:CreateDivider(parent, BOTTOM)
local confirmPanel = parent:Add("Panel")
confirmPanel:Dock(FILL)
confirmPanel:DockMargin(256, 64, 256, 64)
confirmPanel.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
local confirmLabel = confirmPanel:Add("DLabel")
confirmLabel:Dock(TOP)
confirmLabel:DockMargin(0, 16, 0, 0)
confirmLabel:SetContentAlignment(5)
confirmLabel:SetFont("WNTerminalMediumSmallerText")
confirmLabel:SetText(string.utf8upper("Procéder à l'encodage?"))
confirmLabel:SetTextColor(defClr)
confirmLabel:SizeToContents()
self:CreateDivider(confirmPanel, TOP)
local confirmButton = confirmPanel:Add("DButton")
CreateButton(confirmButton, "CONFIRMER LE SCAN", "buttonnoarrow.png", "WNTerminalMediumText", 5)
confirmButton:Dock(FILL)
confirmButton:DockMargin(8, 8, 8, 8)
confirmButton.DoClick = function(s)
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
net.Start("ix.terminal.Scan")
net.WriteEntity(self:GetTerminalEntity())
net.SendToServer()
end
end
function PANEL:ToInteraction()
self.interactionPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.interactionPanel) then return end
self:GetTerminalEntity():EmitSound("buttons/combine_button1.wav", 55, 100, 1, nil, 0, 11)
self.interact = self.interactionPanel:Add("Panel")
self.interact:SetWide(self.interactionPanel:GetWide() * 0.6)
self.interact:SetTall(self.interactionPanel:GetTall() / 1.65)
self.interact:Center()
self.interact.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
self.interact:InvalidateParent(true)
self.interact:SetAlpha(0)
self:BuildInteraction(self.interact)
for _, child in pairs(self.interactionPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:OnDataDiscInsert(dData)
if self.discPanel then
self.bottomLabel:AlphaTo(0, 0.5)
self.upperLabel:AlphaTo(0, 0.5)
self.discPanel:ColorTo(greenClr, 0.5, 0, function()
self:GetTerminalEntity():EmitSound("buttons/combine_button5.wav", 55, 100, 1, nil, 0, 11)
self.discPanel:AlphaTo(0, 0.5, 1, function()
self.discPanel:Remove()
end)
end)
end
end
function PANEL:OnDiscRemoved()
self:PurgeInnerContent()
self:RequestDisc()
end
function PANEL:IsUsedByLocalPlayer()
return self:GetUsedBy() == LocalPlayer()
end
function PANEL:Init()
self:SetSize(scrwSrn, scrhSrn)
self:SetPos(0, 0)
self:SetAlpha(0)
self.innerContent = self:Add("Panel")
self.innerContent:Dock(FILL)
self.innerContent:DockMargin(118, 84, 118, 70)
self.innerContent:InvalidateParent(true)
self:SetPaintedManually( true )
self:AlphaTo(255, 0.5, 0, function()
self:InitializeBootupSequence()
end)
end
function PANEL:Destroy()
self:AlphaTo(0, 0.5, 0, function(animData, pnl)
self:GetTerminalEntity().terminalPanel = nil
pnl:Remove()
end)
end
function PANEL:Paint(w, h)
surface.SetDrawColor(255, 255, 255, 100)
surface.SetMaterial(screenMat)
surface.DrawTexturedRect(0, 0, w, h)
end
vgui.Register("ixDataEncoder", PANEL, "Panel")

View File

@@ -0,0 +1,862 @@
--[[
| 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 screenMat = Material("vgui/terminal_yellow.png", "smooth")
local frameMat = Material("vgui/gradient-d", "smooth")
local cmbLabel = Material("willardnetworks/datafile/licensedisabled2.png", "smooth")
local cmbLogo = Material("vgui/icons/cmb_logo.png", "smooth")
local wnLogo = Material("vgui/icons/wi_logo.png", "smooth")
local defClr = Color(255, 223, 136)
local redClr = Color(200, 36, 36)
local greenClr = Color(36, 200, 61)
local backgroundColor = Color(9, 9, 9, 75)
local PANEL = {}
AccessorFunc(PANEL, "terminalEntity", "TerminalEntity")
AccessorFunc(PANEL, "usedBy", "UsedBy")
AccessorFunc(PANEL, "disc", "Disc")
local scrwSrn, scrhSrn = 1300, 970
local function CreateButton(name, text, path, font, alignment)
name:SetContentAlignment(alignment or 4)
name:SetTextInset(alignment and 0 or 10, 0)
name:SetFont(font or "WNTerminalMediumText")
name:SetText(string.utf8upper(text))
name.Paint = function(self, w, h)
surface.SetDrawColor(defClr)
surface.DrawRect(0, 0, w, h)
end
end
function PANEL:CreateNextPrev(parent, buttonFont, buttonAlign, prevFunc, nextFunc, bHorizontal, manualWidth)
local nextButton = parent:Add("DButton")
CreateButton(nextButton, "suivant", buttonFont, buttonAlign)
nextButton.DoClick = nextFunc
local prevButton = parent:Add("DButton")
CreateButton(prevButton, "précédent", buttonFont, buttonAlign)
prevButton.DoClick = prevFunc
if !bHorizontal then
nextButton:Dock(TOP)
nextButton:SetTall(parent:GetTall() / 2.1)
nextButton:DockMargin(2, 2, 2, 2)
prevButton:Dock(FILL)
prevButton:DockMargin(2, 2, 2, 2)
else
prevButton:Dock(LEFT)
prevButton:DockMargin(5, 5, 5, 5)
prevButton:SetWide(manualWidth or parent:GetWide() / 2)
nextButton:Dock(FILL)
nextButton:DockMargin(5, 5, 5, 5)
end
end
function PANEL:CreateDivider(parent, dock, bVertical)
local divider = parent:Add("Panel")
divider:Dock(dock)
divider:DockMargin(8, 8, 8, 8)
divider:SetHeight(10)
divider.bVertical = bVertical
divider.Paint = function(s, w, h)
surface.SetDrawColor(defClr)
if !bVertical then
surface.DrawLine(0, h * 0.5, w, h * 0.5)
else
surface.DrawLine(w * 0.5, 0, w * 0.5, h)
end
end
return divider
end
function PANEL:CreateAnimatedFrame(parent, dock, dockL, dockT, dockR, dockB, frameClr, callback)
local panel = parent:Add("Panel")
AccessorFunc(panel, "color", "Color")
panel:DockMargin(dockL, dockT, dockR, dockB)
panel:Dock(dock)
panel:InvalidateParent(true)
panel:SetColor(frameClr)
local wCoef = 0
local hCoef = 0
local anim = self:NewAnimation( 0.75, 0, -1)
anim.Think = function( s, pnl, fraction )
wCoef = fraction
end
local anim2 = self:NewAnimation( 0.8, 0.85, -1, function( s, pnl )
if callback then
callback()
end
end )
anim2.Think = function( s, pnl, fraction )
hCoef = fraction
end
panel.Paint = function(s, w, h)
w = w * wCoef
h = h * hCoef
local clr = s:GetColor()
clr.a = 100
surface.SetDrawColor(43, 42, 42, 200)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(clr)
surface.SetMaterial(frameMat)
surface.DrawTexturedRect(0, h * 0.95, w, h * 0.05)
surface.SetDrawColor(clr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
return panel
end
function PANEL:PurgeInnerContent()
for _, pnl in pairs(self.innerContent:GetChildren()) do
pnl:Remove()
end
end
function PANEL:CreateLock()
self.lockPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.lockPanel) then return end
self.lockPanel:ColorTo(redClr, 0.5)
self:GetTerminalEntity():EmitSound("buttons/button8.wav", 55, 100, 1, nil, 0, 11)
self.bottomWarning = self.lockPanel:Add("DLabel")
self.bottomWarning:SetFont("WNTerminalLargeText")
self.bottomWarning:SetText(string.utf8upper("ce terminal est occupé"))
self.bottomWarning:SetTextColor(redClr)
self.bottomWarning:Dock(BOTTOM)
self.bottomWarning:DockMargin(0, 0, 0, 32)
self.bottomWarning:SetContentAlignment(5)
self.bottomWarning:SizeToContents()
self.bottomWarning:SetAlpha(0)
self.warningIcon = self.lockPanel:Add("DLabel")
self.warningIcon:SetFont("WNTerminalVeryLargeText")
self.warningIcon:SetTextColor(redClr)
self.warningIcon:SetText("!")
self.warningIcon:SetContentAlignment(5)
self.warningIcon:Center()
self.warningIcon:SetAlpha(0)
self.warningIcon:SizeToContents()
self.warningIcon.Paint = function(s, w, h)
surface.SetDrawColor(redClr)
surface.DrawCircle(26, 133, 75)
end
local alphishRedClr = redClr
alphishRedClr.a = 50
self.upperWarning = self.lockPanel:Add("DLabel")
self.upperWarning:Dock(TOP)
self.upperWarning:DockMargin(1, 64, 1, 0)
self.upperWarning:SetHeight(self:GetParent():GetTall() * 0.1)
self.upperWarning:SetContentAlignment(5)
self.upperWarning:SetFont("WNTerminalMediumText")
self.upperWarning:SetText(string.utf8upper("[SOYEZ PATIENT // ATTENDEZ VOTRE TOUR]"))
self.upperWarning:SetTextColor(defClr)
self.upperWarning.Paint = function(s, w, h)
surface.SetDrawColor(redClr)
surface.DrawRect(0, 0, w, h)
surface.SetMaterial(cmbLabel)
surface.SetDrawColor(alphishRedClr)
surface.DrawTexturedRect(0, 0, w, h)
end
self.upperWarning:SetAlpha(0)
for _, child in pairs(self.lockPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:InitializeBootupSequence()
self.wnLogo = self.innerContent:Add("Panel")
self.wnLogo:SetSize(500, 500)
self.wnLogo:CenterHorizontal(0.25)
self.wnLogo:CenterVertical(0.5)
self.wnLogo.Paint = function(s, w, h)
surface.SetMaterial(wnLogo)
surface.SetDrawColor(defClr)
surface.DrawTexturedRect(0, 0, w, h)
end
self.wnLogo:SetAlpha(0)
self.cmbLogo = self.innerContent:Add("Panel")
self.cmbLogo:SetSize(400, 500)
self.cmbLogo:CenterHorizontal(0.75)
self.cmbLogo:CenterVertical(0.5)
self.cmbLogo.Paint = function(s, w, h)
surface.SetMaterial(cmbLogo)
surface.SetDrawColor(defClr)
surface.DrawTexturedRect(0, 0, w, h)
end
self.cmbLogo:SetAlpha(0)
self.indicator = self.innerContent:Add("Panel")
self.indicator:SetWide(2)
self.indicator:SetHeight(self.innerContent:GetTall() - 2)
self.indicator:Center()
self.indicator:SetAlpha(0)
local defClrAlphish = defClr
defClrAlphish.a = 100
self.indicator.Paint = function(s, w, h)
surface.SetDrawColor(defClrAlphish)
surface.DrawRect(0, 0, w, h)
end
for _, child in pairs(self.innerContent:GetChildren()) do
child:AlphaTo(255, 0.25, 0, function()
self:GetTerminalEntity():EmitSound("wn_goi/terminal_turnon.mp3", 55, 100, 1, CHAN_VOICE, 0, 11)
end)
end
self.indicator:SizeTo(-1, 0, 1, 0.25, -1, function()
self.cmbLogo:MoveTo(self.innerContent:GetWide() / 2.72, self.cmbLogo:GetY(), 1)
self.cmbLogo:AlphaTo(0, 0.15, 0.5)
self.wnLogo:MoveTo(self.innerContent:GetWide() / 3.5, self.wnLogo:GetY(), 1, 0, -1, function()
self.wnLogo:AlphaTo(0, 0.25, 1.5, function()
for _, child in pairs(self.innerContent:GetChildren()) do
child:Remove()
end
self:Proceed()
end)
end)
end)
end
function PANEL:OnDiscDetach()
if (self.fabricatingPanel) then
self:PurgeInnerContent()
self:CreateFabricating()
end
end
function PANEL:OnDiscAttach()
if (self.fabricatingPanel) then
self:PurgeInnerContent()
self:CreateFabricating()
end
end
function PANEL:FillDiscInteraction(parent)
local itemID = self:GetDisc()
if !itemID then return end
local item = ix.item.list[itemID]
self.itemIcon = parent:Add("SpawnIcon")
self.itemIcon:SetSize(176, 176)
self.itemIcon:SetModel(item.model)
self.itemIcon:Center()
self.itemIcon.PaintOver = function(s, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
local itemName = parent:Add("DLabel")
itemName:Dock(TOP)
itemName:DockMargin(0, 16, 0, 0)
itemName:SetContentAlignment(5)
itemName:SetFont("WNTerminalMediumText")
itemName:SetText(string.utf8upper("article encodé: " .. item.name))
itemName:SetTextColor(defClr)
itemName:SizeToContents()
self:CreateDivider(parent, TOP)
local fabricateButtonPanel = parent:Add("Panel")
fabricateButtonPanel:Dock(BOTTOM)
fabricateButtonPanel:SetTall(64)
fabricateButtonPanel:DockMargin(128, 0, 128, 16)
fabricateButtonPanel.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
local fabButton = fabricateButtonPanel:Add("DButton")
CreateButton(fabButton, "SYNTHÉTISER", "buttonnoarrow.png", "WNTerminalMediumText", 5)
fabButton:Dock(FILL)
fabButton:DockMargin(8, 8, 450, 8)
fabButton.DoClick = function(s)
self:GetTerminalEntity():EmitSound("buttons/button4.wav", 55, 100, 1, nil, 0, 11)
net.Start("ix.terminal.Fabricate")
net.WriteEntity(self:GetTerminalEntity())
net.WriteBool(false)
net.WriteInt(1, 5)
net.SendToServer()
end
local fabButtonMass = fabricateButtonPanel:Add("DButton")
CreateButton(fabButtonMass, "FORCER SYNTHÉTISATION", "buttonnoarrow.png", "WNTerminalMediumText", 5)
fabButtonMass:Dock(FILL)
fabButtonMass:DockMargin(450, 8, 8, 8)
fabButtonMass.DoClick = function(s)
self:GetTerminalEntity():EmitSound("buttons/button4.wav", 55, 100, 1, nil, 0, 11)
net.Start("ix.terminal.Fabricate")
net.WriteEntity(self:GetTerminalEntity())
net.WriteBool(true)
net.WriteInt(5, 5)
net.SendToServer()
end
local resinLabel = parent:Add("DLabel")
resinLabel:Dock(BOTTOM)
resinLabel:DockMargin(0, 0, 0, 8)
resinLabel:SetContentAlignment(5)
resinLabel:SetFont("WNTerminalMediumText")
resinLabel:SetText(string.utf8upper("quantité de résine requise: " .. ix.fabrication:Get(itemID).mainMaterialCost))
resinLabel:SetTextColor(defClr)
resinLabel:SizeToContents()
end
function PANEL:CreateFabricating()
self:PurgeInnerContent()
self.fabricatingPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.fabricatingPanel) then return end
self:GetTerminalEntity():EmitSound("buttons/button6.wav", 55, 100, 1, nil, 0, 11)
local returnButton = self.fabricatingPanel:Add("DButton")
CreateButton(returnButton, "RETOUR", "buttonnoarrow.png", "WNTerminalLargeText", 5)
returnButton:Dock(TOP)
returnButton:SetTall(128)
returnButton:DockMargin(8, 8, 8, 8)
returnButton.DoClick = function(s)
if s.bClosing then return end
s.bClosing = true
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
self.fabricatingPanel:AlphaTo(0, 0.5, 0, function()
self:PurgeInnerContent()
self:CreateSelector()
end)
end
returnButton:SetAlpha(0)
if (!self:GetDisc() or self:GetDisc() == "") then
local errorLabel = self.fabricatingPanel:Add("DLabel")
errorLabel:SetContentAlignment(5)
errorLabel:SetFont("WNTerminalLargeText")
errorLabel:SetText(string.utf8upper("disque de données \nencodées requis!"))
errorLabel:SetTextColor(defClr)
errorLabel:SetAlpha(0)
errorLabel:SizeToContents()
errorLabel:CenterHorizontal(0.525)
errorLabel:CenterVertical(0.5)
for _, child in pairs(self.fabricatingPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
return
end
local upperLabel = self.fabricatingPanel:Add("DLabel")
upperLabel:Dock(TOP)
upperLabel:SetContentAlignment(5)
upperLabel:SetFont("WNTerminalLargeText")
upperLabel:SetText(string.utf8upper("information encodée"))
upperLabel:SetTextColor(defClr)
upperLabel:SetAlpha(0)
upperLabel:SizeToContents()
local d = self:CreateDivider(self.fabricatingPanel, TOP)
d:SetAlpha(0)
self.eFab = self.fabricatingPanel:Add("Panel")
self.eFab:Dock(FILL)
self.eFab:DockMargin(16, 16, 16, 48)
self.eFab:InvalidateParent(true)
self.eFab.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
self.eFab:SetAlpha(0)
self:FillDiscInteraction(self.eFab)
for _, child in pairs(self.fabricatingPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:FillRecycleInteraction(parent)
local fcLabel = parent:Add("DLabel")
fcLabel:Dock(TOP)
fcLabel:DockMargin(0, 32, 0, 0)
fcLabel:SetContentAlignment(5)
fcLabel:SetFont("WNTerminalMediumText")
fcLabel:SetText(string.utf8upper("commande du fabricateur"))
fcLabel:SetTextColor(defClr)
fcLabel:SizeToContents()
local wLabel = parent:Add("DLabel")
wLabel:Dock(TOP)
wLabel:DockMargin(0, 8, 0, 0)
wLabel:SetContentAlignment(5)
wLabel:SetFont("WNTerminalMediumText")
wLabel:SetText(string.utf8upper("[Ne mettez pas vos mains dans le dépôt du fabricateur]"))
wLabel:SetTextColor(defClr)
wLabel:SizeToContents()
local buttonsPanel = parent:Add("Panel")
buttonsPanel:Dock(FILL)
buttonsPanel:DockMargin(parent:GetWide() / 3, 8, parent:GetWide() / 3, 16)
buttonsPanel:InvalidateParent(true)
buttonsPanel.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
local toggleDepot = buttonsPanel:Add("DButton")
CreateButton(toggleDepot, "ouvrir\n/\fermer", "buttonnoarrow.png", "WNTerminalMediumText", 5)
toggleDepot:Dock(LEFT)
toggleDepot:SetWide(buttonsPanel:GetWide() / 2.15)
toggleDepot:DockMargin(8, 8, 4, 8)
toggleDepot.DoClick = function(s)
self:GetTerminalEntity():EmitSound("buttons/button4.wav", 55, 100, 1, nil, 0, 11)
net.Start("ix.terminal.ToggleDepot")
net.WriteEntity(self:GetTerminalEntity())
net.SendToServer()
end
local recycle = buttonsPanel:Add("DButton")
CreateButton(recycle, "recycler", "buttonnoarrow.png", "WNTerminalMediumText", 5)
recycle:Dock(FILL)
recycle:DockMargin(4, 8, 8, 8)
recycle.DoClick = function(s)
self:GetTerminalEntity():EmitSound("buttons/button4.wav", 55, 100, 1, nil, 0, 11)
net.Start("ix.terminal.Recycle")
net.WriteEntity(self:GetTerminalEntity())
net.SendToServer()
end
end
function PANEL:CreateRecycling()
self:PurgeInnerContent()
self.recyclingPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.recyclingPanel) then return end
self:GetTerminalEntity():EmitSound("buttons/button6.wav", 55, 100, 1, nil, 0, 11)
local returnButton = self.recyclingPanel:Add("DButton")
CreateButton(returnButton, "RETOUR", "buttonnoarrow.png", "WNTerminalLargeText", 5)
returnButton:Dock(TOP)
returnButton:SetTall(128)
returnButton:DockMargin(8, 8, 8, 8)
returnButton.DoClick = function(s)
if s.bClosing then return end
s.bClosing = true
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
self.recyclingPanel:AlphaTo(0, 0.5, 0, function()
self:PurgeInnerContent()
self:CreateSelector()
end)
end
returnButton:SetAlpha(0)
local upperLabel = self.recyclingPanel:Add("DLabel")
upperLabel:Dock(TOP)
upperLabel:SetContentAlignment(5)
upperLabel:SetFont("WNTerminalLargeText")
upperLabel:SetText(string.utf8upper("recyclage"))
upperLabel:SetTextColor(defClr)
upperLabel:SetAlpha(0)
upperLabel:SizeToContents()
local d = self:CreateDivider(self.recyclingPanel, TOP)
d:SetAlpha(0)
self.recControl = self.recyclingPanel:Add("Panel")
self.recControl:Dock(FILL)
self.recControl:DockMargin(16, 16, 16, 48)
self.recControl:InvalidateParent(true)
self.recControl.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
self.recControl:SetAlpha(0)
self:FillRecycleInteraction(self.recControl)
for _, child in pairs(self.recyclingPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:CreateOptionButtons(parent)
local bClosing = false
local fabricate = parent:Add("DButton")
CreateButton(fabricate, "FABRICATION", "buttonnoarrow.png", "WNTerminalMediumText", 5)
fabricate:Dock(LEFT)
fabricate:DockMargin(8, 16, 4, 16)
fabricate:SetWide(parent:GetWide() / 3)
fabricate.DoClick = function(s)
if bClosing then return end
bClosing = true
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
self.selectorPanel:AlphaTo(0, 0.5, 0, function()
self:CreateFabricating()
end)
end
local recycle = parent:Add("DButton")
CreateButton(recycle, "RECYCLAGE", "buttonnoarrow.png", "WNTerminalMediumText", 5)
recycle:Dock(LEFT)
recycle:DockMargin(4, 32, 4, 32)
recycle:SetWide(parent:GetWide() / 3)
recycle.DoClick = function(s)
if bClosing then return end
bClosing = true
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
self.selectorPanel:AlphaTo(0, 0.5, 0, function()
self:CreateRecycling()
end)
end
local bioprocessing = parent:Add("DButton")
CreateButton(bioprocessing, "BIOPROCESS", "buttonnoarrow.png", "WNTerminalMediumText", 5)
bioprocessing:Dock(FILL)
bioprocessing:DockMargin(4, 16, 8, 16)
bioprocessing.DoClick = function(s)
if bClosing then return end
bClosing = true
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
self.selectorPanel:AlphaTo(0, 0.5, 0, function()
self:CreateBioprocess()
end)
end
end
function PANEL:FillBioPanel(parent)
local nextPrev = parent:Add("Panel")
nextPrev:Dock(TOP)
nextPrev:SetTall(80)
nextPrev:InvalidateParent(true)
nextPrev.Paint = function(s, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
local incrementFunc = function(s)
self:GetTerminalEntity():EmitSound("willardnetworks/datapad/back.wav", 55, 100, 1, nil, 0, 11)
self.itemIcon:Increment()
end
local decrementFunc = function(s)
self:GetTerminalEntity():EmitSound("willardnetworks/datapad/back.wav", 55, 100, 1, nil, 0, 11)
self.itemIcon:Decrement()
end
self:CreateNextPrev(nextPrev, nil, nil, decrementFunc, incrementFunc, true)
local bioprocessButtonPanel = parent:Add("Panel")
bioprocessButtonPanel:Dock(BOTTOM)
bioprocessButtonPanel:SetTall(64)
bioprocessButtonPanel:DockMargin(128, 0, 128, 16)
bioprocessButtonPanel.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
local bioButton = bioprocessButtonPanel:Add("DButton")
CreateButton(bioButton, "SYNTHÉTISER", "buttonnoarrow.png", "WNTerminalMediumText", 5)
bioButton:Dock(FILL)
bioButton:DockMargin(8, 8, 450, 8)
bioButton.DoClick = function(s)
self:GetTerminalEntity():EmitSound("buttons/button4.wav", 55, 100, 1, nil, 0, 11)
net.Start("ix.terminal.Bioprocess")
net.WriteEntity(self:GetTerminalEntity())
net.WriteString(self.itemIcon.fabID)
net.WriteBool(false)
net.WriteInt(1, 5)
net.SendToServer()
end
local bioButtonMass = bioprocessButtonPanel:Add("DButton")
CreateButton(bioButtonMass, "FORCER SYNTHÉTISATION", "buttonnoarrow.png", "WNTerminalMediumText", 5)
bioButtonMass:Dock(FILL)
bioButtonMass:DockMargin(450, 8, 8, 8)
bioButtonMass.DoClick = function(s)
self:GetTerminalEntity():EmitSound("buttons/button4.wav", 55, 100, 1, nil, 0, 11)
net.Start("ix.terminal.Bioprocess")
net.WriteEntity(self:GetTerminalEntity())
net.WriteString(self.itemIcon.fabID)
net.WriteBool(true)
net.WriteInt(5, 5)
net.SendToServer()
end
local itemInfo = parent:Add("Panel")
itemInfo:Dock(LEFT)
itemInfo:DockMargin(0, 0, 0, 0)
itemInfo:SetWide(400)
local itemName = itemInfo:Add("DLabel")
itemName:Dock(TOP)
itemName:DockMargin(16, 16, 0, 8)
itemName:SetContentAlignment(5)
itemName:SetFont("WNTerminalMediumText")
itemName:SetText("")
itemName:SetTextColor(defClr)
local itemMats = itemInfo:Add("DLabel")
itemMats:Dock(TOP)
itemMats:DockMargin(16, 16, 0, 8)
itemMats:SetContentAlignment(5)
itemMats:SetFont("WNTerminalMediumText")
itemMats:SetText("")
itemMats:SetTextColor(defClr)
local itemP = itemInfo:Add("DLabel")
itemP:Dock(TOP)
itemP:DockMargin(16, 16, 0, 8)
itemP:SetContentAlignment(5)
itemP:SetFont("WNTerminalMediumText")
itemP:SetText("")
itemP:SetTextColor(defClr)
self.itemIcon = parent:Add("SpawnIcon")
self.itemIcon:SetSize(176, 176)
self.itemIcon:SetModel("models/Gibs/HGIBS.mdl")
self.itemIcon:CenterHorizontal(0.5)
self.itemIcon:CenterVertical(0.55)
self.itemIcon.PaintOver = function(s, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
self.itemIcon.SetItem = function(s, fabPos)
s.fabID = self.biofabs[fabPos].id
s.fab = self.biofabs[fabPos].fab
s.fabPos = fabPos
s:OnItemChanged()
end
self.itemIcon.OnItemChanged = function(s)
local curItem = ix.item.list[s.fabID]
s:SetModel(curItem.model)
itemName:SetText(string.utf8upper(curItem.name))
itemMats:SetText(string.utf8upper("Coût biopâte: " .. s.fab.mainMaterialCost))
itemP:SetText("[ " .. s.fabPos .. " / " .. #self.biofabs .. " ]")
end
self.itemIcon.Increment = function(s)
if self.biofabs[s.fabPos + 1] then
s:SetItem(s.fabPos + 1)
end
end
self.itemIcon.Decrement = function(s)
if self.biofabs[s.fabPos - 1] then
s:SetItem(s.fabPos - 1)
end
end
self.itemIcon:SetItem(1)
end
function PANEL:CreateBioprocess()
self:PurgeInnerContent()
self.bioprocessPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.bioprocessPanel) then return end
self:GetTerminalEntity():EmitSound("buttons/button6.wav", 55, 100, 1, nil, 0, 11)
local returnButton = self.bioprocessPanel:Add("DButton")
CreateButton(returnButton, "RETOUR", "buttonnoarrow.png", "WNTerminalLargeText", 5)
returnButton:Dock(TOP)
returnButton:SetTall(128)
returnButton:DockMargin(8, 8, 8, 8)
returnButton.DoClick = function(s)
if s.bClosing then return end
s.bClosing = true
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
self.bioprocessPanel:AlphaTo(0, 0.5, 0, function()
self:PurgeInnerContent()
self:CreateSelector()
end)
end
returnButton:SetAlpha(0)
local upperLabel = self.bioprocessPanel:Add("DLabel")
upperLabel:Dock(TOP)
upperLabel:SetContentAlignment(5)
upperLabel:SetFont("WNTerminalLargeText")
upperLabel:SetText(string.utf8upper("bioprocessing"))
upperLabel:SetTextColor(defClr)
upperLabel:SetAlpha(0)
upperLabel:SizeToContents()
local d = self:CreateDivider(self.bioprocessPanel, TOP)
d:SetAlpha(0)
self.bioPanel = self.bioprocessPanel:Add("Panel")
self.bioPanel:Dock(FILL)
self.bioPanel:DockMargin(16, 16, 16, 48)
self.bioPanel:InvalidateParent(true)
self.bioPanel.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
self.bioPanel:SetAlpha(0)
self:FillBioPanel(self.bioPanel)
for _, child in pairs(self.bioprocessPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:CreateSelector()
self.selectorPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.selectorPanel) then return end
self:GetTerminalEntity():EmitSound("buttons/combine_button1.wav", 55, 100, 1, nil, 0, 11)
local upperLabel = self.selectorPanel:Add("DLabel")
upperLabel:Dock(TOP)
upperLabel:DockMargin(0, 36, 0, 6)
upperLabel:SetContentAlignment(5)
upperLabel:SetFont("WNTerminalLargeText")
upperLabel:SetText("EN COURS")
upperLabel:SetTextColor(defClr)
upperLabel:SetAlpha(0)
upperLabel:SizeToContents()
local d = self:CreateDivider(self.selectorPanel, TOP)
d:SetAlpha(0)
self.sButtonPanel = self.selectorPanel:Add("Panel")
self.sButtonPanel:Dock(FILL)
self.sButtonPanel:DockMargin(106, 36, 106, 112)
self.sButtonPanel:InvalidateParent(true)
self.sButtonPanel:SetAlpha(0)
self.sButtonPanel.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
self:CreateOptionButtons(self.sButtonPanel)
for _, child in pairs(self.selectorPanel:GetChildren()) do
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:Proceed()
if (!self:IsUsedByLocalPlayer()) then
self:CreateLock()
else
self:CreateSelector()
end
end
function PANEL:IsUsedByLocalPlayer()
return self:GetUsedBy() == LocalPlayer()
end
function PANEL:SortBiofabs()
self.biofabs = {}
for id, fab in pairs(ix.fabrication.list) do
if fab.category != "bio" then continue end
self.biofabs[#self.biofabs + 1] = {
id = id,
fab = fab,
fabPos = #self.biofabs + 1
}
end
end
function PANEL:Init()
self:SetSize(scrwSrn, scrhSrn)
self:SetPos(0, 0)
self:SetAlpha(0)
self.innerContent = self:Add("Panel")
self.innerContent:Dock(FILL)
self.innerContent:DockMargin(84, 94, 84, 78)
self.innerContent:InvalidateParent(true)
self:SetPaintedManually( true )
self:SortBiofabs()
self:AlphaTo(255, 0.5, 0, function()
self:InitializeBootupSequence()
end)
end
function PANEL:Destroy()
self:AlphaTo(0, 0.5, 0, function(animData, pnl)
self:GetTerminalEntity().terminalPanel = nil
pnl:Remove()
end)
end
function PANEL:Paint(w, h)
surface.SetDrawColor(255, 255, 255, 200)
surface.SetMaterial(screenMat)
surface.DrawTexturedRect(0, 0, w, h)
end
vgui.Register("ixFabricator", PANEL, "Panel")

View File

@@ -0,0 +1,374 @@
--[[
| 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 screenMat = Material("willardnetworks/datafile/workshifterminal.png", "smooth")
local frameMat = Material("vgui/gradient-d", "smooth")
local cmbLabel = Material("willardnetworks/datafile/licensedisabled2.png", "smooth")
local defClr = Color(16, 224, 207)
local redClr = Color(200, 36, 36)
local greenClr = Color(36, 200, 61)
local backgroundColor = Color(9, 9, 9, 75)
local PANEL = {}
AccessorFunc(PANEL, "terminalEntity", "TerminalEntity")
local scrwSrn, scrhSrn = 1600, 1400
PANEL.shopTerminal = true
local function CreateButton(name, text, path, font, alignment)
name:SetContentAlignment(alignment or 4)
name:SetTextInset(alignment and 0 or 10, 0)
name:SetFont(font or "WNTerminalMediumText")
name:SetText(string.utf8upper(text))
name.Paint = function(self, w, h)
surface.SetDrawColor(defClr)
surface.DrawRect(0, 0, w, h)
end
end
function PANEL:CreateDivider(parent, dock, bVertical)
local divider = parent:Add("Panel")
divider:Dock(dock)
divider:DockMargin(8, 8, 8, 8)
divider:SetHeight(10)
divider.bVertical = bVertical
divider.Paint = function(s, w, h)
surface.SetDrawColor(defClr)
if !bVertical then
surface.DrawLine(0, h * 0.5, w, h * 0.5)
else
surface.DrawLine(w * 0.5, 0, w * 0.5, h)
end
end
return divider
end
function PANEL:CreateAnimatedFrame(parent, dock, dockL, dockT, dockR, dockB, frameClr, callback)
local panel = parent:Add("Panel")
AccessorFunc(panel, "color", "Color")
panel:DockMargin(dockL, dockT, dockR, dockB)
panel:Dock(dock)
panel:InvalidateParent(true)
panel:SetColor(frameClr)
panel:SetAlpha(0)
panel:AlphaTo(255, 0.75, 0, function()
if callback then
callback()
end
end)
panel.Paint = function(s, w, h)
local clr = s:GetColor()
clr.a = 100
surface.SetDrawColor(43, 42, 42, 200)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(clr)
surface.SetMaterial(frameMat)
surface.DrawTexturedRect(0, h * 0.95, w, h * 0.05)
surface.SetDrawColor(clr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
return panel
end
function PANEL:CreateNextPrev(parent, buttonFont, buttonAlign, prevFunc, nextFunc, bHorizontal, manualWidth)
print(buttonFont)
local nextButton = parent:Add("DButton")
CreateButton(nextButton, "suivant", nil, buttonFont, buttonAlign)
nextButton.DoClick = nextFunc
local prevButton = parent:Add("DButton")
CreateButton(prevButton, "précédent", nil, buttonFont, buttonAlign)
prevButton.DoClick = prevFunc
if !bHorizontal then
nextButton:Dock(TOP)
nextButton:SetTall(parent:GetTall() / 2.1)
nextButton:DockMargin(2, 2, 2, 2)
prevButton:Dock(FILL)
prevButton:DockMargin(2, 2, 2, 2)
else
prevButton:Dock(LEFT)
prevButton:DockMargin(5, 5, 5, 5)
prevButton:SetWide(manualWidth or parent:GetWide() / 2)
nextButton:Dock(FILL)
nextButton:DockMargin(5, 5, 5, 5)
end
end
function PANEL:Init()
self:SetSize(scrwSrn, scrhSrn)
self:SetPos(0, 0)
self.innerContent = self:Add("Panel")
self.innerContent:Dock(FILL)
self.innerContent:DockMargin(107, 134, 107, 114)
self.innerContent:InvalidateParent(true)
self:SetPaintedManually( true )
self.selectedPermits = 0
self.permits = {}
for k, permit in pairs(ix.permits.list) do
self.permits[#self.permits + 1] = {id = k, pInfo = permit, selected = false}
end
end
function PANEL:PurgeInnerContent()
for _, pnl in pairs(self.innerContent:GetChildren()) do
pnl:Remove()
end
end
function PANEL:CreatePermitSelector(parent)
local nextPrev = parent:Add("Panel")
nextPrev:Dock(TOP)
nextPrev:SetTall(parent:GetTall() / 2)
nextPrev:InvalidateParent(true)
nextPrev.Paint = function(s, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
local incrementFunc = function(s)
self:GetTerminalEntity():EmitSound("willardnetworks/datapad/back.wav", 55, 100, 1, nil, 0, 11)
if (self.curPermit) then
self.curPermit:Increment()
end
end
local decrementFunc = function(s)
self:GetTerminalEntity():EmitSound("willardnetworks/datapad/back.wav", 55, 100, 1, nil, 0, 11)
if (self.curPermit) then
self.curPermit:Decrement()
end
end
self:CreateNextPrev(nextPrev, "WNTerminalMediumText", 5, decrementFunc, incrementFunc, true)
self.curPermit = parent:Add("DLabel")
self.curPermit:Dock(FILL)
self.curPermit:DockMargin(6, 6, 6, 6)
self.curPermit:SetContentAlignment(5)
self.curPermit:SetFont("WNTerminalLargeText")
self.curPermit:SetText(string.utf8upper(self.permits[1].id))
self.curPermit:SizeToContents()
self.curPermit.pos = 1
self.curPermit:SetTextColor(self.permits[self.curPermit.pos].selected and greenClr or redClr)
self.curPermit.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
self.curPermit.Increment = function(s)
if self.permits[s.pos + 1] then
s.pos = s.pos + 1
s:Update()
end
end
self.curPermit.Decrement = function(s)
if self.permits[s.pos - 1] then
s.pos = s.pos - 1
s:Update()
end
end
self.curPermit.Update = function(s)
s:SetText(string.utf8upper(self.permits[s.pos].id))
s:SetTextColor(self.permits[s.pos].selected and greenClr or redClr)
if self.sPermits then
self.sPermits:SetText(string.utf8upper("permis sélectionnés: ").."["..self.selectedPermits.."/3]")
end
end
end
function PANEL:CanSelectPermit()
return self.selectedPermits < 3
end
function PANEL:BuildShopPanel(shop)
self:PurgeInnerContent()
self.shopPanel = self:CreateAnimatedFrame(self.innerContent, FILL, 0, 0, 0, 0,
defClr,
function()
if !IsValid(self.shopPanel) then return end
for _, child in pairs(self.shopPanel:GetChildren()) do
child:Remove()
end
local upperLabel = self.shopPanel:Add("DLabel")
upperLabel:Dock(TOP)
upperLabel:DockMargin(0, 32, 0, 0)
upperLabel:SetContentAlignment(5)
upperLabel:SetFont("WNTerminalMoreLargerText")
upperLabel:SetText(string.utf8upper("shop terminal"))
upperLabel:SetTextColor(defClr)
upperLabel:SizeToContents()
self:CreateDivider(self.shopPanel, TOP)
if shop.shopName and shop.cost and shop.scReq and shop.rent then
self.shopName = self.shopPanel:Add("DLabel")
self.shopName:Dock(TOP)
self.shopName:DockMargin(0, 8, 0, 0)
self.shopName:SetContentAlignment(5)
self.shopName:SetFont("WNTerminalLargeText")
self.shopName:SetText(string.utf8upper(shop.shopName))
self.shopName:SetTextColor(defClr)
self.shopName:SizeToContents()
self.shopInfo = self.shopPanel:Add("DLabel")
self.shopInfo:Dock(TOP)
self.shopInfo:DockMargin(0, 8, 0, 0)
self.shopInfo:SetContentAlignment(5)
self.shopInfo:SetFont("WNTerminalLargeText")
self.shopInfo:SetText(string.utf8upper("cs req: ")..shop.scReq.." | "..shop.cost..string.utf8upper(" crédits").." | " .. shop.rent .. string.utf8upper(" loué"))
self.shopInfo:SetTextColor(defClr)
self.shopInfo:SizeToContents()
self:CreateDivider(self.shopPanel, TOP)
local isPurchasable = self:GetTerminalEntity():GetNetVar("isPurchasable", false)
self.isPurchasable = self.shopPanel:Add("DLabel")
self.isPurchasable:Dock(TOP)
self.isPurchasable:DockMargin(0, 8, 0, 0)
self.isPurchasable:SetContentAlignment(5)
self.isPurchasable:SetFont("WNTerminalLargeText")
self.isPurchasable:SetText(isPurchasable and string.utf8upper("Ce magasin est achetable") or string.utf8upper("Ce magasin n'est pas achetable"))
self.isPurchasable:SetTextColor(isPurchasable and greenClr or redClr)
self.isPurchasable:SizeToContents()
self:CreateDivider(self.shopPanel, TOP)
if isPurchasable then
local permitSelector = self.shopPanel:Add("Panel")
permitSelector:Dock(TOP)
permitSelector:DockMargin(16, 8, 16, 0)
permitSelector:SetTall(168)
permitSelector:InvalidateParent(true)
self:CreatePermitSelector(permitSelector)
self.selectPermit = self.shopPanel:Add("DButton")
CreateButton(self.selectPermit, "Activer/Désactiver le permis", nil, "WNTerminalMediumText", 5)
self.selectPermit:Dock(TOP)
self.selectPermit:DockMargin(32, 0, 32, 0)
self.selectPermit:SizeToContents()
self.selectPermit.DoClick = function()
if self.permits[self.curPermit.pos].selected then
self.selectedPermits = self.selectedPermits - 1
self.permits[self.curPermit.pos].selected = !self.permits[self.curPermit.pos].selected
self.curPermit:Update()
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
else
if self:CanSelectPermit() then
self.selectedPermits = self.selectedPermits + 1
self.permits[self.curPermit.pos].selected = !self.permits[self.curPermit.pos].selected
self.curPermit:Update()
self:GetTerminalEntity():EmitSound("buttons/button18.wav", 55, 100, 1, nil, 0, 11)
else
self:GetTerminalEntity():EmitSound("buttons/button8.wav", 55, 100, 1, nil, 0, 11)
end
end
end
self.sPermits = self.shopPanel:Add("DLabel")
self.sPermits:Dock(TOP)
self.sPermits:DockMargin(0, 8, 0, 0)
self.sPermits:SetContentAlignment(5)
self.sPermits:SetFont("WNTerminalMediumText")
self.sPermits:SetTextColor(defClr)
self.sPermits:SetText(string.utf8upper("permis sélectionnés: ").."["..self.selectedPermits.."/3]")
self.sPermits:SizeToContents()
local buttonPanel = self.shopPanel:Add("Panel")
buttonPanel:Dock(BOTTOM)
buttonPanel:DockMargin(12, 0, 12, 108)
buttonPanel:SetTall(108)
buttonPanel.Paint = function(s, w, h)
surface.SetDrawColor(backgroundColor)
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(defClr)
surface.DrawOutlinedRect(0, 0, w, h, 1)
end
self.purchaseButton = buttonPanel:Add("DButton")
CreateButton(self.purchaseButton, "Acheter le magasin", nil, "WNTerminalLargeText", 5)
self.purchaseButton:Dock(FILL)
self.purchaseButton:DockMargin(8, 8, 8, 8)
self.purchaseButton.DoClick = function()
local permits = {}
for _, permit in pairs(self.permits) do
if permit.selected then
permits[permit.id] = true
end
end
netstream.Start("BuyShopViaTerminal", self:GetTerminalEntity(), permits)
end
end
end
for _, child in pairs(self.shopPanel:GetChildren()) do
child:SetAlpha(0)
child:AlphaTo(255, 0.95)
end
end)
end
function PANEL:Destroy()
self:AlphaTo(0, 0.5, 0, function(animData, pnl)
self:GetTerminalEntity().terminalPanel = nil
pnl:Remove()
end)
end
function PANEL:Paint(w, h)
surface.SetDrawColor(255, 255, 255, 245)
surface.SetMaterial(screenMat)
surface.DrawTexturedRect(0, 0, w, h)
end
vgui.Register("ixShopTerminal", PANEL, "Panel")
netstream.Hook("UpdateShopScreen", function()
local panelList = ix.factoryPanels.list
for i = 1, #ix.factoryPanels.list do
local panel = panelList[i]
if panel.shopTerminal then
local ent = panel:GetTerminalEntity()
panel:BuildShopPanel({
shopName = ent:GetShop(),
cost = ent:GetShopCost(),
scReq = ent:GetShopSocialCreditReq(),
rent = ent:GetNetVar("Rent", 0)
})
end
end
end)