Skip to content
Merged
Changes from 2 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
20 changes: 13 additions & 7 deletions lua/wire/client/cl_wirelib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
--]]----------------------------------------------------------
local WIRE_SCROLL_SPEED = 0.5
local WIRE_BLINKS_PER_SECOND = 2
local Wire_DisableWireRender = CreateClientConVar("cl_wire_disablewirerender", 0, true, false)

Check warning on line 8 in lua/wire/client/cl_wirelib.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: Wire_DisableWireRender

WIRE_CLIENT_INSTALLED = 1



BeamMat = Material("tripmine_laser")
BeamMatHR = Material("Models/effects/comball_tape")

Expand All @@ -25,6 +24,8 @@
local render_DrawBeam = render.DrawBeam
local EntityMeta = FindMetaTable("Entity")
local IsValid = EntityMeta.IsValid
local ent_GetTable = EntityMeta.GetTable

Check warning on line 27 in lua/wire/client/cl_wirelib.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: ent_GetTable
local ent_GetNWString = EntityMeta.GetNWString
local ent_WorldToLocal = EntityMeta.WorldToLocal
local ent_LocalToWorld = EntityMeta.LocalToWorld
local Vector = Vector
Expand Down Expand Up @@ -55,13 +56,13 @@
return mats_cache[ mat ]
end

function Wire_Render(ent)
if Wire_DisableWireRender:GetBool() then return end --We shouldn't render anything
if not IsValid(ent) then return end
local function Wire_Render_Enabled(ent)
local ent_tbl = Ent_GetTable(ent)
if ent_tbl == nil then return end
Comment thread
Astralcircle marked this conversation as resolved.
Outdated

local wires = ent.WirePaths
local wires = ent_tbl.WirePaths
if not wires then
ent.WirePaths = {}
ent_tbl.WirePaths = {}
net.Start("WireLib.Paths.RequestPaths")
net.WriteEntity(ent)
net.SendToServer()
Expand All @@ -70,7 +71,7 @@

if not next(wires) then return end
Comment thread
thegrb93 marked this conversation as resolved.

local blink = shouldblink and ent:GetNWString("BlinkWire")
local blink = shouldblink and ent_GetNWString(ent, "BlinkWire")
--CREATING (Not assigning a value) local variables OUTSIDE of cycle a bit faster
local start, color, nodes, len, endpos, node, node_ent, last_node_ent, vector_cache
for net_name, wiretbl in pairs(wires) do
Expand Down Expand Up @@ -111,6 +112,11 @@
end
end
end
local function Set_Disable_Wire_Render(_, _, val)
Wire_Render = tobool(val) and (function() end) or Wire_Render_Enabled

Check warning on line 116 in lua/wire/client/cl_wirelib.lua

View workflow job for this annotation

GitHub Actions / lint

"Unnecessary parentheses"

Unnecessary parentheses
end
Set_Disable_Wire_Render(nil,nil,GetConvarNumber("cl_wire_disablewirerender"))
Comment thread
Astralcircle marked this conversation as resolved.
Outdated
cvars.AddChangeCallback("cl_wire_disablewirerender", Set_Disable_Wire_Render)

local function Wire_GetWireRenderBounds(ent)
local tab = ent:GetTable()
Expand Down
Loading