From fefb0c8c35863ce15d3282e733e4edef9fddd0d8 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sun, 17 May 2026 17:51:49 +0300 Subject: [PATCH 1/3] Don't use NW to network holograms values There can be a lot of holograms and networking via NW is not the most effective, it is better to use datatables --- .../gmod_wire_expression2/core/hologram.lua | 4 ++-- lua/entities/gmod_wire_hologram.lua | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/hologram.lua b/lua/entities/gmod_wire_expression2/core/hologram.lua index 6ac1bb55ac..2711b6a285 100644 --- a/lua/entities/gmod_wire_expression2/core/hologram.lua +++ b/lua/entities/gmod_wire_expression2/core/hologram.lua @@ -1085,14 +1085,14 @@ e2function void holoDisableShading( index, disable ) local Holo = CheckIndex(self, index) if not Holo then return end - Holo.ent:SetNWBool( "disable_shading", disable == 1 ) + Holo.ent:SetDisableShading( disable == 1 ) end e2function void holoInvertModel( index, enable ) local Holo = CheckIndex(self, index) if not Holo then return end - Holo.ent:SetNWInt("invert_model", enable ~= 0 and 1 or 0) + Holo.ent:SetInvertModel( enable ~= 0 and true or false ) end -- ----------------------------------------------------------------------------- diff --git a/lua/entities/gmod_wire_hologram.lua b/lua/entities/gmod_wire_hologram.lua index ded7396280..736a3e696b 100644 --- a/lua/entities/gmod_wire_hologram.lua +++ b/lua/entities/gmod_wire_hologram.lua @@ -5,6 +5,8 @@ ENT.DisableDuplicator = true function ENT:SetupDataTables() self:NetworkVar( "Entity", 0, "PlayerEnt" ) + self:NetworkVar( "Bool", 0, "InvertModel" ) + self:NetworkVar( "Bool", 1, "DisableShading" ) end function ENT:GetPlayer() @@ -122,10 +124,13 @@ if CLIENT then SetupClipping(selfTbl) end - local invert_model = EntityMeta.GetNWInt(self, "invert_model") - render.CullMode(invert_model) + local invert_model = selfTbl.GetInvertModel(self) - if EntityMeta.GetNWBool(self, "disable_shading") then + if invert_model then + render.CullMode(1) + end + + if selfTbl.GetDisableShading(self) then render.SuppressEngineLighting(true) EntityMeta.DrawModel(self) render.SuppressEngineLighting(false) @@ -133,7 +138,7 @@ if CLIENT then EntityMeta.DrawModel(self) end - if invert_model ~= 0 then + if invert_model then render.CullMode(0) end From 6b25b94499393ba1f0b1d44e34b8181431058d44 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sun, 17 May 2026 18:23:48 +0300 Subject: [PATCH 2/3] Switch E2 name/owner networking to datatables too --- lua/entities/gmod_wire_expression2/core/selfaware.lua | 2 +- lua/entities/gmod_wire_expression2/init.lua | 11 ++++++++--- .../client/text_editor/wire_expression2_editor.lua | 2 +- lua/wire/stools/expression2.lua | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/selfaware.lua b/lua/entities/gmod_wire_expression2/core/selfaware.lua index a38bdb71ad..0b8a7001e4 100644 --- a/lua/entities/gmod_wire_expression2/core/selfaware.lua +++ b/lua/entities/gmod_wire_expression2/core/selfaware.lua @@ -129,7 +129,7 @@ local function doSetName(self, this, name) end this.name = name - this:SetNWString("name", name) + this:SetInstanceName(name) this:SetOverlayText(name) else if #name > 200 then name = string.sub(name, 1, 200) end diff --git a/lua/entities/gmod_wire_expression2/init.lua b/lua/entities/gmod_wire_expression2/init.lua index 27bc43538e..3b0c1a98e9 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -88,6 +88,11 @@ function ENT:Initialize() end end +function ENT:SetupDataTables() + self:NetworkVar("Entity", 0, "InstancePlayer") + self:NetworkVar("String", 0, "InstanceName") +end + function ENT:OnRestore() self:Setup(self.original, self.inc_files, nil, true) end @@ -460,7 +465,7 @@ function ENT:CompileCode(buffer, files, filepath) else self.WireDebugName = "E2 - " .. self.name end - self:SetNWString("name", self.name) + self:SetInstanceName(self.name) self.directives = directives self.inports = directives.inputs @@ -846,7 +851,7 @@ hook.Add("PlayerAuthed", "Wire_Expression2_Player_Authed", function(ply, sid, ui end if ent.uid == uid then - ent:SetNWEntity("player", ply) + ent:SetInstancePlayer(ply) ent.player = ply end end @@ -866,7 +871,7 @@ function MakeWireExpression2(player, Pos, Ang, model, buffer, name, inputs, outp self:SetAngles(Ang) self:SetPos(Pos) self:SetPlayer(player) - self:SetNWEntity("player", player) + self:SetInstancePlayer("player", player) self.player = player self:Spawn() diff --git a/lua/wire/client/text_editor/wire_expression2_editor.lua b/lua/wire/client/text_editor/wire_expression2_editor.lua index 38526871d0..9874477ac9 100644 --- a/lua/wire/client/text_editor/wire_expression2_editor.lua +++ b/lua/wire/client/text_editor/wire_expression2_editor.lua @@ -1438,7 +1438,7 @@ Text here]# ]] dlist2:Clear() local size = 0 for _, v in ipairs(E2s) do - local ply = v:GetNWEntity("player", NULL) + local ply = v:GetInstancePlayer() if IsValid(ply) and ply == LocalPlayer() or showall then local nick if not ply or not ply:IsValid() then nick = "Unknown" else nick = ply:Nick() end diff --git a/lua/wire/stools/expression2.lua b/lua/wire/stools/expression2.lua index 2d10a32774..55ab0ce58b 100644 --- a/lua/wire/stools/expression2.lua +++ b/lua/wire/stools/expression2.lua @@ -392,7 +392,7 @@ if SERVER then if ply ~= toent.player then toent.player = ply toent:SetPlayer(ply) - toent:SetNWEntity("player", ply) + toent:SetInstancePlayer(ply) -- Note that the SENT and CPPI owners aren't set here to allow the original owner to still access their chip end From 16d48657dffc5033d0cbaf975699dede30306559 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sun, 17 May 2026 18:28:03 +0300 Subject: [PATCH 3/3] Fixes --- lua/entities/gmod_wire_expression2/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/entities/gmod_wire_expression2/init.lua b/lua/entities/gmod_wire_expression2/init.lua index 3b0c1a98e9..8d2999419b 100644 --- a/lua/entities/gmod_wire_expression2/init.lua +++ b/lua/entities/gmod_wire_expression2/init.lua @@ -871,10 +871,12 @@ function MakeWireExpression2(player, Pos, Ang, model, buffer, name, inputs, outp self:SetAngles(Ang) self:SetPos(Pos) self:SetPlayer(player) - self:SetInstancePlayer("player", player) self.player = player self:Spawn() + -- Wait for ENT:SetupDataTables + self:SetInstancePlayer(self.player) + if isstring( buffer ) then -- if someone dupes an E2 with compile errors, then all these values will be invalid buffer = string.Replace(string.Replace(buffer, string.char(163), "\""), string.char(128), "\n")