@@ -217,6 +217,8 @@ function ENT:Initialize()
217217 self :SetMoveType ( MOVETYPE_VPHYSICS )
218218 self :SetSolid ( SOLID_VPHYSICS )
219219
220+ self .doSendText = false
221+ self .doSendConfig = false
220222 self .Inputs = WireLib .CreateSpecialInputs (self , { " String" , " Font" , " FGColor" , " BGColor" }, { " STRING" , " STRING" , " VECTOR" , " VECTOR" })
221223 self :InitializeShared ()
222224end
@@ -230,14 +232,13 @@ function ENT:Setup(DefaultText, chrPerLine, textJust, valign, tfont, fgcolor, bg
230232 self .tfont = tfont or " Arial"
231233 self :SendConfig ()
232234
233- self .text = DefaultText or " "
234- self :TriggerInput (" String" , self .text )
235+ self :TriggerInput (" String" , DefaultText or " " )
235236end
236237
237238function ENT :TriggerInput (iname , value )
238239 if iname == " String" then
239- self .text = tostring (value )
240- self : SendText ()
240+ self .text = string.sub ( tostring (value ), 1 , 1024 )
241+ self . doSendText = true
241242 elseif iname == " Font" then
242243 self .tfont = tostring (value )
243244 self .doSendConfig = true
@@ -255,6 +256,7 @@ local function formatText(text)
255256end
256257
257258function ENT :SendText (ply )
259+ self .doSendText = false
258260 WireLib .netStart (self )
259261 net .WriteBit (false ) -- Sending Text
260262 net .WriteString (formatText (self .text ))
@@ -265,10 +267,13 @@ function ENT:Think()
265267 if self .doSendConfig then
266268 self :SendConfig ()
267269 end
270+ if self .doSendText then
271+ self :SendText ()
272+ end
268273end
269274
270275function ENT :SendConfig (ply )
271- self .doSendConfig = nil
276+ self .doSendConfig = false
272277 WireLib .netStart (self )
273278 net .WriteBit (true ) -- Sending Config
274279 net .WriteUInt (self .chrPerLine , 4 )
0 commit comments