aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/combat
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-11-08 15:51:26 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2017-11-08 15:51:26 -0500
commit2252904b8147419c551ad2653a20627281d0531f (patch)
treec1d76a132fa085940dd33d8af99c08dd9da04675 /gamemode/core/combat
parent07593f0c983ac6b16161829b20ea6fde887fa7e9 (diff)
downloadartery-2252904b8147419c551ad2653a20627281d0531f.tar.gz
artery-2252904b8147419c551ad2653a20627281d0531f.tar.bz2
artery-2252904b8147419c551ad2653a20627281d0531f.zip
Finished LDoc comments
Diffstat (limited to 'gamemode/core/combat')
-rw-r--r--gamemode/core/combat/cl_weaponswing.lua4
-rw-r--r--gamemode/core/combat/sv_weaponswing.lua22
2 files changed, 24 insertions, 2 deletions
diff --git a/gamemode/core/combat/cl_weaponswing.lua b/gamemode/core/combat/cl_weaponswing.lua
index ec5b954..7f2c927 100644
--- a/gamemode/core/combat/cl_weaponswing.lua
+++ b/gamemode/core/combat/cl_weaponswing.lua
@@ -82,6 +82,10 @@ net.Receive("artery_doanimation",function()
end)
end)
+---Force the player to do an animation.
+-- The animation must have been already registered to animbonelib ![Requires admin](./req_admin)
+--@usage artery_startanimation <animation name>
+--@concommand artery_startanimation
concommand.Add("artery_startanimation",function(ply,cmd,args)
if not ply:IsAdmin() then return end
swingtbl = {}
diff --git a/gamemode/core/combat/sv_weaponswing.lua b/gamemode/core/combat/sv_weaponswing.lua
index 2d45d31..b02c8fc 100644
--- a/gamemode/core/combat/sv_weaponswing.lua
+++ b/gamemode/core/combat/sv_weaponswing.lua
@@ -1,3 +1,6 @@
+---Automatically re-calculates swing arcs for weapons.
+-- This files helps you create mele weapons that need to be swung
+--@module sv_weaponswing.lua
--[[
This file tells you what weapons need their swings recalculated
]]
@@ -41,6 +44,9 @@ net.Receive("artery_notifyserverofswing",function()
file.Write("artery/dynamic/swingdata/" .. weapon .. ".txt",util.Compress(util.TableToJSON(olddata)))
end)
+---Make a weapons swingable.
+-- Make a new weapon that needs swing arcs, this function checks to make sure the table has a .Name, .attacks, and .pacname
+--@tparam swingitem tbl A swingable item.
function ws.makeSwingable(tbl)
--print("Makeing a swingable out of:")
--PrintTable(tbl)
@@ -50,6 +56,11 @@ function ws.makeSwingable(tbl)
swingable[tbl.Name] = tbl
end
+---Actually swings a weapon.
+-- Makes a player swing their weapon, and dammages anything in the swing arc
+--@tparam swingitem The item the player swung
+--@tparam player ply The player swinging the weapon
+--@tparam function callback The function to call when the swing arc hit something.
function ws.doSwing(weapon,ply,callback)
local dir = wep.playermovedir(ply)
local fdata = file.Read("artery/dynamic/swingdata/" .. weapon.Name .. ".txt")
@@ -92,7 +103,9 @@ function ws.doSwing(weapon,ply,callback)
end)
end
---Create a fake thing in front of the player, do the swing animations, and record them.
+---Records animations for swingables.
+-- Records the player doing swings ![Requires admin](./req_admin)
+--@concommand artery_Recordanimations
concommand.Add("artery_recordanimations",function(ply,cmd,args)
if not ply:IsAdmin() then return end
local e = ply
@@ -162,7 +175,9 @@ concommand.Add("artery_recordanimations",function(ply,cmd,args)
end)
-
+---Command to check that all swingable weapons have been recorded.
+-- Check the console for output
+--@concommand artery_checkSwingable
concommand.Add("artery_checkSwingable",function(ply,cmd,args)
local nitms = 0
local noswingdata = {}
@@ -180,6 +195,9 @@ concommand.Add("artery_checkSwingable",function(ply,cmd,args)
print("Scanned ",nitms,"swingable items, could not find data for:\n\t",table.concat(noswingdata,"\n\t"))
end)
+---Clears the swingable cache, usefull for developers.
+-- Clears the list of items the gamemode knows about that are swingable ![Requires admin](./req_admin)
+--@concommand artery_clearswingable
concommand.Add("artery_clearswingable",function(ply,cmd,args)
if not ply:IsAdmin() then return end
swingable = {}