aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/combat/sv_weaponswing.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-08-24 20:32:34 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-08-24 20:32:34 -0400
commit233e478e40d72a091f70f18dc6846066a4f52016 (patch)
treecf34be714088889731736c81bd44e198c792625a /gamemode/core/combat/sv_weaponswing.lua
parent61bc16dae5a1b61bcd237d9f0be36125829d95b1 (diff)
downloadartery-233e478e40d72a091f70f18dc6846066a4f52016.tar.gz
artery-233e478e40d72a091f70f18dc6846066a4f52016.tar.bz2
artery-233e478e40d72a091f70f18dc6846066a4f52016.zip
Fix all linter warnings
Diffstat (limited to 'gamemode/core/combat/sv_weaponswing.lua')
-rw-r--r--gamemode/core/combat/sv_weaponswing.lua30
1 files changed, 14 insertions, 16 deletions
diff --git a/gamemode/core/combat/sv_weaponswing.lua b/gamemode/core/combat/sv_weaponswing.lua
index f754000..ea43f0b 100644
--- a/gamemode/core/combat/sv_weaponswing.lua
+++ b/gamemode/core/combat/sv_weaponswing.lua
@@ -1,14 +1,14 @@
--[[
This file tells you what weapons need their swings recalculated
]]
-local itm = nrequire("core/inventory/item.lua")
-local inv = nrequire("core/inventory/inventory.lua")
+-- local itm = nrequire("core/inventory/item.lua")
+-- local inv = nrequire("core/inventory/inventory.lua")
local wep = nrequire("core/inventory/common/weapons.lua")
local ws = {}
--Cache swing hits, if we used one once, we'll probably use it again soon
-local swingcache_size = 30
-local swingcache = {} --Swing arc cache
+-- local swingcache_size = 30
+-- local swingcache = {} --Swing arc cache
--A table of all the items that are swingable
local swingable = {}
@@ -25,18 +25,18 @@ net.Receive("artery_notifyserverofswing",function()
local weapon = net.ReadString()
local anim = net.ReadString()
local data = net.ReadTable()
-
+
print("Got swing data for ",weapon,anim)
PrintTable(data)
-
+
--Get the data that already exists for this weapon
local olddata = file.Read("artery/dynamic/swingdata/" .. weapon .. ".txt","DATA")
if olddata == nil then olddata = {}
else olddata = util.JSONToTable(util.Decompress(olddata)) end
-
+
--Add our new data
olddata[anim] = data
-
+
--And save back
file.Write("artery/dynamic/swingdata/" .. weapon .. ".txt",util.Compress(util.TableToJSON(olddata)))
end)
@@ -86,10 +86,8 @@ function ws.doSwing(weapon,ply,callback)
for k,v in pairs(hitthings) do
callback(v)
end
- if #hitthings == 0 then
- if weapon.onMiss then
- weapon:onMiss(ply)
- end
+ if #hitthings == 0 and weapon.onMiss then
+ weapon:onMiss(ply)
end
end)
end
@@ -100,7 +98,7 @@ concommand.Add("artery_recordanimations",function(ply,cmd,args)
local e = ply
e:SetAngles(Angle(0,0,0))
e:SetEyeAngles(Angle(0,0,0))
-
+
--Add everything in swingables to a queue to be recorded
for k,v in pairs(swingable) do
for i,j in pairs(v.attacks) do
@@ -115,7 +113,7 @@ concommand.Add("artery_recordanimations",function(ply,cmd,args)
recordqueue[#recordqueue + 1] = tn
end
end
-
+
--Create timers for everything
local timefromnow = 0
for k,v in ipairs(recordqueue) do
@@ -123,7 +121,7 @@ concommand.Add("artery_recordanimations",function(ply,cmd,args)
print("timefromnow 1 is",timefromnow)
--Put the item into the inventory
local tfunc = function(nowtime)
- local whentoremove = nowtime + 1 + v[3] + 1
+ --local whentoremove = nowtime + 1 + v[3] + 1
timer.Simple(nowtime,function()
print("timefromnow 2 is",nowtime)
local einv = e.data.inventories[1]
@@ -178,7 +176,7 @@ concommand.Add("artery_checkSwingable",function(ply,cmd,args)
end
nitms = nitms + 1
end
-
+
print("Scanned ",nitms,"swingable items, could not find data for:\n\t",table.concat(noswingdata,"\n\t"))
end)