From b305a1d4d4ea53e619d83cfca96d1f9c441cbd0c Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Thu, 9 Jul 2026 20:30:24 +0300 Subject: [PATCH 1/2] fix: apply passed review fixes --- addon.json | 2 +- lua/entities/gmod_wire_customprop/shared.lua | 4 ++-- lua/wire/server/sents_registry.lua | 12 ++++++------ lua/wire/server/wirelib.lua | 5 ++++- 4 files changed, 13 insertions(+), 10 deletions(-) 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_*" ] } 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/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 From 8f339a5712a0392ca6b4f67729a778a7ec994cdd Mon Sep 17 00:00:00 2001 From: ShiroKSH Date: Thu, 9 Jul 2026 21:05:47 +0300 Subject: [PATCH 2/2] fix: drop MakeWireEnt guard --- lua/wire/server/wirelib.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/wire/server/wirelib.lua b/lua/wire/server/wirelib.lua index b14e285e3a..739c8939a3 100644 --- a/lua/wire/server/wirelib.lua +++ b/lua/wire/server/wirelib.lua @@ -1180,10 +1180,7 @@ function WireLib.CanModel(ply, model, skin) end function WireLib.MakeWireEnt( pl, Data, ... ) - local sent = scripted_ents.Get(Data.Class) - if not sent or not sent.ClassName then return false end - - Data.Class = sent.ClassName + Data.Class = scripted_ents.Get(Data.Class).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