From 21960fa5abe50c31a3dede4136e3e804b7a288a7 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Mon, 28 Sep 2026 22:12:20 +0300 Subject: [PATCH] Clamp font lenght on server too + don't send info twice on textscreen init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s easier and more convenient to clamp this on the server. Also moved ENT:SendConfig to after the text is set so the config isn't sent twice --- lua/entities/gmod_wire_textscreen.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lua/entities/gmod_wire_textscreen.lua b/lua/entities/gmod_wire_textscreen.lua index 9b01a3ec6a..efeeb440f8 100644 --- a/lua/entities/gmod_wire_textscreen.lua +++ b/lua/entities/gmod_wire_textscreen.lua @@ -230,10 +230,9 @@ function ENT:Setup(DefaultText, chrPerLine, textJust, valign, tfont, fgcolor, bg self.chrPerLine = math.Clamp(math.ceil(chrPerLine or 10), 1, 15) self.textJust = textJust or 1 self.valign = valign or 0 - self.tfont = tfont or "Arial" - self:SendConfig() - + self.tfont = tfont and string.sub(tfont, 1, 32) or "Arial" self:TriggerInput("String", DefaultText or "") + self:SendConfig() end function ENT:TriggerInput(iname, value) @@ -241,7 +240,7 @@ function ENT:TriggerInput(iname, value) self.text = string.sub(tostring(value), 1, 1024) self.doSendText = true elseif iname == "Font" then - self.tfont = tostring(value) + self.tfont = string.sub(tostring(value), 1, 32) self.doSendConfig = true elseif iname == "FGColor" then self.fgcolor = Color(value.x, value.y, value.z) @@ -279,7 +278,7 @@ function ENT:SendConfig(ply) self.doSendConfig = false - local font = string.sub(self.tfont, 0, 31) + local font = self.tfont local size = self.chrPerLine if not WireLib.CheckFont(font .. math.floor(760 / size), ply) then