mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
214
gamemodes/ixhl2rp/plugins/writing/cl_plugin.lua
Normal file
214
gamemodes/ixhl2rp/plugins/writing/cl_plugin.lua
Normal file
@@ -0,0 +1,214 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
function PLUGIN:LoadFonts(font, genericFont)
|
||||
for fontName, fontFileName in pairs(self.validHandwriting) do
|
||||
surface.CreateFont( fontName, {
|
||||
font = fontFileName,
|
||||
extended = false,
|
||||
size = SScaleMin(30 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
end
|
||||
|
||||
surface.CreateFont( "GeorgiaBold", {
|
||||
font = "Georgia",
|
||||
extended = false,
|
||||
size = SScaleMin(16 / 3),
|
||||
weight = 1000,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "FjallaOneRegularLarge", {
|
||||
font = "Fjalla One",
|
||||
extended = false,
|
||||
size = SScaleMin(124 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "FjallaOneRegularSmall", {
|
||||
font = "Fjalla One",
|
||||
extended = false,
|
||||
size = SScaleMin(40 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "ArialBold", {
|
||||
font = "Arial",
|
||||
extended = false,
|
||||
size = SScaleMin(14 / 3),
|
||||
weight = 1000,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "AdobeCaslonProBold", {
|
||||
font = "Caslon-Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(40 / 3),
|
||||
weight = 1000,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "AdobeCaslonProBoldSmaller", {
|
||||
font = "Caslon-Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(24 / 3),
|
||||
weight = 1000,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MinionProBold", {
|
||||
font = "MinionPro-Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(18 / 3),
|
||||
weight = 1000,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MinionProBoldAd", {
|
||||
font = "MinionPro-Bold",
|
||||
extended = false,
|
||||
size = SScaleMin(80 / 3),
|
||||
weight = 1000,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MinionProRegular", {
|
||||
font = "MinionPro-Regular",
|
||||
extended = false,
|
||||
size = SScaleMin(18 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "MinionProItalic", {
|
||||
font = "MinionPro-It",
|
||||
extended = false,
|
||||
size = SScaleMin(60 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "AbrilTitlingRegular", {
|
||||
font = "AbrilTitlingW01-Regular",
|
||||
extended = false,
|
||||
size = SScaleMin(16 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont("UnifrakturTitle", {
|
||||
font = "UnifrakturMaguntia",
|
||||
size = SScaleMin(59 / 3),
|
||||
extended = true,
|
||||
weight = 500
|
||||
})
|
||||
|
||||
surface.CreateFont( "LusitanaTitle", {
|
||||
font = "Lusitana",
|
||||
extended = true,
|
||||
size = SScaleMin(34 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "LusitanaItalic", {
|
||||
font = "Lusitana",
|
||||
extended = true,
|
||||
size = SScaleMin(34 / 3),
|
||||
weight = 550,
|
||||
antialias = true,
|
||||
italic = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "LusitanaSmall", {
|
||||
font = "Lusitana",
|
||||
extended = true,
|
||||
size = SScaleMin(24 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
surface.CreateFont( "TNRTitle", {
|
||||
font = "Times New Roman",
|
||||
extended = false,
|
||||
size = SScaleMin(36 / 3),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
-- Sorry for the hardcode, but its' size needed to be adjusted.
|
||||
surface.CreateFont( "BookTimes", {
|
||||
font = "Times New Roman",
|
||||
extended = false,
|
||||
size = SScaleMin(9),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
|
||||
-- Sorry for the hardcode, but its' size needed to be adjusted.
|
||||
surface.CreateFont( "BookTypewriter", {
|
||||
font = "Traveling _Typewriter",
|
||||
extended = false,
|
||||
size = SScaleMin(8.9),
|
||||
weight = 550,
|
||||
antialias = true
|
||||
} )
|
||||
end
|
||||
|
||||
function PLUGIN:OpenViewerEditor(itemID, identifier, data, tNewspaper, contents)
|
||||
local viewerEditor = vgui.Create("ixWriting"..Schema:FirstToUpper(identifier))
|
||||
viewerEditor.itemID = itemID
|
||||
viewerEditor.nData = data
|
||||
viewerEditor.tNewspaper = tNewspaper
|
||||
viewerEditor.identifier = identifier
|
||||
|
||||
if tNewspaper and viewerEditor.BuildContents then
|
||||
viewerEditor:BuildContents(contents or "The Informed Citizen")
|
||||
end
|
||||
|
||||
if (data or (!data and tNewspaper)) then
|
||||
viewerEditor:Populate(itemID, identifier, data, tNewspaper)
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:OpenHandWritingSelector()
|
||||
vgui.Create("ixWritingHandwritingSelector")
|
||||
end
|
||||
|
||||
netstream.Hook("ixWritingOpenViewerEditor", function(itemID, identifier, data, tNewspaper)
|
||||
PLUGIN:OpenViewerEditor(itemID, identifier, data, tNewspaper, data and data.template)
|
||||
end)
|
||||
|
||||
netstream.Hook("ixWritingOpenHandWritingSelector", function()
|
||||
PLUGIN:OpenHandWritingSelector()
|
||||
end)
|
||||
|
||||
netstream.Hook("ixWritingReplyUnionNewspapers", function(newspapers, bTerminal)
|
||||
if bTerminal then
|
||||
if ix.gui.terminalPanel and IsValid(ix.gui.terminalPanel) then
|
||||
if !ix.gui.terminalPanel.newspaperPanel or ix.gui.terminalPanel.newspaperPanel and !IsValid(ix.gui.terminalPanel.newspaperPanel) then return end
|
||||
|
||||
ix.gui.terminalPanel:CreateStoredNewspapers(newspapers)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if ix.gui.medicalComputer.newspaper and IsValid(ix.gui.medicalComputer.newspaper) then
|
||||
ix.gui.medicalComputer.newspaper:CreateStoredNewspapers(newspapers)
|
||||
end
|
||||
end)
|
||||
122
gamemodes/ixhl2rp/plugins/writing/derma/cl_book.lua
Normal file
122
gamemodes/ixhl2rp/plugins/writing/derma/cl_book.lua
Normal file
@@ -0,0 +1,122 @@
|
||||
--[[
|
||||
| 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 padding = SScaleMin(20 / 3)
|
||||
local SScaleMin55 = SScaleMin(55 / 3)
|
||||
local SScaleMin84 = SScaleMin(84 / 3)
|
||||
local SScaleMin30 = SScaleMin(30 / 3)
|
||||
|
||||
function PANEL:Init()
|
||||
local bookPanel = self:CreateMainPanel(SScaleMin(1297 / 3), SScaleMin(859 / 3))
|
||||
bookPanel.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/writing/book.png"))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local optionTop = self:CreateOptionPanel(bookPanel, TOP)
|
||||
self:CreateExitButton(optionTop, RIGHT, padding, 0, SScaleMin30, 0)
|
||||
|
||||
local contentPanel = bookPanel:Add("Panel")
|
||||
contentPanel:Dock(FILL)
|
||||
|
||||
local leftPage = contentPanel:Add("Panel")
|
||||
leftPage:Dock(LEFT)
|
||||
leftPage:SetWide(bookPanel:GetWide() / 2)
|
||||
|
||||
local rightPage = contentPanel:Add("Panel")
|
||||
rightPage:Dock(FILL)
|
||||
|
||||
self.title1 = self:CreateTextEntry(leftPage, nil, SScaleMin(55 / 3), TOP, SScaleMin84, 0, SScaleMin55, 0, nil, self.charHandwriting, 35, false, true, "", nil, "Write your title here (if any).")
|
||||
self.title2 = self:CreateTextEntry(rightPage, nil, SScaleMin(55 / 3), TOP, SScaleMin84, 0, SScaleMin55, 0, nil, self.charHandwriting, 35, false, true, "", nil, "Write your title here (if any).")
|
||||
self.content1 = self:CreateTextEntry(leftPage, nil, nil, FILL, SScaleMin84, padding / 2, SScaleMin55, SScaleMin84, nil, self.charHandwriting, 1170, true, true, "", nil, "Write your content here (if any).")
|
||||
self.content2 = self:CreateTextEntry(rightPage, nil, nil, FILL, SScaleMin84, padding / 2, SScaleMin55, SScaleMin84, nil, self.charHandwriting, 1170, true, true, "", nil, "Write your content here (if any).")
|
||||
|
||||
local colors = {
|
||||
["BLUE"] = "000000000",
|
||||
["BLACK"] = "100000000",
|
||||
["GREEN"] = "200000000",
|
||||
["ORANGE"] = "300000000",
|
||||
["PURPLE"] = "400000000",
|
||||
["RED"] = "500000000",
|
||||
["GREY UNION"] = "600000000",
|
||||
["YELLOW"] = "700000000"
|
||||
}
|
||||
|
||||
local optionBot = self:CreateOptionPanel(bookPanel, BOTTOM)
|
||||
self:CreateOption(optionBot, LEFT, "PREVIEW", function(button)
|
||||
self:TogglePreview(button)
|
||||
button:SetVisible(true)
|
||||
end, SScaleMin(35 / 3))
|
||||
|
||||
self:CreateDividerLine(optionBot, LEFT)
|
||||
self:CreateOption(optionBot, LEFT, "BOOK COLOR: ", nil, 0)
|
||||
|
||||
local canClick = true
|
||||
for colorName, bg in SortedPairs(colors) do
|
||||
self:CreateOption(optionBot, LEFT, colorName, function(button)
|
||||
if canClick then
|
||||
canClick = false
|
||||
netstream.Start("ixWritingSetBookColor", self.itemID, bg)
|
||||
LocalPlayer():NotifyLocalized("You've set the book color to "..string.utf8lower(colorName))
|
||||
|
||||
timer.Simple(1, function()
|
||||
canClick = true
|
||||
end)
|
||||
else
|
||||
LocalPlayer():NotifyLocalized("You can't click this just yet!")
|
||||
end
|
||||
end, 0)
|
||||
|
||||
if colorName != "YELLOW" then
|
||||
local dividerLine = self:CreateDividerLine(optionBot, LEFT)
|
||||
dividerLine:DockMargin(SScaleMin(5 / 3), padding / 4, SScaleMin(5 / 3), padding / 4)
|
||||
end
|
||||
end
|
||||
|
||||
self:CreateOption(optionBot, RIGHT, "SAVE", function(button)
|
||||
netstream.Start("ixWritingAddWriting", self.identifier, {title1 = self.title1:GetValue(), content1 = self.content1:GetValue(), title2 = self.title2:GetValue(), content2 = self.content2:GetValue()}, self.itemID)
|
||||
self:Remove()
|
||||
end, 0, 0, SScaleMin30, 0)
|
||||
end
|
||||
|
||||
function PANEL:Populate(itemID, identifier, data)
|
||||
local owner = data.owner
|
||||
local localChar = LocalPlayer():GetCharacter()
|
||||
if !localChar then return end
|
||||
local titleText1 = data.title1 or ""
|
||||
local contentText1 = data.content1 or ""
|
||||
local titleText2 = data.title2 or ""
|
||||
local contentText2 = data.content2 or ""
|
||||
local canRead = localChar:GetCanread()
|
||||
|
||||
self.title1:SetValue(canRead and titleText1 or Schema:ShuffleText(titleText1))
|
||||
self.title1:SetFont(data.font or self.charHandwriting)
|
||||
if self.title1:GetName() != "DTextEntry" then self.title1:SizeToContents() end
|
||||
|
||||
self.title2:SetValue(canRead and titleText2 or Schema:ShuffleText(titleText2))
|
||||
self.title2:SetFont(data.font or self.charHandwriting)
|
||||
if self.title2:GetName() != "DTextEntry" then self.title2:SizeToContents() end
|
||||
|
||||
self.content1:SetValue(canRead and contentText1 or Schema:ShuffleText(contentText1))
|
||||
self.content1:SetFont(data.font or self.charHandwriting)
|
||||
|
||||
self.content2:SetValue(canRead and contentText2 or Schema:ShuffleText(contentText2))
|
||||
self.content2:SetFont(data.font or self.charHandwriting)
|
||||
|
||||
if localChar.id != owner then self:TogglePreview() return end
|
||||
|
||||
self:CreateDividerLine(self.optionPanels[2], RIGHT)
|
||||
self:CreateOption(self.optionPanels[2], RIGHT, "EDITS LEFT: "..ix.config.Get("maxEditTimes"..Schema:FirstToUpper(identifier), 0) - data.editedTimes, nil)
|
||||
end
|
||||
|
||||
vgui.Register("ixWritingBook", PANEL, "ixWritingBase")
|
||||
@@ -0,0 +1,93 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(SScaleMin(900 / 3), SScaleMin(100 / 3))
|
||||
self:Center()
|
||||
self:MakePopup()
|
||||
self.Paint = function(this, w, h)
|
||||
self:PaintStuff(this, w, h)
|
||||
end
|
||||
|
||||
local topbar = self:Add("Panel")
|
||||
topbar:SetSize(self:GetWide(), SScaleMin(50 / 3))
|
||||
topbar:Dock(TOP)
|
||||
topbar.Paint = function( this, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local titleText = topbar:Add("DLabel")
|
||||
titleText:SetFont("CharCreationBoldTitleNoClamp")
|
||||
titleText:Dock(LEFT)
|
||||
titleText:SetText("Handwriting Style")
|
||||
titleText:DockMargin(SScaleMin(10 / 3), 0, 0, 0)
|
||||
titleText:SetContentAlignment(4)
|
||||
titleText:SizeToContents()
|
||||
|
||||
local exit = topbar:Add("DImageButton")
|
||||
exit:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
exit:SetSize(SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
exit:DockMargin(0, SScaleMin(15 / 3), SScaleMin(10 / 3), SScaleMin(15 / 3))
|
||||
exit:Dock(RIGHT)
|
||||
exit.DoClick = function()
|
||||
self:Remove()
|
||||
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
local buttonBox = self:Add("Panel")
|
||||
buttonBox:Dock(TOP)
|
||||
buttonBox:SetTall(SScaleMin(50 / 3))
|
||||
|
||||
self:CreateFontButton(buttonBox, "BookSatisfy", "Satisfy")
|
||||
self:CreateFontButton(buttonBox, "BookChilanka", "Chilanka")
|
||||
self:CreateFontButton(buttonBox, "BookAmita", "Amita")
|
||||
self:CreateFontButton(buttonBox, "BookHandlee", "Handlee")
|
||||
self:CreateFontButton(buttonBox, "BookDancing", "Dancing")
|
||||
self:CreateFontButton(buttonBox, "BookTimes", "Times")
|
||||
self:CreateFontButton(buttonBox, "BookTypewriter", "Typewriter")
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if (self) then
|
||||
self:MoveToFront()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateFontButton(buttonBox, font, text)
|
||||
local button = buttonBox:Add("DButton")
|
||||
button:Dock(LEFT)
|
||||
button:SetWide(self:GetWide() / 7)
|
||||
button:SetText(text)
|
||||
button:SetFont(font)
|
||||
button:SetContentAlignment(5)
|
||||
button.Paint = function(this, w, h)
|
||||
self:PaintStuff(this, w, h)
|
||||
end
|
||||
|
||||
button.DoClick = function()
|
||||
netstream.Start("ixWritingSetHandWriting", font)
|
||||
LocalPlayer():NotifyLocalized("You've successfully chosen your handwriting to be "..text)
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:PaintStuff(this, w, h)
|
||||
surface.SetDrawColor(Color(0, 0, 0, 100))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
vgui.Register("ixWritingHandwritingSelector", PANEL, "Panel")
|
||||
712
gamemodes/ixhl2rp/plugins/writing/derma/cl_newspaper.lua
Normal file
712
gamemodes/ixhl2rp/plugins/writing/derma/cl_newspaper.lua
Normal file
@@ -0,0 +1,712 @@
|
||||
--[[
|
||||
| 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 padding = SScaleMin(20 / 3)
|
||||
PANEL.templates = {}
|
||||
|
||||
function PANEL:RegisterTemplate(name, storedFunc)
|
||||
self.templates[name] = {
|
||||
create = storedFunc
|
||||
}
|
||||
end
|
||||
|
||||
function PANEL:Init()
|
||||
local informedCitizen = function()
|
||||
local newspaperPanel = self.surrounder:Add("Panel")
|
||||
newspaperPanel:Dock(TOP)
|
||||
newspaperPanel:SetTall(SScaleMin(1391 / 3))
|
||||
newspaperPanel.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("models/wn/newspapers/newspaper_bg_noheadline.png"))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.mainPanel = newspaperPanel
|
||||
|
||||
self.optionTop = self:CreateOptionPanel(self, TOP)
|
||||
self.optionTop:DockMargin(ScrW() / 2 - self.surrounder:GetWide() / 2, padding / 2, ScrW() / 2 - self.surrounder:GetWide() / 2, 0)
|
||||
|
||||
self.headlineText = self:CreateTextEntry(self.mainPanel, SScaleMin(164 / 3), SScaleMin(64 / 3), TOP, 0, 0, 0, 0, nil, "UnifrakturTitle", 20, true, true, "", nil, "The Informed Citizen")
|
||||
self.headlineText:SetZPos(-1)
|
||||
self.headlineText:SetContentAlignment(4)
|
||||
self.headlineText:DockMargin(self.surrounder:GetWide() * 0.21, SScaleMin(48 / 3), self.surrounder:GetWide() * 0.20, 0)
|
||||
|
||||
self.date = self.mainPanel:Add("DLabel")
|
||||
self.date:Dock(TOP)
|
||||
self.date:SetFont("GeorgiaBold")
|
||||
self.date:SetText(string.upper(ix.date.GetFormatted("%A"..",".." %B %d".."th"..", ".."%Y")))
|
||||
self.date:SetTextColor(color_black)
|
||||
self.date:SizeToContents()
|
||||
self.date:SetContentAlignment(5)
|
||||
self.date:DockMargin(0, SScaleMin(12 / 3), 0, 0)
|
||||
self.date:SetZPos(0)
|
||||
|
||||
self.bigHeadline = self:CreateTextEntry(self.mainPanel, nil, SScaleMin(117 / 3), TOP, SScaleMin(33 / 3), SScaleMin(3 / 3), SScaleMin(33 / 3), 0, nil, "FjallaOneRegularLarge", 20, false, true, "", nil, string.upper("TERROR IN THE STREET"))
|
||||
self.bigHeadline:SetZPos(1)
|
||||
self.subHeadline = self:CreateTextEntry(self.mainPanel, nil, SScaleMin(60 / 3), TOP, SScaleMin(33 / 3), 0, SScaleMin(33 / 3), 0, nil, "FjallaOneRegularSmall", 52, false, true, "", nil, string.upper("MONTH-WIDE LOCKDOWN DECLARED AFTER UNCIVIL RIOTS ERUPT"))
|
||||
self.subHeadline:SetZPos(2)
|
||||
|
||||
local leftRight = self.mainPanel:Add("Panel")
|
||||
leftRight:Dock(FILL)
|
||||
leftRight:DockMargin(SScaleMin(32 / 3), 0, SScaleMin(30 / 3), 0)
|
||||
|
||||
local left = leftRight:Add("Panel")
|
||||
left:Dock(LEFT)
|
||||
left:SetWide(SScaleMin(534 / 3))
|
||||
left:DockMargin(0, 0, SScaleMin(8 / 3), 0)
|
||||
|
||||
local right = leftRight:Add("Panel")
|
||||
right:Dock(FILL)
|
||||
|
||||
self.imageButton = self:CreateSelectorButton(left, SScaleMin(534 / 3), SScaleMin(480 / 3), TOP, 0, 0, 0, 0, nil, "SELECT IMAGE", function()
|
||||
-- if self.cracked then LocalPlayer():Notify("You cannot add images to cracked newspapers!") return end
|
||||
|
||||
Derma_StringRequest(
|
||||
"URL (any pictures with sexually explicit content will get you banned)",
|
||||
"Input the URL to the image you want to be shown.",
|
||||
"",
|
||||
function(url)
|
||||
self.imageButton.OnRequest(url)
|
||||
end,
|
||||
nil
|
||||
)
|
||||
end)
|
||||
|
||||
self.imageButton:SetZPos(3)
|
||||
self.imageButton.OnRequest = function(url)
|
||||
self.imageButton:Remove()
|
||||
local linkedImage = self:CreateLinkedImage(left, SScaleMin(534 / 3), SScaleMin(480 / 3), TOP, 0, 0, 0, 0, nil, url)
|
||||
linkedImage:SetZPos(3)
|
||||
self.image = url
|
||||
end
|
||||
|
||||
self.articleTitle = self:CreateTextEntry(left, nil, SScaleMin(60 / 3), TOP, 0, 0, 0, 0, nil, "AdobeCaslonProBold", 30, false, true, "", nil, "C24 Admin. Stewart to Resign")
|
||||
self.articleTitle:SetZPos(4)
|
||||
self.articleTitle.bAlignLeft = true
|
||||
|
||||
self.articleAuthor = self:CreateTextEntry(left, nil, SScaleMin(28 / 3), TOP, 0, SScaleMin(20 / 3), 0, SScaleMin(5 / 3), nil, "MinionProBold", 45, false, true, "", nil, string.upper("James Hawke"))
|
||||
self.articleAuthor:SetZPos(5)
|
||||
self.articleAuthor.bAlignLeft = true
|
||||
|
||||
local articleContentPanel = left:Add("Panel")
|
||||
articleContentPanel:Dock(FILL)
|
||||
articleContentPanel:SetZPos(6)
|
||||
|
||||
self.articleText1 = self:CreateTextEntry(articleContentPanel, (SScaleMin(534 / 3) / 2) + SScaleMin(3 / 3), nil, LEFT, 0, 0, 0, 0, nil, "AbrilTitlingRegular", 655, true, true, "", nil, "Article text goes here")
|
||||
self.articleText1:SetZPos(7)
|
||||
self.articleText1.bAlignTopLeft = true
|
||||
self.articleText1:DockMargin(-SScaleMin(3 / 3), 0, 0, 0)
|
||||
|
||||
self.articleText2 = self:CreateTextEntry(articleContentPanel, (SScaleMin(534 / 3) / 2) - padding / 2, nil, RIGHT, 0, 0, 0, 0, nil, "AbrilTitlingRegular", 655, true, true, "", nil, "Article text part 2 goes here")
|
||||
self.articleText2:SetZPos(8)
|
||||
self.articleText2.bAlignTopLeft = true
|
||||
|
||||
self.imageButton2 = self:CreateSelectorButton(right, SScaleMin(283 / 3) - SScaleMin(13 / 3), SScaleMin(202 / 3), TOP, 0, 0, 0, 0, nil, "SELECT IMAGE", function()
|
||||
-- if self.cracked then LocalPlayer():Notify("You cannot add images to cracked newspapers!") return end
|
||||
Derma_StringRequest(
|
||||
"URL (any pictures with sexually explicit content will get you banned)",
|
||||
"Input the URL to the image you want to be shown.",
|
||||
"",
|
||||
function(url)
|
||||
self.imageButton2.OnRequest(url)
|
||||
end,
|
||||
nil
|
||||
)
|
||||
end)
|
||||
|
||||
self.imageButton2:SetZPos(9)
|
||||
self.imageButton2.OnRequest = function(url)
|
||||
self.imageButton2:Remove()
|
||||
local linkedImage = self:CreateLinkedImage(right, SScaleMin(283 / 3) - SScaleMin(12 / 3), SScaleMin(202 / 3), TOP, 0, 0, 0, 0, nil, url)
|
||||
linkedImage:SetZPos(9)
|
||||
self.image2 = url
|
||||
end
|
||||
|
||||
self.sideArticleCaption = self:CreateTextEntry(right, nil, SScaleMin(28 / 3), TOP, 0, 0, 0, 0, nil, "ArialBold", 35, false, true, "", nil, string.upper("TINY HUMAN STANDS BEFORE SUMMIT 24"))
|
||||
self.sideArticleCaption:SetZPos(10)
|
||||
self.sideArticleCaption.bAlignLeft = true
|
||||
|
||||
self.articleTitle2 = self:CreateTextEntry(right, nil, SScaleMin(58 / 3), TOP, 0, 0, 0, 0, nil, "AdobeCaslonProBoldSmaller", 26, false, true, "", nil, "Summit Meeting")
|
||||
self.articleTitle2:SetZPos(11)
|
||||
self.articleTitle2.bAlignLeft = true
|
||||
|
||||
self.articleAuthor2 = self:CreateTextEntry(right, nil, SScaleMin(28 / 3), TOP, 0, SScaleMin(20 / 3), 0, SScaleMin(10 / 3), nil, "MinionProBold", 31, false, true, "", nil, string.upper("John Smith"))
|
||||
self.articleAuthor2:SetZPos(12)
|
||||
self.articleAuthor2.bAlignLeft = true
|
||||
|
||||
self.article2Text = self:CreateTextEntry(right, 0, nil, FILL, 0, 0, 0, 0, nil, "AbrilTitlingRegular", 1700, true, true, "", nil, "Article 2 text goes here")
|
||||
self.article2Text:SetZPos(13)
|
||||
self.article2Text.bAlignTopLeft = true
|
||||
|
||||
self.adPanel = self.mainPanel:Add("Panel")
|
||||
self.adPanel:Dock(BOTTOM)
|
||||
self.adPanel:SetTall(SScaleMin(150 / 3))
|
||||
self.adPanel:DockMargin(SScaleMin(32 / 3), SScaleMin(23 / 3), SScaleMin(32 / 3), SScaleMin(78 / 3))
|
||||
self.adPanel:SetZPos(14)
|
||||
|
||||
self.adImageButton = self:CreateSelectorButton(self.adPanel, SScaleMin(105 / 3), SScaleMin(105 / 3), LEFT, SScaleMin(47 / 3), SScaleMin(24 / 3), SScaleMin(54 / 3), SScaleMin(21 / 3), nil, "SELECT IMAGE", function()
|
||||
-- if self.cracked then LocalPlayer():Notify("You cannot add images to cracked newspapers!") return end
|
||||
self:CreateAdSelector(self.adPanel)
|
||||
end)
|
||||
|
||||
self.adImageButton:SetZPos(15)
|
||||
|
||||
local adTitleDescPanel = self.adPanel:Add("Panel")
|
||||
adTitleDescPanel:Dock(LEFT)
|
||||
adTitleDescPanel:SetSize(SScaleMin(400 / 3), self.adPanel:GetTall())
|
||||
adTitleDescPanel:DockMargin(0, SScaleMin(36 / 3), 0, SScaleMin(23 / 3))
|
||||
adTitleDescPanel:SetZPos(16)
|
||||
|
||||
self.adTitle = self:CreateTextEntry(adTitleDescPanel, nil, SScaleMin(40 / 3), TOP, 0, 0, 0, 0, nil, "MinionProBoldAd", 11, false, true, "", nil, "THE TRIUMPH")
|
||||
self.adTitle:SetZPos(17)
|
||||
|
||||
self.adSubtitle = self:CreateTextEntry(adTitleDescPanel, nil, SScaleMin(50 / 3), TOP, 0, 0, 0, 0, nil, "MinionProItalic", 15, false, true, "", nil, "Casino & Lounge")
|
||||
self.adSubtitle:SetZPos(18)
|
||||
|
||||
self.adDesc = self:CreateTextEntry(self.adPanel, SScaleMin(125 / 3), nil, RIGHT, 0, SScaleMin(42 / 3), SScaleMin(42 / 3), SScaleMin(32 / 3), nil, "MinionProRegular", 80, true, true, "", nil, "Ad Desc")
|
||||
self.adDesc:SetZPos(19)
|
||||
|
||||
local optionBot = self:CreateOptionPanel(self, BOTTOM)
|
||||
optionBot:DockMargin(ScrW() / 2 - self.surrounder:GetWide() / 2, 0, ScrW() / 2 - self.surrounder:GetWide() / 2, padding / 2)
|
||||
self:CreateOption(optionBot, LEFT, "PREVIEW", function(button)
|
||||
self.bigHeadline:SetText(string.upper(self.bigHeadline:GetText()))
|
||||
self.subHeadline:SetText(string.upper(self.subHeadline:GetText()))
|
||||
self.articleAuthor:SetText(string.upper(self.articleAuthor:GetText()))
|
||||
self.articleAuthor2:SetText(string.upper(self.articleAuthor2:GetText()))
|
||||
self.sideArticleCaption:SetText(string.upper(self.sideArticleCaption:GetText()))
|
||||
self:TogglePreview(button)
|
||||
button:SetVisible(true)
|
||||
end, 0, 0, 0, 0)
|
||||
|
||||
self:CreateOption(optionBot, RIGHT, "PRINT", function(button)
|
||||
netstream.Start("ixWritingAddWriting", self.identifier, {
|
||||
headlineText = self.headlineText:GetText(),
|
||||
date = self.date:GetText(),
|
||||
bigHeadline = self.bigHeadline:GetValue(),
|
||||
subHeadline = self.subHeadline:GetValue(),
|
||||
image = self.image or "",
|
||||
articleTitle = self.articleTitle:GetValue(),
|
||||
articleAuthor = self.articleAuthor:GetValue(),
|
||||
articleText1 = self.articleText1:GetValue(),
|
||||
articleText2 = self.articleText2:GetValue(),
|
||||
image2 = self.image2 or "",
|
||||
sideArticleCaption = self.sideArticleCaption:GetValue(),
|
||||
articleTitle2 = self.articleTitle2:GetValue(),
|
||||
articleAuthor2 = self.articleAuthor2:GetValue(),
|
||||
article2Text = self.article2Text:GetValue(),
|
||||
adTitle = self.adTitle:GetValue(),
|
||||
adSubtitle = self.adSubtitle:GetValue(),
|
||||
adDesc = self.adDesc:GetValue(),
|
||||
adMaterial = self.adMaterial or "",
|
||||
template = "The Informed Citizen",
|
||||
unionDatabase = self.unionDatabase and self.unionDatabase:GetChecked() or false
|
||||
}, self.itemID)
|
||||
self:Remove()
|
||||
end, 0, 0, 0, 0)
|
||||
end
|
||||
self:RegisterTemplate("The Informed Citizen", informedCitizen)
|
||||
local GenevanTribute = function()
|
||||
local newspaperPanel = self.surrounder:Add("Panel")
|
||||
newspaperPanel:Dock(TOP)
|
||||
newspaperPanel:SetTall(SScaleMin(1391 / 3))
|
||||
newspaperPanel.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("models/wn/newspapers/newspaper_bg_two.png"))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.mainPanel = newspaperPanel
|
||||
|
||||
self.optionTop = self:CreateOptionPanel(self, TOP)
|
||||
self.optionTop:DockMargin(ScrW() / 2 - self.surrounder:GetWide() / 2, padding / 2, ScrW() / 2 - self.surrounder:GetWide() / 2, 0)
|
||||
|
||||
self.headlineText = self:CreateTextEntry(self.mainPanel, SScaleMin(164 / 3), SScaleMin(64 / 3), TOP, 0, 0, 0, 0, nil, "UnifrakturTitle", 20, true, true, "", nil, "The Genevan Tribune")
|
||||
self.headlineText:SetZPos(-1)
|
||||
self.headlineText:SetContentAlignment(4)
|
||||
self.headlineText:DockMargin(self.surrounder:GetWide() * 0.21, SScaleMin(48 / 3), self.surrounder:GetWide() * 0.20, 0)
|
||||
|
||||
self.date = self.mainPanel:Add("DLabel")
|
||||
self.date:Dock(TOP)
|
||||
self.date:SetFont("GeorgiaBold")
|
||||
self.date:SetText(string.upper(ix.date.GetFormatted("%A"..",".." %B %d".."th"..", ".."%Y")))
|
||||
self.date:SetTextColor(color_black)
|
||||
self.date:SizeToContents()
|
||||
self.date:SetContentAlignment(5)
|
||||
self.date:DockMargin(0, SScaleMin(-3 / 3), 0, 0)
|
||||
self.date:SetZPos(0)
|
||||
|
||||
self.bigHeadline = self:CreateTextEntry(self.mainPanel, nil, SScaleMin(117 / 3), TOP, SScaleMin(33 / 3), SScaleMin(9 / 3), SScaleMin(33 / 3), 0, nil, "FjallaOneRegularLarge", 20, false, true, "", nil, string.upper("TERROR IN THE STREET"))
|
||||
self.bigHeadline:SetZPos(1)
|
||||
|
||||
self.subHeadline = self:CreateTextEntry(self.mainPanel, nil, SScaleMin(60 / 3), TOP, SScaleMin(55 / 3), 0, SScaleMin(33 / 3), 0, nil, "FjallaOneRegularSmall", 52, false, true, "", nil, string.upper("MONTH-WIDE LOCKDOWN DECLARED AFTER UNCIVIL RIOTS ERUPT"))
|
||||
self.subHeadline:SetZPos(2)
|
||||
|
||||
local bottomContents = self.mainPanel:Add("Panel")
|
||||
bottomContents:Dock(BOTTOM)
|
||||
bottomContents:DockMargin(SScaleMin(32 / 3), 0, SScaleMin(30 / 3), SScaleMin(6 / 3))
|
||||
bottomContents:SetTall(SScaleMin(370 / 3))
|
||||
|
||||
local leftRight = self.mainPanel:Add("Panel")
|
||||
leftRight:Dock(FILL)
|
||||
leftRight:DockMargin(SScaleMin(32 / 3), 0, SScaleMin(30 / 3), 0)
|
||||
|
||||
local left = leftRight:Add("Panel")
|
||||
left:Dock(LEFT)
|
||||
left:SetWide(SScaleMin(391 / 3))
|
||||
left:DockMargin(0, 0, SScaleMin(8 / 3), 0)
|
||||
|
||||
local right = leftRight:Add("Panel")
|
||||
right:Dock(FILL)
|
||||
|
||||
self.imageButton = self:CreateSelectorButton(right, SScaleMin(650 / 3), SScaleMin(555 / 3), TOP, 0, 0, 0, 0, nil, "SELECT IMAGE", function()
|
||||
-- if self.cracked then LocalPlayer():Notify("You cannot add images to cracked newspapers!") return end
|
||||
|
||||
Derma_StringRequest(
|
||||
"URL (any pictures with sexually explicit content will get you banned)",
|
||||
"Input the URL to the image you want to be shown.",
|
||||
"",
|
||||
function(url)
|
||||
self.imageButton.OnRequest(url)
|
||||
end,
|
||||
nil
|
||||
)
|
||||
end)
|
||||
self.imageButton:SetZPos(3)
|
||||
self.imageButton.OnRequest = function(url)
|
||||
self.imageButton:Remove()
|
||||
local linkedImage = self:CreateLinkedImage(right, SScaleMin(650 / 3), SScaleMin(555 / 3), TOP, 0, 0, 0, 0, nil, url)
|
||||
linkedImage:SetZPos(3)
|
||||
self.image = url
|
||||
end
|
||||
|
||||
self.articleTitle = self:CreateTextEntry(left, nil, SScaleMin(60 / 3), TOP, 0, 0, 0, 0, nil, "AdobeCaslonProBold", 30, false, true, "", nil, "HEADLINE")
|
||||
self.articleTitle:SetZPos(4)
|
||||
self.articleTitle.bAlignLeft = true
|
||||
|
||||
local articleContentPanel = left:Add("Panel")
|
||||
articleContentPanel:Dock(TOP)
|
||||
articleContentPanel:SetTall(SScaleMin(100 / 3))
|
||||
articleContentPanel:SetZPos(5)
|
||||
|
||||
self.articleText1 = self:CreateTextEntry(articleContentPanel, (SScaleMin(534 / 3) / 2) + SScaleMin(64 / 3), SScaleMin(60 / 3), LEFT, 0, 0, 0, 0, nil, "LusitanaSmall", 156, true, true, "", nil, "Article text goes here")
|
||||
self.articleText1:SetZPos(6)
|
||||
--self.articleText1.bAlignTopLeft = true
|
||||
self.articleText1.fixedHeight = false
|
||||
|
||||
self.articleAuthor = self:CreateTextEntry(left, nil, SScaleMin(28 / 3), TOP, 0, SScaleMin(56 / 3), 0, SScaleMin(5 / 3), nil, "MinionProBold", 45, false, true, "", nil, string.upper("James Hawke"))
|
||||
self.articleAuthor:SetZPos(7)
|
||||
self.articleAuthor.bAlignLeft = true
|
||||
|
||||
local articleContentPanel2 = left:Add("Panel")
|
||||
articleContentPanel2:Dock(TOP)
|
||||
articleContentPanel2:SetTall(SScaleMin(385 / 3))
|
||||
articleContentPanel2:SetZPos(8)
|
||||
|
||||
self.articleText2 = self:CreateTextEntry(articleContentPanel2, (SScaleMin(534 / 3) / 2) + SScaleMin(128 / 3), nil, LEFT, 0, 0, 0, 0, nil, "AbrilTitlingRegular", 1453, true, true, "", nil, "Article text goes here")
|
||||
self.articleText2:SetZPos(9)
|
||||
self.articleText2.bAlignTopLeft = true
|
||||
self.articleText2:DockMargin(-SScaleMin(3 / 3), 0, 0, 0)
|
||||
|
||||
local articleContentPanel3 = right:Add("Panel")
|
||||
articleContentPanel3:Dock(TOP)
|
||||
articleContentPanel3:SetTall(SScaleMin(80 / 3))
|
||||
articleContentPanel3:SetZPos(10)
|
||||
|
||||
self.articleText3 = self:CreateTextEntry(articleContentPanel3, (SScaleMin(534 / 3) / 2) + SScaleMin(128 / 3), nil, LEFT, 0, 0, 0, 0, nil, "AbrilTitlingRegular", 190, true, true, "", nil, "Article text goes here")
|
||||
self.articleText3:SetZPos(11)
|
||||
self.articleText3.bAlignTopLeft = true
|
||||
self.articleText3:DockMargin(-SScaleMin(3 / 3), 0, 0, 0)
|
||||
|
||||
local adContents = bottomContents:Add("Panel")
|
||||
adContents:Dock(LEFT)
|
||||
adContents:SetWide(SScaleMin(255 / 3))
|
||||
|
||||
local rightContents = bottomContents:Add("Panel")
|
||||
rightContents:Dock(FILL)
|
||||
|
||||
self.advert = self:CreateTextEntry(adContents, nil, SScaleMin(60 / 3), TOP, 0, 0, 0, 0, nil, "LusitanaTitle", 30, false, true, "", nil, "ADVERT")
|
||||
self.advert:SetZPos(12)
|
||||
|
||||
self.advertName = self:CreateTextEntry(adContents, nil, SScaleMin(30 / 3), TOP, 0, 0, 0, 0, nil, "LusitanaItalic", 30, false, true, "", nil, "ADVERT NAME!")
|
||||
self.advertName:SetZPos(13)
|
||||
self.advertName:Dock(TOP)
|
||||
|
||||
self.adPanel = adContents:Add("Panel")
|
||||
self.adPanel:Dock(BOTTOM)
|
||||
self.adPanel:DockMargin(SScaleMin(24 / 3), 0, SScaleMin(24 / 3), 0)
|
||||
self.adPanel:SetTall(SScaleMin(144 / 3))
|
||||
|
||||
self.adImageButton = self:CreateSelectorButton(self.adPanel, SScaleMin(105 / 3), SScaleMin(105 / 3), FILL, 0, 0, 0, 0, nil, "SELECT IMAGE", function()
|
||||
-- if self.cracked then LocalPlayer():Notify("You cannot add images to cracked newspapers!") return end
|
||||
self:CreateAdSelector(self.adPanel)
|
||||
end)
|
||||
|
||||
local articleContentPanel4 = adContents:Add("Panel")
|
||||
articleContentPanel4:Dock(FILL)
|
||||
|
||||
self.advertArticle = self:CreateTextEntry(articleContentPanel4, (SScaleMin(534 / 3) / 2) - SScaleMin(24 / 3), nil, LEFT, SScaleMin(9 / 3), 0, SScaleMin(3 / 3), 0, nil, "AbrilTitlingRegular", 279, true, true, "", nil, "Article text goes here")
|
||||
self.advertArticle.bAlignTopLeft = true
|
||||
|
||||
self.rightHeadline = self:CreateTextEntry(rightContents, SScaleMin(96 / 3), SScaleMin(48 / 3), TOP, SScaleMin(48 / 3), 0, 0, 0, nil, "LusitanaTitle", 30, false, true, "", nil, "HEADLINE")
|
||||
self.rightHeadline:SetZPos(14)
|
||||
self.rightHeadline:SetTextColor(Color(244, 244, 244, 255))
|
||||
self.rightHeadline.fixedHeight = false
|
||||
|
||||
local articleContentPanel5 = rightContents:Add("Panel")
|
||||
articleContentPanel5:Dock(LEFT)
|
||||
articleContentPanel5:SetZPos(15)
|
||||
articleContentPanel5:DockMargin(SScaleMin(6 / 3), SScaleMin(2 / 3), 0, SScaleMin(6 / 3))
|
||||
articleContentPanel5:SetWide(SScaleMin(272 / 3))
|
||||
|
||||
self.articleText4 = self:CreateTextEntry(articleContentPanel5, (SScaleMin(534 / 3) / 2) + SScaleMin(2 / 3), nil, LEFT, 0, 0, 0, 0, nil, "AbrilTitlingRegular", 791, true, true, "", nil, "Article text goes here")
|
||||
self.articleText4:SetZPos(16)
|
||||
self.articleText4.bAlignTopLeft = true
|
||||
self.articleText4:DockMargin(-SScaleMin(3 / 3), 0, 0, 0)
|
||||
|
||||
local articleContentPanel6 = rightContents:Add("Panel")
|
||||
articleContentPanel6:Dock(TOP)
|
||||
articleContentPanel6:SetZPos(17)
|
||||
articleContentPanel6:DockMargin(SScaleMin(6 / 3), SScaleMin(2 / 3), SScaleMin(6 / 3), SScaleMin(24 / 3))
|
||||
articleContentPanel6:SetTall(SScaleMin(75 / 3))
|
||||
|
||||
self.articleText5 = self:CreateTextEntry(articleContentPanel6, (SScaleMin(534 / 3) / 2) + SScaleMin(2 / 3), nil, LEFT, 0, 0, 0, 0, nil, "AbrilTitlingRegular", 160, true, true, "", nil, "Article text goes here")
|
||||
self.articleText5:SetZPos(17)
|
||||
self.articleText5.bAlignTopLeft = true
|
||||
self.articleText5:DockMargin(-SScaleMin(3 / 3), 0, 0, 0)
|
||||
|
||||
self.articleAuthor2 = self:CreateTextEntry(rightContents, nil, SScaleMin(18 / 3), TOP, SScaleMin(90 / 3), -SScaleMin(9 / 3), 0, SScaleMin(5 / 3), nil, "MinionProBold", 45, false, true, "", nil, string.upper("James Hawke"))
|
||||
self.articleAuthor2:SetZPos(18)
|
||||
self.articleAuthor2.bAlignLeft = true
|
||||
|
||||
self.imageButton2 = self:CreateSelectorButton(rightContents, SScaleMin(80 / 3), SScaleMin(190 / 3), TOP, SScaleMin(4 / 3), SScaleMin(8 / 3), SScaleMin(14 / 3), 0, nil, "SELECT IMAGE", function()
|
||||
-- if self.cracked then LocalPlayer():Notify("You cannot add images to cracked newspapers!") return end
|
||||
|
||||
Derma_StringRequest(
|
||||
"URL (any pictures with sexually explicit content will get you banned)",
|
||||
"Input the URL to the image you want to be shown.",
|
||||
"",
|
||||
function(url)
|
||||
self.imageButton2.OnRequest(url)
|
||||
end,
|
||||
nil
|
||||
)
|
||||
end)
|
||||
self.imageButton2:SetZPos(19)
|
||||
self.imageButton2.OnRequest = function(url)
|
||||
self.imageButton2:Remove()
|
||||
local linkedImage = self:CreateLinkedImage(rightContents, SScaleMin(80 / 3), SScaleMin(190 / 3), TOP, SScaleMin(4 / 3), SScaleMin(8 / 3), SScaleMin(14 / 3), 0, nil, url)
|
||||
linkedImage:SetZPos(19)
|
||||
self.image2 = url
|
||||
end
|
||||
|
||||
local sloganLR = self.mainPanel:Add("Panel")
|
||||
sloganLR:Dock(BOTTOM)
|
||||
sloganLR:DockMargin(SScaleMin(204 / 3), 0, SScaleMin(204 / 3), SScaleMin(16 / 3))
|
||||
|
||||
|
||||
sloganLR:SetZPos(-1)
|
||||
|
||||
self.sloganL = self:CreateTextEntry(sloganLR, SScaleMin(176 / 3), SScaleMin(16 / 3), LEFT, SScaleMin(44 / 3), 0, 0, 0, nil, "MinionProBold", 45, false, true, "", nil, string.upper("The Genevan Tribune"))
|
||||
self.sloganL:SetZPos(20)
|
||||
self.sloganL.bAlignRight = true
|
||||
self.sloganL.fixedHeight = false
|
||||
|
||||
self.sloganR = self:CreateTextEntry(sloganLR, SScaleMin(204 / 3), SScaleMin(16 / 3), RIGHT, 0, 0, 0, 0, nil, "MinionProBold", 45, false, true, "", nil, string.upper("FORWARD FROM GENEVA"))
|
||||
self.sloganR:SetZPos(20)
|
||||
self.sloganR.bAlignLeft = true
|
||||
self.sloganR.fixedHeight = false
|
||||
|
||||
local optionBot = self:CreateOptionPanel(self, BOTTOM)
|
||||
optionBot:DockMargin(ScrW() / 2 - self.surrounder:GetWide() / 2, 0, ScrW() / 2 - self.surrounder:GetWide() / 2, padding / 2)
|
||||
self:CreateOption(optionBot, LEFT, "PREVIEW", function(button)
|
||||
|
||||
self:TogglePreview(button)
|
||||
button:SetVisible(true)
|
||||
end, 0, 0, 0, 0)
|
||||
|
||||
self:CreateOption(optionBot, RIGHT, "PRINT", function(button)
|
||||
netstream.Start("ixWritingAddWriting", self.identifier, {
|
||||
headlineText = self.headlineText:GetText(),
|
||||
date = self.date:GetText(),
|
||||
bigHeadline = self.bigHeadline:GetValue(),
|
||||
subHeadline = self.subHeadline:GetValue(),
|
||||
image = self.image or "",
|
||||
articleTitle = self.articleTitle:GetValue(),
|
||||
articleAuthor = self.articleAuthor:GetValue(),
|
||||
articleText1 = self.articleText1:GetValue(),
|
||||
articleText2 = self.articleText2:GetValue(),
|
||||
articleText3 = self.articleText3:GetValue(),
|
||||
articleText4 = self.articleText4:GetValue(),
|
||||
articleText5 = self.articleText5:GetValue(),
|
||||
advert = self.advert:GetValue(),
|
||||
advertName = self.advertName:GetValue(),
|
||||
advertArticle = self.advertArticle:GetValue(),
|
||||
sloganL = self.sloganL:GetValue(),
|
||||
sloganR = self.sloganR:GetValue(),
|
||||
image2 = self.image2 or "",
|
||||
articleAuthor2 = self.articleAuthor2:GetValue(),
|
||||
rightHeadline = self.rightHeadline:GetValue(),
|
||||
template = "The Genevan Tribune",
|
||||
adMaterial = self.adMaterial or "",
|
||||
unionDatabase = self.unionDatabase and self.unionDatabase:GetChecked() or false
|
||||
}, self.itemID)
|
||||
self:Remove()
|
||||
end, 0, 0, 0, 0)
|
||||
end
|
||||
self:RegisterTemplate("The Genevan Tribune", GenevanTribute)
|
||||
self.surrounder = self:CreateMainPanel(SScaleMin(900 / 3), SScaleMin(980 / 3), true)
|
||||
end
|
||||
|
||||
function PANEL:CreateDropdownMenu()
|
||||
self.dropdown = self.optionTop:Add("DComboBox")
|
||||
self.dropdown:SetValue("Background")
|
||||
for newspaper, info in pairs(self.templates) do
|
||||
self.dropdown:AddChoice(newspaper)
|
||||
end
|
||||
self.dropdown.OnSelect = function( s, index, value )
|
||||
self.mainPanel:Remove()
|
||||
for _, optPanel in pairs(self.optionPanels) do
|
||||
optPanel:Remove()
|
||||
end
|
||||
self.optionPanels = {}
|
||||
|
||||
self:BuildContents(value)
|
||||
|
||||
if (self.data or (!self.data and self.tNewspaper)) then
|
||||
self:Populate(self.itemID, self.identifier, self.nData, self.tNewspaper, true)
|
||||
end
|
||||
|
||||
end
|
||||
self.dropdown:Dock(LEFT)
|
||||
self.dropdown:SizeToContents()
|
||||
end
|
||||
|
||||
function PANEL:BuildContents(template)
|
||||
if self.templates[template] then
|
||||
self.templates[template].create()
|
||||
if self.optionTop then
|
||||
self.exit = self:CreateExitButton(self.optionTop, RIGHT, 0, 0, 0, 0)
|
||||
self.exit.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
netstream.Start("ixWritingCloseNewspaperCreator", self.itemID)
|
||||
self:Remove()
|
||||
end
|
||||
self:CreateDropdownMenu()
|
||||
end
|
||||
self.newspaperTemplate = template
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Populate(itemID, identifier, data, tNewspaper, dropdownPopulate)
|
||||
local localChar = LocalPlayer():GetCharacter()
|
||||
if !localChar then return end
|
||||
local canRead = localChar:GetCanread()
|
||||
if !self.mainPanel then return end
|
||||
|
||||
if (data) then
|
||||
for dermaName, value in pairs(data) do
|
||||
if string.find(dermaName, "image") then
|
||||
if (string.find(dermaName, 2)) then
|
||||
self.imageButton2.OnRequest(value)
|
||||
else
|
||||
self.imageButton.OnRequest(value)
|
||||
end
|
||||
|
||||
continue
|
||||
end
|
||||
|
||||
if dermaName == "adMaterial" then
|
||||
if value and value != "" then
|
||||
self.adImageButton:Remove()
|
||||
self:CreateAdImage(self.adPanel, value)
|
||||
end
|
||||
continue
|
||||
end
|
||||
|
||||
if !self[dermaName] then continue end
|
||||
self[dermaName]:SetText(canRead and value or Schema:ShuffleText(value))
|
||||
end
|
||||
|
||||
if self.headlineText and self.headlineText:GetValue() == "" and self.newspaperTemplate then
|
||||
self.headlineText:SetText(self.newspaperTemplate)
|
||||
end
|
||||
end
|
||||
|
||||
if !self.cracked and tNewspaper.builder then
|
||||
self:CreateDividerLine(self.optionPanels[2], LEFT)
|
||||
|
||||
self.unionDatabase = self.optionPanels[2]:Add( "DCheckBoxLabel" )
|
||||
self.unionDatabase:Dock(LEFT)
|
||||
self.unionDatabase:SetText("")
|
||||
self.unionDatabase:SetValue( false )
|
||||
self.unionDatabase:SizeToContents()
|
||||
|
||||
local unionDatabaseLabel = self.optionPanels[2]:Add( "DLabel" )
|
||||
unionDatabaseLabel:Dock(LEFT)
|
||||
unionDatabaseLabel:SetFont("MenuFontLargerBoldNoFix")
|
||||
unionDatabaseLabel:SetText("Upload to Union database")
|
||||
unionDatabaseLabel:SizeToContents()
|
||||
end
|
||||
|
||||
if tNewspaper and tNewspaper.builder then return end
|
||||
|
||||
if !tNewspaper.builder and self.dropdown then self.dropdown:Remove() end
|
||||
|
||||
if dropdownPopulate then
|
||||
self.previewEnabled = false
|
||||
end
|
||||
|
||||
self:TogglePreview()
|
||||
end
|
||||
|
||||
function PANEL:CreateAdImage(parent, material)
|
||||
self.adImage = parent:Add("Panel")
|
||||
self.adImage:Dock(LEFT)
|
||||
self.adImage:SetSize(SScaleMin(105 / 3), SScaleMin(105 / 3))
|
||||
self.adImage:DockMargin(SScaleMin(47 / 3), SScaleMin(24 / 3), SScaleMin(54 / 3), SScaleMin(21 / 3))
|
||||
self.adImage.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial(material))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.adMaterial = material
|
||||
end
|
||||
|
||||
function PANEL:CreateAdSelector(adPanel)
|
||||
local selector = vgui.Create("DFrame")
|
||||
selector:SetSize(SScaleMin((105 * 3) / 3) + SScaleMin(10 / 3), SScaleMin((105 * 4) / 3) + SScaleMin(34 / 3))
|
||||
selector:Center()
|
||||
selector:SetTitle("Ad Image Selector")
|
||||
DFrameFixer(selector)
|
||||
|
||||
local grid = selector:Add("DGrid")
|
||||
grid:Dock(FILL)
|
||||
grid:SetCols( 3 )
|
||||
grid:SetColWide( SScaleMin(105 / 3) )
|
||||
grid:SetRowHeight( SScaleMin(105 / 3) )
|
||||
|
||||
for i = 1, 10 do
|
||||
local image = vgui.Create( "DButton" )
|
||||
image:SetText("")
|
||||
image:SetSize( SScaleMin(105 / 3), SScaleMin(105 / 3) )
|
||||
image.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/writing/newspaper_icon_"..i..".png"))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
|
||||
surface.SetDrawColor(color_black)
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
image.DoClick = function(button)
|
||||
self:CreateAdImage(adPanel, "willardnetworks/writing/newspaper_icon_"..i..".png")
|
||||
selector:Remove()
|
||||
self.adImageButton:Remove()
|
||||
end
|
||||
|
||||
grid:AddItem( image )
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:TogglePreview(button)
|
||||
if self.previewEnabled then
|
||||
if (button) then
|
||||
button:SetText("PREVIEW")
|
||||
button:SizeToContents()
|
||||
end
|
||||
|
||||
for _, textPanel in pairs(self.textEntries) do
|
||||
if !IsValid(textPanel) then continue end
|
||||
textPanel:SetVisible(true)
|
||||
textPanel:SetKeyboardInputEnabled(true)
|
||||
textPanel:SetCursorColor(Color(0, 0, 0, 255))
|
||||
|
||||
textPanel.shouldVoidPlaceholder = false
|
||||
end
|
||||
|
||||
for _, label in pairs(self.labels) do
|
||||
if !IsValid(label) then continue end
|
||||
label:SetVisible(false)
|
||||
end
|
||||
|
||||
for _, selector in pairs(self.selectorButtons) do
|
||||
if IsValid(selector) then
|
||||
if IsValid(selector.temp) then
|
||||
selector.temp:SetVisible(false)
|
||||
end
|
||||
|
||||
selector:SetVisible(true)
|
||||
end
|
||||
end
|
||||
|
||||
for _, option in pairs(self.options) do
|
||||
if !IsValid(option) then continue end
|
||||
if option:GetText() == "EXIT" then continue end
|
||||
option:SetVisible(true)
|
||||
end
|
||||
|
||||
if self.dropdown then
|
||||
self.dropdown:SetVisible(true)
|
||||
end
|
||||
|
||||
self.previewEnabled = false
|
||||
else
|
||||
if (button) then
|
||||
button:SetText("STOP PREVIEW")
|
||||
button:SizeToContents()
|
||||
end
|
||||
|
||||
for _, textPanel in pairs(self.textEntries) do
|
||||
if !IsValid(textPanel) then continue end
|
||||
if textPanel.fixedHeight then
|
||||
self:ConvertTextEntryToLabel(textPanel:GetParent(), textPanel)
|
||||
else
|
||||
textPanel:SetKeyboardInputEnabled(false)
|
||||
textPanel:SetCursorColor(Color(0, 0, 0, 0))
|
||||
end
|
||||
|
||||
textPanel.shouldVoidPlaceholder = true
|
||||
end
|
||||
|
||||
for _, selector in pairs(self.selectorButtons) do
|
||||
if IsValid(selector) then
|
||||
local temp = selector:GetParent():Add("Panel")
|
||||
temp:Dock(selector:GetDock())
|
||||
temp:SetSize(selector:GetSize())
|
||||
temp:SetZPos(selector:GetZPos())
|
||||
temp:DockMargin(selector:GetDockMargin())
|
||||
|
||||
selector:SetVisible(false)
|
||||
selector.temp = temp
|
||||
|
||||
selector:SetVisible(false)
|
||||
end
|
||||
end
|
||||
|
||||
for _, option in pairs(self.options) do
|
||||
if !IsValid(option) then continue end
|
||||
if option:GetText() == "EXIT" then continue end
|
||||
option:SetVisible(false)
|
||||
end
|
||||
|
||||
if self.dropdown then
|
||||
self.dropdown:SetVisible(false)
|
||||
end
|
||||
|
||||
self.previewEnabled = true
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixWritingNewspaper", PANEL, "ixWritingBase")
|
||||
67
gamemodes/ixhl2rp/plugins/writing/derma/cl_notepad.lua
Normal file
67
gamemodes/ixhl2rp/plugins/writing/derma/cl_notepad.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
--[[
|
||||
| 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 padding = SScaleMin(20 / 3)
|
||||
local SScaleMin30 = SScaleMin(30 / 3)
|
||||
local SScaleMin120 = SScaleMin(125 / 3)
|
||||
local SScaleMin90 = SScaleMin(90 / 3)
|
||||
local SScaleMin300 = SScaleMin(100 / 3)
|
||||
|
||||
function PANEL:Init()
|
||||
local notepadPanel = self:CreateMainPanel(SScaleMin(623 / 3), SScaleMin(987 / 3))
|
||||
notepadPanel.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/writing/notepad.png"))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local optionTop = self:CreateOptionPanel(notepadPanel, TOP)
|
||||
optionTop:DockMargin(0, SScaleMin30 * 2, 0, 0)
|
||||
self:CreateExitButton(optionTop, RIGHT, 0, 0, SScaleMin30, 0)
|
||||
|
||||
self.title = self:CreateTextEntry(notepadPanel, nil, SScaleMin(55 / 3), TOP, SScaleMin120 - (padding / 2), SScaleMin120 - (SScaleMin30 * 2) + padding, SScaleMin90 + padding, SScaleMin(7 / 3), nil, self.charHandwriting, 28, false, true, "", nil, "Write your title here (if any).")
|
||||
self.content = self:CreateTextEntry(notepadPanel, nil, nil, FILL, SScaleMin120 - (padding / 2), 0, SScaleMin90 + (padding / 2), SScaleMin300, nil, self.charHandwriting, 830, true, true, "", nil, "Write your content here (if any).")
|
||||
|
||||
local optionBot = self:CreateOptionPanel(notepadPanel, BOTTOM)
|
||||
self:CreateOption(optionBot, LEFT, "PREVIEW", function(button)
|
||||
self:TogglePreview(button)
|
||||
button:SetVisible(true)
|
||||
end, SScaleMin30)
|
||||
|
||||
self:CreateOption(optionBot, RIGHT, "SAVE", function(button)
|
||||
netstream.Start("ixWritingAddWriting", self.identifier, {title = self.title:GetValue(), content = self.content:GetValue()}, self.itemID)
|
||||
self:Remove()
|
||||
end, 0, 0, SScaleMin30, 0)
|
||||
end
|
||||
|
||||
function PANEL:Populate(itemID, identifier, data)
|
||||
local owner = data.owner
|
||||
local localChar = LocalPlayer():GetCharacter()
|
||||
if !localChar then return end
|
||||
local titleText = data.title or ""
|
||||
local contentText = data.content or ""
|
||||
local canRead = localChar:GetCanread()
|
||||
|
||||
self.title:SetValue(canRead and titleText or Schema:ShuffleText(titleText))
|
||||
self.title:SetFont(data.font or self.charHandwriting)
|
||||
if self.title:GetName() != "DTextEntry" then self.title:SizeToContents() end
|
||||
|
||||
self.content:SetValue(canRead and contentText or Schema:ShuffleText(contentText))
|
||||
self.content:SetFont(data.font or self.charHandwriting)
|
||||
|
||||
if localChar.id != owner then self:TogglePreview() return end
|
||||
|
||||
self:CreateDividerLine(self.optionPanels[2], LEFT)
|
||||
self:CreateOption(self.optionPanels[2], LEFT, "EDITS LEFT: "..ix.config.Get("maxEditTimes"..Schema:FirstToUpper(identifier), 0) - data.editedTimes, nil)
|
||||
end
|
||||
|
||||
vgui.Register("ixWritingNotepad", PANEL, "ixWritingBase")
|
||||
64
gamemodes/ixhl2rp/plugins/writing/derma/cl_paper.lua
Normal file
64
gamemodes/ixhl2rp/plugins/writing/derma/cl_paper.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
--[[
|
||||
| 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 padding = SScaleMin(20 / 3)
|
||||
local SScaleMin55 = SScaleMin(55 / 3)
|
||||
local SScaleMin84 = SScaleMin(84 / 3)
|
||||
local SScaleMin30 = SScaleMin(30 / 3)
|
||||
|
||||
function PANEL:Init()
|
||||
local paperPanel = self:CreateMainPanel(SScaleMin(710 / 3), SScaleMin(995 / 3))
|
||||
paperPanel.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(color_white)
|
||||
surface.SetMaterial(ix.util.GetMaterial("willardnetworks/writing/paper.png"))
|
||||
surface.DrawTexturedRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
local optionTop = self:CreateOptionPanel(paperPanel, TOP)
|
||||
self:CreateExitButton(optionTop, RIGHT, padding, 0, SScaleMin30, 0)
|
||||
|
||||
self.title = self:CreateTextEntry(paperPanel, nil, SScaleMin(55 / 3), TOP, SScaleMin84, 0, SScaleMin55, 0, nil, self.charHandwriting, 35, false, true, "", nil, "Write your title here (if any).")
|
||||
self.content = self:CreateTextEntry(paperPanel, nil, nil, FILL, SScaleMin84, padding, SScaleMin55, SScaleMin84, nil, self.charHandwriting, 1100, true, true, "", nil, "Write your content here (if any).")
|
||||
|
||||
local optionBot = self:CreateOptionPanel(paperPanel, BOTTOM)
|
||||
self:CreateOption(optionBot, LEFT, "PREVIEW", function(button)
|
||||
self:TogglePreview(button)
|
||||
button:SetVisible(true)
|
||||
end, SScaleMin(35 / 3))
|
||||
|
||||
self:CreateOption(optionBot, RIGHT, "SAVE", function(button)
|
||||
netstream.Start("ixWritingAddWriting", self.identifier, {title = self.title:GetValue(), content = self.content:GetValue()}, self.itemID)
|
||||
self:Remove()
|
||||
end, 0, 0, SScaleMin30, 0)
|
||||
end
|
||||
|
||||
function PANEL:Populate(itemID, identifier, data)
|
||||
local owner = data.owner
|
||||
local localChar = LocalPlayer():GetCharacter()
|
||||
if !localChar then return end
|
||||
local titleText = data.title or ""
|
||||
local contentText = data.content or ""
|
||||
local canRead = localChar:GetCanread()
|
||||
|
||||
self.title:SetValue(canRead and titleText or Schema:ShuffleText(titleText))
|
||||
self.title:SetFont(data.font or self.charHandwriting)
|
||||
if self.title:GetName() != "DTextEntry" then self.title:SizeToContents() end
|
||||
|
||||
self.content:SetValue(canRead and contentText or Schema:ShuffleText(contentText))
|
||||
self.content:SetFont(data.font or self.charHandwriting)
|
||||
|
||||
if localChar.id != owner then self:TogglePreview() return end
|
||||
|
||||
self:CreateOption(self.optionPanels[2], LEFT, "EDITS LEFT: "..ix.config.Get("maxEditTimes"..Schema:FirstToUpper(identifier), 0) - data.editedTimes, nil, padding)
|
||||
end
|
||||
|
||||
vgui.Register("ixWritingPaper", PANEL, "ixWritingBase")
|
||||
294
gamemodes/ixhl2rp/plugins/writing/derma/cl_writingbase.lua
Normal file
294
gamemodes/ixhl2rp/plugins/writing/derma/cl_writingbase.lua
Normal file
@@ -0,0 +1,294 @@
|
||||
--[[
|
||||
| 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 PLUGIN = PLUGIN
|
||||
local padding = SScaleMin(20 / 3)
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self:SetAlpha(0)
|
||||
self:AlphaTo(255, 0.5, 0)
|
||||
self:MakePopup()
|
||||
Schema:AllowMessage(self)
|
||||
|
||||
self.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(0, 0, 0, 150))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
Derma_DrawBackgroundBlur( this, 1 )
|
||||
end
|
||||
|
||||
self.selectorButtons = {}
|
||||
self.optionPanels = {}
|
||||
self.textEntries = {}
|
||||
self.labels = {}
|
||||
self.options = {}
|
||||
self.images = {}
|
||||
self.previewEnabled = false
|
||||
|
||||
self.charHandwriting = LocalPlayer():GetCharacter():GetHandwriting()
|
||||
|
||||
if !self.charHandwriting or self.charHandwriting and !PLUGIN.validHandwriting[self.charHandwriting] then
|
||||
self.charHandwriting = "BookChilanka"
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateMainPanel(width, height, bNewspaper)
|
||||
local mainPanel = self:Add(bNewspaper and "DScrollPanel" or "Panel")
|
||||
mainPanel:SetSize(width, height)
|
||||
mainPanel:Center()
|
||||
|
||||
return mainPanel
|
||||
end
|
||||
|
||||
function PANEL:CreateOptionPanel(parent, dock)
|
||||
local optionPanel = parent:Add("Panel")
|
||||
optionPanel:Dock(dock)
|
||||
optionPanel:SetTall(SScaleMin(30 / 3))
|
||||
optionPanel:DockMargin(0, (dock == TOP and 0 or padding), 0, (dock == BOTTOM and 0 or padding))
|
||||
|
||||
self.optionPanels[#self.optionPanels + 1] = optionPanel
|
||||
|
||||
return optionPanel
|
||||
end
|
||||
|
||||
function PANEL:CreateDividerLine(parent, dock)
|
||||
local dividerLine = parent:Add("DShape")
|
||||
dividerLine:SetWide(1)
|
||||
dividerLine:Dock(dock)
|
||||
dividerLine:DockMargin(padding, padding / 4, padding, padding / 4)
|
||||
dividerLine:SetType("Rect")
|
||||
dividerLine:SetColor(color_white)
|
||||
|
||||
return dividerLine
|
||||
end
|
||||
|
||||
function PANEL:Populate(itemID, identifier, data)
|
||||
end
|
||||
|
||||
function PANEL:CreateOption(parent, dock, text, callback, mL, mT, mR, mB)
|
||||
local option = parent:Add("DButton")
|
||||
option:Dock(dock)
|
||||
option:SetText(text or "")
|
||||
option:SetContentAlignment(5)
|
||||
option:SetFont("MenuFontLargerBoldNoFix")
|
||||
option:SizeToContents()
|
||||
option:DockMargin(mL or 0, mT or 0, mR or 0, mB or 0)
|
||||
option.Paint = nil
|
||||
option.DoClick = function(button)
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
if (callback) then
|
||||
callback(button)
|
||||
end
|
||||
end
|
||||
|
||||
self.options[#self.options + 1] = option
|
||||
|
||||
return option
|
||||
end
|
||||
|
||||
function PANEL:CreateExitButton(parent, dock, mL, mT, mR, mB)
|
||||
local option = self:CreateOption(parent, dock, "EXIT", function()
|
||||
self:Remove()
|
||||
end, mL, mT, mR, mB)
|
||||
|
||||
return option
|
||||
end
|
||||
|
||||
function PANEL:ConvertTextEntryToLabel(parent, textEntry)
|
||||
textEntry:SetVisible(false)
|
||||
|
||||
local label = parent:Add("DLabel")
|
||||
label:SetText(textEntry:GetValue())
|
||||
label:SetFont(textEntry:GetFont())
|
||||
label:SetTall(textEntry:GetTall())
|
||||
label:Dock(textEntry:GetDock())
|
||||
label:SetContentAlignment(textEntry.bAlignTopLeft and 7 or textEntry.bAlignLeft and 4 or textEntry.bAlignRight and 4 or 5)
|
||||
|
||||
local dmL, dmT, dmR, dmB = textEntry:GetDockMargin()
|
||||
label:SetPos(textEntry:GetPos())
|
||||
label:DockMargin(((textEntry.bAlignLeft or textEntry.bAlignTopLeft) and (dmL + SScaleMin(2 / 3)) or dmL), dmT, dmR, dmB)
|
||||
label:SetTextColor(textEntry:GetTextColor())
|
||||
label:SetZPos(textEntry:GetZPos())
|
||||
|
||||
self.labels[#self.labels + 1] = label
|
||||
|
||||
return label
|
||||
end
|
||||
|
||||
function PANEL:TogglePreview(button)
|
||||
if self.previewEnabled then
|
||||
if (button) then
|
||||
button:SetText("PREVIEW")
|
||||
button:SizeToContents()
|
||||
end
|
||||
|
||||
for _, textPanel in pairs(self.textEntries) do
|
||||
textPanel:SetVisible(true)
|
||||
textPanel:SetKeyboardInputEnabled(true)
|
||||
textPanel:SetCursorColor(Color(0, 0, 0, 255))
|
||||
|
||||
textPanel.shouldVoidPlaceholder = false
|
||||
end
|
||||
|
||||
for _, label in pairs(self.labels) do
|
||||
label:SetVisible(false)
|
||||
end
|
||||
|
||||
for _, selector in pairs(self.selectorButtons) do
|
||||
if IsValid(selector) then
|
||||
if IsValid(selector.temp) then
|
||||
selector.temp:SetVisible(false)
|
||||
end
|
||||
|
||||
selector:SetVisible(true)
|
||||
end
|
||||
end
|
||||
|
||||
for _, option in pairs(self.options) do
|
||||
if option:GetText() == "EXIT" then continue end
|
||||
|
||||
option:SetVisible(true)
|
||||
end
|
||||
|
||||
self.previewEnabled = false
|
||||
else
|
||||
if (button) then
|
||||
button:SetText("STOP PREVIEW")
|
||||
button:SizeToContents()
|
||||
end
|
||||
|
||||
for _, textPanel in pairs(self.textEntries) do
|
||||
if !IsValid(textPanel) then continue end
|
||||
if textPanel.fixedHeight then
|
||||
self:ConvertTextEntryToLabel(textPanel:GetParent(), textPanel)
|
||||
else
|
||||
textPanel:SetKeyboardInputEnabled(false)
|
||||
textPanel:SetCursorColor(Color(0, 0, 0, 0))
|
||||
end
|
||||
|
||||
textPanel.shouldVoidPlaceholder = true
|
||||
end
|
||||
|
||||
for _, selector in pairs(self.selectorButtons) do
|
||||
if IsValid(selector) then
|
||||
local temp = selector:GetParent():Add("Panel")
|
||||
temp:Dock(selector:GetDock())
|
||||
temp:SetSize(selector:GetSize())
|
||||
temp:SetZPos(selector:GetZPos())
|
||||
temp:DockMargin(selector:GetDockMargin())
|
||||
|
||||
selector:SetVisible(false)
|
||||
selector.temp = temp
|
||||
|
||||
selector:SetVisible(false)
|
||||
end
|
||||
end
|
||||
|
||||
for _, option in pairs(self.options) do
|
||||
if !IsValid(option) then continue end
|
||||
if option:GetText() == "EXIT" then continue end
|
||||
option:SetVisible(false)
|
||||
end
|
||||
|
||||
self.previewEnabled = true
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateTextEntry(parent, width, height, dock, mL, mT, mR, mB, pos, font, maxChars, bMultiline, bEditable, text, color, placeholderText)
|
||||
local textEntry = parent:Add("DTextEntry")
|
||||
textEntry:Dock(!dock and NODOCK or dock)
|
||||
textEntry:MoveToFront()
|
||||
textEntry:SetMultiline(bMultiline or false)
|
||||
textEntry:SetFont(font)
|
||||
textEntry:SetText(text or "")
|
||||
textEntry:SetPos(pos or 0, 0)
|
||||
textEntry:SetSize(width or 0, height or 0)
|
||||
if (height) then textEntry.fixedHeight = true end
|
||||
|
||||
textEntry:SetTextColor(color or color_black)
|
||||
textEntry:DockMargin(mL or 0, mT or 0, mR or 0, mB or 0)
|
||||
textEntry:SetKeyboardInputEnabled(bEditable or true)
|
||||
textEntry:SetPlaceholderText(placeholderText or "")
|
||||
textEntry:SetPlaceholderColor(color_black)
|
||||
|
||||
if (!bEditable) then
|
||||
textEntry:SetCursorColor(Color(0, 0, 0, 0))
|
||||
end
|
||||
|
||||
textEntry.Paint = function(this, w, h)
|
||||
if !this.shouldVoidPlaceholder then
|
||||
if ( this.GetPlaceholderText and this.GetPlaceholderColor and this:GetPlaceholderText() and this:GetPlaceholderText():Trim() != "" and this:GetPlaceholderColor() and ( !this:GetText() or this:GetText() == "" ) ) then
|
||||
|
||||
local oldText = this:GetText()
|
||||
|
||||
local str = this:GetPlaceholderText()
|
||||
if ( str:StartWith( "#" ) ) then str = str:utf8sub( 2 ) end
|
||||
str = language.GetPhrase( str )
|
||||
|
||||
this:SetText( str )
|
||||
this:DrawTextEntryText( this:GetPlaceholderColor(), this:GetHighlightColor(), this:GetCursorColor() )
|
||||
this:SetText( oldText )
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
this:DrawTextEntryText( this:GetTextColor(), this:GetHighlightColor(), this:GetCursorColor() )
|
||||
end
|
||||
|
||||
textEntry.AllowInput = function()
|
||||
local value = textEntry:GetValue()
|
||||
if (string.utf8len(value) > maxChars) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
self.textEntries[#self.textEntries + 1] = textEntry
|
||||
|
||||
return textEntry
|
||||
end
|
||||
|
||||
function PANEL:CreateLinkedImage(parent, width, height, dock, mL, mT, mR, mB, pos, url)
|
||||
local image = parent:Add("HTML")
|
||||
image:SetSize(width or 0, height or 0)
|
||||
image:DockMargin(mL or 0, mT or 0, mR or 0, mB or 0)
|
||||
image:Dock(!dock and NODOCK or dock)
|
||||
image:SetPos(pos or 0, 0)
|
||||
image:SetHTML("<html style='margin:0; padding:0; overflow: hidden;'> <body style ='overflow: hidden; padding: 0; margin: 0;'> <img src='"..url.."' style='width:100%; height:auto;'> </body> <footer style='margin:0; padding:0; overflow: hidden;'></footer> </html>")
|
||||
|
||||
self.images[#self.images + 1] = image
|
||||
|
||||
return image
|
||||
end
|
||||
|
||||
function PANEL:CreateSelectorButton(parent, width, height, dock, mL, mT, mR, mB, pos, text, callback)
|
||||
local selectorButton = parent:Add("DButton")
|
||||
selectorButton:SetSize(width or 0, height or 0)
|
||||
selectorButton:Dock(!dock and NODOCK or dock)
|
||||
selectorButton:DockMargin(mL or 0, mT or 0, mR or 0, mB or 0)
|
||||
selectorButton:SetPos(pos or 0, 0)
|
||||
selectorButton:SetText(text or "")
|
||||
selectorButton:SetFont("MenuFontNoClamp")
|
||||
selectorButton.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
if (callback) then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
self.selectorButtons[#self.selectorButtons + 1] = selectorButton
|
||||
|
||||
return selectorButton
|
||||
end
|
||||
|
||||
vgui.Register("ixWritingBase", PANEL, "EditablePanel")
|
||||
@@ -0,0 +1,25 @@
|
||||
--[[
|
||||
| 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.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
/*---------------------------------------------------------
|
||||
Name: Draw
|
||||
Desc: Draw it!
|
||||
---------------------------------------------------------*/
|
||||
function ENT:Draw()
|
||||
|
||||
self:DrawModel()
|
||||
|
||||
end
|
||||
|
||||
include('shared.lua')
|
||||
@@ -0,0 +1,26 @@
|
||||
--[[
|
||||
| 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')
|
||||
|
||||
/*---------------------------------------------------------
|
||||
Name: Initialize
|
||||
Desc: First function called. Use to set up your entity
|
||||
---------------------------------------------------------*/
|
||||
function ENT:Initialize()
|
||||
|
||||
self:SetModel( "models/crossbow_bolt.mdl" )
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--[[
|
||||
| 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.PrintName = ""
|
||||
ENT.Author = ""
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = ""
|
||||
@@ -0,0 +1,39 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Author = "Fruity"
|
||||
ENT.PrintName = "Cracked Newspaper Printer"
|
||||
ENT.Base = "ix_newspaperprinter"
|
||||
ENT.Category = "HL2 RP"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
ENT.cracked = true
|
||||
|
||||
ENT.Displays = {
|
||||
[1] = {"W41T1NG F0R USER", Color( 255, 255, 180 ), true},
|
||||
[2] = {"RETR1EV1NG 1NF0", Color(0, 255, 0)},
|
||||
[3] = {"N0 P4PER/1NK", Color(255, 0, 0)},
|
||||
[4] = {"N0 P4PER", Color(255, 0, 0)},
|
||||
[5] = {"N0 1NK", Color(255, 0, 0)},
|
||||
[6] = {"REL04D1NG", Color(255, 200, 0)},
|
||||
[7] = {"W41T1NG", Color(255, 255, 180), true},
|
||||
[8] = {"PR1NT1NG", Color( 0, 255, 0 ), true},
|
||||
[9] = {"N0 PERM1T", Color(255, 0, 0)},
|
||||
[10] = {"N0 C1D REQU1RED", Color(0, 255, 0)},
|
||||
[11] = {"P4PER M4XED 0UT", Color(0, 255, 0)},
|
||||
[12] = {"1NK M4XED 0UT", Color(0, 255, 0)},
|
||||
[13] = {"1NV4L1D C1D", Color(255, 0, 0)}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
--[[
|
||||
| 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
|
||||
include('shared.lua')
|
||||
|
||||
netstream.Hook("SetNewspaperContent", function(randomID, savedText)
|
||||
ix.data.Set("newspaper_"..randomID, savedText, false, true)
|
||||
end)
|
||||
|
||||
netstream.Hook("SetNewspaperContentWithIDCL", function(id, content)
|
||||
ix.data.Set(id, content, false, true)
|
||||
end)
|
||||
|
||||
netstream.Hook("OpenNewspaperEditor", function(canEdit, activeNewspaper, entity, bCracked)
|
||||
local editor = vgui.Create("NewspaperEditor")
|
||||
editor:CreateFunctionsPanel(canEdit, entity, bCracked)
|
||||
editor:CreateInnerContent(entity, activeNewspaper, bCracked)
|
||||
end)
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
local ang = self:GetAngles()
|
||||
local pos = self:GetPos() + ang:Up() * 41.7 + ang:Right() * 9.56 + ang:Forward() * 8.6
|
||||
ang:RotateAroundAxis(ang:Right(), 90)
|
||||
ang:RotateAroundAxis(ang:Up(), 90)
|
||||
ang:RotateAroundAxis(ang:Forward(), 90)
|
||||
|
||||
local width, height = 176, 66
|
||||
|
||||
local display = self.Displays[self:GetDisplay()] or self.Displays[6]
|
||||
|
||||
cam.Start3D2D( pos, ang, 0.1 )
|
||||
render.PushFilterMin(TEXFILTER.NONE)
|
||||
render.PushFilterMag(TEXFILTER.NONE)
|
||||
|
||||
surface.SetDrawColor( Color( 16, 16, 16, 240 ) )
|
||||
surface.DrawRect( 0, 0, width, height )
|
||||
|
||||
surface.SetDrawColor( Color( 255, 255, 255, 16 ) )
|
||||
surface.DrawRect( 10, height / 2 + math.sin( CurTime() * 4 ) * height / 2.5, width - 22, 1 )
|
||||
|
||||
local alpha = 191 + 64 * math.sin( CurTime() * 4 )
|
||||
local color = ColorAlpha(display[2], alpha)
|
||||
|
||||
draw.SimpleText( "NEWSPAPER PRINTER", "MenuFont", width / 2, 10, Color( 255, 255, 255, alpha ), TEXT_ALIGN_CENTER )
|
||||
draw.SimpleText( display[1], "MenuFont", width / 2, height - 16, color, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
|
||||
render.PopFilterMin()
|
||||
render.PopFilterMag()
|
||||
cam.End3D2D()
|
||||
|
||||
local paper = self:GetPaper() or 0
|
||||
local ink = self:GetInk() or 0
|
||||
|
||||
pos = pos + ang:Up() * -1.95
|
||||
cam.Start3D2D( pos, ang, 0.1 )
|
||||
render.PushFilterMin(TEXFILTER.NONE)
|
||||
render.PushFilterMag(TEXFILTER.NONE)
|
||||
|
||||
surface.SetDrawColor( Color(255, 255, 255, 255) )
|
||||
surface.DrawRect( -6, 97, 35 / 2, 12 )
|
||||
|
||||
draw.SimpleText( paper, "MenuFont", 3, 93, Color( 0, 0, 0, 255 ), TEXT_ALIGN_CENTER )
|
||||
|
||||
surface.SetDrawColor( Color(0, 0, 0, 255) )
|
||||
surface.DrawRect( -6 + (35 / 2), 97, 35 / 2, 12 )
|
||||
|
||||
draw.SimpleText( ink, "MenuFont", 20, 93, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
|
||||
|
||||
render.PopFilterMin()
|
||||
render.PopFilterMag()
|
||||
cam.End3D2D()
|
||||
end
|
||||
@@ -0,0 +1,254 @@
|
||||
--[[
|
||||
| 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/willardnetworks/plotter.mdl")
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:DrawShadow(false)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self:SetDisplay(1)
|
||||
self:SetSkin(1)
|
||||
|
||||
local physics = self:GetPhysicsObject()
|
||||
physics:EnableMotion(false)
|
||||
physics:Wake()
|
||||
|
||||
self.canUse = true
|
||||
self.paper = self.paper or 0
|
||||
self.ink = self.ink or 0
|
||||
self:SetInk(self.ink)
|
||||
self:SetPaper(self.paper)
|
||||
self.canTouch = true
|
||||
end
|
||||
|
||||
function ENT:CheckCID(client)
|
||||
if self.cracked == true then return true end
|
||||
local character = client:GetCharacter()
|
||||
local inventory = character:GetInventory()
|
||||
|
||||
if self.registeredCID and self.registeredCID != "00000" then
|
||||
if self.registeredCID != "00000" then
|
||||
for _, v in pairs(inventory:GetItems()) do
|
||||
if v.uniqueID == "id_card" then
|
||||
if v:GetData("cid") == self.registeredCID then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
self:SetDisplay(10)
|
||||
return true
|
||||
end
|
||||
else
|
||||
self:SetDisplay(10)
|
||||
return true
|
||||
end
|
||||
|
||||
self:SetDisplay(13)
|
||||
|
||||
timer.Simple(2, function()
|
||||
self.canUse = true
|
||||
self:SetDisplay(1)
|
||||
end)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:CheckForPaperInk()
|
||||
if (self.paper <= 0 or self.ink <= 0) then
|
||||
if (self.paper <= 0 and self.ink <= 0) then
|
||||
self:SetDisplay(3)
|
||||
self:EmitSound("buttons/button10.wav")
|
||||
timer.Simple(2, function()
|
||||
self:SetDisplay(1)
|
||||
self.canUse = true
|
||||
end)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if self.paper <= 0 then
|
||||
self:SetDisplay(4)
|
||||
self:EmitSound("buttons/button10.wav")
|
||||
end
|
||||
|
||||
if self.ink <= 0 then
|
||||
self:SetDisplay(5)
|
||||
self:EmitSound("buttons/button10.wav")
|
||||
end
|
||||
|
||||
timer.Simple(2, function()
|
||||
self:SetDisplay(1)
|
||||
self.canUse = true
|
||||
end)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:Touch(touchingEnt)
|
||||
if self.canTouch then
|
||||
if touchingEnt:GetClass() == "ix_item" then
|
||||
self.canTouch = false
|
||||
local itemID = touchingEnt.ixItemID
|
||||
local itemTable = ix.item.instances[itemID]
|
||||
if itemTable.uniqueID == "paper" or itemTable.uniqueID == "black_ink" then
|
||||
if itemTable.uniqueID == "paper" then
|
||||
if self.paper == 50 then
|
||||
self:SetDisplay(11)
|
||||
self:EmitSound("buttons/button10.wav")
|
||||
timer.Simple(1, function()
|
||||
self:SetDisplay(1)
|
||||
self.canTouch = true
|
||||
end)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
self:EmitSound("buttons/button14.wav")
|
||||
self.paper = math.Clamp(self.paper + 1, 0, 50)
|
||||
self:SetPaper(self.paper)
|
||||
touchingEnt:Remove()
|
||||
end
|
||||
|
||||
if itemTable.uniqueID == "black_ink" then
|
||||
if self.ink == 50 then
|
||||
self:SetDisplay(12)
|
||||
self:EmitSound("buttons/button10.wav")
|
||||
timer.Simple(1, function()
|
||||
self:SetDisplay(1)
|
||||
self.canTouch = true
|
||||
end)
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
self:EmitSound("buttons/button14.wav")
|
||||
self.ink = math.Clamp(self.ink + 1, 0, 50)
|
||||
self:SetInk(self.ink)
|
||||
touchingEnt:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
timer.Simple(1, function()
|
||||
self.canTouch = true
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(client)
|
||||
if self.canUse then
|
||||
self:SetDisplay(2)
|
||||
self:EmitSound("ambient/materials/metal_stress3.wav")
|
||||
self.canUse = false
|
||||
timer.Simple(2, function()
|
||||
if self:CheckCID(client) then
|
||||
timer.Simple(2, function()
|
||||
if self:CheckForPaperInk() then
|
||||
netstream.Start(client, "ixWritingOpenViewerEditor", self:EntIndex(), "newspaper", nil, {builder = true, cracked = self.cracked})
|
||||
self:EmitSound("buttons/button4.wav")
|
||||
self:SetDisplay(7)
|
||||
self.canUse = false
|
||||
|
||||
local uniqueID = "NewspaperCheckForPlayer"..self:EntIndex()
|
||||
timer.Create(uniqueID, 10, 0, function()
|
||||
if (!IsValid(self)) then
|
||||
timer.Remove(uniqueID)
|
||||
return
|
||||
end
|
||||
|
||||
if !client or !client:GetCharacter() then
|
||||
if IsValid(self) then
|
||||
self.canUse = true
|
||||
self:SetDisplay(1)
|
||||
|
||||
timer.Remove(uniqueID)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Close()
|
||||
self.canUse = true
|
||||
self:SetDisplay(1)
|
||||
end
|
||||
|
||||
function ENT:PrintNewspaper(client, data, writingID)
|
||||
local character = client:GetCharacter()
|
||||
|
||||
if !character:HasPermit("writing") and self.cracked != true then
|
||||
self:SetDisplay(9)
|
||||
client:NotifyLocalized("You don't have a writing permit!")
|
||||
self:EmitSound("buttons/button10.wav")
|
||||
|
||||
timer.Simple(2, function()
|
||||
self:SetDisplay(1)
|
||||
self.canUse = true
|
||||
end)
|
||||
else
|
||||
self:SetDisplay(8)
|
||||
self:EmitSound("ambient/machines/combine_terminal_idle3.wav")
|
||||
self:SetSkin(0)
|
||||
self:ResetSequence( 1 )
|
||||
|
||||
timer.Simple(5, function()
|
||||
local entity = ents.Create("ix_shipment")
|
||||
entity:Spawn()
|
||||
entity:SetPos(client:GetItemDropPos(entity))
|
||||
entity:SetItems({["newspaper"] = self.paper})
|
||||
entity:SetNetVar("owner", character:GetID())
|
||||
entity.itemData = {title = data.bigHeadline or "", writingID = writingID, cracked = self.cracked}
|
||||
|
||||
self:SetSkin(1)
|
||||
self:SetDisplay(1)
|
||||
self:ResetSequence( 0 )
|
||||
self:EmitSound("buttons/button6.wav")
|
||||
|
||||
local shipments = character:GetVar("charEnts") or {}
|
||||
table.insert(shipments, entity)
|
||||
character:SetVar("charEnts", shipments, true)
|
||||
|
||||
hook.Run("CreateShipment", client, entity)
|
||||
|
||||
self.ink = math.Round(math.Clamp(self.ink - (self.paper / 5), 0, 50)) -- 1 ink makes 5 newspapers.
|
||||
self.paper = 0
|
||||
self:SetInk(self.ink)
|
||||
self:SetPaper(self.paper)
|
||||
self.canUse = true
|
||||
|
||||
if data.unionDatabase then
|
||||
local queryObj = mysql:Insert("ix_unionnewspapers")
|
||||
local newData = {bigHeadline = data.bigHeadline, subHeadline = data.subHeadline, unionDatabase = writingID}
|
||||
queryObj:Insert("unionnewspaper_data", util.TableToJSON(newData))
|
||||
queryObj:Execute()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
ENT.AutomaticFrameAdvance = true -- Must be set on client
|
||||
@@ -0,0 +1,44 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Author = "Fruity"
|
||||
ENT.PrintName = "Newspaper Printer"
|
||||
ENT.Category = "HL2 RP"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
ENT.cracked = false
|
||||
|
||||
ENT.Displays = {
|
||||
[1] = {"WAITING FOR USER", Color( 255, 255, 180 ), true},
|
||||
[2] = {"RETRIEVING INFO", Color(0, 255, 0)},
|
||||
[3] = {"NO PAPER/INK", Color(255, 0, 0)},
|
||||
[4] = {"NO PAPER", Color(255, 0, 0)},
|
||||
[5] = {"NO INK", Color(255, 0, 0)},
|
||||
[6] = {"RELOADING", Color(255, 200, 0)},
|
||||
[7] = {"WAITING", Color(255, 255, 180), true},
|
||||
[8] = {"PRINTING", Color( 0, 255, 0 ), true},
|
||||
[9] = {"NO PERMIT", Color(255, 0, 0)},
|
||||
[10] = {"NO CID REQUIRED", Color(0, 255, 0)},
|
||||
[11] = {"PAPER MAXED OUT", Color(0, 255, 0)},
|
||||
[12] = {"INK MAXED OUT", Color(0, 255, 0)},
|
||||
[13] = {"INVALID CID", Color(255, 0, 0)}
|
||||
}
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Int", 0, "Display")
|
||||
self:NetworkVar("Float", 0, "Ink")
|
||||
self:NetworkVar("Float", 1, "Paper")
|
||||
end
|
||||
68
gamemodes/ixhl2rp/plugins/writing/items/base/sh_plotters.lua
Normal file
68
gamemodes/ixhl2rp/plugins/writing/items/base/sh_plotters.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
ITEM.name = "Newspaper Printer Base"
|
||||
ITEM.model = "models/willardnetworks/plotter.mdl"
|
||||
ITEM.width = 2
|
||||
ITEM.height = 2
|
||||
ITEM.skin = 1
|
||||
ITEM.description = ""
|
||||
ITEM.category = "Writing"
|
||||
ITEM.ent = ""
|
||||
|
||||
ITEM.functions.Place = {
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local entity = ents.Create(itemTable.ent)
|
||||
local trace = client:GetEyeTraceNoCursor()
|
||||
|
||||
if (trace.HitPos:Distance( client:GetShootPos() ) <= 192) and !client.CantPlace then
|
||||
entity:SetPos(trace.HitPos)
|
||||
entity:Spawn()
|
||||
entity:SetNWInt("owner", client:GetCharacter():GetID())
|
||||
|
||||
client.CantPlace = true
|
||||
|
||||
if itemTable:GetData("paper") then
|
||||
entity.paper = itemTable:GetData("paper")
|
||||
entity:SetPaper(entity.paper)
|
||||
end
|
||||
|
||||
if itemTable:GetData("ink") then
|
||||
entity.ink = itemTable:GetData("ink")
|
||||
entity:SetInk(entity.ink)
|
||||
end
|
||||
|
||||
if itemTable:GetData("registeredCID") then
|
||||
entity.registeredCID = itemTable:GetData("registeredCID")
|
||||
end
|
||||
|
||||
if (IsValid(entity)) then
|
||||
entity:SetAngles(Angle(0, client:EyeAngles().yaw + 180, 0))
|
||||
end
|
||||
|
||||
ix.saveEnts:SaveEntity(entity)
|
||||
|
||||
timer.Simple(3, function()
|
||||
if client then
|
||||
client.CantPlace = false
|
||||
end
|
||||
end)
|
||||
elseif client.CantPlace then
|
||||
client:NotifyLocalized("You cannot place this right now!")
|
||||
return false
|
||||
else
|
||||
client:NotifyLocalized("You cannot place it that far away!..")
|
||||
return false
|
||||
end
|
||||
end
|
||||
}
|
||||
57
gamemodes/ixhl2rp/plugins/writing/items/base/sh_writing.lua
Normal file
57
gamemodes/ixhl2rp/plugins/writing/items/base/sh_writing.lua
Normal file
@@ -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/
|
||||
--]]
|
||||
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
ITEM.name = "Writing Base"
|
||||
ITEM.model = "models/error.mdl"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.identifier = "base"
|
||||
ITEM.description = ""
|
||||
ITEM.category = "Writing"
|
||||
ITEM.bAllowMultiCharacterInteraction = true
|
||||
|
||||
function ITEM:GetName()
|
||||
local title = self:GetData("title")
|
||||
if title and title != "" then return title end
|
||||
|
||||
return self.name
|
||||
end
|
||||
|
||||
function ITEM:GetDescription()
|
||||
return "A "..self.identifier.." to read or write on."
|
||||
end
|
||||
|
||||
function ITEM:SetBodygroups(bodygroups)
|
||||
self:SetData("bodygroups", bodygroups)
|
||||
end
|
||||
|
||||
function ITEM:GetModelBodygroups()
|
||||
return self:GetData("bodygroups") or ""
|
||||
end
|
||||
|
||||
ITEM.functions.Write = {
|
||||
name = "Read/Write",
|
||||
tip = "Read/Write on this object.",
|
||||
icon = "icon16/text_align_center.png",
|
||||
OnRun = function(item)
|
||||
local client = item.player
|
||||
if !IsValid(client) then return false end
|
||||
|
||||
if (SERVER) then
|
||||
PLUGIN:OpenWriting(client, item)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
--[[
|
||||
| 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 = "Cracked Printer"
|
||||
ITEM.uniqueID = "newspaper_printer_cracked"
|
||||
ITEM.description = "A cracked newspaper printer that can print shady newspapers."
|
||||
ITEM.ent = "ix_crackedprinter"
|
||||
@@ -0,0 +1,15 @@
|
||||
--[[
|
||||
| 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 = "Newspaper Printer"
|
||||
ITEM.uniqueID = "newspaper_printer"
|
||||
ITEM.description = "A newspaper printer that can print newspapers."
|
||||
ITEM.ent = "ix_newspaperprinter"
|
||||
19
gamemodes/ixhl2rp/plugins/writing/items/sh_blackink.lua
Normal file
19
gamemodes/ixhl2rp/plugins/writing/items/sh_blackink.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
ITEM.name = "Black Ink"
|
||||
ITEM.uniqueID = "black_ink"
|
||||
ITEM.model = "models/gibs/metal_gib2.mdl"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.description = "A black ink cartridge."
|
||||
ITEM.category = "Writing"
|
||||
80
gamemodes/ixhl2rp/plugins/writing/items/sh_pin.lua
Normal file
80
gamemodes/ixhl2rp/plugins/writing/items/sh_pin.lua
Normal file
@@ -0,0 +1,80 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
ITEM.name = "Pin"
|
||||
ITEM.uniqueID = "pin"
|
||||
ITEM.model = "models/items/crossbowrounds.mdl"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.description = "A pin. Used to hang up papers etc. on the walls."
|
||||
ITEM.category = "Writing"
|
||||
|
||||
function ITEM:MakeNail(nailedEnt, pos, ang, client)
|
||||
pos = nailedEnt:LocalToWorld( pos )
|
||||
nailedEnt:GetPhysicsObject():EnableMotion(false)
|
||||
|
||||
local nail = ents.Create( "gmod_nail" )
|
||||
nail:SetPos( pos )
|
||||
nail:SetAngles( ang )
|
||||
nail:SetParent( nailedEnt )
|
||||
|
||||
nail:Spawn()
|
||||
nail:Activate()
|
||||
|
||||
local item = ix.item.instances[nailedEnt.ixItemID]
|
||||
item:SetData("pin", true)
|
||||
item:SetData("owner", client:GetCharacter():GetID())
|
||||
nail.itemparentID = nailedEnt.ixItemID
|
||||
nail.itemparentPos = nailedEnt:GetPos()
|
||||
nail.itemparentAngs = nailedEnt:GetAngles()
|
||||
|
||||
ix.saveEnts:SaveEntity(nail)
|
||||
end
|
||||
|
||||
ITEM.functions.Pin = {
|
||||
OnRun = function(item)
|
||||
local client = item.player
|
||||
|
||||
local trace = client:GetEyeTrace()
|
||||
|
||||
-- Bail if we hit world or a client
|
||||
if ( !trace.Entity:IsValid() or trace.Entity:IsPlayer() ) then return false end
|
||||
|
||||
if ( SERVER and !util.IsValidPhysicsObject( trace.Entity, trace.PhysicsBone ) ) then return false end
|
||||
|
||||
local tr = {}
|
||||
tr.start = trace.HitPos
|
||||
tr.endpos = trace.HitPos + (client:GetAimVector() * 16.0)
|
||||
tr.filter = { client, trace.Entity }
|
||||
local trTwo = util.TraceLine( tr )
|
||||
|
||||
if ( trTwo.Hit and !trTwo.Entity:IsPlayer() ) then
|
||||
if trace.Entity:GetClass() != "ix_item" then
|
||||
client:NotifyLocalized("Only items can be pinned!")
|
||||
return false
|
||||
end
|
||||
|
||||
-- Client can bail now
|
||||
if ( CLIENT ) then return true end
|
||||
|
||||
local vOrigin = trace.HitPos - (client:GetAimVector() * 8.0)
|
||||
local vDirection = client:GetAimVector():Angle()
|
||||
|
||||
vOrigin = trace.Entity:WorldToLocal( vOrigin )
|
||||
item:MakeNail( trace.Entity, vOrigin, vDirection, client )
|
||||
client:EmitSound("weapons/crossbow/hit1.wav", 110)
|
||||
else
|
||||
client:NotifyLocalized("Could not find anything to pin!")
|
||||
return false
|
||||
end
|
||||
end
|
||||
}
|
||||
25
gamemodes/ixhl2rp/plugins/writing/items/writing/sh_book.lua
Normal file
25
gamemodes/ixhl2rp/plugins/writing/items/writing/sh_book.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
--[[
|
||||
| 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 = "Book"
|
||||
ITEM.model = "models/willardnetworks/misc/book.mdl"
|
||||
ITEM.identifier = "book"
|
||||
ITEM.holdData = {
|
||||
vectorOffset = {
|
||||
right = 1.5,
|
||||
up = -4,
|
||||
forward = -5.5
|
||||
},
|
||||
angleOffset = {
|
||||
right = 0,
|
||||
up = 30,
|
||||
forward = 0
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
--[[
|
||||
| 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.uniqueID = "bulkbox_paper_pins"
|
||||
ITEM.name = "Paper and Pins Box"
|
||||
ITEM.description = "A box containing a set of five papers and pins. How convenient."
|
||||
ITEM.category = "Boxes"
|
||||
ITEM.model = "models/items/item_item_crate.mdl"
|
||||
ITEM.width = 2
|
||||
ITEM.height = 2
|
||||
|
||||
ITEM.colorAppendix = {["red"] = "Please ensure you have 10 free inventory slots before converting this into it's individual script form."}
|
||||
|
||||
ITEM.functions.Convert = {
|
||||
name = "Convert",
|
||||
icon = "icon16/wrench.png",
|
||||
OnRun = function(item)
|
||||
local client = item.player
|
||||
local inventory = client:GetCharacter():GetInventory()
|
||||
|
||||
inventory:Add("paper", 5)
|
||||
inventory:Add("pin", 5)
|
||||
|
||||
client:Notify("You have converted the " .. item.name .. " into its relevant set.")
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
--[[
|
||||
| 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 = "Newspaper"
|
||||
ITEM.model = "models/props_junk/garbage_newspaper001a.mdl"
|
||||
ITEM.identifier = "newspaper"
|
||||
ITEM.holdData = {
|
||||
vectorOffset = {
|
||||
right = -1,
|
||||
up = 2,
|
||||
forward = 1
|
||||
},
|
||||
angleOffset = {
|
||||
right = 0,
|
||||
up = 90,
|
||||
forward = -90
|
||||
},
|
||||
}
|
||||
|
||||
function ITEM:OnInstanced()
|
||||
if self.data and self.data.data then
|
||||
if self.data.data.writingID then self:SetData("writingID", self.data.data.writingID) end
|
||||
if self.data.data.title then self:SetData("title", self.data.data.title) end
|
||||
if self.data.data.cracked then self:SetData("cracked", self.data.data.cracked) end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
--[[
|
||||
| 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 = "Notepad"
|
||||
ITEM.model = "models/props_lab/clipboard.mdl"
|
||||
ITEM.identifier = "notepad"
|
||||
ITEM.holdData = {
|
||||
vectorOffset = {
|
||||
right = 0.7,
|
||||
up = -3,
|
||||
forward = 0
|
||||
},
|
||||
angleOffset = {
|
||||
right = 20,
|
||||
up = 90,
|
||||
forward = -90
|
||||
},
|
||||
}
|
||||
45
gamemodes/ixhl2rp/plugins/writing/items/writing/sh_paper.lua
Normal file
45
gamemodes/ixhl2rp/plugins/writing/items/writing/sh_paper.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
--[[
|
||||
| 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 = "Paper"
|
||||
ITEM.model = "models/props_c17/paper01.mdl"
|
||||
ITEM.identifier = "paper"
|
||||
ITEM.holdData = {
|
||||
vectorOffset = {
|
||||
right = 0,
|
||||
up = -3,
|
||||
forward = 1
|
||||
},
|
||||
angleOffset = {
|
||||
right = -15,
|
||||
up = 90,
|
||||
forward = 90
|
||||
},
|
||||
}
|
||||
ITEM.functions.zTear = { -- I want it to be last
|
||||
name = "Tear",
|
||||
icon = "icon16/textfield_delete.png",
|
||||
OnRun = function(item)
|
||||
local client = item.player
|
||||
|
||||
client:RequestConfirmation("Confirm Tear", "Are you sure you want to tear this paper?", function(confirmation)
|
||||
if (!confirmation) then return end
|
||||
|
||||
client:Notify("You tear the paper apart.")
|
||||
item:Remove()
|
||||
end)
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
return !item.entity or !IsValid(item.entity)
|
||||
end
|
||||
}
|
||||
21
gamemodes/ixhl2rp/plugins/writing/languages/sh_english.lua
Normal file
21
gamemodes/ixhl2rp/plugins/writing/languages/sh_english.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
--[[
|
||||
| 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 = {
|
||||
writingDataError = "Something went wrong when getting writing data.",
|
||||
writingFontSet = "You have set this character's handwriting to %s.",
|
||||
writingFontInvalid = "This is an invalid font.",
|
||||
writingOwnerNotYou = "You are not the owner of this writing object.",
|
||||
writingMaxEditsReached = "You have reached the maximum edits of this writing object.",
|
||||
waitBeforeReadingWriting = "You need to wait before you can read/write in this!..",
|
||||
noHandwritingSelected = "You haven't selected your handwriting style yet!",
|
||||
cmdCharSetHandwriting = "Set a character's handwriting.",
|
||||
}
|
||||
18
gamemodes/ixhl2rp/plugins/writing/languages/sh_spanish.lua
Normal file
18
gamemodes/ixhl2rp/plugins/writing/languages/sh_spanish.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
--[[
|
||||
| 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 = {
|
||||
noHandwritingSelected = "¡No has seleccionado tu estilo de escritura aún!",
|
||||
writingMaxEditsReached = "Has alcanzado el máximo de ediciones para este objeto de escritura.",
|
||||
writingDataError = "Algo ha salido mal cuando se escribía la información.",
|
||||
waitBeforeReadingWriting = "¡Necesitas esperar antes de poder leer/escribir en esto!..",
|
||||
writingFontInvalid = "Esta fuente no es válida.",
|
||||
writingOwnerNotYou = "No eres el propietario de este objeto de escritura."
|
||||
}
|
||||
75
gamemodes/ixhl2rp/plugins/writing/sh_plugin.lua
Normal file
75
gamemodes/ixhl2rp/plugins/writing/sh_plugin.lua
Normal file
@@ -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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Writing Essentials"
|
||||
PLUGIN.author = "Fruity"
|
||||
PLUGIN.description = "Newspapers, notepads, papers."
|
||||
|
||||
PLUGIN.cachedNewspapers = PLUGIN.cachedNewspapers or {}
|
||||
PLUGIN.cachedNotepads = PLUGIN.cachedNotepads or {}
|
||||
PLUGIN.cachedPapers = PLUGIN.cachedPapers or {}
|
||||
PLUGIN.cachedBooks = PLUGIN.cachedBooks or {}
|
||||
|
||||
PLUGIN.identifiers = {"newspaper", "paper", "notepad", "book", "unionnewspaper"}
|
||||
|
||||
PLUGIN.validHandwriting = {
|
||||
BookSatisfy = "Satisfy",
|
||||
BookChilanka = "Chilanka",
|
||||
BookDancing = "Amita",
|
||||
BookHandlee = "Handlee",
|
||||
BookAmita = "Dancing Script",
|
||||
BookTimes = "Times New Roman",
|
||||
BookTypewriter = "Traveling _Typewriter"
|
||||
}
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
ix.util.Include("cl_plugin.lua")
|
||||
|
||||
ix.char.RegisterVar("handwriting", {
|
||||
field = "handwriting",
|
||||
fieldType = ix.type.string,
|
||||
default = "",
|
||||
isLocal = true,
|
||||
bNoDisplay = true
|
||||
})
|
||||
|
||||
ix.command.Add("CharSetHandwriting", {
|
||||
description = "@cmdCharSetHandwriting",
|
||||
adminOnly = true,
|
||||
argumentNames = {"target", "Satisfy | Chilanka | Dancing | Handlee | Amita | Times | Typewriter"},
|
||||
arguments = {ix.type.character, ix.type.text},
|
||||
OnRun = function(self, client, target, font)
|
||||
if (CLIENT) then return end
|
||||
|
||||
font = "Book" .. font
|
||||
|
||||
PLUGIN:SetHandwriting(client, target, font)
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("ChangeHandwriting", {
|
||||
description = "Change your character's handwriting.",
|
||||
OnRun = function(self, client)
|
||||
netstream.Start(client, "ixWritingOpenHandWritingSelector")
|
||||
end
|
||||
})
|
||||
|
||||
do
|
||||
for _, identifier in pairs(PLUGIN.identifiers) do
|
||||
if identifier == "newspaper" then continue end
|
||||
ix.config.Add("maxEditTimes"..Schema:FirstToUpper(identifier), 3, "The max edit times of a "..identifier..".", nil, {
|
||||
data = {min = 1, max = 20},
|
||||
category = "Writing"
|
||||
})
|
||||
end
|
||||
end
|
||||
462
gamemodes/ixhl2rp/plugins/writing/sv_plugin.lua
Normal file
462
gamemodes/ixhl2rp/plugins/writing/sv_plugin.lua
Normal file
@@ -0,0 +1,462 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
function PLUGIN:DatabaseConnected()
|
||||
for _, identifier in pairs(self.identifiers) do
|
||||
local query = mysql:Create("ix_"..identifier.."s")
|
||||
query:Create(identifier.."_id", "INT(11) UNSIGNED NOT NULL AUTO_INCREMENT")
|
||||
query:Create(identifier.."_data", "TEXT")
|
||||
query:PrimaryKey(identifier.."_id")
|
||||
query:Execute()
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:FetchDatabaseWritingData(identifier, id, callback)
|
||||
local query = mysql:Select("ix_"..identifier.."s")
|
||||
query:Select(identifier.."_id")
|
||||
query:Select(identifier.."_data")
|
||||
query:Where(identifier.."_id", id)
|
||||
query:Limit(1)
|
||||
|
||||
query:Callback(function(result)
|
||||
if (!istable(result) or #result == 0) then
|
||||
callback(false)
|
||||
return
|
||||
end
|
||||
|
||||
if !callback or (callback and !isfunction(callback)) then return end
|
||||
callback(result)
|
||||
end)
|
||||
|
||||
query:Execute()
|
||||
end
|
||||
|
||||
function PLUGIN:FetchCachedWritingData(identifier, id)
|
||||
local cachedTable = self["cached"..Schema:FirstToUpper(identifier).."s"]
|
||||
if !cachedTable then return false end
|
||||
if !cachedTable[id] then return false end
|
||||
|
||||
return cachedTable[id]
|
||||
end
|
||||
|
||||
function PLUGIN:FetchWritingData(client, identifier, id, callback)
|
||||
local cachedData = self:FetchCachedWritingData(identifier, id)
|
||||
if cachedData then
|
||||
return callback(cachedData)
|
||||
end
|
||||
|
||||
return self:FetchDatabaseWritingData(identifier, id, function(result)
|
||||
if !result then return false end
|
||||
if !result[1] then return false end
|
||||
|
||||
local resultData = result[1][identifier.."_data"]
|
||||
if !resultData then return false end
|
||||
|
||||
result[1][identifier.."_data"] = util.JSONToTable(resultData)
|
||||
|
||||
local cachedTable = "cached"..Schema:FirstToUpper(identifier).."s"
|
||||
if self[cachedTable] then
|
||||
self[cachedTable][id] = result[1][identifier.."_data"]
|
||||
end
|
||||
|
||||
return callback(result[1][identifier.."_data"])
|
||||
end)
|
||||
end
|
||||
|
||||
function PLUGIN:AddWriting(client, identifier, data, item)
|
||||
if !item or (item and IsEntity(item)) then
|
||||
if identifier != "newspaper" then return false end
|
||||
local found = false
|
||||
for _, v in pairs(ents.FindInSphere( client:GetPos(), 100 )) do
|
||||
if v != item then continue end
|
||||
found = true
|
||||
end
|
||||
|
||||
if !found then
|
||||
client:NotifyLocalized("You are not near a newspaper printer!")
|
||||
item:Close()
|
||||
return
|
||||
end
|
||||
|
||||
local cachedTable = "cached"..Schema:FirstToUpper(identifier).."s"
|
||||
local queryObj = mysql:Insert("ix_"..identifier.."s")
|
||||
queryObj:Insert(identifier.."_data", util.TableToJSON(data))
|
||||
|
||||
queryObj:Callback(function(result, status, lastID)
|
||||
self[cachedTable][lastID] = data
|
||||
item:PrintNewspaper(client, data, lastID)
|
||||
end)
|
||||
|
||||
queryObj:Execute()
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local success, lastOwner, editedTimes = self:ItemChecks(client, identifier, item)
|
||||
if !success then
|
||||
if lastOwner then
|
||||
client:NotifyLocalized(lastOwner)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local cachedTable = "cached"..Schema:FirstToUpper(identifier).."s"
|
||||
local character = client:GetCharacter()
|
||||
if !character then return false end
|
||||
local writingID = item:GetData("writingID", false)
|
||||
if !editedTimes then editedTimes = 0 end
|
||||
|
||||
data.owner = lastOwner or character.id
|
||||
data.font = character:GetHandwriting()
|
||||
data.editedTimes = editedTimes
|
||||
item:SetData("title", data.title or data.title1 or "")
|
||||
item:SetData("owner", data.owner)
|
||||
|
||||
if writingID then
|
||||
data.editedTimes = editedTimes + 1
|
||||
|
||||
local query2 = mysql:Update("ix_"..identifier.."s")
|
||||
query2:Where(identifier.."_id", writingID)
|
||||
query2:Update(identifier.."_data", util.TableToJSON(data))
|
||||
query2:Execute()
|
||||
|
||||
self[cachedTable][writingID] = data
|
||||
return
|
||||
end
|
||||
|
||||
local queryObj = mysql:Insert("ix_"..identifier.."s")
|
||||
queryObj:Insert(identifier.."_data", util.TableToJSON(data))
|
||||
|
||||
queryObj:Callback(function(result, status, lastID)
|
||||
item:SetData("writingID", lastID)
|
||||
self[cachedTable][lastID] = data
|
||||
end)
|
||||
|
||||
queryObj:Execute()
|
||||
end
|
||||
|
||||
function PLUGIN:CheckForHandwriting(client)
|
||||
if !IsValid(client) then return false end
|
||||
|
||||
local character = client:GetCharacter()
|
||||
if !character then return end
|
||||
|
||||
local handWriting = character:GetHandwriting()
|
||||
if (!handWriting or !PLUGIN.validHandwriting[handWriting]) then
|
||||
client:NotifyLocalized("noHandwritingSelected")
|
||||
netstream.Start(client, "ixWritingOpenHandWritingSelector")
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function PLUGIN:CanOpenWriting(client)
|
||||
if client.CantPlace then
|
||||
client:NotifyLocalized("waitBeforeReadingWriting")
|
||||
return false
|
||||
end
|
||||
|
||||
if !self:CheckForHandwriting(client) then return false end
|
||||
|
||||
client.CantPlace = true
|
||||
|
||||
timer.Simple(3, function()
|
||||
if client then
|
||||
client.CantPlace = false
|
||||
end
|
||||
end)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function PLUGIN:OpenWriting(client, item)
|
||||
if !self:CanOpenWriting(client) then return false end
|
||||
local writingID = item:GetData("writingID", false)
|
||||
local cracked = item:GetData("cracked", false)
|
||||
if writingID then
|
||||
self:FetchWritingData(client, item.identifier, writingID, function(data)
|
||||
if !data then
|
||||
client:NotifyLocalized("writingDataError")
|
||||
return
|
||||
end
|
||||
|
||||
netstream.Start(client, "ixWritingOpenViewerEditor", item.id, item.identifier, data, {builder = false, cracked = cracked})
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
netstream.Start(client, "ixWritingOpenViewerEditor", item.id, item.identifier)
|
||||
end
|
||||
|
||||
function PLUGIN:ItemChecks(client, identifier, item)
|
||||
local character = client:GetCharacter()
|
||||
if !character then return false end
|
||||
|
||||
local inventory = character:GetInventory()
|
||||
if !inventory then return false end
|
||||
|
||||
if !inventory.GetItemByID then return false end
|
||||
if !inventory:GetItemByID(item.id) then
|
||||
local targetEnt = client:GetEyeTraceNoCursor().Entity
|
||||
if !IsValid(targetEnt) then return false end
|
||||
if targetEnt:GetClass() != "ix_item" then return false end
|
||||
if (targetEnt.ixItemID and targetEnt.ixItemID != item.id) then return false end
|
||||
end
|
||||
|
||||
local writingID = item:GetData("writingID", false)
|
||||
if writingID then
|
||||
return self:FetchWritingData(client, identifier, writingID, function(data)
|
||||
if data.owner != character.id then return false, "writingOwnerNotYou" end
|
||||
if data.editedTimes and data.editedTimes >= ix.config.Get("maxEditTimes"..Schema:FirstToUpper(identifier), 0) then
|
||||
return false, "writingMaxEditsReached"
|
||||
end
|
||||
|
||||
return true, data.owner, data.editedTimes
|
||||
end)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function PLUGIN:SetHandwriting(client, targetChar, font)
|
||||
if !targetChar then return false end
|
||||
|
||||
if (self.validHandwriting[font]) then
|
||||
targetChar:SetHandwriting(font)
|
||||
|
||||
if (client:GetCharacter() != targetChar) then
|
||||
client:NotifyLocalized("writingFontSet", font)
|
||||
end
|
||||
else
|
||||
if !IsValid(client) then return false end
|
||||
|
||||
return client:NotifyLocalized("writingFontInvalid")
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:SetBookColor(client, itemID, bodygroups)
|
||||
local item = ix.item.instances[itemID]
|
||||
if !item then return false end
|
||||
if !self:ItemChecks(client, "book", item) then return false end
|
||||
|
||||
item:SetBodygroups(bodygroups)
|
||||
end
|
||||
|
||||
function PLUGIN:RegisterSaveEnts()
|
||||
ix.saveEnts:RegisterEntity("gmod_nail", true, true, false, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
if (!entity.itemparentPos) then
|
||||
entity.itemparentPos = ix.item.instances[entity.itemparentID]:GetEntity():GetPos()
|
||||
end
|
||||
|
||||
if (!entity.itemparentAngs) then
|
||||
entity.itemparentAngs = ix.item.instances[entity.itemparentID]:GetEntity():GetAngles()
|
||||
end
|
||||
|
||||
data.parent = entity.itemparentID
|
||||
data.parentPos = entity.itemparentPos
|
||||
data.parentAngs = entity.itemparentAngs
|
||||
data.motion = false
|
||||
end,
|
||||
OnRestore = function(entity, data) --OnRestore
|
||||
local parentEntity = ix.item.instances[data.parent]:GetEntity()
|
||||
entity:SetParent(parentEntity)
|
||||
entity.itemparentID = data.parent
|
||||
|
||||
if (data.parentPos) then
|
||||
entity.itemparentPos = data.parentPos
|
||||
parentEntity:SetPos(data.parentPos)
|
||||
end
|
||||
|
||||
if (data.parentAngs) then
|
||||
entity.itemparentAngs = data.parentAngs
|
||||
parentEntity:SetAngles(data.parentAngs)
|
||||
end
|
||||
|
||||
parentEntity:GetPhysicsObject():EnableMotion(false)
|
||||
end,
|
||||
ShouldSave = function(entity)
|
||||
return entity.itemparentID and ix.item.instances[entity.itemparentID] and IsValid(ix.item.instances[entity.itemparentID]:GetEntity())
|
||||
end,
|
||||
ShouldRestore = function(data)
|
||||
if (!ix.item.instances[data.parent]) then return false end
|
||||
|
||||
local parentEntity = ix.item.instances[data.parent]:GetEntity()
|
||||
if (!IsValid(parentEntity)) then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
})
|
||||
|
||||
ix.saveEnts:RegisterEntity("ix_newspaperprinter", true, true, true, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
data.paper = entity.paper
|
||||
data.ink = entity.ink
|
||||
data.registeredCID = entity.registeredCID
|
||||
data.owner = entity:GetNWInt("owner")
|
||||
end,
|
||||
OnRestore = function(entity, data) --OnRestore
|
||||
entity.paper = data.paper or 0
|
||||
entity.ink = data.ink or 0
|
||||
entity:SetInk(data.ink or 0)
|
||||
entity:SetPaper(data.paper or 0)
|
||||
entity.registeredCID = data.registeredCID
|
||||
entity:SetNWInt("owner", data.owner)
|
||||
end,
|
||||
})
|
||||
|
||||
ix.saveEnts:RegisterEntity("ix_crackedprinter", true, true, true, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
data.paper = entity.paper
|
||||
data.ink = entity.ink
|
||||
data.registeredCID = entity.registeredCID
|
||||
data.owner = entity:GetNWInt("owner")
|
||||
end,
|
||||
OnRestore = function(entity, data) --OnRestore
|
||||
entity.paper = data.paper or 0
|
||||
entity.ink = data.ink or 0
|
||||
entity:SetInk(data.ink or 0)
|
||||
entity:SetPaper(data.paper or 0)
|
||||
entity.registeredCID = data.registeredCID
|
||||
entity:SetNWInt("owner", data.owner)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function PLUGIN:PostSaveEntsRestore(class)
|
||||
if (!class) then
|
||||
timer.Simple(30, function()
|
||||
ix.saveEnts:RestoreAll("gmod_nail")
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:CanPlayerTakeItem(client, entity)
|
||||
local item = ix.item.instances[entity.ixItemID]
|
||||
if (!item) then return end
|
||||
|
||||
local character = client:GetCharacter()
|
||||
local charid = character.id or character:GetID()
|
||||
local data = item.data or {}
|
||||
|
||||
if data.pin and data.owner then
|
||||
if data.owner == charid then
|
||||
item:SetData("pin", false)
|
||||
return true
|
||||
else
|
||||
client:NotifyLocalized("You cannot pick up pinned items unless you own them!")
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerButtonDown( client, key )
|
||||
if (IsFirstTimePredicted() and key == KEY_LALT) then
|
||||
local entity = client:GetEyeTraceNoCursor().Entity
|
||||
if !IsValid(entity) then return false end
|
||||
if !entity.canUse then return false end
|
||||
|
||||
if (client:GetShootPos():DistToSqr(entity:GetPos()) > 100 * 100) then return false end
|
||||
|
||||
local character = client:GetCharacter()
|
||||
if !character then return false end
|
||||
|
||||
if entity:GetNWInt("owner") and client:GetCharacter():GetID() != entity:GetNWInt("owner") then
|
||||
return false
|
||||
end
|
||||
|
||||
if (entity:GetClass() == "ix_newspaperprinter" or entity:GetClass() == "ix_crackedprinter") then
|
||||
local getInk = entity.ink or 0
|
||||
local getPaper = entity.paper or 0
|
||||
local registeredCID = entity.registeredCID or "00000"
|
||||
local activeClass = "newspaper_printer"
|
||||
|
||||
if entity:GetClass() == "ix_crackedprinter" then
|
||||
activeClass = "newspaper_printer_cracked"
|
||||
end
|
||||
|
||||
local pos = entity:GetPos()
|
||||
|
||||
ix.item.Spawn(activeClass, pos + Vector( 0, 0, 2 ), function(item, entityCreated)
|
||||
item:SetData("ink", getInk)
|
||||
item:SetData("paper", getPaper)
|
||||
item:SetData("registeredCID", registeredCID)
|
||||
end, entity:GetAngles())
|
||||
|
||||
entity:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:GetUnionNewspapers(client, bTerminal)
|
||||
local query = mysql:Select("ix_unionnewspapers")
|
||||
query:Select("unionnewspaper_id")
|
||||
query:Select("unionnewspaper_data")
|
||||
query:Callback(function(result)
|
||||
if (!istable(result) or #result == 0) then
|
||||
return
|
||||
end
|
||||
|
||||
netstream.Start(client, "ixWritingReplyUnionNewspapers", result, bTerminal)
|
||||
end)
|
||||
|
||||
query:Execute()
|
||||
end
|
||||
|
||||
netstream.Hook("ixWritingGetUnionWritingData", function(client, writingID)
|
||||
PLUGIN:FetchWritingData(client, "newspaper", writingID, function(data)
|
||||
if !data then
|
||||
client:NotifyLocalized("writingDataError")
|
||||
return
|
||||
end
|
||||
|
||||
netstream.Start(client, "ixWritingOpenViewerEditor", false, "newspaper", data, {builder = false, cracked = false})
|
||||
end)
|
||||
end)
|
||||
|
||||
netstream.Hook("ixWritingGetUnionNewspapers", function(client, bTerminal)
|
||||
PLUGIN:GetUnionNewspapers(client, bTerminal)
|
||||
end)
|
||||
|
||||
netstream.Hook("ixWritingSetBookColor", function(client, itemID, bodygroups)
|
||||
PLUGIN:SetBookColor(client, itemID, bodygroups)
|
||||
end)
|
||||
|
||||
netstream.Hook("ixWritingAddWriting", function(client, identifier, data, itemID)
|
||||
local item
|
||||
if identifier != "newspaper" then
|
||||
item = (itemID and ix.item.instances[itemID] or false)
|
||||
end
|
||||
|
||||
if identifier == "newspaper" then
|
||||
item = !Entity(itemID) and false or IsValid(Entity(itemID)) and Entity(itemID)
|
||||
end
|
||||
|
||||
PLUGIN:AddWriting(client, identifier, data, item)
|
||||
end)
|
||||
|
||||
netstream.Hook("ixWritingSetHandWriting", function(client, font)
|
||||
PLUGIN:SetHandwriting(client, client:GetCharacter(), font)
|
||||
end)
|
||||
|
||||
netstream.Hook("ixWritingCloseNewspaperCreator", function(client, entityID)
|
||||
if isbool(entityID) then return false end
|
||||
if IsValid(Entity(entityID)) then
|
||||
if !Entity(entityID).Close then return end
|
||||
|
||||
Entity(entityID):Close()
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user