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
5 changes: 4 additions & 1 deletion lua/entities/gmod_wire_colorer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ function ENT:TriggerInput(iname, value)
filter = { self }
}
if not IsValid(trace.Entity) then return end
if not WireLib.CanTool(self:GetPlayer(), trace.Entity, "colour") then return end

local ply = self:GetPlayer()
if not ply:IsValid() then return end
if not WireLib.CanTool(ply, trace.Entity, "colour") then return end

if trace.Entity:IsPlayer() then
trace.Entity:SetColor(Color(self.InColor.r, self.InColor.g, self.InColor.b, 255))
Expand Down
7 changes: 6 additions & 1 deletion lua/entities/gmod_wire_exit_point.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ end

function ENT:CheckPP(ent)
-- Check Prop Protection. Most block/allow all of CanTool, but lets check hoverdrive controller specifically, since if they can attach one to your vehicle, they can simulate this anyways
return IsValid(ent) and WireLib.CanTool(self:GetPlayer(), ent, "wire_hoverdrivecontroller")
if not IsValid(ent) then return false end

local ply = self:GetPlayer()
if not ply:IsValid() then return false end

return WireLib.CanTool(ply, ent, "wire_hoverdrivecontroller")
end

function ENT:Think()
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_expression2/core/egpfunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

e2function void wirelink:egpLoadFrame( number index )
if (!EGP:IsAllowed( self, this )) then return end
if (!index) then return end

Check warning on line 62 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'not' and '!'
local bool, frame = EGP:LoadFrame( self.player, nil, tostring(index) )
if (bool) then
if (EGP:IsDifferent( this.RenderTable, frame )) then
Expand All @@ -74,7 +74,7 @@
--------------------------------------------------------

e2function void wirelink:egpOrder(number index, number order)
if not isAllowed(nil, self, this) then return end

Check warning on line 77 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'not' and '!'
local bool, k, v = hasObject(this, index)
if bool then
if EGP.SetOrder(this, k, order) then
Expand Down Expand Up @@ -107,7 +107,7 @@
end

e2function void wirelink:egpOrderBelow( number index, number belowthis )
if not isAllowed(nil, self, this) then return end

Check warning on line 110 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '!' and 'not'
local bool, k, v = hasObject(this, index)
if bool then
if hasObject(this, belowthis) then
Expand All @@ -125,7 +125,7 @@
-- Box
--------------------------------------------------------
e2function egpobject wirelink:egpBox( number index, vector2 pos, vector2 size )
if (!EGP:IsAllowed( self, this )) then return NULL_EGPOBJECT end

Check warning on line 128 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of '!' and 'not'
local bool, obj = egp_create("Box", { index = index, w = size[1], h = size[2], x = pos[1], y = pos[2] }, this)
if (bool) then EGP:DoAction( this, self, "SendObject", obj ) Update(self,this) end
return obj
Expand Down Expand Up @@ -153,7 +153,7 @@

e2function void wirelink:egpRadius( number index, number radius )
if (!EGP:IsAllowed( self, this )) then return NULL_EGPOBJECT end
local bool, k, v = hasObject(this, index)

Check warning on line 156 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: k
if (bool) then
if v:EditObject({ radius = radius }) then EGP:DoAction( this, self, "SendObject", v ) Update(self,this) end
end
Expand Down Expand Up @@ -198,7 +198,7 @@
e2function void wirelink:egpSetText( number index, string text )
if (!EGP:IsAllowed( self, this )) then return end
if #text>EGP_TEXT_LIMIT then text = string.sub(text, 1, EGP_TEXT_LIMIT) end
local bool, k, v = hasObject(this, index)

Check warning on line 201 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: k
if (bool) then
if v:EditObject({ text = text }) then EGP:DoAction( this, self, "SendObject", v ) Update(self,this) end
end
Expand All @@ -209,7 +209,7 @@
----------------------------
e2function void wirelink:egpAlign( number index, number halign )
if (!EGP:IsAllowed( self, this )) then return end
local bool, k, v = hasObject(this, index)

Check warning on line 212 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: k
if (bool) then
if v:EditObject({ halign = math.Clamp(halign,0,2) }) then EGP:DoAction( this, self, "SendObject", v ) Update(self,this) end
end
Expand All @@ -217,7 +217,7 @@

e2function void wirelink:egpAlign( number index, number halign, number valign )
if (!EGP:IsAllowed( self, this )) then return end
local bool, k, v = hasObject(this, index)

Check warning on line 220 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: k
if (bool) then
if v:EditObject({ valign = math.Clamp(valign,0,2), halign = math.Clamp(halign,0,2) }) then EGP:DoAction( this, self, "SendObject", v ) Update(self,this) end
end
Expand All @@ -228,7 +228,7 @@
----------------------------
e2function void wirelink:egpFiltering( number index, number filtering )
if (!EGP:IsAllowed( self, this )) then return end
local bool, k, v = hasObject(this, index)

Check warning on line 231 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Unused variable"

Unused variable: k
if (bool) then
if v:EditObject({ filtering = math.Clamp(filtering,0,3) }) then EGP:DoAction( this, self, "SendObject", v ) Update(self,this) end
end
Expand All @@ -255,11 +255,11 @@
-- Font
----------------------------
local function canCreateFont( ply, font, size )
return WireLib.CanFont(font .. (size or 18), ply)
return WireLib.CheckFont(font .. (size or 18), ply)
end

e2function void wirelink:egpFont( number index, string font )
if (!EGP:IsAllowed( self, this )) then return end

Check warning on line 262 in lua/entities/gmod_wire_expression2/core/egpfunctions.lua

View workflow job for this annotation

GitHub Actions / lint

"Syntax inconsistency"

Inconsistent use of 'not' and '!'
if #font > 30 then return self:throw("Font string is too long!", nil) end
if not canCreateFont( self.player, font ) then return self:throw("You have reached the maximum amount of fonts!", nil) end

Expand Down
4 changes: 3 additions & 1 deletion lua/entities/gmod_wire_grabber.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ function ENT:CanGrab(trace)
-- If there's no physics object then we can't constraint it!
if not util.IsValidPhysicsObject(trace.Entity, trace.PhysicsBone) then return false end

if not WireLib.CanTool(self:GetPlayer(), trace.Entity, "weld") then return false end
local ply = self:GetPlayer()
if not ply:IsValid() then return false end
if not WireLib.CanTool(ply, trace.Entity, "weld") then return false end

return true
end
Expand Down
8 changes: 6 additions & 2 deletions lua/entities/gmod_wire_materializer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ function ENT:TriggerInput(iname, value)
filter = self
}).Entity

if ent:IsValid() and WireLib.CanTool(self:GetPlayer(), ent, "material") then
E2Lib.setMaterial(ent, self.Material)
if ent:IsValid() then
local ply = self:GetPlayer()

if ply:IsValid() and WireLib.CanTool(ply, ent, "material") then
E2Lib.setMaterial(ent, self.Material)
end
end
end
elseif iname == "Length" then
Expand Down
4 changes: 3 additions & 1 deletion lua/entities/gmod_wire_nailer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ function ENT:CanNail(trace)
-- If there's no physics object then we can't constraint it!
if not util.IsValidPhysicsObject(trace.Entity, trace.PhysicsBone) then return false end
-- The nailer tool no longer exists, but we ask for permission under its name anyway
if not WireLib.CanTool(self:GetPlayer(), trace.Entity, "nailer" ) then return false end
local ply = self:GetPlayer()
if not ply:IsValid() then return false end
if not WireLib.CanTool(ply, trace.Entity, "nailer" ) then return false end
return true
end

Expand Down
5 changes: 4 additions & 1 deletion lua/entities/gmod_wire_pod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ function ENT:LinkEnt(pod)

-- if pod is still not a vehicle even after all of the above, then error out
if not IsValid(pod) or not pod:IsVehicle() then return false, "Must link to a vehicle" end
if not WireLib.CanTool(self:GetPlayer(), pod, "wire_pod") then return false, "You do not have permission to access this vehicle" end

local ply = self:GetPlayer()
if not ply:IsValid() then return false, "Owner is invalid" end
if not WireLib.CanTool(ply, pod, "wire_pod") then return false, "You do not have permission to access this vehicle" end

self:SetPod(pod)
WireLib.SendMarks(self, { pod })
Expand Down
5 changes: 4 additions & 1 deletion lua/entities/gmod_wire_textscreen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,15 @@ function ENT:Think()
end

function ENT:SendConfig(ply)
local ply = self:GetPlayer()
if not ply:IsValid() then return end

self.doSendConfig = false

local font = string.sub(self.tfont, 0, 31)
local size = self.chrPerLine

if not WireLib.CheckFont(font .. math.floor(760 / size), self:GetPlayer()) then
if not WireLib.CheckFont(font .. math.floor(760 / size), ply) then
font = "Arial"
size = 10
end
Expand Down
5 changes: 4 additions & 1 deletion lua/entities/gmod_wire_vehicle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ function ENT:LinkEnt( pod )
pod = WireLib.GetClosestRealVehicle(pod,self:GetPos(),self:GetPlayer())

if not IsValid(pod) or not pod:IsVehicle() then return false, "Must link to a vehicle" end
if not WireLib.CanTool(self:GetPlayer(), pod, "wire_vehicle") then return false, "You do not have permission to access this vehicle" end

local ply = self:GetPlayer()
if not ply:IsValid() then return false, "Owner is invalid" end
if not WireLib.CanTool(ply, pod, "wire_vehicle") then return false, "You do not have permission to access this vehicle" end

self.Vehicle = pod
WireLib.SendMarks(self, {pod})
Expand Down
Loading