aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared/itemsystem/weapons_common.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/shared/itemsystem/weapons_common.lua')
-rw-r--r--gamemode/shared/itemsystem/weapons_common.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/gamemode/shared/itemsystem/weapons_common.lua b/gamemode/shared/itemsystem/weapons_common.lua
index 5da9b9a..6e73318 100644
--- a/gamemode/shared/itemsystem/weapons_common.lua
+++ b/gamemode/shared/itemsystem/weapons_common.lua
@@ -1,7 +1,9 @@
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
@@ -17,8 +19,14 @@ function ART.playermovedir(player)
return swings[1][2]
end
-local positionset = {}
+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)