Skip to content

Commit

Permalink
Merge pull request #1942 from wiremod/remove-gmodisms
Browse files Browse the repository at this point in the history
Remove GModisms and fix luacheck errors
  • Loading branch information
TomyLobo authored Jun 16, 2019
2 parents 7410f35 + 239f80e commit 9a524dc
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions lua/wire/stools/egp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (SERVER) then
CreateConVar('sbox_maxwire_egps', 5)

local function SpawnEnt( ply, Pos, Ang, model, class)
if IsValid(ply) and (!ply:CheckLimit("wire_egps")) then return false end
if IsValid(ply) and (not ply:CheckLimit("wire_egps")) then return false end
if not ply then ply = game.GetWorld() end -- For Garry's Map Saver
if model and not WireLib.CanModel(ply, model) then return false end
local ent = ents.Create(class)
Expand Down Expand Up @@ -91,13 +91,13 @@ if (SERVER) then
end

local ply = self:GetOwner()
if (!ply:CheckLimit( "wire_egps" )) then return false end
if (not ply:CheckLimit( "wire_egps" )) then return false end

local ent
local Type = self:GetClientNumber("type")
if (Type == 1) then -- Screen
local model = self:GetClientInfo("model")
if (!util.IsValidModel( model )) then return false end
if (not util.IsValidModel( model )) then return false end

ent = SpawnEGP( ply, trace.HitPos, self:GetAngle(trace), model )
if not IsValid(ent) then return end
Expand All @@ -111,8 +111,8 @@ if (SERVER) then
ent:SetUseRT(self:GetClientNumber("emitter_usert")~=0)
end

local weld = self:GetClientNumber("weld") != 0 and true or false
local weldworld = self:GetClientNumber("weldworld") != 0 and true or false
local weld = self:GetClientNumber("weld") ~= 0 and true or false
local weldworld = self:GetClientNumber("weldworld") ~= 0 and true or false
local const
if (trace.Entity) then
if (trace.Entity:IsValid() and weld) then
Expand All @@ -122,15 +122,15 @@ if (SERVER) then
end
end

if (self:GetClientNumber("freeze") != 0) then
if (self:GetClientNumber("freeze") ~= 0) then
local phys = ent:GetPhysicsObject()
if IsValid(phys) then
phys:EnableMotion(false)
phys:Wake()
end
end

if (!ent or !ent:IsValid()) then return end
if (not ent or not ent:IsValid()) then return end
undo.Create( "wire_egp" )
if (const) then undo.AddEntity( const ) end
undo.AddEntity( ent )
Expand Down Expand Up @@ -175,13 +175,13 @@ if CLIENT then
local Menu = {}
local CurEnt

function refreshRT( ent )
local function refreshRT( ent )
ent.GPU:FreeRT()
ent.GPU = GPULib.WireGPU( ent )
ent:EGP_Update()
end

function refreshObjects( ent )
local function refreshObjects( ent )
if ent then
RunConsoleCommand("EGP_Request_Reload",ent:EntIndex())
else
Expand All @@ -208,10 +208,10 @@ if CLIENT then
lbl:SetText("Current Screen:")
lbl:SizeToContents()

local lbl = vgui.Create("DLabel",pnl)
lbl:SetPos( x2, 24 )
lbl:SetText("All screens on map:")
lbl:SizeToContents()
local lbl2 = vgui.Create("DLabel",pnl)
lbl2:SetPos( x2, 24 )
lbl2:SetText("All screens on map:")
lbl2:SizeToContents()

local btn = vgui.Create("DButton",pnl)
btn:SetText("RenderTarget")
Expand Down Expand Up @@ -261,7 +261,7 @@ if CLIENT then
function btn4:DoClick()
pnl:SetVisible( false )
local tbl = ents.FindByClass("gmod_wire_egp")
for k,v in pairs( tbl ) do
for _,v in pairs( tbl ) do
refreshRT( v )
end
LocalPlayer():ChatPrint("[EGP] RenderTargets reloaded on all screens on the map.")
Expand All @@ -284,7 +284,7 @@ if CLIENT then
function btn6:DoClick()
pnl:SetVisible( false )
local tbl = ents.FindByClass("gmod_wire_egp")
for k,v in pairs( tbl ) do
for _,v in pairs( tbl ) do
refreshRT( v )
end
LocalPlayer():ChatPrint("[EGP] RenderTargets reloaded on all screens on the map.")
Expand All @@ -297,13 +297,13 @@ if CLIENT then
Menu = { Panel = pnl, SingleRender = btn, SingleObjects = btn2, SingleBoth = btn3, AllRender = btn4, AllObjects = btn5, AllBoth = btn6 }
end

function TOOL:LeftClick( trace ) return (!trace.Entity or (trace.Entity and !trace.Entity:IsPlayer())) end
function TOOL:LeftClick( trace ) return (not trace.Entity or (trace.Entity and not trace.Entity:IsPlayer())) end
function TOOL:Reload( trace )

if (!Menu.Panel) then CreateToolReloadMenu() end
if (not Menu.Panel) then CreateToolReloadMenu() end

Menu.Panel:SetVisible( true )
if (!EGP:ValidEGP( trace.Entity )) then
if (not EGP:ValidEGP( trace.Entity )) then
Menu.SingleRender:SetEnabled( false )
Menu.SingleObjects:SetEnabled( false )
Menu.SingleBoth:SetEnabled( false )
Expand All @@ -321,7 +321,7 @@ if CLIENT then
end

function TOOL.BuildCPanel(panel)
if !(EGP) then return end
if not EGP then return end
panel:SetSpacing( 10 )
panel:SetName( "E2 Graphics Processor" )

Expand Down Expand Up @@ -382,10 +382,10 @@ function TOOL:Think()
end

local Type = self:GetClientNumber("type")
if (!self.GhostEntity or !self.GhostEntity:IsValid()) then
if (not self.GhostEntity or not self.GhostEntity:IsValid()) then
local trace = self:GetOwner():GetEyeTrace()
self:MakeGhostEntity( Model("models/bull/dynamicbutton.mdl"), trace.HitPos, trace.HitNormal:Angle() + Angle(90,0,0) )
elseif (!self.GhostEntity.Type or self.GhostEntity.Type != Type or (self.GhostEntity.Type == 1 and self.GhostEntity:GetModel() != self:GetClientInfo("model"))) then
elseif (not self.GhostEntity.Type or self.GhostEntity.Type ~= Type or (self.GhostEntity.Type == 1 and self.GhostEntity:GetModel() ~= self:GetClientInfo("model"))) then
if (Type == 1) then
self.GhostEntity:SetModel(self:GetClientInfo("model"))
elseif (Type == 2 or Type == 3) then
Expand Down

0 comments on commit 9a524dc

Please sign in to comment.