From 233e478e40d72a091f70f18dc6846066a4f52016 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Thu, 24 Aug 2017 20:32:34 -0400 Subject: Fix all linter warnings --- entities/entities/art_chest/cl_init.lua | 14 +++---- entities/entities/art_droppeditem/cl_init.lua | 6 +-- entities/entities/art_droppeditem/init.lua | 16 +++---- entities/entities/art_serverchanger/init.lua | 2 +- entities/entities/info_townienode/cl_init.lua | 60 --------------------------- entities/entities/info_townienode/shared.lua | 7 ---- entities/entities/npc_huntable/init.lua | 28 ++++++------- entities/entities/npc_huntable/shared.lua | 8 ++-- entities/entities/npc_townie/cl_init.lua | 2 +- entities/entities/npc_townie/init.lua | 2 +- entities/entities/npc_townie/shared.lua | 9 ++-- entities/weapons/hands.lua | 16 +++---- 12 files changed, 52 insertions(+), 118 deletions(-) (limited to 'entities') diff --git a/entities/entities/art_chest/cl_init.lua b/entities/entities/art_chest/cl_init.lua index 232010c..41a98d9 100644 --- a/entities/entities/art_chest/cl_init.lua +++ b/entities/entities/art_chest/cl_init.lua @@ -1,4 +1,4 @@ -include('shared.lua') +include("shared.lua") --local invfuncs = include("../../../gamemode/shared/inventory_common.lua") local invfuncs = nrequire("inventory/inventory.lua") @@ -22,11 +22,11 @@ local oldpanel = nil local namecache = {} net.Receive("openchestinv",function(len,ply) - if oldpanel ~= nil then oldpanel:Remove() end - print("Opening chest inventory") - local what = net.ReadEntity() - local chest = invfuncs.DeSerializeBackpack() - ShowInventory() + if oldpanel ~= nil then oldpanel:Remove() end + print("Opening chest inventory") + local what = net.ReadEntity() + local chest = invfuncs.DeSerializeBackpack() + ShowInventory() local dat = {} dat.redraw = function() net.Start("requestchestinv") @@ -44,7 +44,7 @@ net.Receive("openchestinv",function(len,ply) local width = ScrW() local height = ScrH() local invpanel = dat.panel - invpanel:SetPos( width - (width/4), 0 ) + invpanel:SetPos( width - (width / 4), 0 ) invpanel:SetSize( width / 4, height ) print("Trying to get name",name) if namecache[what] == nil then diff --git a/entities/entities/art_droppeditem/cl_init.lua b/entities/entities/art_droppeditem/cl_init.lua index 83f8087..12c369c 100644 --- a/entities/entities/art_droppeditem/cl_init.lua +++ b/entities/entities/art_droppeditem/cl_init.lua @@ -1,4 +1,4 @@ -include('shared.lua') +include("shared.lua") ENT.RenderGroup = RENDERGROUP_BOTH @@ -7,8 +7,8 @@ ENT.RenderGroup = RENDERGROUP_BOTH Desc: Draw it! ---------------------------------------------------------*/ function ENT:Draw() - self:SetAngles(Angle(180,(CurTime()*200)%360,0)) - if(self:GetColor().a == 255) then + self:SetAngles(Angle(180,(CurTime() * 200) % 360,0)) + if self:GetColor().a == 255 then self:DrawModel() end end diff --git a/entities/entities/art_droppeditem/init.lua b/entities/entities/art_droppeditem/init.lua index effc96b..afd3139 100644 --- a/entities/entities/art_droppeditem/init.lua +++ b/entities/entities/art_droppeditem/init.lua @@ -1,5 +1,5 @@ --[[ - This entity is a item that was dropped, and can be picked up again. +This entity is a item that was dropped, and can be picked up again. ]] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) @@ -31,7 +31,7 @@ function ENT:Initialize() -- end -- end) end - print("Dropped item spawned at", self:GetPos()) + print("Dropped item spawned at", self:GetPos()) self:DrawShadow(false) self:SetMoveType(MOVETYPE_NONE) self:SetSolid(SOLID_NONE) @@ -64,12 +64,12 @@ net.Receive("art_requestpickup",function(len,pl) print("Inside if statement") local i = itm.GetItemFromData(e.ItemName, e.ItemData) print("Created item") - xpcall(function() - pl:GiveItem(i) - e:Remove() - end,function() --We couldn't put the item in the player's inventory! - --Don't do anything I guess - end) + xpcall(function() + pl:GiveItem(i) + e:Remove() + end,function() --We couldn't put the item in the player's inventory! + --Don't do anything I guess + end) else print("Player not close enough!") end diff --git a/entities/entities/art_serverchanger/init.lua b/entities/entities/art_serverchanger/init.lua index ebb1e54..b72d03c 100644 --- a/entities/entities/art_serverchanger/init.lua +++ b/entities/entities/art_serverchanger/init.lua @@ -9,7 +9,7 @@ function ENT:Initialize() --self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE) --self:SetUseType(SIMPLE_USE) - if(self.Model) then self:SetModel(self.Model) + if self.Model then self:SetModel(self.Model) else print("Server changer created without model, this might be a bug!") end if self.Pos then self:SetPos(self.Pos) diff --git a/entities/entities/info_townienode/cl_init.lua b/entities/entities/info_townienode/cl_init.lua index 7c6a2d1..58f9631 100644 --- a/entities/entities/info_townienode/cl_init.lua +++ b/entities/entities/info_townienode/cl_init.lua @@ -1,69 +1,9 @@ include('shared.lua') ENT.RenderGroup = RENDERGROUP_BOTH - -/*--------------------------------------------------------- - Name: Drawasd - Desc: Draw it! ----------------------------------------------------------*/ function ENT:Draw() --self:DrawModel() render.SetColorMaterial() render.DrawSphere( self:GetPos(), 10, 30, 30, Color( 0, 175, 175, 100 ) ) end - -/*--------------------------------------------------------- - Name: DrawTranslucent - Desc: Draw translucent ----------------------------------------------------------*/ -function ENT:DrawTranslucent() - - // This is here just to make it backwards compatible. - // You shouldn't really be drawing your model here unless it's translucent - - --self:Draw() - -end - -/*--------------------------------------------------------- - Name: BuildBonePositions - Desc: ----------------------------------------------------------*/ -function ENT:BuildBonePositions( NumBones, NumPhysBones ) - - // You can use this section to position the bones of - // any animated model using self:SetBonePosition( BoneNum, Pos, Angle ) - - // This will override any animation data and isn't meant as a - // replacement for animations. We're using this to position the limbs - // of ragdolls. - -end - - - -/*--------------------------------------------------------- - Name: SetRagdollBones - Desc: ----------------------------------------------------------*/ -function ENT:SetRagdollBones( bIn ) - - // If this is set to true then the engine will call - // DoRagdollBone (below) for each ragdoll bone. - // It will then automatically fill in the rest of the bones - - self.m_bRagdollSetup = bIn - -end - - -/*--------------------------------------------------------- - Name: DoRagdollBone - Desc: ----------------------------------------------------------*/ -function ENT:DoRagdollBone( PhysBoneNum, BoneNum ) - - // self:SetBonePosition( BoneNum, Pos, Angle ) - -end diff --git a/entities/entities/info_townienode/shared.lua b/entities/entities/info_townienode/shared.lua index e16aff4..fe72ac8 100644 --- a/entities/entities/info_townienode/shared.lua +++ b/entities/entities/info_townienode/shared.lua @@ -1,12 +1,5 @@ ENT.Base = "base_entity" -/*--------------------------------------------------------- - Name: OnRemove - Desc: Called just before entity is deleted ----------------------------------------------------------*/ -function ENT:OnRemove() -end - function ENT:DoActivity(npc) if not self.onActivity() then print("Node without activity, this might be an error!") diff --git a/entities/entities/npc_huntable/init.lua b/entities/entities/npc_huntable/init.lua index 31d6ea8..f1e7ac2 100644 --- a/entities/entities/npc_huntable/init.lua +++ b/entities/entities/npc_huntable/init.lua @@ -33,7 +33,7 @@ function ENT:Initialize() if (self.Stats["Step"]) then self.loco:SetJumpHeight(self.Stats["Step"]) end - + if self.Stats["Speed"] then self.loco:SetDesiredSpeed(self.Stats["Speed"]) end @@ -55,20 +55,20 @@ function ENT:OnKilled(dmg) if not self.Drops then return end --print("Looks like we have some drops") --error("You need to code how item drops work!") - local itemstodrop = {} - - for k, v in pairs(self.Drops) do - local rng = math.random(0, 100) - local itemname = self.Drops[k][1] - local itemchance = self.Drops[k][2] - local heightoffset = 10 + --local itemstodrop = {} - if rng < itemchance then - --local drop = ART.GetItemByName(itemname) - --print("Createing a drop of",drop) - --ART.CreateDroppedItem(drop, self:GetPos()) - end - end + -- for k, v in pairs(self.Drops) do + -- local rng = math.random(0, 100) + -- local itemname = self.Drops[k][1] + -- local itemchance = self.Drops[k][2] + -- local heightoffset = 10 + -- + -- if rng < itemchance then + -- --local drop = ART.GetItemByName(itemname) + -- --print("Createing a drop of",drop) + -- --ART.CreateDroppedItem(drop, self:GetPos()) + -- end + -- end self:BecomeRagdoll(dmg) end diff --git a/entities/entities/npc_huntable/shared.lua b/entities/entities/npc_huntable/shared.lua index 4c4c535..619e2b4 100644 --- a/entities/entities/npc_huntable/shared.lua +++ b/entities/entities/npc_huntable/shared.lua @@ -49,10 +49,10 @@ function ENT:DefaultBehaviour() if ( true ) then path:Draw() end -- If we're stuck then call the HandleStuck function and abandon - if ( self.loco:IsStuck() ) then - --self:HandleStuck() - --return "stuck" - end + -- if ( self.loco:IsStuck() ) then + -- --self:HandleStuck() + -- --return "stuck" + -- end --return "ok" end diff --git a/entities/entities/npc_townie/cl_init.lua b/entities/entities/npc_townie/cl_init.lua index a8ba643..41cee22 100644 --- a/entities/entities/npc_townie/cl_init.lua +++ b/entities/entities/npc_townie/cl_init.lua @@ -1,4 +1,4 @@ -include('shared.lua') +include("shared.lua") ENT.RenderGroup = RENDERGROUP_BOTH diff --git a/entities/entities/npc_townie/init.lua b/entities/entities/npc_townie/init.lua index 908b3e8..00eaa63 100644 --- a/entities/entities/npc_townie/init.lua +++ b/entities/entities/npc_townie/init.lua @@ -37,7 +37,7 @@ function ENT:Initialize() if self.Name then self:SetName(self.Name) else print("NPC created without a name! They won't be able to open doors!") end - + if self.Ang then self:SetAngles(self.Ang) end if self.OnSpawn then self.OnSpawn(self) end diff --git a/entities/entities/npc_townie/shared.lua b/entities/entities/npc_townie/shared.lua index bb07b51..4962681 100644 --- a/entities/entities/npc_townie/shared.lua +++ b/entities/entities/npc_townie/shared.lua @@ -4,7 +4,7 @@ function ENT:OnRemove() end function ENT:BehaveAct() - if(self.Act) then + if self.Act then self:Act() else print("NPC spawned without an Act function, this might be an error!") @@ -71,11 +71,12 @@ net.Receive("closenpcdialog",function(len,ply) local npc = net.ReadEntity() print("player closed dialog") npc.DialogCursors[ply] = nil - if next(npc.DialogCursors) == nil then -- no one is talking to us, resume movement - if npc.loco:GetMaxYawRate() == 0 and npc.loco:GetAcceleration() == 0 then + if next(npc.DialogCursors) == nil and + npc.loco:GetMaxYawRate() == 0 and + npc.loco:GetAcceleration() == 0 + then -- no one is talking to us, resume movement npc.loco:SetMaxYawRate(npc.oyaw) npc.loco:SetAcceleration(npc.oacc) - end end end) diff --git a/entities/weapons/hands.lua b/entities/weapons/hands.lua index 7532104..553c4f1 100644 --- a/entities/weapons/hands.lua +++ b/entities/weapons/hands.lua @@ -51,13 +51,13 @@ end function SWEP:Tick() if self.Pickup ~= nil then - + --Set position local targetpos = (self.Owner:EyeAngles():Forward() * self.PickupOffset * 2) + self.Owner:GetPos() + Vector(0,0,64) local deltavel = targetpos - (self.Pickup:GetPos() + self.Pickup:GetVelocity()) local clampvel = Vector(math.Clamp(deltavel.x,-100,100),math.Clamp(deltavel.y,-100,100),math.Clamp(deltavel.z,-100,100)) self.Pickup:GetPhysicsObject():SetVelocity(clampvel) - + --Set angles local targetang = self.Owner:EyeAngles() + self.PickupAngles local angvel = self.Pickup:GetAngles() - targetang @@ -74,17 +74,17 @@ end function SWEP:PrimaryAttack() if CLIENT then return end - + --Make sure we have an equipment inventory if not self.Owner then return end if not self.Owner.data then return end if not self.Owner.data.inventories then return end if not self.Owner.data.inventories[1] then return end local eqpd = self.Owner.data.inventories[1] - + --Get the weapon we want to fire, and fire it! local weapon = eqpd:Get({"Left Hand"}) or eqpd:Get({"Dual"}) - if not weapon then + if not weapon then self:DefaultPickup() elseif weapon.onClick ~= nil then weapon:onClick(self.Owner) @@ -93,17 +93,17 @@ end function SWEP:SecondaryAttack() if CLIENT then return end - + --Make sure we have an equipment inventory if not self.Owner then return end if not self.Owner.data then return end if not self.Owner.data.inventories then return end if not self.Owner.data.inventories[1] then return end local eqpd = self.Owner.data.inventories[1] - + --Get the weapon we want to fire, and fire it! local weapon = eqpd:Get({"Right Hand"}) or eqpd:Get({"Dual"}) - if not weapon then + if not weapon then self:DefaultPickup() elseif weapon.onClick ~= nil then weapon:onClick(self.Owner) -- cgit v1.2.3-70-g09d2