From eb3560ea9ba991529769c593aeee1646f468a025 Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Wed, 8 Jul 2026 23:44:14 +0300 Subject: [PATCH 1/8] fix: repair addon metadata --- addon.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon.json b/addon.json index dc706894f9..d50f9dd2ff 100644 --- a/addon.json +++ b/addon.json @@ -15,7 +15,7 @@ "git-hooks-pre-commit", "gitrid.sh", "LICENSE", - "wiremod.*" + "wiremod.*", "benchmark_*" ] } From d8f5fd3ac9402ec12c09e81592c6a8607e67be13 Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Wed, 8 Jul 2026 23:40:22 +0300 Subject: [PATCH 2/8] fix: harden wire runtime and net handling --- lua/entities/gmod_wire_cd_ray.lua | 108 +++++++++--------- lua/entities/gmod_wire_customprop/shared.lua | 4 +- .../gmod_wire_expression2/core/cl_files.lua | 7 +- .../gmod_wire_expression2/core/debug.lua | 4 +- .../core/egpfunctions.lua | 6 +- .../gmod_wire_expression2/core/files.lua | 11 +- .../gmod_wire_expression2/core/signal.lua | 8 +- lua/entities/gmod_wire_fpga/shared.lua | 8 +- lua/weapons/gmod_tool/stools/wire_adv.lua | 4 + lua/wire/client/cl_wirelib.lua | 2 +- lua/wire/fpga_gates/execution.lua | 10 +- lua/wire/server/sents_registry.lua | 12 +- lua/wire/server/wirelib.lua | 5 +- lua/wire/wirenet.lua | 10 +- 14 files changed, 108 insertions(+), 91 deletions(-) diff --git a/lua/entities/gmod_wire_cd_ray.lua b/lua/entities/gmod_wire_cd_ray.lua index d5e335d1ae..241a5135fc 100644 --- a/lua/entities/gmod_wire_cd_ray.lua +++ b/lua/entities/gmod_wire_cd_ray.lua @@ -18,36 +18,36 @@ function ENT:Initialize() self.Outputs = Wire_CreateOutputs(self, {"Data","Sector","LocalSector","Track","Stack","Address"}) self.Command = {} - self.Command[0] = 0 //[W] Write ray on - self.Command[1] = 0 //[W] Read ray on - self.Command[2] = 0 //[R] Current sector (global) - self.Command[3] = 0 //[R] Current sector (on track) - self.Command[4] = 0 //[R] Current track - self.Command[5] = 0 //[R] Current stack - self.Command[6] = 0 //[R] Current address (global) - self.Command[7] = 0 //[R] Current address (in current stack) - - self.Command[8] = 0 //[W] Buffer ready (read or write - pick the ray) - self.Command[9] = 0 //[W] Continious mode - self.Command[10] = 0 //[W] Wait for address mode - self.Command[11] = 0 //[W] Target address (in current stack) - self.Command[12] = 0 //[W] Wait for track§or mode - self.Command[13] = 0 //[W] Target sector - self.Command[14] = 0 //[W] Target track - - self.Command[21] = 0 //[R] Raw disk spin velocity - self.Command[22] = 0 //[R] Raw disk spin angle - self.Command[23] = 0 //[R] Raw distance from disk center - self.Command[24] = 0 //[R] Raw stack index - - self.Command[25] = 0 //[R] Disk precision (Inches Per Block) - self.Command[26] = 0 //[R] Disk sectors (total) - self.Command[27] = 0 //[R] Disk tracks (total) - self.Command[28] = 0 //[R] First track number - self.Command[29] = 0 //[R] Bytes per block - self.Command[30] = 0 //[R] Disk size (per stack) - self.Command[31] = 0 //[R] Disk volume (bytes total) - self.Command[32] = 0 //[R] Disk entity id + self.Command[0] = 0 --[W] Write ray on + self.Command[1] = 0 --[W] Read ray on + self.Command[2] = 0 --[R] Current sector (global) + self.Command[3] = 0 --[R] Current sector (on track) + self.Command[4] = 0 --[R] Current track + self.Command[5] = 0 --[R] Current stack + self.Command[6] = 0 --[R] Current address (global) + self.Command[7] = 0 --[R] Current address (in current stack) + + self.Command[8] = 0 --[W] Buffer ready (read or write - pick the ray) + self.Command[9] = 0 --[W] Continious mode + self.Command[10] = 0 --[W] Wait for address mode + self.Command[11] = 0 --[W] Target address (in current stack) + self.Command[12] = 0 --[W] Wait for track§or mode + self.Command[13] = 0 --[W] Target sector + self.Command[14] = 0 --[W] Target track + + self.Command[21] = 0 --[R] Raw disk spin velocity + self.Command[22] = 0 --[R] Raw disk spin angle + self.Command[23] = 0 --[R] Raw distance from disk center + self.Command[24] = 0 --[R] Raw stack index + + self.Command[25] = 0 --[R] Disk precision (Inches Per Block) + self.Command[26] = 0 --[R] Disk sectors (total) + self.Command[27] = 0 --[R] Disk tracks (total) + self.Command[28] = 0 --[R] First track number + self.Command[29] = 0 --[R] Bytes per block + self.Command[30] = 0 --[R] Disk size (per stack) + self.Command[31] = 0 --[R] Disk volume (bytes total) + self.Command[32] = 0 --[R] Disk entity id self.WriteBuffer = {} self.PrevDiskEnt = nil @@ -133,10 +133,10 @@ function ENT:DoJob() if dojob then if (self.Command[9] == 0) then self.Command[8] = 0 end - local sector_addr = self.Sector.."."..self.Track.."."..self.Stack//{s=sector,t=track,st=stack} - if (self.Command[0] ~= 0) then //write ray + local sector_addr = self.Sector.."."..self.Track.."."..self.Stack --{s=sector,t=track,st=stack} + if (self.Command[0] ~= 0) then --write ray disk.DiskMemory[sector_addr] = table.Copy(self.WriteBuffer) - else //read ray + else --read ray self.WriteBuffer = table.Copy(disk.DiskMemory[sector_addr]) or { [0] = 0 } end end @@ -163,21 +163,21 @@ function ENT:Think() self:SetColor(Color(255, 255, 255, 255)) end - if ((trace.Entity) and - (trace.Entity:IsValid()) and - (trace.Entity:GetClass() == "gmod_wire_cd_disk")) then + if trace.Entity and + trace.Entity:IsValid() and + trace.Entity:GetClass() == "gmod_wire_cd_disk" then local pos = trace.HitPos local disk = trace.Entity local lpos = disk:WorldToLocal(pos) - local vel = disk.Entity:GetPhysicsObject():GetAngleVelocity().z + local vel = disk:GetPhysicsObject():GetAngleVelocity().z - local r = (lpos.x^2+lpos.y^2)^0.5 //radius - local a = math.fmod(3.1415926+math.atan2(lpos.x,lpos.y),2*3.1415926) //angle - local h = lpos.z-disk.StackStartHeight //stack + local r = (lpos.x^2+lpos.y^2)^0.5 --radius + local a = math.fmod(3.1415926+math.atan2(lpos.x,lpos.y),2*3.1415926) --angle + local h = lpos.z-disk.StackStartHeight --stack local track = math.floor(r / disk.Precision) - local sector = math.floor(a*track)//*disk.Precision) + local sector = math.floor(a*track) --*disk.Precision) local stack = math.floor(h/disk.Precision) if (disk.DiskStacks == 1) then stack = 0 end @@ -191,25 +191,25 @@ function ENT:Think() self.Command[29] = disk.BytesPerBlock self.Command[30] = disk.DiskSize self.Command[31] = disk.DiskVolume - self.Command[32] = disk.Entity:EntIndex() + self.Command[32] = disk:EntIndex() end if ((track >= disk.FirstTrack) and (stack >= 0) and (sector >= 0) and - //(track < disk.DiskTracks) and + --(track < disk.DiskTracks) and (stack < disk.DiskStacks)) then - self.Command[21] = vel //[R] Raw disk spin velocity - self.Command[22] = a //[R] Raw disk spin angle - self.Command[23] = r //[R] Raw distance from disk center - self.Command[24] = h //[R] Raw stack index + self.Command[21] = vel --[R] Raw disk spin velocity + self.Command[22] = a --[R] Raw disk spin angle + self.Command[23] = r --[R] Raw distance from disk center + self.Command[24] = h --[R] Raw stack index if (not disk.TrackSectors[track]) then disk.TrackSectors[track] = 0 end - self.Command[2] = disk.DiskSectors*stack+disk.TrackSectors[track]+sector //[R] Current sector (global) - self.Command[3] = sector //[R] Current sector (on track) - self.Command[4] = track //[R] Current track - self.Command[5] = stack //[R] Current stack - self.Command[6] = self.Command[2]*disk.BytesPerBlock //[R] Current address (global) - self.Command[7] = (disk.TrackSectors[track]+sector)*disk.BytesPerBlock //[R] Current address (in current stack) + self.Command[2] = disk.DiskSectors*stack+disk.TrackSectors[track]+sector --[R] Current sector (global) + self.Command[3] = sector --[R] Current sector (on track) + self.Command[4] = track --[R] Current track + self.Command[5] = stack --[R] Current stack + self.Command[6] = self.Command[2]*disk.BytesPerBlock --[R] Current address (global) + self.Command[7] = (disk.TrackSectors[track]+sector)*disk.BytesPerBlock --[R] Current address (in current stack) if ((self.Command[0] ~= 0) or (self.Command[1] ~= 0)) then self.Sector = sector @@ -256,7 +256,7 @@ function ENT:Think() self.Command[32] = 0 end - //Update output + --Update output if (self.WriteBuffer[0]) then Wire_TriggerOutput(self, "Data",self.WriteBuffer[0]) else diff --git a/lua/entities/gmod_wire_customprop/shared.lua b/lua/entities/gmod_wire_customprop/shared.lua index 97a62c2be5..22264dff67 100644 --- a/lua/entities/gmod_wire_customprop/shared.lua +++ b/lua/entities/gmod_wire_customprop/shared.lua @@ -58,8 +58,8 @@ return { classname = "gmod_wire_customprop", readReliableEntity = function(callback) - index = net.ReadUInt(16) - creationIndex = net.ReadUInt(32) + local index = net.ReadUInt(16) + local creationIndex = net.ReadUInt(32) local startTime = CurTime() local function check() diff --git a/lua/entities/gmod_wire_expression2/core/cl_files.lua b/lua/entities/gmod_wire_expression2/core/cl_files.lua index 0cf2a1126e..769312b0fb 100644 --- a/lua/entities/gmod_wire_expression2/core/cl_files.lua +++ b/lua/entities/gmod_wire_expression2/core/cl_files.lua @@ -94,12 +94,13 @@ net.Receive( "wire_expression2_request_list", function() for _,fop in pairs(files) do if string.GetExtensionFromFilename( fop ) == "txt" then net.WriteUInt(#fop, 16) - net.WriteData(fop) + net.WriteData(fop, #fop) end end for _,fop in pairs(folders) do - net.WriteUInt(#fop, 16) - net.WriteData(fop .. "/") + local folder = fop .. "/" + net.WriteUInt(#folder, 16) + net.WriteData(folder, #folder) end net.SendToServer() end) diff --git a/lua/entities/gmod_wire_expression2/core/debug.lua b/lua/entities/gmod_wire_expression2/core/debug.lua index 77a55a082d..0d43b76328 100644 --- a/lua/entities/gmod_wire_expression2/core/debug.lua +++ b/lua/entities/gmod_wire_expression2/core/debug.lua @@ -543,7 +543,7 @@ local function send_caption(self, text, duration, fromPlayer) net.Start("wire_expression2_caption") net.WriteUInt(len, 16) - net.WriteData(text) + net.WriteData(text, len) net.WriteDouble(duration) net.WriteBool(fromPlayer) net.Send(ply) @@ -557,4 +557,4 @@ end e2function void printCaption(string text, number duration) send_caption(self, text, duration, false) -end \ No newline at end of file +end diff --git a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua index 4d3ebb59f0..bdf14d5dc1 100644 --- a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua +++ b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua @@ -1223,10 +1223,10 @@ e2function number egpMaxUmsgPerSecond() end e2function number egpBytesLeft() - local maxcount = EGP.ConVars.MaxPerSec:GetInt() + EGP:CheckInterval(self.player) + local tbl = EGP.IntervalCheck[self.player] - tbl.bytes = math.max(0, tbl.bytes - (CurTime() - tbl.time) * maxcount) - tbl.time = CurTime() + local maxcount = EGP.ConVars.MaxPerSec:GetInt() return maxcount - tbl.bytes end diff --git a/lua/entities/gmod_wire_expression2/core/files.lua b/lua/entities/gmod_wire_expression2/core/files.lua index 9349e21b8f..a23d804ab5 100644 --- a/lua/entities/gmod_wire_expression2/core/files.lua +++ b/lua/entities/gmod_wire_expression2/core/files.lua @@ -241,7 +241,7 @@ end [deprecated = "Use the file events instead", nodiscard] e2function array fileReadList() - local plist = lists[self.player] + local plist = lists[self.player].last return (plist.uploaded and not plist.uploading and plist.data) and plist.data or {} end @@ -410,7 +410,10 @@ end util.AddNetworkString("wire_expression2_file_upload") net.Receive("wire_expression2_file_upload", function(_, ply) - local pfile = uploads[ply][1] + local queue = uploads[ply] + if not queue then return end + + local pfile = queue[1] if pfile then if net.ReadBool() and not pfile.uploading and not pfile.uploaded then local len = net.ReadUInt(32) @@ -438,6 +441,8 @@ end) util.AddNetworkString("wire_expression2_file_list") net.Receive("wire_expression2_file_list", function(_, ply) local queue = lists[ply] + if not queue then return end + local plist = queue[1] if not plist then return end @@ -489,4 +494,4 @@ E2Lib.registerEvent("fileWritten", { E2Lib.registerEvent("fileList", { { "Path", "s"}, { "Contents", "r" } -}) \ No newline at end of file +}) diff --git a/lua/entities/gmod_wire_expression2/core/signal.lua b/lua/entities/gmod_wire_expression2/core/signal.lua index 3a337a18e3..bf91263fa5 100644 --- a/lua/entities/gmod_wire_expression2/core/signal.lua +++ b/lua/entities/gmod_wire_expression2/core/signal.lua @@ -241,8 +241,8 @@ __e2setcost(20) --- sends signal S to chips owned by the given player, multiple calls for different players do not overwrite each other e2function void signalSendToPlayer(string name, entity player) - if not IsValid(player) then return end - broadcastSignal(self.data.signalgroup, name, 1, self.entity, player) + if not IsValid(player) or not player:IsPlayer() then return end + broadcastSignal(self.data.signalgroup, name, 1, self.entity, player:UniqueID()) end --[[************************************************************************]]-- @@ -253,6 +253,8 @@ registerCallback("construct",function(self) end) registerCallback("destruct",function(self) + local receiverid = self.entity:EntIndex() + -- loop through all scopes, ... for scope,groups in pairs_ac(scopes) do -- ... all groups ... @@ -260,7 +262,7 @@ registerCallback("destruct",function(self) -- ... and all signals ... for name, contexts in pairs_ac(signals) do -- to remove all signals the chip registered for. - contexts[self] = nil + contexts[receiverid] = nil end end end diff --git a/lua/entities/gmod_wire_fpga/shared.lua b/lua/entities/gmod_wire_fpga/shared.lua index e382b58f4a..5d9163ac48 100644 --- a/lua/entities/gmod_wire_fpga/shared.lua +++ b/lua/entities/gmod_wire_fpga/shared.lua @@ -100,8 +100,10 @@ if SERVER then net.Receive("wire_fpga_options", function(len, ply) local ok, options = pcall(WireLib.von.deserialize, net.ReadString()) - if ok then - FPGAPlayerOptions[ply] = options + if ok and istable(options) then + FPGAPlayerOptions[ply] = { + allow_inside_view = options.allow_inside_view == true + } end end) end @@ -142,4 +144,4 @@ if SERVER then end end end) -end \ No newline at end of file +end diff --git a/lua/weapons/gmod_tool/stools/wire_adv.lua b/lua/weapons/gmod_tool/stools/wire_adv.lua index 1272cc31f7..4d019c9451 100644 --- a/lua/weapons/gmod_tool/stools/wire_adv.lua +++ b/lua/weapons/gmod_tool/stools/wire_adv.lua @@ -187,6 +187,8 @@ if SERVER then end local function wireAdvUnwire(ply, ent, tbl) + if not IsValid(ent) then return end + if WireLib.CanTool(ply, ent, "wire_adv") then for i=1,#tbl do WireLib.Link_Clear( ent, tbl[i] ) @@ -195,6 +197,8 @@ if SERVER then end local function wireAdvRemoveUGLinks(ply, ent) + if not IsValid(ent) then return end + if WireLib.CanTool(ply, ent, "wire_adv") then if ent:IsValid() then removeEntityOutput(ent) diff --git a/lua/wire/client/cl_wirelib.lua b/lua/wire/client/cl_wirelib.lua index a8d6911841..9321f116de 100644 --- a/lua/wire/client/cl_wirelib.lua +++ b/lua/wire/client/cl_wirelib.lua @@ -74,7 +74,7 @@ local function Wire_Render_Enabled(ent) -- CREATING (Not assigning a value) local variables OUTSIDE of cycle a bit faster local blink = ent_tbl.WireBlinkWire - local start, color, nodes, len, endpos, node, node_ent, last_node_ent, vector_cache + local start, color, nodes, len, width, endpos, node, node_ent, last_node_ent, vector_cache for net_name, wiretbl in pairs(wires) do width = wiretbl.Width diff --git a/lua/wire/fpga_gates/execution.lua b/lua/wire/fpga_gates/execution.lua index a2b95c7da3..6169f88ab3 100644 --- a/lua/wire/fpga_gates/execution.lua +++ b/lua/wire/fpga_gates/execution.lua @@ -229,7 +229,7 @@ FPGAGateActions["execution-previous-normal"] = { gate.memory = 0 end, postExecution = function(gate) - local changed = gate.value != gate.memory + local changed = gate.value ~= gate.memory gate.value = gate.memory return changed end, @@ -254,7 +254,7 @@ FPGAGateActions["execution-previous-vector"] = { gate.memory = Vector(0, 0, 0) end, postExecution = function(gate) - local changed = gate.value != gate.memory + local changed = gate.value ~= gate.memory gate.value = gate.memory return changed end, @@ -279,7 +279,7 @@ FPGAGateActions["execution-previous-angle"] = { gate.memory = Angle(0, 0, 0) end, postExecution = function(gate) - local changed = gate.value != gate.memory + local changed = gate.value ~= gate.memory gate.value = gate.memory return changed end, @@ -304,8 +304,8 @@ FPGAGateActions["execution-previous-string"] = { gate.memory = "" end, postExecution = function(gate) - local changed = gate.value != gate.memory + local changed = gate.value ~= gate.memory gate.value = gate.memory return changed end, -} \ No newline at end of file +} diff --git a/lua/wire/server/sents_registry.lua b/lua/wire/server/sents_registry.lua index 8ffc2cfdf4..4514b69ad4 100644 --- a/lua/wire/server/sents_registry.lua +++ b/lua/wire/server/sents_registry.lua @@ -1137,8 +1137,8 @@ register("gmod_wire_value", { VECTOR2 = function(val, e2TypeID) if e2TypeID == TYPE_TABLE and #val >= 2 and isnumber(val[1]) and isnumber(val[2]) then return val[1]..", "..val[2] end if e2TypeID == TYPE_STRING then - local x,y,z = string.match( val, "^ *([^%s,]+) *, *([^%s,]+) *$" ) - if x and y and z then return x..", "..y..", "..z end + local x,y = string.match( val, "^ *([^%s,]+) *, *([^%s,]+) *$" ) + if x and y then return x..", "..y end end return nil @@ -1201,7 +1201,7 @@ register("gmod_wire_value", { elseif e2TypeID == TYPE_VECTOR then val = {"VECTOR", castE2TypeToWireValueType["VECTOR"](val, e2TypeID)} elseif e2TypeID == TYPE_ANGLE then val = {"ANGLE", castE2TypeToWireValueType["ANGLE"](val, e2TypeID)} elseif e2TypeID == TYPE_STRING then val = {"STRING", castE2TypeToWireValueType["STRING"](val, e2TypeID)} - else return "Incorrect 'value' parameter #"..i.." type! Expected table (Ex. table(\"normal\", 0)). Got: "..type( steamid ) end + else return "Incorrect 'value' parameter #"..i.." type! Expected table (Ex. table(\"normal\", 0)). Got: "..type( val ) end elseif not isnumber(val[1]) then -- Plain table if TypeID(val[1]) ~= TYPE_STRING then return "Incorrect 'value' parameter #"..i.."[1] type! Expected string ('NORMAL/VECTOR/VECTOR2/VECTOR4/ANGLE/STRING'). Got: "..type( val ) end @@ -1214,15 +1214,15 @@ register("gmod_wire_value", { end val = {wireValueType, CastFunc(val[2], TypeID(val[2]))} elseif #val == 2 then -- vector2 - local tempVal = castE2TypeToWireValueType["VECTOR2"](val[2], typeID(val[2])) + local tempVal = castE2TypeToWireValueType["VECTOR2"](val, TypeID(val)) if not tempVal then return "Incorrect 'value' parameter #"..i.." value! Expected 'VECTOR2'. Got: "..tostring(val[2]) end val = {"VECTOR2", tempVal} elseif #val==4 then -- vector4 - local tempVal = castE2TypeToWireValueType["VECTOR4"](val[2], typeID(val[2])) - if not tempVal then return "Incorrect 'value' parameter #"..i.." value! Expected 'VECTOR2'. Got: "..tostring(val[2]) end + local tempVal = castE2TypeToWireValueType["VECTOR4"](val, TypeID(val)) + if not tempVal then return "Incorrect 'value' parameter #"..i.." value! Expected 'VECTOR4'. Got: "..tostring(val[2]) end val = {"VECTOR4", tempVal} else diff --git a/lua/wire/server/wirelib.lua b/lua/wire/server/wirelib.lua index 739c8939a3..b14e285e3a 100644 --- a/lua/wire/server/wirelib.lua +++ b/lua/wire/server/wirelib.lua @@ -1180,7 +1180,10 @@ function WireLib.CanModel(ply, model, skin) end function WireLib.MakeWireEnt( pl, Data, ... ) - Data.Class = scripted_ents.Get(Data.Class).ClassName + local sent = scripted_ents.Get(Data.Class) + if not sent or not sent.ClassName then return false end + + Data.Class = sent.ClassName if IsValid(pl) and not pl:CheckLimit(Data.Class:sub(6).."s") then return false end if Data.Model and not WireLib.CanModel(pl, Data.Model, Data.Skin) then return false end diff --git a/lua/wire/wirenet.lua b/lua/wire/wirenet.lua index e4fe6a1672..c048ba27e8 100644 --- a/lua/wire/wirenet.lua +++ b/lua/wire/wirenet.lua @@ -47,12 +47,12 @@ if SERVER then end local data = table.concat(tbl) + local compressed = util.Compress(data) - if #data < 4096 then - data = util.Compress(data) + if compressed and #compressed < 4096 then net.WriteBool(false) - net.WriteUInt(#data, 12) - net.WriteData(data) + net.WriteUInt(#compressed, 12) + net.WriteData(compressed, #compressed) else net.WriteBool(true) net.WriteStream(data, nil, false) @@ -207,4 +207,4 @@ function Net.Trivial.Receive(name, callback) update_handlers(name:lower(), callback) end -Net.Receivers = registered_handlers \ No newline at end of file +Net.Receivers = registered_handlers From 89f6cf6f7b946b3b7a2cd6b4a3becee057c81833 Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Wed, 8 Jul 2026 23:40:32 +0300 Subject: [PATCH 3/8] fix: correct wire tool upload and convar handling --- lua/wire/stools/cd_disk.lua | 6 +++--- lua/wire/stools/cd_ray.lua | 9 ++++----- lua/wire/stools/colorer.lua | 4 ++-- lua/wire/stools/cpu.lua | 18 ++++++++---------- lua/wire/stools/emarker.lua | 2 +- lua/wire/stools/gpu.lua | 11 +++++------ lua/wire/stools/igniter.lua | 8 ++++---- lua/wire/stools/speedometer.lua | 2 +- lua/wire/stools/spu.lua | 11 +++++------ lua/wire/tool_loader.lua | 3 ++- 10 files changed, 35 insertions(+), 39 deletions(-) diff --git a/lua/wire/stools/cd_disk.lua b/lua/wire/stools/cd_disk.lua index 9e0b713a2d..d4e7c26626 100644 --- a/lua/wire/stools/cd_disk.lua +++ b/lua/wire/stools/cd_disk.lua @@ -36,8 +36,8 @@ function TOOL:RightClick(trace) if (trace.Entity and trace.Entity:IsValid()) then if (trace.Entity:GetClass() == "prop_physics") then - self:GetOwner():ConCommand('wire_cd_disk_model "'..trace.Entity:GetModel()..'"\n') - self:GetOwner():ConCommand('wire_cd_disk_skin "'..trace.Entity:GetSkin()..'"\n') + self:GetOwner():ConCommand("wire_cd_disk_model \""..trace.Entity:GetModel().."\"\n") + self:GetOwner():ConCommand("wire_cd_disk_skin \""..trace.Entity:GetSkin().."\"\n") end end @@ -45,7 +45,7 @@ function TOOL:RightClick(trace) end function TOOL.BuildCPanel(panel) - WireDermaExts.ModelSelect(panel, "wire_cd_disk_Model", list.Get( "Wire_Laser_Disk_Models" ), 1) + WireDermaExts.ModelSelect(panel, "wire_cd_disk_model", list.Get( "Wire_Laser_Disk_Models" ), 1) panel:NumSlider("Disk density (inches per block, ipb)","wire_cd_disk_precision",1,16,0) panel:NumSlider("Inner radius (disk hole radius)","wire_cd_disk_iradius",1,48,0) panel:NumSlider("Disk skin (0..8, standard disks only)","wire_cd_disk_skin",0,8,0) diff --git a/lua/wire/stools/cd_ray.lua b/lua/wire/stools/cd_ray.lua index d884be16dc..c19b49bc45 100644 --- a/lua/wire/stools/cd_ray.lua +++ b/lua/wire/stools/cd_ray.lua @@ -15,8 +15,8 @@ end WireToolSetup.BaseLang() if (SERVER) then - CreateConVar('sbox_maxwire_cd_rays', 20) - CreateConVar('sbox_maxwire_cd_locks', 20) + CreateConVar("sbox_maxwire_cd_rays", 20) + CreateConVar("sbox_maxwire_cd_locks", 20) end TOOL.ClientConVar[ "model" ] = "models/jaanus/wiretool/wiretool_beamcaster.mdl" @@ -49,13 +49,12 @@ function TOOL:RightClick(trace) local Ang = trace.HitNormal:Angle() Ang.pitch = Ang.pitch + 90 - local range = self:GetClientNumber("Range") - local defZero = (self:GetClientNumber("DefaultZero") ~= 0) local model = self:GetClientInfo("lockmodel") if not util.IsValidModel( model ) or not util.IsValidProp( model ) then return end local wire_cd_lock = WireLib.MakeWireEnt(ply, {Class = "gmod_wire_cd_lock", Pos=trace.HitPos, Angle=Ang, Model=model}) + if not IsValid(wire_cd_lock) then return false end local min = wire_cd_lock:OBBMins() wire_cd_lock:SetPos( trace.HitPos - trace.HitNormal * min.z ) @@ -75,6 +74,6 @@ function TOOL:RightClick(trace) end function TOOL.BuildCPanel(panel) - WireDermaExts.ModelSelect(panel, "wire_cd_ray_Model", list.Get( "Wire_Laser_Tools_Models" ), 1) + WireDermaExts.ModelSelect(panel, "wire_cd_ray_model", list.Get( "Wire_Laser_Tools_Models" ), 1) panel:NumSlider("Range","wire_cd_ray_Range",1,512,2) end diff --git a/lua/wire/stools/colorer.lua b/lua/wire/stools/colorer.lua index beb1a3202f..0bd7383730 100644 --- a/lua/wire/stools/colorer.lua +++ b/lua/wire/stools/colorer.lua @@ -21,7 +21,7 @@ if SERVER then end end -TOOL.ClientConVar[ "Model" ] = "models/jaanus/wiretool/wiretool_siren.mdl" +TOOL.ClientConVar[ "model" ] = "models/jaanus/wiretool/wiretool_siren.mdl" TOOL.ClientConVar[ "outColor" ] = "0" TOOL.ClientConVar[ "range" ] = "2000" @@ -29,5 +29,5 @@ function TOOL.BuildCPanel(panel) WireToolHelpers.MakePresetControl(panel, "wire_colorer") WireDermaExts.ModelSelect(panel, "wire_colorer_model", list.Get( "Wire_Laser_Tools_Models" ), 1, true) panel:CheckBox("#WireColorerTool_outColor", "wire_colorer_outColor") - panel:NumSlider("#WireColorerTool_Range", "wire_colorer_Range", 1, 10000, 2) + panel:NumSlider("#WireColorerTool_Range", "wire_colorer_range", 1, 10000, 2) end diff --git a/lua/wire/stools/cpu.lua b/lua/wire/stools/cpu.lua index 58fe294e4b..785b71f5c1 100644 --- a/lua/wire/stools/cpu.lua +++ b/lua/wire/stools/cpu.lua @@ -73,16 +73,17 @@ if SERVER then function TOOL:CheckHitOwnClass(trace) return trace.Entity:IsValid() and (trace.Entity:GetClass() == self.WireClass or trace.Entity.WriteCell) end - function TOOL:LeftClick_Update(trace) - CPULib.SetUploadTarget(trace.Entity, self:GetOwner()) - net.Start("ZCPU_RequestCode") net.Send(self:GetOwner()) + function TOOL:LeftClick_Update(trace, ent) + local player = self:GetOwner() + CPULib.SetUploadTarget(ent or trace.Entity, player) + net.Start("ZCPU_RequestCode") net.Send(player) net.Start("CPULib.InvalidateDebugger") net.WriteUInt(0,2) net.Send(player) end function TOOL:MakeEnt(ply, model, Ang, trace) local ent = WireLib.MakeWireEnt(ply, {Class = self.WireClass, Pos=trace.HitPos, Angle=Ang, Model=model}) ent:SetMemoryModel(self:GetClientInfo("memorymodel"),self:GetClientInfo("customram"),self:GetClientInfo("customrom")) ent:SetExtensionLoadOrder(self:GetClientInfo("extensions")) - self:LeftClick_Update(trace) + self:LeftClick_Update(trace, ent) return ent end @@ -142,7 +143,6 @@ if CLIENT then ---------------------------------------------------------------------------- - local currentDirectory local FileBrowser = vgui.Create("wire_expression2_browser" , panel) panel:AddPanel(FileBrowser) FileBrowser:Setup("cpuchip") @@ -180,7 +180,7 @@ if CLIENT then ---------------------------------------------------------------------------- - local modelPanel = WireDermaExts.ModelSelect(panel, "wire_cpu_model", list.Get("Wire_gate_Models"), 2) + WireDermaExts.ModelSelect(panel, "wire_cpu_model", list.Get("Wire_gate_Models"), 2) panel:AddControl("Label", {Text = ""}) @@ -389,12 +389,12 @@ if CLIENT then outc(string.format(" RAM %5d KB",collectgarbage("count") or 0),1,Color(255,255,255,255)) surface.SetDrawColor(240, 120, 0, 255) - surface.DrawRect(16*(5),32*2+14,256,4) + surface.DrawRect(16*5,32*2+14,256,4) outc("TASK",2,Color(240, 120,0,255)) outc(" STATUS",3,Color(255,255,255,255)) surface.SetDrawColor(240, 120, 0, 255) - surface.DrawRect(16*(4),32*6+14,256,4) + surface.DrawRect(16*4,32*6+14,256,4) outc("NET",6,Color(240, 120,0,255)) if CPULib.Uploading then outc(string.format("UP %.3f KB",CPULib.RemainingUploadData/1024),7,Color(255,255,255,255)) @@ -485,8 +485,6 @@ if CLIENT then outform(1,1,7,5,"HL-ZASM") outc(string.format(" Stage %d/7",HCOMP.Stage+1),3,Color(0,0,0,255)) outc(" "..stageNameShort[HCOMP.Stage+1],4,Color(0,0,0,255)) - else - -- end end end diff --git a/lua/wire/stools/emarker.lua b/lua/wire/stools/emarker.lua index 9bd044eb6f..c00e91d207 100644 --- a/lua/wire/stools/emarker.lua +++ b/lua/wire/stools/emarker.lua @@ -18,5 +18,5 @@ TOOL.ClientConVar = { WireToolSetup.SetupLinking(true) function TOOL.BuildCPanel(panel) - WireDermaExts.ModelSelect(panel, "wire_emaker_model", list.Get("Wire_Misc_Tools_Models"), nil, true) + WireDermaExts.ModelSelect(panel, "wire_emarker_model", list.Get("Wire_Misc_Tools_Models"), nil, true) end diff --git a/lua/wire/stools/gpu.lua b/lua/wire/stools/gpu.lua index 323febbc53..c428a2d264 100644 --- a/lua/wire/stools/gpu.lua +++ b/lua/wire/stools/gpu.lua @@ -41,7 +41,6 @@ if SERVER then function TOOL:Reload(trace) if trace.Entity:IsPlayer() then return false end - local player = self:GetOwner() if (trace.Entity:IsValid()) and (trace.Entity:GetClass() == "gmod_wire_gpu") then trace.Entity:SetMemoryModel(self:GetClientInfo("memorymodel")) @@ -53,15 +52,16 @@ if SERVER then function TOOL:CheckHitOwnClass(trace) return trace.Entity:IsValid() and (trace.Entity:GetClass() == self.WireClass or trace.Entity.WriteCell) end - function TOOL:LeftClick_Update(trace) - CPULib.SetUploadTarget(trace.Entity, self:GetOwner()) - net.Start("ZGPU_RequestCode") net.Send(self:GetOwner()) + function TOOL:LeftClick_Update(trace, ent) + local player = self:GetOwner() + CPULib.SetUploadTarget(ent or trace.Entity, player) + net.Start("ZGPU_RequestCode") net.Send(player) end function TOOL:MakeEnt(ply, model, Ang, trace) local ent = WireLib.MakeWireEnt(ply, {Class = self.WireClass, Pos=trace.HitPos, Angle=Ang, Model=model}) ent:SetMemoryModel(self:GetClientInfo("memorymodel")) ent:SetExtensionLoadOrder(self:GetClientInfo("extensions")) - self:LeftClick_Update(trace) + self:LeftClick_Update(trace, ent) return ent end @@ -121,7 +121,6 @@ if CLIENT then ---------------------------------------------------------------------------- - local currentDirectory local FileBrowser = vgui.Create("wire_expression2_browser" , panel) panel:AddPanel(FileBrowser) FileBrowser:Setup("GPUChip") diff --git a/lua/wire/stools/igniter.lua b/lua/wire/stools/igniter.lua index 4b103da701..8704765432 100644 --- a/lua/wire/stools/igniter.lua +++ b/lua/wire/stools/igniter.lua @@ -14,11 +14,11 @@ WireToolSetup.BaseLang() WireToolSetup.SetupMax( 20 ) if SERVER then - CreateConVar('sbox_wire_igniters_maxlen', 30) - CreateConVar('sbox_wire_igniters_allowtrgply',1) + CreateConVar("sbox_wire_igniters_maxlen", 30) + CreateConVar("sbox_wire_igniters_allowtrgply",1) function TOOL:GetConVars() - return self:GetClientNumber( "trgply" )~=0, self:GetClientNumber("range") + return self:GetClientNumber("trgply") ~= 0, self:GetClientNumber("range") end end @@ -30,7 +30,7 @@ TOOL.ClientConVar = { function TOOL.BuildCPanel(panel) WireToolHelpers.MakePresetControl(panel, "wire_igniter") - WireDermaExts.ModelSelect(panel, "wire_igniter_Model", list.Get( "Wire_Laser_Tools_Models" ), 1, true) + WireDermaExts.ModelSelect(panel, "wire_igniter_model", list.Get( "Wire_Laser_Tools_Models" ), 1, true) panel:CheckBox("#WireIgniterTool_trgply", "wire_igniter_trgply") panel:NumSlider("#WireIgniterTool_Range", "wire_igniter_range", 1, 10000, 0) end diff --git a/lua/wire/stools/speedometer.lua b/lua/wire/stools/speedometer.lua index 3448b46918..517f6ff510 100644 --- a/lua/wire/stools/speedometer.lua +++ b/lua/wire/stools/speedometer.lua @@ -27,5 +27,5 @@ TOOL.ClientConVar = { function TOOL.BuildCPanel(panel) panel:CheckBox("#Tool_wire_speedometer_xyz_mode", "wire_speedometer_xyz_mode") - panel:CheckBox("#Tool_wire_speedometer_angvel", "wire_speedometer_AngVel") + panel:CheckBox("#Tool_wire_speedometer_angvel", "wire_speedometer_angvel") end diff --git a/lua/wire/stools/spu.lua b/lua/wire/stools/spu.lua index 29e4fad619..21edecb9b9 100644 --- a/lua/wire/stools/spu.lua +++ b/lua/wire/stools/spu.lua @@ -40,7 +40,6 @@ if SERVER then function TOOL:Reload(trace) if trace.Entity:IsPlayer() then return false end - local player = self:GetOwner() if (trace.Entity:IsValid()) and (trace.Entity:GetClass() == "gmod_wire_spu") then trace.Entity:SetMemoryModel(self:GetClientInfo("memorymodel")) @@ -52,15 +51,16 @@ if SERVER then function TOOL:CheckHitOwnClass(trace) return trace.Entity:IsValid() and (trace.Entity:GetClass() == self.WireClass or trace.Entity.WriteCell) end - function TOOL:LeftClick_Update(trace) - CPULib.SetUploadTarget(trace.Entity, self:GetOwner()) - net.Start("ZSPU_RequestCode") net.Send(self:GetOwner()) + function TOOL:LeftClick_Update(trace, ent) + local player = self:GetOwner() + CPULib.SetUploadTarget(ent or trace.Entity, player) + net.Start("ZSPU_RequestCode") net.Send(player) end function TOOL:MakeEnt(ply, model, Ang, trace) local ent = WireLib.MakeWireEnt(ply, {Class = self.WireClass, Pos=trace.HitPos, Angle=Ang, Model=model}) ent:SetMemoryModel(self:GetClientInfo("memorymodel")) ent:SetExtensionLoadOrder(self:GetClientInfo("extensions")) - self:LeftClick_Update(trace) + self:LeftClick_Update(trace, ent) return ent end @@ -126,7 +126,6 @@ if CLIENT then ---------------------------------------------------------------------------- - local currentDirectory local FileBrowser = vgui.Create("wire_expression2_browser" , panel) panel:AddPanel(FileBrowser) FileBrowser:Setup("spuchip") diff --git a/lua/wire/tool_loader.lua b/lua/wire/tool_loader.lua index bdaad92868..656676c46f 100644 --- a/lua/wire/tool_loader.lua +++ b/lua/wire/tool_loader.lua @@ -293,7 +293,7 @@ if CLIENT then else for size=60,20,-2 do surface.SetFont("GmodToolScreen"..size) - local x,y = surface.GetTextSize(text) + local x = surface.GetTextSize(text) if x <= (width - 16) then self.ScreenFont = "GmodToolScreen"..size break @@ -681,6 +681,7 @@ function WireToolSetup.SetupLinking(SingleLink, linkedname) end return true elseif self:GetStage() == 1 then -- stage 1: reloading on something else unlinks it + if not IsValid(self.Controller) then self:SetStage(0) return false end local ply = self:GetOwner() local success, message = self.Controller:UnlinkEnt(ent) if success then From 27e0cbe40ab4c5eea479aac412860db054e44c15 Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Thu, 9 Jul 2026 00:03:28 +0300 Subject: [PATCH 4/8] fix: satisfy lint for E2 signal changes --- lua/entities/gmod_wire_expression2/core/egpfunctions.lua | 6 +++--- lua/entities/gmod_wire_expression2/core/signal.lua | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua index bdf14d5dc1..4d3ebb59f0 100644 --- a/lua/entities/gmod_wire_expression2/core/egpfunctions.lua +++ b/lua/entities/gmod_wire_expression2/core/egpfunctions.lua @@ -1223,10 +1223,10 @@ e2function number egpMaxUmsgPerSecond() end e2function number egpBytesLeft() - EGP:CheckInterval(self.player) - - local tbl = EGP.IntervalCheck[self.player] local maxcount = EGP.ConVars.MaxPerSec:GetInt() + local tbl = EGP.IntervalCheck[self.player] + tbl.bytes = math.max(0, tbl.bytes - (CurTime() - tbl.time) * maxcount) + tbl.time = CurTime() return maxcount - tbl.bytes end diff --git a/lua/entities/gmod_wire_expression2/core/signal.lua b/lua/entities/gmod_wire_expression2/core/signal.lua index bf91263fa5..29c732d381 100644 --- a/lua/entities/gmod_wire_expression2/core/signal.lua +++ b/lua/entities/gmod_wire_expression2/core/signal.lua @@ -91,9 +91,6 @@ local function broadcastSignal(group, name, scope, sender, filter_player) end end ---local function table_IsEmpty(t) return not pairs(t)(t) end -local function table_IsEmpty(t) return not next(t) end - local function setGroup(self, group) -- set the current group to the new group self.data.signalgroup = group From b09d65713a54de5d6e9ea63680ada1b539a5868c Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Thu, 9 Jul 2026 01:41:41 +0300 Subject: [PATCH 5/8] fix: address runtime review feedback --- lua/entities/gmod_wire_cd_ray.lua | 108 +++++++++++++++--------------- lua/wire/wirenet.lua | 15 +++-- 2 files changed, 64 insertions(+), 59 deletions(-) diff --git a/lua/entities/gmod_wire_cd_ray.lua b/lua/entities/gmod_wire_cd_ray.lua index 241a5135fc..d5e335d1ae 100644 --- a/lua/entities/gmod_wire_cd_ray.lua +++ b/lua/entities/gmod_wire_cd_ray.lua @@ -18,36 +18,36 @@ function ENT:Initialize() self.Outputs = Wire_CreateOutputs(self, {"Data","Sector","LocalSector","Track","Stack","Address"}) self.Command = {} - self.Command[0] = 0 --[W] Write ray on - self.Command[1] = 0 --[W] Read ray on - self.Command[2] = 0 --[R] Current sector (global) - self.Command[3] = 0 --[R] Current sector (on track) - self.Command[4] = 0 --[R] Current track - self.Command[5] = 0 --[R] Current stack - self.Command[6] = 0 --[R] Current address (global) - self.Command[7] = 0 --[R] Current address (in current stack) - - self.Command[8] = 0 --[W] Buffer ready (read or write - pick the ray) - self.Command[9] = 0 --[W] Continious mode - self.Command[10] = 0 --[W] Wait for address mode - self.Command[11] = 0 --[W] Target address (in current stack) - self.Command[12] = 0 --[W] Wait for track§or mode - self.Command[13] = 0 --[W] Target sector - self.Command[14] = 0 --[W] Target track - - self.Command[21] = 0 --[R] Raw disk spin velocity - self.Command[22] = 0 --[R] Raw disk spin angle - self.Command[23] = 0 --[R] Raw distance from disk center - self.Command[24] = 0 --[R] Raw stack index - - self.Command[25] = 0 --[R] Disk precision (Inches Per Block) - self.Command[26] = 0 --[R] Disk sectors (total) - self.Command[27] = 0 --[R] Disk tracks (total) - self.Command[28] = 0 --[R] First track number - self.Command[29] = 0 --[R] Bytes per block - self.Command[30] = 0 --[R] Disk size (per stack) - self.Command[31] = 0 --[R] Disk volume (bytes total) - self.Command[32] = 0 --[R] Disk entity id + self.Command[0] = 0 //[W] Write ray on + self.Command[1] = 0 //[W] Read ray on + self.Command[2] = 0 //[R] Current sector (global) + self.Command[3] = 0 //[R] Current sector (on track) + self.Command[4] = 0 //[R] Current track + self.Command[5] = 0 //[R] Current stack + self.Command[6] = 0 //[R] Current address (global) + self.Command[7] = 0 //[R] Current address (in current stack) + + self.Command[8] = 0 //[W] Buffer ready (read or write - pick the ray) + self.Command[9] = 0 //[W] Continious mode + self.Command[10] = 0 //[W] Wait for address mode + self.Command[11] = 0 //[W] Target address (in current stack) + self.Command[12] = 0 //[W] Wait for track§or mode + self.Command[13] = 0 //[W] Target sector + self.Command[14] = 0 //[W] Target track + + self.Command[21] = 0 //[R] Raw disk spin velocity + self.Command[22] = 0 //[R] Raw disk spin angle + self.Command[23] = 0 //[R] Raw distance from disk center + self.Command[24] = 0 //[R] Raw stack index + + self.Command[25] = 0 //[R] Disk precision (Inches Per Block) + self.Command[26] = 0 //[R] Disk sectors (total) + self.Command[27] = 0 //[R] Disk tracks (total) + self.Command[28] = 0 //[R] First track number + self.Command[29] = 0 //[R] Bytes per block + self.Command[30] = 0 //[R] Disk size (per stack) + self.Command[31] = 0 //[R] Disk volume (bytes total) + self.Command[32] = 0 //[R] Disk entity id self.WriteBuffer = {} self.PrevDiskEnt = nil @@ -133,10 +133,10 @@ function ENT:DoJob() if dojob then if (self.Command[9] == 0) then self.Command[8] = 0 end - local sector_addr = self.Sector.."."..self.Track.."."..self.Stack --{s=sector,t=track,st=stack} - if (self.Command[0] ~= 0) then --write ray + local sector_addr = self.Sector.."."..self.Track.."."..self.Stack//{s=sector,t=track,st=stack} + if (self.Command[0] ~= 0) then //write ray disk.DiskMemory[sector_addr] = table.Copy(self.WriteBuffer) - else --read ray + else //read ray self.WriteBuffer = table.Copy(disk.DiskMemory[sector_addr]) or { [0] = 0 } end end @@ -163,21 +163,21 @@ function ENT:Think() self:SetColor(Color(255, 255, 255, 255)) end - if trace.Entity and - trace.Entity:IsValid() and - trace.Entity:GetClass() == "gmod_wire_cd_disk" then + if ((trace.Entity) and + (trace.Entity:IsValid()) and + (trace.Entity:GetClass() == "gmod_wire_cd_disk")) then local pos = trace.HitPos local disk = trace.Entity local lpos = disk:WorldToLocal(pos) - local vel = disk:GetPhysicsObject():GetAngleVelocity().z + local vel = disk.Entity:GetPhysicsObject():GetAngleVelocity().z - local r = (lpos.x^2+lpos.y^2)^0.5 --radius - local a = math.fmod(3.1415926+math.atan2(lpos.x,lpos.y),2*3.1415926) --angle - local h = lpos.z-disk.StackStartHeight --stack + local r = (lpos.x^2+lpos.y^2)^0.5 //radius + local a = math.fmod(3.1415926+math.atan2(lpos.x,lpos.y),2*3.1415926) //angle + local h = lpos.z-disk.StackStartHeight //stack local track = math.floor(r / disk.Precision) - local sector = math.floor(a*track) --*disk.Precision) + local sector = math.floor(a*track)//*disk.Precision) local stack = math.floor(h/disk.Precision) if (disk.DiskStacks == 1) then stack = 0 end @@ -191,25 +191,25 @@ function ENT:Think() self.Command[29] = disk.BytesPerBlock self.Command[30] = disk.DiskSize self.Command[31] = disk.DiskVolume - self.Command[32] = disk:EntIndex() + self.Command[32] = disk.Entity:EntIndex() end if ((track >= disk.FirstTrack) and (stack >= 0) and (sector >= 0) and - --(track < disk.DiskTracks) and + //(track < disk.DiskTracks) and (stack < disk.DiskStacks)) then - self.Command[21] = vel --[R] Raw disk spin velocity - self.Command[22] = a --[R] Raw disk spin angle - self.Command[23] = r --[R] Raw distance from disk center - self.Command[24] = h --[R] Raw stack index + self.Command[21] = vel //[R] Raw disk spin velocity + self.Command[22] = a //[R] Raw disk spin angle + self.Command[23] = r //[R] Raw distance from disk center + self.Command[24] = h //[R] Raw stack index if (not disk.TrackSectors[track]) then disk.TrackSectors[track] = 0 end - self.Command[2] = disk.DiskSectors*stack+disk.TrackSectors[track]+sector --[R] Current sector (global) - self.Command[3] = sector --[R] Current sector (on track) - self.Command[4] = track --[R] Current track - self.Command[5] = stack --[R] Current stack - self.Command[6] = self.Command[2]*disk.BytesPerBlock --[R] Current address (global) - self.Command[7] = (disk.TrackSectors[track]+sector)*disk.BytesPerBlock --[R] Current address (in current stack) + self.Command[2] = disk.DiskSectors*stack+disk.TrackSectors[track]+sector //[R] Current sector (global) + self.Command[3] = sector //[R] Current sector (on track) + self.Command[4] = track //[R] Current track + self.Command[5] = stack //[R] Current stack + self.Command[6] = self.Command[2]*disk.BytesPerBlock //[R] Current address (global) + self.Command[7] = (disk.TrackSectors[track]+sector)*disk.BytesPerBlock //[R] Current address (in current stack) if ((self.Command[0] ~= 0) or (self.Command[1] ~= 0)) then self.Sector = sector @@ -256,7 +256,7 @@ function ENT:Think() self.Command[32] = 0 end - --Update output + //Update output if (self.WriteBuffer[0]) then Wire_TriggerOutput(self, "Data",self.WriteBuffer[0]) else diff --git a/lua/wire/wirenet.lua b/lua/wire/wirenet.lua index c048ba27e8..a9b933633b 100644 --- a/lua/wire/wirenet.lua +++ b/lua/wire/wirenet.lua @@ -47,12 +47,17 @@ if SERVER then end local data = table.concat(tbl) - local compressed = util.Compress(data) - if compressed and #compressed < 4096 then - net.WriteBool(false) - net.WriteUInt(#compressed, 12) - net.WriteData(compressed, #compressed) + if #data < 4096 then + local compressed = util.Compress(data) + if compressed and #compressed < 4096 then + net.WriteBool(false) + net.WriteUInt(#compressed, 12) + net.WriteData(compressed, #compressed) + else + net.WriteBool(true) + net.WriteStream(data, nil, false) + end else net.WriteBool(true) net.WriteStream(data, nil, false) From 3abe3b150b83accc3488c61f0256ec4f039ee13d Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Thu, 9 Jul 2026 07:33:14 +0300 Subject: [PATCH 6/8] fix: keep wirenet compression inline --- lua/wire/wirenet.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/wire/wirenet.lua b/lua/wire/wirenet.lua index a9b933633b..f7cbb89ecc 100644 --- a/lua/wire/wirenet.lua +++ b/lua/wire/wirenet.lua @@ -50,13 +50,12 @@ if SERVER then if #data < 4096 then local compressed = util.Compress(data) - if compressed and #compressed < 4096 then - net.WriteBool(false) + net.WriteBool(false) + if compressed then net.WriteUInt(#compressed, 12) net.WriteData(compressed, #compressed) else - net.WriteBool(true) - net.WriteStream(data, nil, false) + net.WriteUInt(0, 12) end else net.WriteBool(true) From 79b276fac1271b9c8f98e7056a57dd75296a1691 Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Thu, 9 Jul 2026 17:08:45 +0300 Subject: [PATCH 7/8] fix: drop redundant net WriteData lengths --- lua/entities/gmod_wire_expression2/core/cl_files.lua | 4 ++-- lua/entities/gmod_wire_expression2/core/debug.lua | 2 +- lua/wire/wirenet.lua | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/cl_files.lua b/lua/entities/gmod_wire_expression2/core/cl_files.lua index 769312b0fb..714c137fac 100644 --- a/lua/entities/gmod_wire_expression2/core/cl_files.lua +++ b/lua/entities/gmod_wire_expression2/core/cl_files.lua @@ -94,13 +94,13 @@ net.Receive( "wire_expression2_request_list", function() for _,fop in pairs(files) do if string.GetExtensionFromFilename( fop ) == "txt" then net.WriteUInt(#fop, 16) - net.WriteData(fop, #fop) + net.WriteData(fop) end end for _,fop in pairs(folders) do local folder = fop .. "/" net.WriteUInt(#folder, 16) - net.WriteData(folder, #folder) + net.WriteData(folder) end net.SendToServer() end) diff --git a/lua/entities/gmod_wire_expression2/core/debug.lua b/lua/entities/gmod_wire_expression2/core/debug.lua index 0d43b76328..ca99d9e935 100644 --- a/lua/entities/gmod_wire_expression2/core/debug.lua +++ b/lua/entities/gmod_wire_expression2/core/debug.lua @@ -543,7 +543,7 @@ local function send_caption(self, text, duration, fromPlayer) net.Start("wire_expression2_caption") net.WriteUInt(len, 16) - net.WriteData(text, len) + net.WriteData(text) net.WriteDouble(duration) net.WriteBool(fromPlayer) net.Send(ply) diff --git a/lua/wire/wirenet.lua b/lua/wire/wirenet.lua index f7cbb89ecc..138fdb91dc 100644 --- a/lua/wire/wirenet.lua +++ b/lua/wire/wirenet.lua @@ -53,7 +53,7 @@ if SERVER then net.WriteBool(false) if compressed then net.WriteUInt(#compressed, 12) - net.WriteData(compressed, #compressed) + net.WriteData(compressed) else net.WriteUInt(0, 12) end From 1dc23118ac07b314fcb5283c18f6cdcaeda84f7d Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Thu, 9 Jul 2026 17:32:40 +0300 Subject: [PATCH 8/8] fix: revert debug newline cleanup --- lua/entities/gmod_wire_expression2/core/debug.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/entities/gmod_wire_expression2/core/debug.lua b/lua/entities/gmod_wire_expression2/core/debug.lua index ca99d9e935..77a55a082d 100644 --- a/lua/entities/gmod_wire_expression2/core/debug.lua +++ b/lua/entities/gmod_wire_expression2/core/debug.lua @@ -557,4 +557,4 @@ end e2function void printCaption(string text, number duration) send_caption(self, text, duration, false) -end +end \ No newline at end of file