mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
176
gamemodes/darkrp/plugins/n7stuff/derma/cl_datapad_cmu.lua
Normal file
176
gamemodes/darkrp/plugins/n7stuff/derma/cl_datapad_cmu.lua
Normal file
@@ -0,0 +1,176 @@
|
||||
--[[
|
||||
| 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 DATAFILEPLUGIN = ix.plugin.Get("combineutilities")
|
||||
|
||||
local PANEL = {}
|
||||
|
||||
local materialMainframe = ix.util.GetMaterial("willardnetworks/datafile/mainframe.png")
|
||||
local materialGadgetlight = ix.util.GetMaterial("willardnetworks/datafile/gadgetlight.png")
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:MakePopup()
|
||||
Schema:AllowMessage(self)
|
||||
|
||||
local mainFrame = self:Add("EditablePanel")
|
||||
mainFrame:SetSize(SScaleMin(645 / 3), SScaleMin(850 / 3))
|
||||
mainFrame:Center()
|
||||
mainFrame.Paint = function(this, with, height)
|
||||
surface.SetDrawColor(color_white:Unpack())
|
||||
surface.SetMaterial(materialMainframe)
|
||||
surface.DrawTexturedRect(0, 0, with, height)
|
||||
end
|
||||
|
||||
local close = self:Add("DButton")
|
||||
close:SetSize(SScaleMin(107 / 3), SScaleMin(105 / 3))
|
||||
close:SetPos(self:GetWide() * 0.5 + mainFrame:GetWide() * 0.5 - close:GetWide() * 0.6, self:GetTall() * 0.5 - mainFrame:GetTall() * 0.5 - close:GetTall() * 0.4)
|
||||
close:SetText("")
|
||||
close.Paint = function(this, with, height)
|
||||
if (this:IsHovered()) then
|
||||
surface.SetDrawColor(ColorAlpha(color_white, 50))
|
||||
surface.SetMaterial(materialGadgetlight)
|
||||
surface.DrawTexturedRect(0, 0, with, height)
|
||||
end
|
||||
end
|
||||
close.DoClick = function()
|
||||
surface.PlaySound("willardnetworks/datapad/close.wav")
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
self.subFrame = self:Add("EditablePanel")
|
||||
self.subFrame:SetSize(mainFrame:GetWide() * 0.8, mainFrame:GetTall() * 0.75)
|
||||
self.subFrame:Center()
|
||||
self.subFrame:SetTall(mainFrame:GetTall() * 0.8)
|
||||
|
||||
self.searchPanel = self.subFrame:Add("ixDatapadSearchProfiles")
|
||||
self.searchPanel:Dock(TOP)
|
||||
self.searchPanel:DockMargin(0, 0, 0, 0)
|
||||
self.searchPanel:SetTall(150)
|
||||
|
||||
self.searchPanel.back:Remove()
|
||||
self.searchPanel.topDivider:Remove()
|
||||
self.searchPanel.name.OnEnter = function()
|
||||
if (ix.config.Get("datafileNoConnection")) then
|
||||
LocalPlayer():NotifyLocalized("Error: no connection!")
|
||||
surface.PlaySound("hl1/fvox/buzz.wav")
|
||||
self.searchPanel.noConnection2:SetVisible(true)
|
||||
self.searchPanel:SetTall(250)
|
||||
return
|
||||
end
|
||||
|
||||
self.searchPanel:SetTall(150)
|
||||
|
||||
surface.PlaySound("willardnetworks/datapad/navigate.wav")
|
||||
|
||||
net.Start("ixDataFilePDA_CMU_RequestData")
|
||||
net.WriteString(self.searchPanel.name:GetText())
|
||||
net.SendToServer()
|
||||
end
|
||||
self.searchPanel.search.DoClick = function()
|
||||
if (ix.config.Get("datafileNoConnection")) then
|
||||
LocalPlayer():NotifyLocalized("Error: no connection!")
|
||||
surface.PlaySound("hl1/fvox/buzz.wav")
|
||||
self.searchPanel.noConnection2:SetVisible(true)
|
||||
return
|
||||
end
|
||||
|
||||
surface.PlaySound("willardnetworks/datapad/navigate.wav")
|
||||
|
||||
net.Start("ixDataFilePDA_CMU_RequestData")
|
||||
net.WriteString(self.searchPanel.name:GetText())
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
self.output = self.subFrame:Add("DPanel")
|
||||
self.output:Dock(FILL)
|
||||
self.output.Populate = function(this, data)
|
||||
this:Clear()
|
||||
|
||||
if (!data or !istable(data) or table.IsEmpty(data)) then return end
|
||||
|
||||
local name = this:Add("EditablePanel")
|
||||
if (!data.genericData.cohesionPoints) then
|
||||
DATAFILEPLUGIN:CreateRow(name, "name", data.genericData.name, nil, true, false)
|
||||
else
|
||||
DATAFILEPLUGIN:CreateRow(name, "collar id", data.genericData.collarID, nil, true, false)
|
||||
end
|
||||
|
||||
local cid = this:Add("EditablePanel")
|
||||
DATAFILEPLUGIN:CreateRow(cid, "cid", data.genericData.cid, nil, false, false)
|
||||
|
||||
local socialCredits = this:Add("EditablePanel")
|
||||
if (!data.genericData.cohesionPoints) then
|
||||
DATAFILEPLUGIN:CreateRow(socialCredits, data.genericData.socialCredits and "social credits", math.Clamp(tonumber(data.genericData.socialCredits), 0, 200), (isnumber(data.genericData.socialCreditsDate) and os.date("%d/%m/%Y", data.genericData.socialCreditsDate) or data.genericData.socialCredits), true, true)
|
||||
else
|
||||
DATAFILEPLUGIN:CreateRow(socialCredits, data.genericData.cohesionPoints and "cohesion points", math.Clamp(tonumber(data.genericData.cohesionPoints), 0, 200), (isnumber(data.genericData.cohesionPointsDate) and os.date("%d/%m/%Y", data.genericData.cohesionPointsDate) or data.genericData.cohesionPointsDate), true, true)
|
||||
end
|
||||
|
||||
local geneticDescription = this:Add("EditablePanel")
|
||||
DATAFILEPLUGIN:CreateRow(geneticDescription, "genetic description", data.genericData.geneticDesc, nil, false, false)
|
||||
|
||||
local occupation = this:Add("EditablePanel")
|
||||
DATAFILEPLUGIN:CreateRow(occupation, "occupation", string.Left(data.genericData.occupation, 38), data.genericData.occupationDate, true, true)
|
||||
|
||||
local designatedStatus = this:Add("EditablePanel")
|
||||
DATAFILEPLUGIN:CreateRow(designatedStatus, "designated status", string.Left(data.genericData.designatedStatus, 38), data.genericData.designatedStatusDate, false, true)
|
||||
designatedStatus:DockMargin(0, 0, 0, 15)
|
||||
|
||||
local records = this:Add("ixDatafileMedicalRecords")
|
||||
records:Dock(TOP)
|
||||
records:DockMargin(0, 0, 0, 0)
|
||||
records:SetTall(this:GetTall() - name:GetTall() - cid:GetTall() - socialCredits:GetTall() - geneticDescription:GetTall() - occupation:GetTall() - designatedStatus:GetTall() - 15) -- I'm sorry, FILL didn't work. I don't know why.
|
||||
records.back:Remove()
|
||||
records.topDivider:Remove()
|
||||
records.contentSubframe = this
|
||||
records.medicalRecords = data.medicalRecords
|
||||
records.genericData = data.genericData
|
||||
records.cmuPDA = true
|
||||
records.recordsFrame:SetTall(this:GetTall() - name:GetTall() - cid:GetTall() - socialCredits:GetTall() - geneticDescription:GetTall() - occupation:GetTall() - designatedStatus:GetTall() - 15 - SScaleMin(2 / 3) - SScaleMin(11 / 3) - 20)
|
||||
records.OnSaveRecord = function()
|
||||
timer.Simple(0.1, function()
|
||||
net.Start("ixDataFilePDA_CMU_RequestData")
|
||||
net.WriteString(self.searchPanel.name:GetText())
|
||||
net.WriteBool(true)
|
||||
net.SendToServer()
|
||||
end)
|
||||
end
|
||||
records:Populate(data.medicalRecords)
|
||||
end
|
||||
self.output.Paint = nil
|
||||
|
||||
net.Receive("ixDataFilePDA_CMU_CheckData", function(_, client)
|
||||
local length = net.ReadUInt(32)
|
||||
local data = net.ReadData(length)
|
||||
local uncompressed = util.Decompress(data)
|
||||
|
||||
if (!uncompressed) then return end
|
||||
|
||||
local output = util.JSONToTable(uncompressed)
|
||||
|
||||
self.output:Populate(output)
|
||||
end)
|
||||
end
|
||||
|
||||
vgui.Register("ixDatafilePDA_CMU", PANEL, "EditablePanel")
|
||||
|
||||
net.Receive("ixDataFilePDA_CMU_Open", function(length, client)
|
||||
local character = LocalPlayer():GetCharacter()
|
||||
|
||||
if (LocalPlayer():Team() == FACTION_MEDICAL or character:IsVortigaunt() and character:GetBioticPDA() == "CMU" ) then
|
||||
if IsValid(ix.gui.menu) then
|
||||
ix.gui.menu:Remove()
|
||||
end
|
||||
|
||||
surface.PlaySound("willardnetworks/datapad/open.wav")
|
||||
vgui.Create("ixDatafilePDA_CMU")
|
||||
end
|
||||
end)
|
||||
344
gamemodes/darkrp/plugins/n7stuff/derma/cl_datapad_cwu.lua
Normal file
344
gamemodes/darkrp/plugins/n7stuff/derma/cl_datapad_cwu.lua
Normal file
@@ -0,0 +1,344 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
local materialMainframe = ix.util.GetMaterial("willardnetworks/datafile/mainframe.png")
|
||||
local materialGadgetlight = ix.util.GetMaterial("willardnetworks/datafile/gadgetlight.png")
|
||||
local materialDataBackground = ix.util.GetMaterial("willardnetworks/datafile/buttonnoarrow.png")
|
||||
|
||||
local color_blueDark = Color(40, 88, 115, 75)
|
||||
local color_blueLight = Color(41, 243, 229, 255)
|
||||
local color_gray = Color(154, 169, 175, 255)
|
||||
|
||||
local font = "MenuFontNoClamp"
|
||||
|
||||
local dateFormat = "%d/%m/%Y"
|
||||
|
||||
local animationSpeed = {
|
||||
[true] = 1,
|
||||
[false] = 0.5
|
||||
}
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:MakePopup()
|
||||
Schema:AllowMessage(self)
|
||||
self.outputHeight = 0
|
||||
self.dividerWide = 0
|
||||
|
||||
local mainFrame = self:Add("EditablePanel")
|
||||
mainFrame:SetSize(SScaleMin(645 / 3), SScaleMin(850 / 3))
|
||||
mainFrame:Center()
|
||||
mainFrame.Paint = function(this, with, height)
|
||||
surface.SetDrawColor(color_white:Unpack())
|
||||
surface.SetMaterial(materialMainframe)
|
||||
surface.DrawTexturedRect(0, 0, with, height)
|
||||
end
|
||||
|
||||
local close = self:Add("DButton")
|
||||
close:SetSize(SScaleMin(107 / 3), SScaleMin(105 / 3))
|
||||
close:SetPos(self:GetWide() * 0.5 + mainFrame:GetWide() * 0.5 - close:GetWide() * 0.6, self:GetTall() * 0.5 - mainFrame:GetTall() * 0.5 - close:GetTall() * 0.4)
|
||||
close:SetText("")
|
||||
close.Paint = function(this, with, height)
|
||||
if this:IsHovered() then
|
||||
surface.SetDrawColor(ColorAlpha(color_white, 50))
|
||||
surface.SetMaterial(materialGadgetlight)
|
||||
surface.DrawTexturedRect(0, 0, with, height)
|
||||
end
|
||||
end
|
||||
|
||||
close.DoClick = function()
|
||||
surface.PlaySound("willardnetworks/datapad/close.wav")
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
local subFrame = self:Add("EditablePanel")
|
||||
subFrame:SetSize(mainFrame:GetWide() * 0.8, mainFrame:GetTall() * 0.5)
|
||||
subFrame:Center()
|
||||
subFrame:SetPos(subFrame.x, subFrame.y - SScaleMin(105 / 3))
|
||||
|
||||
self.dataSearch = subFrame:Add("ixDatapadSearchProfiles")
|
||||
self.dataSearch.sendData = function(this, text)
|
||||
self:UpdateStatus(L"pdaDatafile_search", "Warning")
|
||||
|
||||
net.Start("ixDataFilePDA_CWU_RequestData")
|
||||
net.WriteString(text)
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
self.dataSearch:GetChildren()[1]:GetChildren()[3]:Clear()
|
||||
self.dataSearch:GetChildren()[3]:GetChildren()[2].OnEnter = function(this)
|
||||
if (ix.config.Get("datafileNoConnection")) then
|
||||
LocalPlayer():NotifyLocalized("Error: no connection!")
|
||||
surface.PlaySound("hl1/fvox/buzz.wav")
|
||||
self.dataSearch.noConnection2:SetVisible(true)
|
||||
return
|
||||
end
|
||||
if self.outputFrame.inProgress then return end
|
||||
|
||||
surface.PlaySound("willardnetworks/datapad/navigate.wav")
|
||||
|
||||
if self.outputFrame.isOpen then
|
||||
self:UpdateStatus(L"pdaDatafile_search", "Warning")
|
||||
|
||||
return self:SetOutputDataHeight(0, false, function(isOpen)
|
||||
self.dataSearch:sendData(this:GetValue())
|
||||
end)
|
||||
end
|
||||
|
||||
self.dataSearch:sendData(this:GetValue())
|
||||
end
|
||||
|
||||
self.dividerLine = self.dataSearch:Add("DShape")
|
||||
self.dividerLine:SetType( "Rect" )
|
||||
self.dividerLine:SetSize(self.dividerWide, SScaleMin(1 / 3))
|
||||
self.dividerLine:SetPos(0, self.dataSearch:GetTall() - self.dividerLine:GetTall())
|
||||
self.dividerLine:SetColor(color_blueLight)
|
||||
|
||||
self.status = self.dataSearch:GetChildren()[1]:GetChildren()[3]:Add("DLabel")
|
||||
self:UpdateStatus(L"pdaDatafile_waiting", "Info")
|
||||
|
||||
self:InvalidateLayout(true)
|
||||
|
||||
self.outputFrame = self:Add("EditablePanel")
|
||||
self.outputFrame:SetSize(subFrame:GetWide(), self.outputHeight)
|
||||
self.outputFrame:SetPos(subFrame.x, self.dataSearch:GetTall() + subFrame.y)
|
||||
self.outputFrame.isOpen = false
|
||||
self.outputFrame.inProgress = false
|
||||
self.outputFrame.Paint = function(this, width, height)
|
||||
surface.SetDrawColor(color_blueDark)
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
self.outputScroll = self.outputFrame:Add("DScrollPanel")
|
||||
self.outputScroll:Dock(FILL)
|
||||
self.outputScroll:DockMargin(SScaleMin(2 / 3), SScaleMin(2 / 3), SScaleMin(2 / 3), SScaleMin(2 / 3))
|
||||
self.outputScroll.alphaOffset = 0.125
|
||||
|
||||
net.Receive("ixDataFilePDA_CWU_CheckData", function(_, client)
|
||||
local length = net.ReadUInt(32)
|
||||
local data = net.ReadData(length)
|
||||
local uncompressed = util.Decompress(data)
|
||||
|
||||
if (!uncompressed) then
|
||||
return self:UpdateStatus("Unable to decompress data", "Error")
|
||||
end
|
||||
|
||||
local output = util.JSONToTable(uncompressed)
|
||||
|
||||
self:UpdateStatus(output.status[1], output.status[2])
|
||||
|
||||
if output.id then
|
||||
output.status = nil
|
||||
|
||||
self:SetOutputDataHeight(SScaleMin(48 / 3) * 8 + SScaleMin(20 / 3), true)
|
||||
|
||||
self.outputScroll:Clear()
|
||||
self:OnGetData(output)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function AddAdditionalInfo(basePanel, title, subtitle)
|
||||
local top = basePanel:Add("DLabel")
|
||||
top:SetTextColor(color_gray)
|
||||
top:SetFont(font)
|
||||
top:SetText(title:utf8upper()..":")
|
||||
top:SizeToContents()
|
||||
top:SetPos(basePanel:GetWide() - top:GetWide() - SScaleMin(32 / 3), basePanel:GetTall() * 0.2 - top:GetTall() * 0.2)
|
||||
|
||||
local bottom = basePanel:Add("DLabel")
|
||||
bottom:SetTextColor(color_blueLight)
|
||||
bottom:SetFont(font)
|
||||
bottom:SetText(subtitle:utf8upper())
|
||||
bottom:SizeToContents()
|
||||
bottom:SetPos(basePanel:GetWide() - bottom:GetWide() - SScaleMin(32 / 3), basePanel:GetTall() - bottom:GetTall() - SScaleMin(4 / 3))
|
||||
end
|
||||
|
||||
local function addInfo(basePanel, title, subtitle, additionalTitle, additionalSubtitle)
|
||||
subtitle, additionalSubtitle = tostring(subtitle), tostring(additionalSubtitle)
|
||||
|
||||
local plugin = ix.plugin.Get("combineutilities")
|
||||
|
||||
local panel = basePanel:Add("EditablePanel")
|
||||
panel:SetSize(basePanel:GetWide(), SScaleMin(48 / 3))
|
||||
panel:Dock(TOP)
|
||||
panel:DockMargin(0, 1, 0, 1)
|
||||
panel:SetAlpha(0)
|
||||
panel:AlphaTo(255, 1, basePanel.alphaOffset)
|
||||
|
||||
plugin:CreateRow(panel, title, subtitle)
|
||||
|
||||
panel.Paint = function(this, width, height)
|
||||
surface.SetDrawColor(ColorAlpha(color_white, 50))
|
||||
surface.SetMaterial(materialDataBackground)
|
||||
surface.DrawTexturedRect(0, 0, width, height)
|
||||
end
|
||||
|
||||
if additionalTitle then
|
||||
AddAdditionalInfo(panel, additionalTitle, additionalSubtitle)
|
||||
end
|
||||
|
||||
basePanel.alphaOffset = basePanel.alphaOffset + 0.125
|
||||
|
||||
return panel
|
||||
end
|
||||
|
||||
function PANEL:OnGetData(data)
|
||||
self.outputScroll.alphaOffset = 0.125
|
||||
|
||||
local anticitizen = addInfo(self.outputScroll, L("pdaDatafile_data_anticitizen"), data.anticitizen, L("pdaDatafile_data_bol"), data.bol)
|
||||
|
||||
if data.anticitizen or data.bol then
|
||||
local color = data.anticitizen and derma.GetColor("Error", anticitizen) or derma.GetColor("Warning", anticitizen)
|
||||
|
||||
local oldPaint = anticitizen.Paint
|
||||
anticitizen.Paint = function(this, width, height)
|
||||
surface.SetDrawColor(ColorAlpha(color, 69))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
oldPaint(this, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
local permits = addInfo(self.outputScroll, L("pdaDatafile_data_permits"), "")
|
||||
permits.oldHeight = permits:GetTall()
|
||||
permits.newHeight = 0
|
||||
|
||||
local permitsButton = permits:Add("DButton")
|
||||
permitsButton:SetTextColor(color_blueLight)
|
||||
permitsButton:SetFont(font)
|
||||
permitsButton:SetText(L("pdaDatafile_data_permits_buttonShow"):utf8upper())
|
||||
permitsButton:SizeToContentsY()
|
||||
permitsButton:SetWide(permits:GetWide() - SScaleMin(24 / 3))
|
||||
permitsButton:SetPos(SScaleMin(4 / 3), permits:GetTall() - permitsButton:GetTall() - SScaleMin(4 / 3))
|
||||
permitsButton.isOpen = false
|
||||
permitsButton.inProgress = false
|
||||
permitsButton._SetHeight = function(this, height)
|
||||
this.inProgress = true
|
||||
|
||||
permits:CreateAnimation(animationSpeed[this.isOpen], {
|
||||
index = 0,
|
||||
target = { newHeight = height },
|
||||
easing = "outQuint",
|
||||
Think = function(animation, panel)
|
||||
panel:SetTall(panel.newHeight)
|
||||
end,
|
||||
OnComplete = function(animation, panel)
|
||||
permitsButton.inProgress = false
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
local permitsPanel = permits:Add("EditablePanel")
|
||||
permitsPanel:SetWide(permits:GetWide())
|
||||
permitsPanel:SetTall(0)
|
||||
permitsPanel:SetPos(0, permitsButton.y + permitsButton:GetTall())
|
||||
|
||||
local y = SScaleMin(8 / 3)
|
||||
|
||||
for k, _ in pairs(ix.permits.list) do
|
||||
if data.permits[k] then
|
||||
local left = permitsPanel:Add("DLabel")
|
||||
left:SetTextColor(color_gray)
|
||||
left:SetFont(font)
|
||||
left:SetText(k:utf8upper())
|
||||
left:SizeToContents()
|
||||
left:SetPos(SScaleMin(20 / 3), y)
|
||||
|
||||
local right = permitsPanel:Add("DLabel")
|
||||
right:SetTextColor(color_blueLight)
|
||||
right:SetFont(font)
|
||||
right:SetText(isbool(data.permits[k]) and L("pdaDatafile_data_permitsUnlimited"):utf8upper() or os.date(dateFormat, data.permits[k]))
|
||||
right:SizeToContents()
|
||||
right:SetPos(permitsPanel:GetWide() - right:GetWide() - SScaleMin(32 / 3), y)
|
||||
|
||||
y = y + left:GetTall() + SScaleMin(8 / 3)
|
||||
end
|
||||
end
|
||||
|
||||
permitsPanel:SetTall(y)
|
||||
|
||||
permitsButton.permitsTall = permits.oldHeight + y
|
||||
permitsButton.DoClick = function(this, width, height)
|
||||
if this.inProgress then return end
|
||||
|
||||
surface.PlaySound("willardnetworks/datapad/navigate2.wav")
|
||||
|
||||
this.isOpen = !this.isOpen
|
||||
|
||||
local translate = this.isOpen and "pdaDatafile_data_permits_buttonHide" or "pdaDatafile_data_permits_buttonShow"
|
||||
|
||||
this:SetText(L(translate):utf8upper())
|
||||
this:_SetHeight(this.isOpen and this.permitsTall or permits.oldHeight)
|
||||
end
|
||||
|
||||
permitsButton.Paint = function(this, width, height)
|
||||
local alpha = this:IsHovered() and 125 or 69
|
||||
|
||||
surface.SetDrawColor(ColorAlpha(color_white, alpha))
|
||||
surface.SetMaterial(materialDataBackground)
|
||||
surface.DrawTexturedRect(0, 0, width, height)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:UpdateStatus(text, color)
|
||||
if color == "Error" then
|
||||
surface.PlaySound("willardnetworks/datapad/deny.wav")
|
||||
end
|
||||
|
||||
self.status:SetFont(font)
|
||||
self.status:SetTextColor(derma.GetColor(color, self.status))
|
||||
self.status:SetText(text:utf8upper())
|
||||
self.status:SizeToContents()
|
||||
self.status:Dock(RIGHT)
|
||||
self.status:DockMargin(0, 0, SScaleMin(4 / 4), SScaleMin(6 / 3))
|
||||
end
|
||||
|
||||
function PANEL:SetOutputDataHeight(height, boolean, callback)
|
||||
local dataSearchWide = self.dataSearch:GetWide()
|
||||
|
||||
self.outputFrame.inProgress = true
|
||||
|
||||
self:CreateAnimation(animationSpeed[boolean], {
|
||||
index = -1,
|
||||
target = { outputHeight = height, dividerWide = boolean and dataSearchWide or 0 },
|
||||
easing = "outQuint",
|
||||
Think = function(animation, panel)
|
||||
panel.outputFrame:SetTall(panel.outputHeight)
|
||||
panel.dividerLine:SetWide(panel.dividerWide)
|
||||
end,
|
||||
OnComplete = function(animation, panel)
|
||||
panel.outputFrame.isOpen = boolean
|
||||
panel.outputFrame.inProgress = false
|
||||
|
||||
if callback then
|
||||
callback(boolean)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vgui.Register("ixDatafilePDA_CWU", PANEL, "EditablePanel")
|
||||
|
||||
net.Receive("ixDataFilePDA_CWU_Open", function(length, client)
|
||||
local character = LocalPlayer():GetCharacter()
|
||||
|
||||
if LocalPlayer():Team() == FACTION_WORKERS or character:IsVortigaunt() and character:GetBioticPDA() == "CWU" then
|
||||
if IsValid(ix.gui.menu) then
|
||||
ix.gui.menu:Remove()
|
||||
end
|
||||
|
||||
surface.PlaySound("willardnetworks/datapad/open.wav")
|
||||
vgui.Create("ixDatafilePDA_CWU")
|
||||
end
|
||||
end)
|
||||
@@ -0,0 +1,75 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
--[[-------------------------------------------------------------------------
|
||||
TODO: PLAY ANIMATION WHEN DEPLOYING SUPPORT
|
||||
---------------------------------------------------------------------------]]
|
||||
ENT.Base = "base_entity"
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Broke (Electricity)"
|
||||
ENT.Category = "Helix"
|
||||
ENT.Spawnable = true
|
||||
ENT.RenderGroup = RENDERGROUP_BOTH
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/hunter/blocks/cube025x025x025.mdl")
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetNoDraw(true)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self.health = 200
|
||||
self:SetNetVar("destroyed", true)
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local curTime = CurTime()
|
||||
|
||||
if self:GetNetVar("destroyed", false) == true then
|
||||
if !self.nextSpark or self.nextSpark <= curTime then
|
||||
if (!IsValid(self.spark)) then
|
||||
self.spark = ents.Create("env_spark")
|
||||
end
|
||||
self.spark:SetPos(self:GetPos() + Vector(0, 10, 0))
|
||||
self.spark:Fire("SparkOnce")
|
||||
|
||||
self.nextSpark = curTime + 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(user)
|
||||
local item = user:GetCharacter():GetInventory():HasItem("tool_toolkit")
|
||||
if self:GetNetVar("destroyed", false) == true and !item then
|
||||
user:Notify("Vous avez besoin d'une boîte à outils pour réparer les dégâts") -- message when dont work and you dont have item
|
||||
return false
|
||||
else
|
||||
if item and self:GetNetVar("destroyed", false) == true then
|
||||
user:Freeze(true)
|
||||
user:SetAction("Réparation en cours...", 12, function() -- line with text when you repair it
|
||||
item = user:GetCharacter():GetInventory():HasItem("tool_toolkit")
|
||||
|
||||
if (item) then
|
||||
if (item.isTool) then
|
||||
item:DamageDurability(1)
|
||||
end
|
||||
|
||||
self:SetNetVar("destroyed", false)
|
||||
user:Freeze(false)
|
||||
self.health = 200
|
||||
self:EmitSound("physics/cardboard/cardboard_box_impact_hard7.wav", 100, 75)
|
||||
self:Remove()
|
||||
user:Notify("Vous avez réparé avec succès les problèmes électriques") -- message when you finish the job
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,115 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
--[[-------------------------------------------------------------------------
|
||||
TODO: PLAY ANIMATION WHEN DEPLOYING SUPPORT
|
||||
---------------------------------------------------------------------------]]
|
||||
ENT.Base = "base_entity"
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Broken (Gas)"
|
||||
ENT.Category = "Helix"
|
||||
ENT.Spawnable = true
|
||||
ENT.RenderGroup = RENDERGROUP_BOTH
|
||||
|
||||
sound.Add( {
|
||||
name = "SteamLoop1.Play",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 0.6,
|
||||
level = 70,
|
||||
pitch = { 100, 100 },
|
||||
sound = "ambient/gas/steam2.wav"
|
||||
} )
|
||||
|
||||
sound.Add( {
|
||||
name = "SteamLoop2.Play",
|
||||
channel = CHAN_STATIC,
|
||||
volume = 0.6,
|
||||
level = 70,
|
||||
pitch = { 100, 100 },
|
||||
sound = "ambient/gas/steam_loop1.wav"
|
||||
} )
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
|
||||
self:SetModel("models/hunter/blocks/cube025x025x025.mdl")
|
||||
self:SetNoDraw(true)
|
||||
self:DrawShadow(false)
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self.health = 200
|
||||
self:SetNetVar("destroyed", true)
|
||||
local self_name = "steam_base" .. self:EntIndex()
|
||||
self:SetName( self_name )
|
||||
|
||||
local phys1 = self:GetPhysicsObject()
|
||||
if ( IsValid( phys1 ) ) then
|
||||
phys1:Sleep()
|
||||
phys1:SetMass(100)
|
||||
end
|
||||
self:EmitSound("SteamLoop2.Play")
|
||||
self.steam = ents.Create("env_steam")
|
||||
self.steam:SetPos( self:GetPos())
|
||||
self.steam:SetAngles( self:GetAngles() )
|
||||
self.steam:SetKeyValue( "InitialState", "1" )
|
||||
self.steam:SetKeyValue( "SpreadSpeed", 15)
|
||||
self.steam:SetKeyValue( "Speed", 120 )
|
||||
self.steam:SetKeyValue( "StartSize", 10 )
|
||||
self.steam:SetKeyValue( "EndSize", 35 )
|
||||
self.steam:SetKeyValue( "Rate", 26 )
|
||||
self.steam:SetKeyValue( "JetLength", 20 )
|
||||
self.steam:SetKeyValue( "renderamt", 255 )
|
||||
self.steam:SetKeyValue( "type", 0 )
|
||||
self.steam:SetKeyValue("spawnflags", "16" + "32")
|
||||
self.steam:SetOwner( self.Owner )
|
||||
self.steam:SetParent(self)
|
||||
self.steam:Spawn()
|
||||
self.steam:Activate()
|
||||
local steam_name = "steam" .. self.steam:EntIndex()
|
||||
self.steam:SetName( steam_name )
|
||||
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:StopSound("SteamLoop1.Play")
|
||||
self:StopSound("SteamLoop2.Play")
|
||||
end
|
||||
|
||||
function ENT:Use(user)
|
||||
local item = user:GetCharacter():GetInventory():HasItem("tool_toolkit")
|
||||
if self:GetNetVar("destroyed", false) == true and !item then
|
||||
user:Notify("Le tuyau est cassé ! Vous avez besoin d'une boîte à outils pour le réparer.") -- message when dont work and you dont have item
|
||||
return false
|
||||
else
|
||||
if item and self:GetNetVar("destroyed", false) == true then
|
||||
user:Freeze(true)
|
||||
user:SetAction("Réparation en cours...", 12, function() -- line with text when you repair it
|
||||
item = user:GetCharacter():GetInventory():HasItem("tool_toolkit")
|
||||
|
||||
if (item) then
|
||||
if (item.isTool) then
|
||||
item:DamageDurability(1)
|
||||
end
|
||||
|
||||
self:SetNetVar("destroyed", false)
|
||||
user:Freeze(false)
|
||||
self.health = 200
|
||||
self:EmitSound("physics/cardboard/cardboard_box_impact_hard7.wav", 100, 75)
|
||||
self:Remove()
|
||||
user:Notify("Vous avez réparé le tuyau.") -- message when you finish the job
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,76 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
--[[-------------------------------------------------------------------------
|
||||
TODO: PLAY ANIMATION WHEN DEPLOYING SUPPORT
|
||||
---------------------------------------------------------------------------]]
|
||||
ENT.Base = "base_entity"
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Broken (Water)"
|
||||
ENT.Category = "Helix"
|
||||
ENT.Spawnable = true
|
||||
ENT.RenderGroup = RENDERGROUP_BOTH
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/hunter/blocks/cube025x025x025.mdl")
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetNoDraw(true)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self.health = 200
|
||||
self:SetNetVar("destroyed", true)
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local curTime = CurTime()
|
||||
|
||||
if self:GetNetVar("destroyed", false) == true then
|
||||
if !self.nextSpark or self.nextSpark <= curTime then
|
||||
if (!IsValid(self.spark)) then
|
||||
self.spark = ents.Create("env_splash")
|
||||
end
|
||||
self.spark:SetPos(self:GetPos() + Vector(0, 10, 0))
|
||||
self.spark:SetKeyValue( "scale", 3 )
|
||||
self.spark:Fire("Splash")
|
||||
|
||||
self.nextSpark = curTime + 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(user)
|
||||
local item = user:GetCharacter():GetInventory():HasItem("tool_toolkit")
|
||||
if self:GetNetVar("destroyed", false) == true and !item then
|
||||
user:Notify("L'alimentation en eau a une fuite ! Vous avez besoin d'une boîte à outils pour la réparer.") -- message when dont work and you dont have item
|
||||
return false
|
||||
else
|
||||
if item and self:GetNetVar("destroyed", false) == true then
|
||||
user:Freeze(true)
|
||||
user:SetAction("Réparation en cours...", 12, function() -- line with text when you repair it
|
||||
item = user:GetCharacter():GetInventory():HasItem("tool_toolkit")
|
||||
|
||||
if (item) then
|
||||
if (item.isTool) then
|
||||
item:DamageDurability(1)
|
||||
end
|
||||
|
||||
self:SetNetVar("destroyed", false)
|
||||
user:Freeze(false)
|
||||
self.health = 200
|
||||
self:EmitSound("physics/cardboard/cardboard_box_impact_hard7.wav", 100, 75)
|
||||
self:Remove()
|
||||
user:Notify("Vous avez réparé le tuyeau d'eau.") -- message when you finish the job
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
surface.CreateFont( "ScaffoldFont", {
|
||||
font = "Open Sans",
|
||||
extended = true,
|
||||
size = 30,
|
||||
weight = 500
|
||||
} )
|
||||
|
||||
|
||||
function ENT:Initialize()
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
|
||||
local TIMER;
|
||||
if (self:GetNWInt('timer') < CurTime()) then
|
||||
TIMER = 0
|
||||
else
|
||||
TIMER = (self:GetNWInt('timer')-CurTime())
|
||||
end
|
||||
self:DrawModel()
|
||||
|
||||
local Pos = self:GetPos()
|
||||
local Ang = self:GetAngles()
|
||||
|
||||
Ang:RotateAroundAxis(Ang:Forward(), 90)
|
||||
Ang:RotateAroundAxis(Ang:Right(), -90)
|
||||
|
||||
if LocalPlayer():GetPos():Distance(self:GetPos()) < 400 then
|
||||
cam.Start3D2D(Pos + Ang:Up() * 50, Ang, 0.3)
|
||||
draw.WordBox(0, -100, -190, "Échafaudage de construction", "ScaffoldFont", Color(255, 78, 69, 0), Color(240, 240, 240,255))
|
||||
draw.WordBox(0, -130, -150, "Matériaux de construction: "..self:GetNWInt("ItemsRequired").."/40", "ScaffoldFont", Color(255, 78, 69, 0), Color(240, 240, 240,255)) -- /40
|
||||
if self:GetNWInt("ItemsRequired") == 40 then
|
||||
draw.WordBox(0, -100, -110, "Bâtiment achevé", "ScaffoldFont", Color(28, 161, 34, 0), Color(28, 161, 34,255))
|
||||
end
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
end
|
||||
@@ -0,0 +1,61 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/props/de_inferno/scaffolding.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
phys:Wake()
|
||||
self.items = 0
|
||||
self:SetNWInt("ItemsRequired", 0)
|
||||
self:SetUseType( SIMPLE_USE )
|
||||
self.LastUse = 0
|
||||
self.Delay = 2
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
-- Timer to pretend abuse
|
||||
if self.LastUse <= CurTime() then
|
||||
self.LastUse = CurTime() + self.Delay
|
||||
|
||||
activator:Notify("Placez-y les matériaux de construction.") -- Notify on press E
|
||||
end
|
||||
end
|
||||
|
||||
local worksound = {
|
||||
"physics/wood/wood_box_break1.wav",
|
||||
"physics/wood/wood_box_break2.wav",
|
||||
"physics/wood/wood_crate_break2.wav",
|
||||
"physics/wood/wood_plank_break3.wav"
|
||||
}
|
||||
function ENT:StartTouch( hitEnt )
|
||||
if (self:GetNWInt("ItemsRequired") == 40) then return end -- max of items
|
||||
|
||||
if (hitEnt:GetClass() == "ix_item") then
|
||||
if (hitEnt:GetItemID() != "buildingmaterials") then -- Check item id to accept item
|
||||
return
|
||||
end
|
||||
|
||||
hitEnt:Remove()
|
||||
self.items = self.items + 1
|
||||
self:SetNWInt("ItemsRequired", self.items)
|
||||
self:EmitSound(worksound[math.random(1, #worksound)])
|
||||
|
||||
ix.saveEnts:SaveEntity(self)
|
||||
|
||||
--if self:GetNWInt("ItemsRequired") != 40 then return end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
ENT.PrintName = "Scaffold"
|
||||
ENT.Category = "Other"
|
||||
ENT.Author = "Legion"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
@@ -0,0 +1,57 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
surface.CreateFont( "WashingMachine", {
|
||||
font = "Roboto Light",
|
||||
extended = false,
|
||||
size = 25,
|
||||
weight = 500,
|
||||
extended = true
|
||||
} )
|
||||
|
||||
|
||||
function ENT:Initialize()
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
|
||||
local TIMER;
|
||||
if (self:GetNWInt('timer') < CurTime()) then
|
||||
TIMER = 0
|
||||
else
|
||||
TIMER = (self:GetNWInt('timer')-CurTime())
|
||||
end
|
||||
self:DrawModel()
|
||||
|
||||
local Pos = self:GetPos()
|
||||
local Ang = self:GetAngles()
|
||||
|
||||
Ang:RotateAroundAxis(Ang:Forward(), 90)
|
||||
Ang:RotateAroundAxis(Ang:Right(), -90)
|
||||
|
||||
if LocalPlayer():GetPos():Distance(self:GetPos()) < 200 then
|
||||
cam.Start3D2D(Pos + Ang:Up() * 14, Ang, 0.11)
|
||||
if (self:GetNWInt('timer') > CurTime()) then
|
||||
draw.RoundedBox(6, -47, -75, 165, 40, Color(15,15,15,225))
|
||||
draw.WordBox(2, -42, -70, "Processus : "..string.ToMinutesSeconds(TIMER), "WashingMachine", Color(214, 181, 16, 200), Color(35,35,35,255))
|
||||
end
|
||||
draw.RoundedBox(6, -105, -125, 195, 44, Color(15,15,15,225)) -- Name
|
||||
draw.RoundedBox(6, -105, -75, 50, 40, Color(15,15,15,225)) -- /3
|
||||
draw.WordBox(2, -100, -117, "Machine à laver", "WashingMachine", Color(214, 181, 16, 200), Color(35,35,35,255))
|
||||
draw.WordBox(2, -100, -70, self:GetNWInt("ItemsRequired").."/3", "WashingMachine", Color(214, 163, 16, 200), Color(35,35,35,255))
|
||||
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
end
|
||||
@@ -0,0 +1,127 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/props_c17/FurnitureWashingmachine001a.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
phys:Wake()
|
||||
self:SetNWInt("ItemsRequired", 0)
|
||||
self:SetUseType( SIMPLE_USE )
|
||||
self.LastUse = 0
|
||||
self.Delay = 2
|
||||
|
||||
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
-- Timer to pretend abuse
|
||||
if self.LastUse <= CurTime() then
|
||||
self.LastUse = CurTime() + self.Delay
|
||||
|
||||
activator:Notify("Ajouter les vêtements sales.") -- Notify on press E
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:StartTouch( hitEnt )
|
||||
|
||||
if hitEnt:GetClass() == "ix_item" then
|
||||
local TimerSoundC = "plats/hall_elev_door.wav"
|
||||
local WorkTime = 10 -- work time
|
||||
|
||||
if hitEnt:GetModel() != "models/willardnetworks/clothingitems/torso_citizen_refugee.mdl" then -- Check model to accept item
|
||||
return end
|
||||
|
||||
if self:GetNWInt("ItemsRequired") == 3 then return end
|
||||
|
||||
hitEnt:Remove()
|
||||
self:SetNWInt("ItemsRequired", (self:GetNWInt("ItemsRequired") + 1))
|
||||
self:EmitSound("physics/body/body_medium_impact_soft5.wav")
|
||||
|
||||
if self:GetNWInt("ItemsRequired") != 3 then return end
|
||||
|
||||
self:EmitSound("items/medshot4.wav")
|
||||
self:EmitSound("plats/tram_hit1.wav")
|
||||
self:SetNWInt('timer', CurTime() + WorkTime)
|
||||
|
||||
|
||||
|
||||
-- Sounds after work start (if you gonna make work more than 10 seconds, add new sounds and keep timer growing
|
||||
timer.Simple(0.2, function()
|
||||
self:EmitSound("plats/tram_motor_start.wav")
|
||||
|
||||
end)
|
||||
timer.Simple(0.4, function()
|
||||
self:EmitSound(TimerSoundC)
|
||||
self.sound = CreateSound(self, Sound("plats/tram_move.wav"))
|
||||
self.sound:SetSoundLevel(50)
|
||||
self.sound:PlayEx(1, 200)
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
timer.Simple(0.8, function()
|
||||
self:EmitSound(TimerSoundC)
|
||||
|
||||
end)
|
||||
timer.Simple(1.2, function()
|
||||
self:EmitSound(TimerSoundC)
|
||||
|
||||
end)
|
||||
timer.Simple(1.4, function()
|
||||
self:EmitSound(TimerSoundC)
|
||||
|
||||
end)
|
||||
timer.Simple(2, function()
|
||||
self:EmitSound(TimerSoundC)
|
||||
|
||||
end)
|
||||
|
||||
|
||||
timer.Simple(4, function()
|
||||
self:EmitSound("physics/cardboard/cardboard_box_impact_soft5.wav")
|
||||
|
||||
end)
|
||||
timer.Simple(5, function()
|
||||
self:EmitSound("physics/cardboard/cardboard_box_impact_hard4.wav")
|
||||
|
||||
end)
|
||||
timer.Simple(6.5, function()
|
||||
self:EmitSound("physics/flesh/flesh_impact_hard6.wav")
|
||||
|
||||
end)
|
||||
timer.Simple(7, function()
|
||||
self:EmitSound("physics/flesh/flesh_impact_hard6.wav")
|
||||
|
||||
end)
|
||||
|
||||
timer.Simple(WorkTime - 2, function()
|
||||
if self.sound then
|
||||
self.sound:Stop()
|
||||
end
|
||||
self:EmitSound("plats/elevator_large_stop1.wav")
|
||||
end)
|
||||
timer.Simple(WorkTime, function()
|
||||
self:SetNWInt("ItemsRequired", 0)
|
||||
ix.item.Spawn("clean_clothes", Vector(self:GetPos().x + 0.5, self:GetPos().y - 20, self:GetPos().z + 6)) -- Spawn item (maybe need edit some pos)
|
||||
ix.item.Spawn("clean_clothes", Vector(self:GetPos().x + 0.5, self:GetPos().y - 28, self:GetPos().z + 12))
|
||||
ix.item.Spawn("clean_clothes", Vector(self:GetPos().x + 0.5, self:GetPos().y - 36, self:GetPos().z + 20))
|
||||
end)
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
ENT.PrintName = "Machine à laver"
|
||||
ENT.Category = "Other"
|
||||
ENT.Author = "Legion"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
16
gamemodes/darkrp/plugins/n7stuff/items/sh_clean_clothes.lua
Normal file
16
gamemodes/darkrp/plugins/n7stuff/items/sh_clean_clothes.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ITEM.name = "Vêtements propres"
|
||||
ITEM.model = Model("models/willardnetworks/clothingitems/torso_citizen2.mdl")
|
||||
ITEM.description = "Un amas soigneusement plié de vêtements fraîchement lavés trône devant vous."
|
||||
ITEM.category = "Autres"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
16
gamemodes/darkrp/plugins/n7stuff/items/sh_dirty_clothes.lua
Normal file
16
gamemodes/darkrp/plugins/n7stuff/items/sh_dirty_clothes.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ITEM.name = "Vêtements sales"
|
||||
ITEM.model = Model("models/willardnetworks/clothingitems/torso_citizen_refugee.mdl")
|
||||
ITEM.description = " Une montagne négligée de vêtements souillés trône devant vous. La pile dégage une odeur distincte de saleté et de transpiration, tandis que les vêtements froissés et tachés se mêlent les uns aux autres dans un amas désordonné."
|
||||
ITEM.category = "Autres"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
32
gamemodes/darkrp/plugins/n7stuff/items/sh_pda_cmu.lua
Normal file
32
gamemodes/darkrp/plugins/n7stuff/items/sh_pda_cmu.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "CMRU PDA"
|
||||
ITEM.model = Model("models/fruity/tablet/tablet_sfm.mdl")
|
||||
ITEM.description = "Civilian issued PDA for local CMRU groups."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.KeepOnDeath = true
|
||||
|
||||
ITEM.functions.Open = {
|
||||
OnRun = function(item)
|
||||
net.Start("ixDataFilePDA_CMU_Open")
|
||||
net.Send(item.player)
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
local character = item.player:GetCharacter()
|
||||
|
||||
return item.player:Team() == FACTION_MEDICAL or character:IsVortigaunt() and character:GetBioticPDA() == "CMU"
|
||||
end
|
||||
}
|
||||
32
gamemodes/darkrp/plugins/n7stuff/items/sh_pda_cwu.lua
Normal file
32
gamemodes/darkrp/plugins/n7stuff/items/sh_pda_cwu.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "Datapad UTC-Recrue"
|
||||
ITEM.model = Model("models/fruity/tablet/tablet_sfm.mdl")
|
||||
ITEM.description = "Un datapad pour les recrues UTC."
|
||||
ITEM.category = "Combine"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.KeepOnDeath = true
|
||||
|
||||
ITEM.functions.Open = {
|
||||
OnRun = function(item)
|
||||
net.Start("ixDataFilePDA_CWU_Open")
|
||||
net.Send(item.player)
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
local character = item.player:GetCharacter()
|
||||
|
||||
return item.player:Team() == FACTION_WORKERS or character:IsVortigaunt() and character:GetBioticPDA() == "CWU"
|
||||
end
|
||||
}
|
||||
36
gamemodes/darkrp/plugins/n7stuff/languages/sh_english.lua
Normal file
36
gamemodes/darkrp/plugins/n7stuff/languages/sh_english.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
LANGUAGE = {
|
||||
pdaDatafile_waiting = "En attente d'entrée",
|
||||
pdaDatafile_search = "recherche...",
|
||||
pdaDatafile_notFound = "Aucun résultat. essayer à nouveau.",
|
||||
pdaDatafile_noAccess = "Vous n'avez pas accès à ces données.",
|
||||
|
||||
pdaDatafile_data_socialCredits = "Crédits sociaux",
|
||||
pdaDatafile_data_socialCreditsDate = "Dernière mise à jour",
|
||||
pdaDatafile_data_permits = "Permis",
|
||||
pdaDatafile_data_permitsUnlimited = "Illimité",
|
||||
pdaDatafile_data_permits_buttonShow = "Montrer",
|
||||
pdaDatafile_data_permits_buttonHide = "Cacher",
|
||||
pdaDatafile_data_shop = "Boutique",
|
||||
pdaDatafile_data_housing = "Logement",
|
||||
pdaDatafile_data_wages = "Salaires supplémentaires ajoutés aux rations",
|
||||
pdaDatafile_data_anticitizen = "Anti-citoyen",
|
||||
pdaDatafile_data_geneticDesc = "Description génétique",
|
||||
pdaDatafile_data_occupation = "Profession",
|
||||
pdaDatafile_data_occupationDate = "Dernière mise à jour",
|
||||
pdaDatafile_data_loyaltyStatus = "Statut de loyauté",
|
||||
pdaDatafile_data_cid = "CID",
|
||||
pdaDatafile_data_designatedStatus = "Statut désigné",
|
||||
pdaDatafile_data_designatedStatusDate = "Dernière mise à jour",
|
||||
pdaDatafile_data_bol = "recherché",
|
||||
pdaDatafile_data_name = "nom"
|
||||
}
|
||||
36
gamemodes/darkrp/plugins/n7stuff/languages/sh_french.lua
Normal file
36
gamemodes/darkrp/plugins/n7stuff/languages/sh_french.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
LANGUAGE = {
|
||||
pdaDatafile_waiting = "En attente d'entrée",
|
||||
pdaDatafile_search = "recherche...",
|
||||
pdaDatafile_notFound = "Aucun résultat. essayer à nouveau.",
|
||||
pdaDatafile_noAccess = "Vous n'avez pas accès à ces données.",
|
||||
|
||||
pdaDatafile_data_socialCredits = "Crédits sociaux",
|
||||
pdaDatafile_data_socialCreditsDate = "Dernière mise à jour",
|
||||
pdaDatafile_data_permits = "Permis",
|
||||
pdaDatafile_data_permitsUnlimited = "Illimité",
|
||||
pdaDatafile_data_permits_buttonShow = "Montrer",
|
||||
pdaDatafile_data_permits_buttonHide = "Cacher",
|
||||
pdaDatafile_data_shop = "Boutique",
|
||||
pdaDatafile_data_housing = "Logement",
|
||||
pdaDatafile_data_wages = "Salaires supplémentaires ajoutés aux rations",
|
||||
pdaDatafile_data_anticitizen = "Anti-citoyen",
|
||||
pdaDatafile_data_geneticDesc = "Description génétique",
|
||||
pdaDatafile_data_occupation = "Profession",
|
||||
pdaDatafile_data_occupationDate = "Dernière mise à jour",
|
||||
pdaDatafile_data_loyaltyStatus = "Statut de loyauté",
|
||||
pdaDatafile_data_cid = "CID",
|
||||
pdaDatafile_data_designatedStatus = "Statut désigné",
|
||||
pdaDatafile_data_designatedStatusDate = "Dernière mise à jour",
|
||||
pdaDatafile_data_bol = "recherché",
|
||||
pdaDatafile_data_name = "nom"
|
||||
}
|
||||
36
gamemodes/darkrp/plugins/n7stuff/languages/sh_russian.lua
Normal file
36
gamemodes/darkrp/plugins/n7stuff/languages/sh_russian.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
LANGUAGE = {
|
||||
pdaDatafile_waiting = "en attente d'entrée",
|
||||
pdaDatafile_search = "recherche...",
|
||||
pdaDatafile_notFound = "Aucun résultat. essayer à nouveau.",
|
||||
pdaDatafile_noAccess = "vous n'avez pas accès à ces données.",
|
||||
|
||||
pdaDatafile_data_socialCredits = "crédits sociaux",
|
||||
pdaDatafile_data_socialCreditsDate = "dernière mise à jour",
|
||||
pdaDatafile_data_permits = "permis",
|
||||
pdaDatafile_data_permitsUnlimited = "illimité",
|
||||
pdaDatafile_data_permits_buttonShow = "montrer",
|
||||
pdaDatafile_data_permits_buttonHide = "cacher",
|
||||
pdaDatafile_data_shop = "boutique",
|
||||
pdaDatafile_data_housing = "logement",
|
||||
pdaDatafile_data_wages = "salaires supplémentaires ajoutés aux rations",
|
||||
pdaDatafile_data_anticitizen = "anti-citoyen",
|
||||
pdaDatafile_data_geneticDesc = "description génétique",
|
||||
pdaDatafile_data_occupation = "profession",
|
||||
pdaDatafile_data_occupationDate = "dernière mise à jour",
|
||||
pdaDatafile_data_loyaltyStatus = "statut de loyauté",
|
||||
pdaDatafile_data_cid = "cid",
|
||||
pdaDatafile_data_designatedStatus = "statut désigné",
|
||||
pdaDatafile_data_designatedStatusDate = "dernière mise à jour",
|
||||
pdaDatafile_data_bol = "bol",
|
||||
pdaDatafile_data_name = "nom"
|
||||
}
|
||||
36
gamemodes/darkrp/plugins/n7stuff/languages/sh_spanish.lua
Normal file
36
gamemodes/darkrp/plugins/n7stuff/languages/sh_spanish.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
LANGUAGE = {
|
||||
pdaDatafile_waiting = "en attente d'entrée",
|
||||
pdaDatafile_search = "recherche...",
|
||||
pdaDatafile_notFound = "Aucun résultat. essayer à nouveau.",
|
||||
pdaDatafile_noAccess = "vous n'avez pas accès à ces données.",
|
||||
|
||||
pdaDatafile_data_socialCredits = "crédits sociaux",
|
||||
pdaDatafile_data_socialCreditsDate = "dernière mise à jour",
|
||||
pdaDatafile_data_permits = "permis",
|
||||
pdaDatafile_data_permitsUnlimited = "illimité",
|
||||
pdaDatafile_data_permits_buttonShow = "montrer",
|
||||
pdaDatafile_data_permits_buttonHide = "cacher",
|
||||
pdaDatafile_data_shop = "boutique",
|
||||
pdaDatafile_data_housing = "logement",
|
||||
pdaDatafile_data_wages = "salaires supplémentaires ajoutés aux rations",
|
||||
pdaDatafile_data_anticitizen = "anti-citoyen",
|
||||
pdaDatafile_data_geneticDesc = "description génétique",
|
||||
pdaDatafile_data_occupation = "profession",
|
||||
pdaDatafile_data_occupationDate = "dernière mise à jour",
|
||||
pdaDatafile_data_loyaltyStatus = "statut de loyauté",
|
||||
pdaDatafile_data_cid = "cid",
|
||||
pdaDatafile_data_designatedStatus = "statut désigné",
|
||||
pdaDatafile_data_designatedStatusDate = "dernière mise à jour",
|
||||
pdaDatafile_data_bol = "bol",
|
||||
pdaDatafile_data_name = "nom"
|
||||
}
|
||||
78
gamemodes/darkrp/plugins/n7stuff/sh_plugin.lua
Normal file
78
gamemodes/darkrp/plugins/n7stuff/sh_plugin.lua
Normal file
@@ -0,0 +1,78 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
PLUGIN.name = "WN7sfuff"
|
||||
PLUGIN.description = "Some fun staff!!"
|
||||
PLUGIN.author = "Legion"
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
|
||||
if (CLIENT) then
|
||||
function PLUGIN:InitializedPlugins()
|
||||
local function drawWorkESP(client, entity, x, y, factor)
|
||||
ix.util.DrawText("Cassé (Travail) "..entity:GetClass(), x, y - math.max(10, 32 * factor), Color(185, 179, 38),
|
||||
TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, nil, math.max(255 * factor, 80))
|
||||
end
|
||||
|
||||
ix.observer:RegisterESPType("ix_workerk_water", drawWorkESP, "work")
|
||||
ix.observer:RegisterESPType("ix_workerk_gas", drawWorkESP, "work")
|
||||
ix.observer:RegisterESPType("ix_workerk_electric", drawWorkESP, "work")
|
||||
end
|
||||
else
|
||||
-- Called when loading all the data that has been saved.
|
||||
function PLUGIN:LoadData()
|
||||
if (!ix.config.Get("SaveEntsOldLoadingEnabled")) then return end
|
||||
|
||||
for _, v in ipairs(ix.data.Get("wn_scaffolds") or {}) do
|
||||
local entity = ents.Create("wn_scaffold")
|
||||
entity:SetPos(v.pos)
|
||||
entity:SetAngles(v.angles)
|
||||
entity:Spawn()
|
||||
|
||||
entity:SetSolid(SOLID_VPHYSICS)
|
||||
entity:PhysicsInit(SOLID_VPHYSICS)
|
||||
|
||||
local physObj = entity:GetPhysicsObject()
|
||||
|
||||
if (IsValid(physObj)) then
|
||||
physObj:EnableMotion(false)
|
||||
physObj:Sleep()
|
||||
end
|
||||
|
||||
entity.items = v.materials or 0
|
||||
entity:SetNWInt("ItemsRequired", v.materials or 0)
|
||||
end
|
||||
end
|
||||
|
||||
-- Called just after data should be saved.
|
||||
function PLUGIN:SaveData()
|
||||
self:SaveScaffolds()
|
||||
end
|
||||
|
||||
-- This is a seperate function so we can call it upon deploying a radio.
|
||||
function PLUGIN:SaveScaffolds()
|
||||
local scaffolds = {}
|
||||
|
||||
-- This is faster than two single ents.FindByClass
|
||||
local entities = ents.GetAll()
|
||||
for i = 1, #entities do
|
||||
local entityClass = entities[i]:GetClass()
|
||||
if (entityClass == "wn_scaffold") then
|
||||
scaffolds[#scaffolds + 1] = {
|
||||
pos = entities[i]:GetPos(),
|
||||
angles = entities[i]:GetAngles(),
|
||||
materials = entities[i].items
|
||||
};
|
||||
end
|
||||
end;
|
||||
|
||||
ix.data.Set("wn_scaffolds", scaffolds)
|
||||
end
|
||||
end
|
||||
210
gamemodes/darkrp/plugins/n7stuff/sv_plugin.lua
Normal file
210
gamemodes/darkrp/plugins/n7stuff/sv_plugin.lua
Normal file
@@ -0,0 +1,210 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
util.AddNetworkString("ixDataFilePDA_CWU_Open")
|
||||
util.AddNetworkString("ixDataFilePDA_CWU_RequestData")
|
||||
util.AddNetworkString("ixDataFilePDA_CWU_CheckData")
|
||||
util.AddNetworkString("ixDataFilePDA_CMU_Open")
|
||||
util.AddNetworkString("ixDataFilePDA_CMU_RequestData")
|
||||
util.AddNetworkString("ixDataFilePDA_CMU_CheckData")
|
||||
|
||||
function PLUGIN:RegisterSaveEnts()
|
||||
ix.saveEnts:RegisterEntity("wn_scaffold", true, true, true, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
data.motion = false
|
||||
data.materials = entity.items
|
||||
end,
|
||||
OnRestore = function(entity, data) --OnRestore
|
||||
entity:SetSolid(SOLID_VPHYSICS)
|
||||
entity:PhysicsInit(SOLID_VPHYSICS)
|
||||
|
||||
entity.items = data.materials or 0
|
||||
entity:SetNWInt("ItemsRequired", data.materials or 0)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Include new required data to datafiles of old characters
|
||||
function PLUGIN:UpdateOldVortData(character, genericdata)
|
||||
if (!character or !istable(genericdata)) then return end
|
||||
|
||||
genericdata.collarID = character:GetCollarID() or "N/A"
|
||||
genericdata.cohesionPoints = genericdata.socialCredits or 0
|
||||
genericdata.cohesionPointsDate = ix.config.Get("day").."/"..ix.config.Get("month").."/"..ix.config.Get("year")
|
||||
genericdata.nulled = "INACTIVE"
|
||||
genericdata.cid = "N/A"
|
||||
|
||||
if (character:HasFlags("N") or character:GetBackground() == "Collaborator") then
|
||||
genericdata.nulled = "ACTIVE"
|
||||
end
|
||||
|
||||
for _, v in pairs(character:GetInventory():GetItems()) do
|
||||
if (table.HasValue({"Vortigaunt Collar", "Vortigaunt Collar (fake)"}, v.name) and v:GetData("equip") == true) then
|
||||
if (v:GetData("collarID", nil) and v:GetData("sterilizedCredits", nil)) then
|
||||
genericdata.cohesionPoints = v:GetData("sterilizedCredits", 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
character:SetGenericdata(genericdata)
|
||||
character:Save()
|
||||
|
||||
character:GetPlayer():Notify("New format successfully applied to your datafile.")
|
||||
end
|
||||
|
||||
function PLUGIN:CheckNotifyUpdate(author, character, data)
|
||||
if (character:IsVortigaunt()) then
|
||||
if (data.cid == "N/A") then
|
||||
ix.combineNotify:AddNotification("LOG:// " .. author .. " performing identity inspection on " .. string.upper("biotic asset collar:") .. " #" .. character:GetCollarID())
|
||||
else
|
||||
ix.combineNotify:AddNotification("LOG:// " .. author .. " performing identity inspection on " .. string.upper("biotic asset identification card:") .. " #" .. data.cid)
|
||||
end
|
||||
else
|
||||
ix.combineNotify:AddNotification("LOG:// " .. author .. " performing identity inspection on '" .. string.upper(data.name) .. "', #" .. data.cid)
|
||||
end
|
||||
end
|
||||
|
||||
local function SendDatabaseAnswer(client, data, status, cmu, noNotif)
|
||||
data = data or {}
|
||||
|
||||
if (!cmu) then
|
||||
data.status = status
|
||||
end
|
||||
|
||||
if ((!status or status[2] != "Error") and !noNotif) then
|
||||
local author = client:IsDispatch() and "OVERWATCH" or (ix.faction.Get(client:Team()).idInspectionText or "Unit") .. " " .. string.upper(client:GetCombineTag())
|
||||
|
||||
for k, v in ipairs(ix.char.loaded) do
|
||||
if (cmu and data.genericData and v:GetID() == data.genericData.id) then
|
||||
PLUGIN:CheckNotifyUpdate(author, v, data.genericData)
|
||||
elseif (!cmu and data.cid and v:GetID() == data.id) then
|
||||
PLUGIN:CheckNotifyUpdate(author, v, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local json = util.TableToJSON(data)
|
||||
local compressed = util.Compress(json)
|
||||
local length = compressed:len()
|
||||
|
||||
net.Start("ixDataFilePDA_" .. (cmu and "CMU" or "CWU") .. "_CheckData")
|
||||
net.WriteUInt(length, 32)
|
||||
net.WriteData(compressed, length)
|
||||
net.Send(client)
|
||||
end
|
||||
|
||||
net.Receive("ixDataFilePDA_CWU_RequestData", function(length, client)
|
||||
local text = net.ReadString()
|
||||
|
||||
local query = mysql:Select("ix_characters")
|
||||
query:Select("name")
|
||||
query:Select("faction")
|
||||
query:Select("id")
|
||||
query:Select("cid")
|
||||
query:Where("schema", Schema and Schema.folder or "helix")
|
||||
if tonumber(text) then
|
||||
query:Where("cid", text)
|
||||
else
|
||||
query:Where("name", text)
|
||||
end
|
||||
|
||||
query:Callback(function(result)
|
||||
if (!istable(result) or #result == 0) then
|
||||
return SendDatabaseAnswer(client, nil, { L("pdaDatafile_notFound", client), "Error" })
|
||||
end
|
||||
|
||||
result = result[1]
|
||||
|
||||
if client:GetCharacter():GetGenericdata().cid != result.cid then
|
||||
if (result.faction == "vortigaunt") then
|
||||
return SendDatabaseAnswer(client, nil, { L("pdaDatafile_noAccess", client), "Error" })
|
||||
end
|
||||
end
|
||||
|
||||
local dataSelect = mysql:Select("ix_characters_data")
|
||||
dataSelect:Where("id", result.id)
|
||||
dataSelect:WhereIn("key", "genericdata")
|
||||
dataSelect:Callback(function(dataSelectResult)
|
||||
if (!istable(dataSelectResult) or #dataSelectResult == 0) then
|
||||
return SendDatabaseAnswer(client, nil, { L("pdaDatafile_notFound", client), "Error" })
|
||||
end
|
||||
|
||||
dataSelectResult = dataSelectResult[1]
|
||||
SendDatabaseAnswer(client, util.JSONToTable(dataSelectResult.data), { result.name .." | #"..result.cid, "Succès" })
|
||||
end)
|
||||
dataSelect:Execute()
|
||||
end)
|
||||
query:Execute()
|
||||
end)
|
||||
|
||||
net.Receive("ixDataFilePDA_CMU_RequestData", function(length, client)
|
||||
local text = net.ReadString()
|
||||
local noNotif = net.ReadBool()
|
||||
|
||||
local query = mysql:Select("ix_characters")
|
||||
query:Select("name")
|
||||
query:Select("faction")
|
||||
query:Select("id")
|
||||
query:Select("cid")
|
||||
query:Where("schema", Schema and Schema.folder or "helix")
|
||||
if tonumber(text) then
|
||||
query:Where("cid", text)
|
||||
else
|
||||
query:Where("name", text)
|
||||
end
|
||||
|
||||
query:Callback(function(result)
|
||||
if (!istable(result) or #result == 0) then
|
||||
return SendDatabaseAnswer(client, nil, nil, true)
|
||||
end
|
||||
|
||||
result = result[1]
|
||||
|
||||
if client:GetCharacter():GetGenericdata().cid != result.cid then
|
||||
if (result.faction != "citizen") then
|
||||
return SendDatabaseAnswer(client, nil, nil, true)
|
||||
end
|
||||
end
|
||||
|
||||
local dataSelect = mysql:Select("ix_characters_data")
|
||||
dataSelect:Where("id", result.id)
|
||||
dataSelect:WhereIn("key", "genericdata")
|
||||
dataSelect:Callback(function(genericDataResult)
|
||||
if (!istable(genericDataResult) or #genericDataResult == 0) then
|
||||
return SendDatabaseAnswer(client, nil, nil, true)
|
||||
end
|
||||
|
||||
genericDataResult = genericDataResult[1]
|
||||
|
||||
local dataSelect = mysql:Select("ix_characters_data")
|
||||
dataSelect:Where("id", result.id)
|
||||
dataSelect:WhereIn("key", "datafilemedicalrecords")
|
||||
dataSelect:Callback(function(medicalRecordsResult)
|
||||
if (!istable(medicalRecordsResult) or #medicalRecordsResult == 0) then
|
||||
return SendDatabaseAnswer(client, nil, nil, true)
|
||||
end
|
||||
|
||||
medicalRecordsResult = medicalRecordsResult[1]
|
||||
|
||||
local finalResult = {
|
||||
genericData = util.JSONToTable(genericDataResult.data),
|
||||
medicalRecords = util.JSONToTable(medicalRecordsResult.data),
|
||||
}
|
||||
|
||||
SendDatabaseAnswer(client, finalResult, nil, true, noNotif)
|
||||
end)
|
||||
dataSelect:Execute()
|
||||
end)
|
||||
dataSelect:Execute()
|
||||
end)
|
||||
query:Execute()
|
||||
end)
|
||||
Reference in New Issue
Block a user