Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"git-hooks-pre-commit",
"gitrid.sh",
"LICENSE",
"wiremod.*"
"wiremod.*",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this file ever used, e.g. by workshop uploads? Hard to imagine that it worked with the syntax error like that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah @Grocel, I was not assuming the upload path, just noticed it is invalid JSON as-is. The comma only preserves the existing two ignore entries (wiremod.* and benchmark_*) so any consumer that parses it will not choke.

"benchmark_*"
]
}
4 changes: 2 additions & 2 deletions lua/entities/gmod_wire_customprop/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment on lines +61 to +62

@Grocel Grocel Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find. Looks like that the old version had a global pollution

local startTime = CurTime()

local function check()
Expand Down
5 changes: 3 additions & 2 deletions lua/entities/gmod_wire_expression2/core/cl_files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ net.Receive( "wire_expression2_request_list", function()
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)
end
net.SendToServer()
end)
11 changes: 8 additions & 3 deletions lua/entities/gmod_wire_expression2/core/files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -489,4 +494,4 @@ E2Lib.registerEvent("fileWritten", {
E2Lib.registerEvent("fileList", {
{ "Path", "s"},
{ "Contents", "r" }
})
})
11 changes: 5 additions & 6 deletions lua/entities/gmod_wire_expression2/core/signal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -241,8 +238,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

--[[************************************************************************]]--
Expand All @@ -253,14 +250,16 @@ 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 ...
for group, signals in pairs_ac(groups) do
-- ... 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is better to index by entity index than by entity object, as entity references in indexes are not being GC'd when they become null (being removed). Be careful to when doing this kind of changes, make sure to adjust every instance of such tables.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep @Grocel, I checked the table use before changing this. runOnSignal stores by self.entity:EntIndex(), signal dispatch uses receiver IDs, and destruct was the odd cleanup path still indexing by context object.

end
end
end
Expand Down
8 changes: 5 additions & 3 deletions lua/entities/gmod_wire_fpga/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -142,4 +144,4 @@ if SERVER then
end
end
end)
end
end
4 changes: 4 additions & 0 deletions lua/weapons/gmod_tool/stools/wire_adv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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] )
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lua/wire/client/cl_wirelib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lua/wire/fpga_gates/execution.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What, was that missing before?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @Grocel, the file was missing the final newline. The actual runtime fix there is the != to ~= replacement in the postExecution checks above.

12 changes: 6 additions & 6 deletions lua/wire/server/sents_registry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find. This looks like an oversight from the distant past.

end

return nil
Expand Down Expand Up @@ -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

Expand All @@ -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))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @Grocel. In that branch val is the raw sequential table ({x, y} / {x, y, z, w}), so passing only val[2] gave the caster one component. Passing the whole table with TypeID(val) lets the existing TYPE_TABLE path validate all components. The previous typeID call was also a casing typo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange how did this happen, that no one found this before?

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
Expand Down
5 changes: 4 additions & 1 deletion lua/wire/server/wirelib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +1183 to +1186

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. It is a more defensive structure.

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

Expand Down
6 changes: 3 additions & 3 deletions lua/wire/stools/cd_disk.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ 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")
Comment on lines +39 to +40

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly yes @Grocel; the quote change is just cleanup while touching the tool. The meaningful change in this file is the lowercase model cvar below.

end
end

return true
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercase change. Might not do anything, as it probably lowercased internally already. But it makes it more clean.

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)
Expand Down
9 changes: 4 additions & 5 deletions lua/wire/stools/cd_ray.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 )
Expand All @@ -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
4 changes: 2 additions & 2 deletions lua/wire/stools/colorer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ 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"

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)
Comment on lines +24 to +32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that this PR fixes a lot oversights. Convars should always be lowercase.

end
18 changes: 8 additions & 10 deletions lua/wire/stools/cpu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -142,7 +143,6 @@ if CLIENT then


----------------------------------------------------------------------------
local currentDirectory
local FileBrowser = vgui.Create("wire_expression2_browser" , panel)
panel:AddPanel(FileBrowser)
FileBrowser:Setup("cpuchip")
Expand Down Expand Up @@ -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 = ""})


Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lua/wire/stools/emarker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading
Loading