Skip to content
Merged
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 lua/entities/gmod_wire_characterlcd/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function ENT:UpdateOverlay()
return
end

txt = ""
local txt = ""
if IsValid(self.User) then
txt = "In use by: " .. self.User:Nick()
end
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_consolescreen/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function ENT:UpdateOverlay()
return
end

txt = ""
local txt = ""
if IsValid(self.User) then
txt = "In use by: " .. self.User:Nick()
end
Expand Down
18 changes: 3 additions & 15 deletions lua/entities/gmod_wire_digitalscreen/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -240,25 +240,13 @@ transformcolor[0] = function(c) -- RGBXXX
local crgb = math.floor(c / 1000)
local cgray = c - math.floor(c / 1000)*1000

cb = cgray+28*math.fmod(crgb, 10)
cg = cgray+28*math.fmod(math.floor(crgb / 10), 10)
cr = cgray+28*math.fmod(math.floor(crgb / 100), 10)

return cr, cg, cb
return cgray+28*math.fmod(crgb, 10), cgray+28*math.fmod(math.floor(crgb / 10), 10), cgray+28*math.fmod(math.floor(crgb / 100), 10)
end
transformcolor[2] = function(c) -- 24 bit mode
cb = math.fmod(c, 256)
cg = math.fmod(math.floor(c / 256), 256)
cr = math.fmod(math.floor(c / 65536), 256)

return cr, cg, cb
return math.fmod(c, 256), math.fmod(math.floor(c / 256), 256), math.fmod(math.floor(c / 65536), 256)
end
transformcolor[3] = function(c) -- RRRGGGBBB
cb = math.fmod(c, 1000)
cg = math.fmod(math.floor(c / 1e3), 1000)
cr = math.fmod(math.floor(c / 1e6), 1000)

return cr, cg, cb
return math.fmod(c, 1000), math.fmod(math.floor(c / 1e3), 1000), math.fmod(math.floor(c / 1e6), 1000)
end
transformcolor[4] = function(c) -- XXX
return c, c, c
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_digitalscreen/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function ENT:UpdateOverlay()
return
end

txt = ""
local txt = ""
if IsValid(self.User) then
txt = "In use by: " .. self.User:Nick()
end
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_egp/lib/egplib/parenting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ local function GetGlobalPos(self, Ent, index)
if obj.parent == -1 then -- Object is parented to the cursor
local x, y = 0, 0
if CLIENT then
xy = EGP:EGPCursor( Ent, LocalPlayer() )
local xy = EGP:EGPCursor( Ent, LocalPlayer() )
x, y = xy[1], xy[2]
end

Expand Down
5 changes: 2 additions & 3 deletions lua/entities/gmod_wire_egp/lib/objects/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ if CLIENT then
surface_SetTextPos = surface.SetTextPos
surface_DrawText = surface.DrawText
surface_SetTextColor = surface.SetTextColor
surface_CreateFont = surface.CreateFont
surface_SetFont = surface.SetFont
surface_GetTextSize = surface.GetTextSize

Expand All @@ -48,7 +47,7 @@ function Obj:Draw(ent, drawMat)
x = x - (w * ((self.halign%10)/2))
end
if (self.valign) then
if (not h) then _,h = surface_GetTextSize( self.text ) end
if (not h) then local _,new_h = surface_GetTextSize( self.text ) h = new_h end
y = y - (h * ((self.valign%10)/2))
end

Expand All @@ -62,7 +61,7 @@ function Obj:Draw(ent, drawMat)
x = (w * ((self.halign%10)/2))
end
if (self.valign) then
if (not h) then _,h = surface_GetTextSize( self.text ) end
if (not h) then local _,new_h = surface_GetTextSize( self.text ) h = new_h end
y = (h * ((self.valign%10)/2))
end

Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_egp/lib/objects/wedge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ function Obj:Contains(x, y)
x, y = x / self.w, y / self.h

if x * x + y * y > 1 then return false end
theta = math.deg(math.atan2(y, x))
local theta = math.deg(math.atan2(y, x))
return theta <= -self.size or 0 <= theta
end
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_eyepod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if CLIENT then

hook.Add("CreateMove", "WireEyePodEyeControl", function(ucmd)
if enabled then
currentAng = ucmd:GetViewAngles()
local currentAng = ucmd:GetViewAngles()

if freezePitch then
currentAng.p = freezePitch
Expand Down
1 change: 0 additions & 1 deletion lua/entities/gmod_wire_fpga/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ function ENT:ConstructInsideView(viewData)
b[3] = math.min(b[3], node.y)
b[4] = math.max(b[4], node.y + node.s * FPGANodeSize)
end
borderIsLabel = {false,false,false,false}
if viewData.Labels then
for _, label in pairs(viewData.Labels) do
b[1] = math.min(b[1], label.x)
Expand Down
22 changes: 11 additions & 11 deletions lua/entities/gmod_wire_fpga/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ end
local function getDefaultValues(node)
local gate = getGate(node)

values = {}
local values = {}
for inputNum, name in pairs(gate.inputs) do
local type = getInputType(gate, inputNum)

Expand Down Expand Up @@ -229,7 +229,7 @@ function ENT:SynthesizeViewData(data)
local gate = getGate(node)
local amountOfInputs = 0
if gate.compact_inputs then
inputLimit = gate.compact_inputs
local inputLimit = gate.compact_inputs
for inputIdx, _ in pairs(node.connections) do
inputLimit = math.max(inputLimit, inputIdx + 1)
end
Expand Down Expand Up @@ -402,8 +402,8 @@ function ENT:CompileData(data)
value = node.value,
}
for input, connection in pairs(node.connections) do
fromNode = connection[1]
fromOutput = connection[2]
local fromNode = connection[1]
local fromOutput = connection[2]
if not edges[fromNode] then edges[fromNode] = {} end
if not edges[fromNode][fromOutput] then edges[fromNode][fromOutput] = {} end

Expand Down Expand Up @@ -859,8 +859,8 @@ function ENT:Run(changedNodes)
local executeLater = false
--if input hasnt arrived, send this node to the back of the queue
for inputId, connection in pairs(self.NodeGetsInputFrom[nodeId]) do
nodeId2 = connection[1]
outputNum = connection[2]
local nodeId2 = connection[1]
local outputNum = connection[2]

--if node hasnt been visited yet and its going to be visited
if not nodesVisited[nodeId2] and activeNodes[nodeId2] then
Expand Down Expand Up @@ -933,7 +933,7 @@ function ENT:CalculateNode(node, nodeId, gate)
--compact gates only calculate with connected inputs
if gate.compact_inputs then
--find connected inputs, and assign current values
activeValues = {}
local activeValues = {}
for inputNum, _ in pairs(self.Data.Nodes[nodeId].connections) do
table.insert(activeValues, self.Values[nodeId][inputNum])
end
Expand All @@ -954,8 +954,8 @@ function ENT:Propagate(node, value)
if node.connections then
for outputNum, connections in pairs(node.connections) do
for k, connection in pairs(connections) do
toNode = connection[1]
toInput = connection[2]
local toNode = connection[1]
local toInput = connection[2]

--send values to nodes
self.Values[toNode][toInput] = value[outputNum]
Expand All @@ -968,8 +968,8 @@ function ENT:PropagateAndAddToQueue(node, value, nodeQueue, nodesInQueue)
if node.connections then
for outputNum, connections in pairs(node.connections) do
for k, connection in pairs(connections) do
toNode = connection[1]
toInput = connection[2]
local toNode = connection[1]
local toInput = connection[2]

--send values to nodes
self.Values[toNode][toInput] = value[outputNum]
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_gpu/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ function ENT:Draw(flags)
-- Draw image from another GPU
local videoSource = MonitorLookup[self:EntIndex()]
if videoSource then
videoGPU = ents.GetByIndex(videoSource)
local videoGPU = ents.GetByIndex(videoSource)
if videoGPU and videoGPU:IsValid() and videoGPU.GPU then
videoGPU.GPU.Entity = self
videoGPU.GPU:Render(
Expand Down
1 change: 0 additions & 1 deletion lua/entities/gmod_wire_graphics_tablet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ if CLIENT then
if ent:IsValid() then
local dist = trace.Normal:Dot(trace.HitNormal)*trace.Fraction*-16384
dist = math.max(dist, trace.Fraction*16384-ent:BoundingRadius())
--WireLib.hud_debug(""..dist, true)

if dist < self.workingDistance and ent == self.GPU.Entity then
local cpos = WorldToLocal(trace.HitPos, Angle(), pos, ang)
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_indicator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
end

if CLIENT then
local color_box_size = 64

Check warning on line 21 in lua/entities/gmod_wire_indicator.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: color_box_size
function ENT:GetWorldTipBodySize()
return 400,80
end
Expand All @@ -40,7 +40,7 @@
end

local diff = self.b - self.a
local len = math.abs(self.b) - math.abs(self.a)

Check warning on line 43 in lua/entities/gmod_wire_indicator.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: len
local step = diff / 50

local find_selected = nil
Expand Down Expand Up @@ -113,7 +113,7 @@
-- Percent
local factor = math.Clamp((self.value-self.a)/(self.b-self.a), 0, 1)
local color_text = string.format("%s (%d%%)",math.Round(self.value,2),factor*100)
local w,h = surface.GetTextSize(color_text)

Check warning on line 116 in lua/entities/gmod_wire_indicator.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: w
draw.DrawText( color_text, "GModWorldtip", pos.center.x + 40, pos.min.y + pos.edgesize + h, color_white, TEXT_ALIGN_RIGHT )

-- Slider
Expand Down Expand Up @@ -227,7 +227,7 @@
if not IsValid( wire_indicators[i] ) then break end

for y = 1, i-1 do
const = constraint.Weld( wire_indicators[i], wire_indicators[y], 0, 0, 0, true, true )
constraint.Weld( wire_indicators[i], wire_indicators[y], 0, 0, 0, true, true )
end
wire_indicators[i - 1]:DeleteOnRemove( wire_indicators[i] ) --when one is removed, all are. a linked chain
end
Expand Down
44 changes: 22 additions & 22 deletions lua/entities/gmod_wire_interactiveprop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -230,31 +230,11 @@ function WireLib.GetInteractiveModel( model )
return InteractiveModels[model]
end

function WireLib.GetInteractiveWidgetBody( ent, data )
local body = vgui.Create("DFrame")

body:SetTitle(data.title)
body:SetSize(data.width, data.height)
body:SetDraggable(false)
body:MakePopup()
body:Center()

function body:Paint(w, h)
draw.RoundedBox(4, 0, 0, w, h, color_white)
draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(64, 64, 64))
end

for id, widget in ipairs( data.widgets ) do
WidgetBuilders[widget.type](ent, widget, body, id)
end
return body
end

InteractiveModels["models/props_c17/furnituresink001a.mdl"] = copyPropUI( "models/props_interiors/bathtub01a.mdl", "Furniture Sink" )
InteractiveModels["models/props_interiors/sinkkitchen01a.mdl"] = copyPropUI( "models/props_interiors/bathtub01a.mdl", "Kitchen Sink" )
InteractiveModels["models/props_wasteland/prison_sink001a.mdl"] = copyPropUI( "models/props_interiors/bathtub01a.mdl", "Prison Sink" )

WidgetBuilders = {
local WidgetBuilders = {

DCheckBox = function(self, data, body, index)
local checkbox = vgui.Create("DCheckBox", body)
Expand Down Expand Up @@ -312,6 +292,26 @@ WidgetBuilders = {

}

function WireLib.GetInteractiveWidgetBody( ent, data )
local body = vgui.Create("DFrame")

body:SetTitle(data.title)
body:SetSize(data.width, data.height)
body:SetDraggable(false)
body:MakePopup()
body:Center()

function body:Paint(w, h)
draw.RoundedBox(4, 0, 0, w, h, color_white)
draw.RoundedBox(4, 1, 1, w - 2, h - 2, Color(64, 64, 64))
end

for id, widget in ipairs( data.widgets ) do
WidgetBuilders[widget.type](ent, widget, body, id)
end
return body
end

function ENT:GetPanel()
local data = InteractiveModels[ self:GetModel() ]
return WireLib.GetInteractiveWidgetBody(self, data)
Expand Down Expand Up @@ -386,7 +386,7 @@ end
-- UpdateOverlay
----------------------------------------------------
function ENT:UpdateOverlay()
txt = ""
local txt = ""
if IsValid(self.User) then
txt = "In use by: " .. self.User:Nick()
end
Expand Down
1 change: 1 addition & 0 deletions lua/entities/gmod_wire_keypad.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if CLIENT then

local color_red = Color(255, 0, 0)
local color_green = Color(0, 255, 0)
local highlight_key, highlight_until

function ENT:Draw(flags)
self:DrawModel(flags)
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_oscilloscope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function ENT:UpdateOverlay()
return
end

txt = ""
local txt = ""
if IsValid(self.User) then
txt = "In use by: " .. self.User:Nick()
end
Expand Down
6 changes: 3 additions & 3 deletions lua/entities/gmod_wire_teleporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function ENT:Jump_Part2( withangles )
local Dir = (OldPos - self:GetPos()):GetNormalized()
if self.UseEffects then
-- Effect
effectdata = EffectData()
local effectdata = EffectData()
effectdata:SetEntity( self )
effectdata:SetOrigin( self:GetPos() + Dir * math.Clamp( self:BoundingRadius() * 5, 180, 4092 ) )
util.Effect( "jump_in", effectdata, true, true )
Expand Down Expand Up @@ -275,7 +275,7 @@ function ENT:Jump_Part2( withangles )

if self.UseEffects then
-- Effect in
effectdata = EffectData()
local effectdata = EffectData()
effectdata:SetEntity( ent )
effectdata:SetOrigin( self:GetPos() + Dir * math.Clamp( ent:BoundingRadius() * 5, 180, 4092 ) )
util.Effect( "jump_in", effectdata, true, true )
Expand All @@ -294,7 +294,7 @@ function ENT:Jump_Part2( withangles )
if self.UseEffects then
for _, ent in pairs( self.OtherEntities ) do -- Render the effect on all other entities in the contraption
-- Effect in
effectdata = EffectData()
local effectdata = EffectData()
effectdata:SetEntity( ent )
effectdata:SetOrigin( self:GetPos() + Dir * math.Clamp( ent:BoundingRadius() * 5, 180, 4092 ) )
util.Effect( "jump_in", effectdata, true, true )
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_twoway_radio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@
self.PairID = nil
end
end
function IsRadio(entity)
local function IsRadio(entity)
if IsValid(entity) and entity:GetClass() == "gmod_wire_twoway_radio" then return true end
return false
end
function ENT:ReceiveRadio(iname, value)
if (iname == "A") and (self.Other) and (self.Other:IsValid()) then

Check warning on line 59 in lua/entities/gmod_wire_twoway_radio.lua

View workflow job for this annotation

GitHub Actions / lint

"Unnecessary parentheses"

Unnecessary parentheses
Wire_TriggerOutput(self, "A", value)
elseif (iname == "B") and (self.Other) and (self.Other:IsValid()) then

Check warning on line 61 in lua/entities/gmod_wire_twoway_radio.lua

View workflow job for this annotation

GitHub Actions / lint

"Unnecessary parentheses"

Unnecessary parentheses
Wire_TriggerOutput(self, "B", value)
elseif (iname == "C") and (self.Other) and (self.Other:IsValid()) then

Check warning on line 63 in lua/entities/gmod_wire_twoway_radio.lua

View workflow job for this annotation

GitHub Actions / lint

"Unnecessary parentheses"

Unnecessary parentheses
Wire_TriggerOutput(self, "C", value)
elseif (iname == "D") and (self.Other) and (self.Other:IsValid()) then

Check warning on line 65 in lua/entities/gmod_wire_twoway_radio.lua

View workflow job for this annotation

GitHub Actions / lint

"Unnecessary parentheses"

Unnecessary parentheses
Wire_TriggerOutput(self, "D", value)
end
self:ShowOutput(iname, value)
Expand All @@ -87,7 +87,7 @@
if self.Other then
-- to the same one, return
if self.Other == other then return false end
--to a different one, then tell it to unlink

Check warning on line 90 in lua/entities/gmod_wire_twoway_radio.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '//' and '--'
self.Other.UnlinkEnt()
end

Expand Down Expand Up @@ -150,11 +150,11 @@
Wire_AdjustOutputs(self, { "A", "B", "C", "D" })
end

// Dupe info functions added by TheApathetic

Check warning on line 153 in lua/entities/gmod_wire_twoway_radio.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '//' and '--'
function ENT:BuildDupeInfo()
local info = BaseClass.BuildDupeInfo(self) or {}

if (self.Other) and (self.Other:IsValid()) then

Check warning on line 157 in lua/entities/gmod_wire_twoway_radio.lua

View workflow job for this annotation

GitHub Actions / lint

"Unnecessary parentheses"

Unnecessary parentheses
info.Other = self.Other:EntIndex()
end

Expand Down
2 changes: 1 addition & 1 deletion lua/entities/info_wiremapinterface/convert.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ local g_supportedTypesById = {
wireType = "VECTOR4",

toHammer = function(_, wireValue)
val = val or {0, 0, 0, 0}
local val = wireValue or {0, 0, 0, 0}

local x = tonumber(val[1] or 0) or 0
local y = tonumber(val[2] or 0) or 0
Expand Down
6 changes: 3 additions & 3 deletions lua/entities/info_wiremapinterface/io.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ local function deturedAcceptInput(this, name, activator, caller, data, ...)
errOrResult = tostring(errOrResult or "")

if errOrResult ~= "" then
message = caller:FormatString(": Lua error in target AcceptInput:\n Wire input '%s [%s]' -> Hammer output '%s@%s'\n %s", globals.WIRE_NAME, globals.WIRE_TYPE, caller:FormatEntityString(this), name, errOrResult)
local message = caller:FormatString(": Lua error in target AcceptInput:\n Wire input '%s [%s]' -> Hammer output '%s@%s'\n %s", globals.WIRE_NAME, globals.WIRE_TYPE, caller:FormatEntityString(this), name, errOrResult)
ErrorNoHaltWithStack(message)
end

Expand Down Expand Up @@ -343,7 +343,7 @@ function ENT:TriggerWireOutputSafe(wireEnt, wireOutputName, wireValue, ...)
err = tostring(err or "")

if err ~= "" then
message = self:FormatString(": Lua error at Wire output '%s':\n%s", wireOutputName, err)
local message = self:FormatString(": Lua error at Wire output '%s':\n%s", wireOutputName, err)
ErrorNoHaltWithStack(message)
end

Expand All @@ -363,7 +363,7 @@ function ENT:TriggerHammerOutputSafe(hammerOutputName, activator, hammerValue, .
err = tostring(err or "")

if err ~= "" then
message = self:FormatString(": Lua error at Hammer output '%s':\n%s", hammerOutputName, err)
local message = self:FormatString(": Lua error at Hammer output '%s':\n%s", hammerOutputName, err)
ErrorNoHaltWithStack(message)
end

Expand Down
2 changes: 1 addition & 1 deletion lua/weapons/gmod_tool/stools/wire_adv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ elseif CLIENT then
local traceData = util.GetPlayerTrace(LocalPlayer())
traceData.filter = { LocalPlayer(), trace.Entity }
traceData.collisiongroup = LAST_SHARED_COLLISION_GROUP
newTrace = util.TraceLine(traceData)
local newTrace = util.TraceLine(traceData)
parent = newTrace.Entity
if not IsValid(parent) or parent == game.GetWorld() then
-- Hit the world, don't update the trace.
Expand Down
Loading
Loading