aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared/itemsystem/weapons/seratedknife.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-10-24 21:52:20 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-10-24 21:52:20 -0400
commit78e40d9fd55b6ba23db4f459e2c7e9ae2109cf5a (patch)
tree3c87a74fb2c6a792a93c7f242d9e92e478f4f77a /gamemode/shared/itemsystem/weapons/seratedknife.lua
parent9ae67530dc4be9eaab7b1243330e810d1d5a6fee (diff)
downloadartery-78e40d9fd55b6ba23db4f459e2c7e9ae2109cf5a.tar.gz
artery-78e40d9fd55b6ba23db4f459e2c7e9ae2109cf5a.tar.bz2
artery-78e40d9fd55b6ba23db4f459e2c7e9ae2109cf5a.zip
Allowed items to be dropped
Diffstat (limited to 'gamemode/shared/itemsystem/weapons/seratedknife.lua')
-rw-r--r--gamemode/shared/itemsystem/weapons/seratedknife.lua49
1 files changed, 4 insertions, 45 deletions
diff --git a/gamemode/shared/itemsystem/weapons/seratedknife.lua b/gamemode/shared/itemsystem/weapons/seratedknife.lua
index a6d4c55..e57351d 100644
--- a/gamemode/shared/itemsystem/weapons/seratedknife.lua
+++ b/gamemode/shared/itemsystem/weapons/seratedknife.lua
@@ -58,51 +58,6 @@ item.Shape = {
--Optional, If this item can be equiped in any player slots, put them here.
item.Equipable = "Right"
---[[ returns the direction the player swung]]
-local function 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 = {}
-
-local function swingarc(player,times,positions,onhit)
- local positionpoints = {}
- table.insert(positionset,positionpoints)
- local hitents = {}
- for k,v in ipairs(times) do
- timer.Simple(v,function()
- local weaponpos = positions[k] + player:GetPos()
- table.insert(positionpoints,weaponpos)
- if #positionpoints > 1 then
- local tr = util.TraceLine({
- start = positionpoints[#positionpoints-1],
- endpos = positionpoints[#positionpoints],
- })
- if tr.Hit then
- onhit(tr)
- end
- end
- end)
- end
- timer.Simple(times[#times],function()
- print("Inserted swing, drawn positions are now:")
- PrintTable(positionset)
- end)
-end
-
-
-
--Optional, what to do when the player clicks, and this item is in the slot in inventory. only works for items equipable in left and right
item.lastSwing = {}
local animationtime = 1.833333
@@ -214,5 +169,9 @@ item.onUnEquip = function(self,who)
ART.RemovePAC(who,"seratedknife")
end
+item.onDropped = function(self, ent)
+ ART.ApplyPAC(ent,"seratedknife")
+end
+
--Don't forget to register the item!
ART.RegisterItem(item)