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 --- gamemode/itemsystem/weapons_common.lua | 142 ++++++++++++++++----------------- 1 file changed, 71 insertions(+), 71 deletions(-) (limited to 'gamemode/itemsystem/weapons_common.lua') diff --git a/gamemode/itemsystem/weapons_common.lua b/gamemode/itemsystem/weapons_common.lua index f31b18f..3c3e6ca 100644 --- a/gamemode/itemsystem/weapons_common.lua +++ b/gamemode/itemsystem/weapons_common.lua @@ -1,71 +1,71 @@ ---This file has been moved to core/inventory/common/weapons.lua -do return end -ART = ART or {} - ---- Finds the direction a player is moveing. --- @param player The player to find the move direction of --- @return The string "forward", "backward", "right", or "left" -function ART.playermovedir(player) - local vel = player:GetVelocity():GetNormalized() - vel.z = 0 - local swings = { - {player:GetForward(),"forward"}, - {-player:GetForward(),"backward"}, - {player:GetRight(),"right"}, - {-player:GetRight(),"left"} - } - table.sort(swings,function(a,b) - return vel:Dot(a[1]) > vel:Dot(b[1]) - end) - return swings[1][2] -end - - -local positionset = {} ---- The arc swing of a weapon. --- Finds anything that a weapon should hit in it's swing, and calls a function on it. --- @param player The player that's swinging the weapon --- @param tiems A table of times that the trace calculations should be done at, this table needs to be the same length as the positions table --- @param positions The position offsets from the player that swung that should be the start/end points of the arc --- @param onhit A function to call on any entities that were hit in the swing of the weapon. -function ART.swingarc(player,times,positions,onhit) - local positionpoints = {} - table.insert(positionset,positionpoints) - for k,v in ipairs(times) do - timer.Simple(v,function() - ART.TraceWeapon = true - ART.TraceStart = CurTime() - print("positions[k]",positions[k],"playerpos",player:GetPos(),"add",Vector(0,0,64)) - local weaponpos = positions[k] + player:GetPos() + Vector(0,0,64) - table.insert(positionpoints,weaponpos) - if #positionpoints > 1 then - --print("Trace from ", positionpoints[#positionpoints-1], " to ", positionpoints[#positionpoints]) - local tr = util.TraceLine({ - start = positionpoints[#positionpoints-1], - endpos = positionpoints[#positionpoints], - }) - onhit(tr) - end - end) - end - timer.Simple(times[#times],function() - print("Inserted swing, drawn positions are now:") - PrintTable(positionset) - ART.TraceWeapon = false - end) -end - -hook.Add( "HUDPaint", "weaponswings", function() - cam.Start3D() -- Start the 3D function so we can draw onto the screen. - for k,v in pairs(positionset) do - for i = 1,#v-1 do - render.DrawLine( v[i], v[i+1], Color(255,0,0,255), false ) - render.DrawLine( v[i], v[i]+Vector(0,0,20),Color(0,255,0,255),false) - end - end - --render.SetMaterial( material ) -- Tell render what material we want, in this case the flash from the gravgun - --render.DrawSprite( pos, 16, 16, white ) -- Draw the sprite in the middle of the map, at 16x16 in it's original colour with full alpha. - cam.End3D() -end ) - -return wcommon +-- --This file has been moved to core/inventory/common/weapons.lua +-- do return end +-- ART = ART or {} +-- +-- --- Finds the direction a player is moveing. +-- -- @param player The player to find the move direction of +-- -- @return The string "forward", "backward", "right", or "left" +-- function ART.playermovedir(player) +-- local vel = player:GetVelocity():GetNormalized() +-- vel.z = 0 +-- local swings = { +-- {player:GetForward(),"forward"}, +-- {-player:GetForward(),"backward"}, +-- {player:GetRight(),"right"}, +-- {-player:GetRight(),"left"} +-- } +-- table.sort(swings,function(a,b) +-- return vel:Dot(a[1]) > vel:Dot(b[1]) +-- end) +-- return swings[1][2] +-- end +-- +-- +-- local positionset = {} +-- --- The arc swing of a weapon. +-- -- Finds anything that a weapon should hit in it's swing, and calls a function on it. +-- -- @param player The player that's swinging the weapon +-- -- @param tiems A table of times that the trace calculations should be done at, this table needs to be the same length as the positions table +-- -- @param positions The position offsets from the player that swung that should be the start/end points of the arc +-- -- @param onhit A function to call on any entities that were hit in the swing of the weapon. +-- function ART.swingarc(player,times,positions,onhit) +-- local positionpoints = {} +-- table.insert(positionset,positionpoints) +-- for k,v in ipairs(times) do +-- timer.Simple(v,function() +-- ART.TraceWeapon = true +-- ART.TraceStart = CurTime() +-- print("positions[k]",positions[k],"playerpos",player:GetPos(),"add",Vector(0,0,64)) +-- local weaponpos = positions[k] + player:GetPos() + Vector(0,0,64) +-- table.insert(positionpoints,weaponpos) +-- if #positionpoints > 1 then +-- --print("Trace from ", positionpoints[#positionpoints-1], " to ", positionpoints[#positionpoints]) +-- local tr = util.TraceLine({ +-- start = positionpoints[#positionpoints-1], +-- endpos = positionpoints[#positionpoints], +-- }) +-- onhit(tr) +-- end +-- end) +-- end +-- timer.Simple(times[#times],function() +-- print("Inserted swing, drawn positions are now:") +-- PrintTable(positionset) +-- ART.TraceWeapon = false +-- end) +-- end +-- +-- hook.Add( "HUDPaint", "weaponswings", function() +-- cam.Start3D() -- Start the 3D function so we can draw onto the screen. +-- for k,v in pairs(positionset) do +-- for i = 1,#v-1 do +-- render.DrawLine( v[i], v[i+1], Color(255,0,0,255), false ) +-- render.DrawLine( v[i], v[i]+Vector(0,0,20),Color(0,255,0,255),false) +-- end +-- end +-- --render.SetMaterial( material ) -- Tell render what material we want, in this case the flash from the gravgun +-- --render.DrawSprite( pos, 16, 16, white ) -- Draw the sprite in the middle of the map, at 16x16 in it's original colour with full alpha. +-- cam.End3D() +-- end ) +-- +-- return wcommon -- cgit v1.2.3-70-g09d2