aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared/itemsystem/weapons
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/shared/itemsystem/weapons')
-rw-r--r--gamemode/shared/itemsystem/weapons/knuckledclaw.lua47
-rw-r--r--gamemode/shared/itemsystem/weapons/rustyaxe.lua36
-rw-r--r--gamemode/shared/itemsystem/weapons/scraphammer.lua71
-rw-r--r--gamemode/shared/itemsystem/weapons/seratedknife.lua49
4 files changed, 45 insertions, 158 deletions
diff --git a/gamemode/shared/itemsystem/weapons/knuckledclaw.lua b/gamemode/shared/itemsystem/weapons/knuckledclaw.lua
index 467439e..2db8117 100644
--- a/gamemode/shared/itemsystem/weapons/knuckledclaw.lua
+++ b/gamemode/shared/itemsystem/weapons/knuckledclaw.lua
@@ -58,49 +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
@@ -197,6 +154,10 @@ item.onUnEquip = function(self,who)
ART.RemovePAC(who,"knuckledclaws")
end
+item.onDropped = function(self, ent)
+ ART.ApplyPAC(ent,"knuckledclaws")
+end
+
print("Hello from scrapgun.lua")
--Don't forget to register the item!
ART.RegisterItem(item)
diff --git a/gamemode/shared/itemsystem/weapons/rustyaxe.lua b/gamemode/shared/itemsystem/weapons/rustyaxe.lua
index 71d8603..f21500d 100644
--- a/gamemode/shared/itemsystem/weapons/rustyaxe.lua
+++ b/gamemode/shared/itemsystem/weapons/rustyaxe.lua
@@ -66,6 +66,7 @@ end
local positionset = {}
+--[[
local function swingarc(player,times,positions,onhit)
local positionpoints = {}
table.insert(positionset,positionpoints)
@@ -102,6 +103,7 @@ hook.Add( "HUDPaint", "weaponswings", function()
--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 )
+]]
--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 = {}
@@ -117,13 +119,13 @@ item.onClick = function(self,owner)
["forward"] = function()
owner:SetLuaAnimation("axe_swing_up")
timer.Simple(2.33,function() owner:StopLuaAnimation("axe_swing_up") end)
- local hits = swingarc(owner,{
+ local hits = ART.swingarc(owner,{
1,1.1,1.2,1.3
},{
- fow*20 + up*90,
- fow*45 + up*70,
- fow*35 + up*45,
- fow*20 + up*30,
+ fow*20 + up*26,
+ fow*45 + up*6,
+ fow*35 + up*-13,
+ fow*20 + up*-34,
},function(tr)
if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
@@ -137,13 +139,13 @@ item.onClick = function(self,owner)
["left"] = function()
owner:SetLuaAnimation("axe_swing_left")
timer.Simple(2.33,function() owner:StopLuaAnimation("axe_swing_left") end)
- local hits = swingarc(owner,{
+ local hits = ART.swingarc(owner,{
1,1.1,1.2,1.3
},{
- rig*30 + up*59,
- rig*10 + fow*30 + up*55,
- rig*-10 + fow*30 + up*54,
- rig*-30 + up*50,
+ rig*30 + up*-5,
+ rig*10 + fow*30 + up*-9,
+ rig*-10 + fow*30 + up*-10,
+ rig*-30 + up*-15,
},function(tr)
if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
@@ -154,13 +156,13 @@ item.onClick = function(self,owner)
["right"] = function()
owner:SetLuaAnimation("axe_swing_right")
timer.Simple(2.33,function() owner:StopLuaAnimation("axe_swing_right") end)
- local hits = swingarc(owner,{
+ local hits = ART.swingarc(owner,{
1,1.1,1.2,1.3
},{
- rig*-30 + up*59,
- rig*-10 + fow*30 + up*55,
- rig*10 + fow*30 + up*54,
- rig*30 + up*50,
+ rig*-30 + up*-5,
+ rig*-10 + fow*30 + up*-9,
+ rig*10 + fow*30 + up*-10,
+ rig*30 + up*-15,
},function(tr)
if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
@@ -192,6 +194,10 @@ item.onUnEquip = function(self,who)
ART.RemovePAC(who,"rustyaxe")
end
+item.onDropped = function(self, ent)
+ ART.ApplyPAC(ent,"rustyaxe")
+end
+
print("Hello from scrapgun.lua")
--Don't forget to register the item!
ART.RegisterItem(item)
diff --git a/gamemode/shared/itemsystem/weapons/scraphammer.lua b/gamemode/shared/itemsystem/weapons/scraphammer.lua
index 978fde8..9ec7ac9 100644
--- a/gamemode/shared/itemsystem/weapons/scraphammer.lua
+++ b/gamemode/shared/itemsystem/weapons/scraphammer.lua
@@ -60,49 +60,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
@@ -123,10 +80,10 @@ item.onClick = function(self,owner)
local hits = ART.swingarc(owner,{
1,1.1,1.2,1.3
},{
- fow*20 + up*90,
- fow*45 + up*70,
- fow*35 + up*45,
- fow*20 + up*30,
+ fow*40 + up*26,
+ fow*60 + up*6,
+ fow*55 + up*-13,
+ fow*40 + up*-34,
},function(tr)
if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
@@ -145,10 +102,10 @@ item.onClick = function(self,owner)
local hits = ART.swingarc(owner,{
1,1.1,1.2,1.3
},{
- rig*30 + up*59,
- rig*10 + fow*30 + up*55,
- rig*-10 + fow*30 + up*54,
- rig*-30 + up*50,
+ rig*30 + up*-5,
+ rig*20 + fow*40 + up*-9,
+ rig*-20 + fow*40 + up*-10,
+ rig*-30 + up*-15,
},function(tr)
if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
tr.Entity:TakeDamage(10, owner, owner:GetActiveWeapon())
@@ -164,10 +121,10 @@ item.onClick = function(self,owner)
local hits = ART.swingarc(owner,{
1,1.1,1.2,1.3
},{
- rig*-30 + up*59,
- rig*-10 + fow*30 + up*55,
- rig*10 + fow*30 + up*54,
- rig*30 + up*50,
+ rig*-30 + up*-5,
+ rig*-10 + fow*40 + up*-9,
+ rig*10 + fow*40 + up*-10,
+ rig*30 + up*-15,
},function(tr)
if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
@@ -199,6 +156,10 @@ item.onUnEquip = function(self,who)
ART.RemovePAC(who,"scraphammer")
end
+item.onDropped = function(self, ent)
+ ART.ApplyPAC(ent,"scraphammer")
+end
+
print("Hello from scrapgun.lua")
--Don't forget to register the item!
ART.RegisterItem(item)
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)