aboutsummaryrefslogtreecommitdiff
path: root/gamemode/itemsystem/weapons
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/itemsystem/weapons')
-rw-r--r--gamemode/itemsystem/weapons/knuckledclaw.lua328
-rw-r--r--gamemode/itemsystem/weapons/rustyaxe.lua544
-rw-r--r--gamemode/itemsystem/weapons/scraphammer.lua406
-rw-r--r--gamemode/itemsystem/weapons/seratedknife.lua400
4 files changed, 839 insertions, 839 deletions
diff --git a/gamemode/itemsystem/weapons/knuckledclaw.lua b/gamemode/itemsystem/weapons/knuckledclaw.lua
index c738f2e..1c2b8f6 100644
--- a/gamemode/itemsystem/weapons/knuckledclaw.lua
+++ b/gamemode/itemsystem/weapons/knuckledclaw.lua
@@ -1,164 +1,164 @@
---[[
- An example item
-]]
-do return end
-local item = {}
-
---Required, a name, all item names must be unique
-item.Name = "Knuckled Claws"
-
---Optional, a tooltip to display
-item.Tooltip = "Bits of scrap put togeather to resembel a hammer"
-
---Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
-item.Serialize = function(self)
- print("Trying to serailize!")
- return ""
-end
-
---Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
-item.DeSerialize = function(self,string)
- print("Trying to deserialize!")
- return self
-end
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
-function item.GetOptions(self)
- local options = {}
- options["test"] = function() print("You pressed test!") end
- options["toste"] = function() print("You pressed toste!") end
- return options
-end
-
-function item.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
-end
-
-function item.DoOnEquipPanel(dimagebutton)
- print("called with panel:",panel)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
-end
-
---[[
-function item.Paint(self,width,height)
- --print("painting with values",self,width,height)
- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
-end
-
-function item.PaintEquiped(self,width,height)
- --print("painting with values",self,width,height)
- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
-end
-]]
-
---Required, the shape of this item.
-item.Shape = {
- {true,true},
-}
-
---Optional, If this item can be equiped in any player slots, put them here.
-item.Equipable = "Right"
-
-
-
---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 = {}
-item.onClick = function(self,owner)
- item.lastSwing[owner] = item.lastSwing[owner] or 0
- if item.lastSwing[owner] > CurTime() then
- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
- return end
- item.lastSwing[owner] = CurTime()+1.25
- local fow,rig,up = owner:GetForward(),owner:GetRight(),owner:GetUp()
- local movementtbl = {
- ["forward"] = function()
- owner:SetLuaAnimation("fist_swing_up")
- timer.Simple(1.75,function()
- owner:StopLuaAnimation("fist_swing_up")
- end)
- local hits = ART.swingarc(owner,{
- 0.5,0.57,0.65,0.73
- },{
- fow*20 + up*90,
- fow*45 + up*70,
- fow*35 + up*45,
- fow*20 + up*30,
- },function(tr)
- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
- end
- print("Hit",tr.Entity)
- end)
- end,
- ["backward"] = function()
- owner:SetLuaAnimation("fist_swing_down")
- timer.Simple(1.75,function()
- owner:StopLuaAnimation("fist_swing_down")
- end)
- local hits = ART.swingarc(owner,{
- 0.5,0.57,0.65,0.73
- },{
- fow*15 + up*30,
- fow*35 + up*45,
- fow*25 + up*70,
- fow*15 + up*90,
- },function(tr)
- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
- end
- print("Hit",tr.Entity)
- end)
- end,
- ["left"] = function()
- owner:SetLuaAnimation("fist_swing_left")
- timer.Simple(2,function()
- owner:StopLuaAnimation("fist_swing_left")
- end)
- local hits = ART.swingarc(owner,{
- 0.5,0.57,0.65,0.73
- },{
- rig*-30 + up*59,
- rig*-10 + fow*30 + up*55,
- rig*10 + fow*30 + up*54,
- rig*30 + up*50,
- },function(tr)
- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
- end
- print("Hit",tr.Entity)
- end)
- end,
- ["right"] = function()
-
- end,
- }
- movementtbl[ART.playermovedir(owner)]()
-end
-
---Optional, if we should do something special on equip(like draw the PAC for this weapon)
-item.onEquip = function(self,who)
- print("onEquip",who)
- if CLIENT then print("onEquip client!") end
- if SERVER then
- PrintTable(pac)
- who:GetActiveWeapon():SetHoldType("fist")
- ART.ApplyPAC(who,"knuckledclaws")
- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
- --who:AttachPACPart(outfit)
- --print("onEquip server!")
- end
-end
-
---Optional, if we should do something speical on unequip(like setting animations back to normal)
-item.onUnEquip = function(self,who)
- who:GetActiveWeapon():SetHoldType("normal")
- 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!
-nrequire("item.lua").RegisterItem(item)
+-- --[[
+-- An example item
+-- ]]
+-- do return end
+-- local item = {}
+--
+-- --Required, a name, all item names must be unique
+-- item.Name = "Knuckled Claws"
+--
+-- --Optional, a tooltip to display
+-- item.Tooltip = "Bits of scrap put togeather to resembel a hammer"
+--
+-- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
+-- item.Serialize = function(self)
+-- print("Trying to serailize!")
+-- return ""
+-- end
+--
+-- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
+-- item.DeSerialize = function(self,string)
+-- print("Trying to deserialize!")
+-- return self
+-- end
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
+-- function item.GetOptions(self)
+-- local options = {}
+-- options["test"] = function() print("You pressed test!") end
+-- options["toste"] = function() print("You pressed toste!") end
+-- return options
+-- end
+--
+-- function item.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
+-- end
+--
+-- function item.DoOnEquipPanel(dimagebutton)
+-- print("called with panel:",panel)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
+-- end
+--
+-- --[[
+-- function item.Paint(self,width,height)
+-- --print("painting with values",self,width,height)
+-- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
+-- end
+--
+-- function item.PaintEquiped(self,width,height)
+-- --print("painting with values",self,width,height)
+-- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
+-- end
+-- ]]
+--
+-- --Required, the shape of this item.
+-- item.Shape = {
+-- {true,true},
+-- }
+--
+-- --Optional, If this item can be equiped in any player slots, put them here.
+-- item.Equipable = "Right"
+--
+--
+--
+-- --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 = {}
+-- item.onClick = function(self,owner)
+-- item.lastSwing[owner] = item.lastSwing[owner] or 0
+-- if item.lastSwing[owner] > CurTime() then
+-- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
+-- return end
+-- item.lastSwing[owner] = CurTime()+1.25
+-- local fow,rig,up = owner:GetForward(),owner:GetRight(),owner:GetUp()
+-- local movementtbl = {
+-- ["forward"] = function()
+-- owner:SetLuaAnimation("fist_swing_up")
+-- timer.Simple(1.75,function()
+-- owner:StopLuaAnimation("fist_swing_up")
+-- end)
+-- local hits = ART.swingarc(owner,{
+-- 0.5,0.57,0.65,0.73
+-- },{
+-- fow*20 + up*90,
+-- fow*45 + up*70,
+-- fow*35 + up*45,
+-- fow*20 + up*30,
+-- },function(tr)
+-- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
+-- end
+-- print("Hit",tr.Entity)
+-- end)
+-- end,
+-- ["backward"] = function()
+-- owner:SetLuaAnimation("fist_swing_down")
+-- timer.Simple(1.75,function()
+-- owner:StopLuaAnimation("fist_swing_down")
+-- end)
+-- local hits = ART.swingarc(owner,{
+-- 0.5,0.57,0.65,0.73
+-- },{
+-- fow*15 + up*30,
+-- fow*35 + up*45,
+-- fow*25 + up*70,
+-- fow*15 + up*90,
+-- },function(tr)
+-- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
+-- end
+-- print("Hit",tr.Entity)
+-- end)
+-- end,
+-- ["left"] = function()
+-- owner:SetLuaAnimation("fist_swing_left")
+-- timer.Simple(2,function()
+-- owner:StopLuaAnimation("fist_swing_left")
+-- end)
+-- local hits = ART.swingarc(owner,{
+-- 0.5,0.57,0.65,0.73
+-- },{
+-- rig*-30 + up*59,
+-- rig*-10 + fow*30 + up*55,
+-- rig*10 + fow*30 + up*54,
+-- rig*30 + up*50,
+-- },function(tr)
+-- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- tr.Entity:TakeDamage(4, owner, owner:GetActiveWeapon())
+-- end
+-- print("Hit",tr.Entity)
+-- end)
+-- end,
+-- ["right"] = function()
+--
+-- end,
+-- }
+-- movementtbl[ART.playermovedir(owner)]()
+-- end
+--
+-- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
+-- item.onEquip = function(self,who)
+-- print("onEquip",who)
+-- if CLIENT then print("onEquip client!") end
+-- if SERVER then
+-- PrintTable(pac)
+-- who:GetActiveWeapon():SetHoldType("fist")
+-- ART.ApplyPAC(who,"knuckledclaws")
+-- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
+-- --who:AttachPACPart(outfit)
+-- --print("onEquip server!")
+-- end
+-- end
+--
+-- --Optional, if we should do something speical on unequip(like setting animations back to normal)
+-- item.onUnEquip = function(self,who)
+-- who:GetActiveWeapon():SetHoldType("normal")
+-- 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!
+-- nrequire("item.lua").RegisterItem(item)
diff --git a/gamemode/itemsystem/weapons/rustyaxe.lua b/gamemode/itemsystem/weapons/rustyaxe.lua
index 930a736..cd8004e 100644
--- a/gamemode/itemsystem/weapons/rustyaxe.lua
+++ b/gamemode/itemsystem/weapons/rustyaxe.lua
@@ -1,272 +1,272 @@
---[[
- An axe that you can swing around!
-]]
-do return end
-local pac,swi
-if SERVER then
- pac = nrequire("core/pac/sv_pac.lua")
- swi = nrequire("core/combat/sv_weaponswing.lua")
-end
-local reg = nrequire("core/inventory/item.lua")
-local com = nrequire("core/inventory/common/weapons.lua")
-local itm = nrequire("core/inventory/common/items.lua")
-
-
-
-local item = {}
-
---Required, a name, all item names must be unique
-item.Name = "Rusty Axe"
-
---Optional, a tooltip to display
-item.Tooltip = "An old axe, probably good for fighting."
-
---Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
-item.Serialize = function(self)
- return ""
-end
-
---Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
-item.DeSerialize = function(self,string)
- return self
-end
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
-function item.GetOptions(self)
- local options = {}
- options["test"] = function() print("You pressed test!") end
- options["toste"] = function() print("You pressed toste!") end
- options["Drop"] = ART.DropItem(self)
- return options
-end
-
-function item.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
-end
-
-function item.DoOnEquipPanel(dimagebutton)
- print("called with panel:",panel)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
-end
-
---Required, the shape of this item.
-item.Shape = {
- {true,true},
- {true},
- {true},
-}
-
---Optional, If this item can be equiped in any player slots, put them here.
-item.Equipable = "Right Hand"
-
-item.attacks = {
- ["forward"] = {
- time = 2.33,
- anim = "axe_swing_up",
- },
- ["left"] = {
- time = 2.33,
- anim = "axe_swing_left",
- },
- ["left"] = {
- time = 2.33,
- anim = "axe_swing_right",
- },
-}
-
---The path garrysmod/data/artery/pacs/<pacname>.txt must be a pac file
-item.pacname = "rustyaxe"
-
-if SERVER then
- --Before makeSwingable is called, an item needs a .Name field and a .attacks field and a .pacname field
- --swi.makeSwingable(item)
-end
---[[
-local swingdata = {
- ["fwd"] = {
- {0.011,Vector(-25,-3,-11)},
- {0.020,Vector(-25,-1,-3)},
- {0.031,Vector(-21,0,7)},
- {0.040,Vector(-13,-1,16)},
- {0.051,Vector(0,-5,22)},
- {0.060,Vector(17,-12,19)},
- {0.069,Vector(27,-18,11)},
- {0.077,Vector(31,-22,2)},
- {0.087,Vector(32,-26,-6)},
- {0.098,Vector(32,-28,-12)},
- {0.107,Vector(31,-29,-16)},
- {0.117,Vector(31,-29,-17)},
- {0.128,Vector(31,-29,-16)},
- {0.141,Vector(31,-29,-16)},
- },
- ["lft"] = {
- {0.009,Vector(-34,-25,3)},
- {0.021,Vector(-29,-33,3)},
- {0.031,Vector(-21,-41,2)},
- {0.042,Vector(-9,-47,0)},
- {0.053,Vector(5,-48,-2)},
- {0.064,Vector(20,-44,-6)},
- {0.075,Vector(31,-34,-10)},
- {0.086,Vector(37,-24,-15)},
- {0.095,Vector(39,-16,-17)},
- {0.106,Vector(39,-10,-19)},
- {0.116,Vector(39,-8,-20)},
- {0.126,Vector(39,-8,-19)},
- {0.134,Vector(39,-9,-19)},
- {0.146,Vector(39,-10,-18)},
- },
- ["rig"] = {
- {0.021,Vector(-2,9,11)},
- {0.031,Vector(5,10,10)},
- {0.042,Vector(12,8,9)},
- {0.053,Vector(19,4,6)},
- {0.062,Vector(26,-4,2)},
- {0.072,Vector(29,-12,-4)},
- {0.083,Vector(29,-21,-12)},
- {0.093,Vector(25,-27,-18)},
- {0.102,Vector(22,-30,-22)},
- {0.113,Vector(20,-31,-25)},
- {0.123,Vector(19,-32,-25)},
- {0.133,Vector(19,-32,-25)},
- },
-}
-
-local attacks = {
- ["forward"] = {
- time = 2.33,
- anim = "axe_swing_up",
- }
-}
-
---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 = {}
-item.onClick = function(self,owner)
- item.lastSwing[owner] = item.lastSwing[owner] or 0
- if item.lastSwing[owner] > CurTime() then
- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
- return end
- item.lastSwing[owner] = CurTime() + 1.33
- local movementtbl = {
- ["forward"] = function()
- --Do the animation
- owner:SetLuaAnimation("axe_swing_up")
- timer.Simple(2.33,function()
- owner:StopLuaAnimation("axe_swing_up")
- end)
- --Do the traces
- local times,pos = {},{}
- for k,v in ipairs(swingdata["fwd"]) do
- times[k] = 1 + v[1]
- pos[k] = Vector(v[2])
- pos[k]:Rotate(owner:GetAimVector():Angle())
- end
- --What to do when our weapon hits
- com.swingarc(owner,times,pos,function(tr)
- print("Calling the swingarc function")
- if not tr.Hit then return end
- print("We hit something!")
- print("takedamage is",tr.Entity.TakeDamage)
- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "forward" then
- ART.ApplyEffect(owner,"weapon_blocked")
- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- print("I hit a ", tr.Entity)
- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
- end
- end)
-
- end,
- ["backward"] = function()
-
- end,
- ["left"] = function()
- owner:SetLuaAnimation("axe_swing_left")
- timer.Simple(2.33,function()
- owner:StopLuaAnimation("axe_swing_left")
- end)
- timer.Simple(1,function()
- ART.TraceWeapon = true
- end)
- timer.Simple(1.33,function()
- ART.TraceWeapon = false
- end)
-
- local times,pos = {},{}
- for k,v in ipairs(swingdata["lft"]) do
- times[k] = 1 + v[1]
- pos[k] = Vector(v[2])
- pos[k]:Rotate(owner:GetAimVector():Angle())
- end
- if pos[1] == nil then return end
- com.swingarc(owner,times,pos,function(tr)
- if not tr.Hit then return end
- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "left" then
- ART.ApplyEffect(owner,"weapon_blocked")
- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
- end
- end)
- end,
- ["right"] = function()
- owner:SetLuaAnimation("axe_swing_right")
- timer.Simple(2.33,function()
- owner:StopLuaAnimation("axe_swing_right")
- end)
- timer.Simple(1,function()
- ART.TraceWeapon = true
- end)
- timer.Simple(1.33,function()
- ART.TraceWeapon = false
- end)
-
- local times,pos = {},{}
- for k,v in ipairs(swingdata["rig"]) do
- times[k] = 1 + v[1]
- pos[k] = Vector(v[2])
- pos[k]:Rotate(owner:GetAimVector():Angle())
- end
- if pos[1] == nil then return end
- com.swingarc(owner,times,pos,function(tr)
- if not tr.Hit then return end
- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "right" then
- ART.ApplyEffect(owner,"weapon_blocked")
- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
- end
- end)
- end,
- }
- print("At time of doing playermovedir, com is", com)
- movementtbl[com.playermovedir(owner)]()
-end
-]]
-
-
---Optional, if we should do something special on equip(like draw the PAC for this weapon)
-item.onEquip = function(self,who)
- print("onEquip",who)
- if CLIENT then print("onEquip client!") end
- if SERVER then
- print("pac is", pac)
- PrintTable(pac)
- who:GetActiveWeapon():SetHoldType("melee")
- pac.ApplyPac(who,"rustyaxe")
- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
- --who:AttachPACPart(outfit)
- --print("onEquip server!")
- end
-end
-
---Optional, if we should do something speical on unequip(like setting animations back to normal)
-item.onUnEquip = function(self,who)
- print("Unequiping axe")
- who:GetActiveWeapon():SetHoldType("normal")
- if SERVER then pac.RemovePac(who,"rustyaxe") end
-end
-
-item.onDropped = function(self, ent)
- if SERVER then pac.ApplyPac(ent,"rustyaxe") end
-end
-
-print("Hello from rustyaxe.lua")
---Don't forget to register the item!
-reg.RegisterItem(item)
+-- --[[
+-- An axe that you can swing around!
+-- ]]
+-- do return end
+-- local pac,swi
+-- if SERVER then
+-- pac = nrequire("core/pac/sv_pac.lua")
+-- swi = nrequire("core/combat/sv_weaponswing.lua")
+-- end
+-- local reg = nrequire("core/inventory/item.lua")
+-- local com = nrequire("core/inventory/common/weapons.lua")
+-- local itm = nrequire("core/inventory/common/items.lua")
+--
+--
+--
+-- local item = {}
+--
+-- --Required, a name, all item names must be unique
+-- item.Name = "Rusty Axe"
+--
+-- --Optional, a tooltip to display
+-- item.Tooltip = "An old axe, probably good for fighting."
+--
+-- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
+-- item.Serialize = function(self)
+-- return ""
+-- end
+--
+-- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
+-- item.DeSerialize = function(self,string)
+-- return self
+-- end
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
+-- function item.GetOptions(self)
+-- local options = {}
+-- options["test"] = function() print("You pressed test!") end
+-- options["toste"] = function() print("You pressed toste!") end
+-- options["Drop"] = ART.DropItem(self)
+-- return options
+-- end
+--
+-- function item.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
+-- end
+--
+-- function item.DoOnEquipPanel(dimagebutton)
+-- print("called with panel:",panel)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
+-- end
+--
+-- --Required, the shape of this item.
+-- item.Shape = {
+-- {true,true},
+-- {true},
+-- {true},
+-- }
+--
+-- --Optional, If this item can be equiped in any player slots, put them here.
+-- item.Equipable = "Right Hand"
+--
+-- item.attacks = {
+-- ["forward"] = {
+-- time = 2.33,
+-- anim = "axe_swing_up",
+-- },
+-- ["left"] = {
+-- time = 2.33,
+-- anim = "axe_swing_left",
+-- },
+-- ["left"] = {
+-- time = 2.33,
+-- anim = "axe_swing_right",
+-- },
+-- }
+--
+-- --The path garrysmod/data/artery/pacs/<pacname>.txt must be a pac file
+-- item.pacname = "rustyaxe"
+--
+-- if SERVER then
+-- --Before makeSwingable is called, an item needs a .Name field and a .attacks field and a .pacname field
+-- --swi.makeSwingable(item)
+-- end
+-- --[[
+-- local swingdata = {
+-- ["fwd"] = {
+-- {0.011,Vector(-25,-3,-11)},
+-- {0.020,Vector(-25,-1,-3)},
+-- {0.031,Vector(-21,0,7)},
+-- {0.040,Vector(-13,-1,16)},
+-- {0.051,Vector(0,-5,22)},
+-- {0.060,Vector(17,-12,19)},
+-- {0.069,Vector(27,-18,11)},
+-- {0.077,Vector(31,-22,2)},
+-- {0.087,Vector(32,-26,-6)},
+-- {0.098,Vector(32,-28,-12)},
+-- {0.107,Vector(31,-29,-16)},
+-- {0.117,Vector(31,-29,-17)},
+-- {0.128,Vector(31,-29,-16)},
+-- {0.141,Vector(31,-29,-16)},
+-- },
+-- ["lft"] = {
+-- {0.009,Vector(-34,-25,3)},
+-- {0.021,Vector(-29,-33,3)},
+-- {0.031,Vector(-21,-41,2)},
+-- {0.042,Vector(-9,-47,0)},
+-- {0.053,Vector(5,-48,-2)},
+-- {0.064,Vector(20,-44,-6)},
+-- {0.075,Vector(31,-34,-10)},
+-- {0.086,Vector(37,-24,-15)},
+-- {0.095,Vector(39,-16,-17)},
+-- {0.106,Vector(39,-10,-19)},
+-- {0.116,Vector(39,-8,-20)},
+-- {0.126,Vector(39,-8,-19)},
+-- {0.134,Vector(39,-9,-19)},
+-- {0.146,Vector(39,-10,-18)},
+-- },
+-- ["rig"] = {
+-- {0.021,Vector(-2,9,11)},
+-- {0.031,Vector(5,10,10)},
+-- {0.042,Vector(12,8,9)},
+-- {0.053,Vector(19,4,6)},
+-- {0.062,Vector(26,-4,2)},
+-- {0.072,Vector(29,-12,-4)},
+-- {0.083,Vector(29,-21,-12)},
+-- {0.093,Vector(25,-27,-18)},
+-- {0.102,Vector(22,-30,-22)},
+-- {0.113,Vector(20,-31,-25)},
+-- {0.123,Vector(19,-32,-25)},
+-- {0.133,Vector(19,-32,-25)},
+-- },
+-- }
+--
+-- local attacks = {
+-- ["forward"] = {
+-- time = 2.33,
+-- anim = "axe_swing_up",
+-- }
+-- }
+--
+-- --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 = {}
+-- item.onClick = function(self,owner)
+-- item.lastSwing[owner] = item.lastSwing[owner] or 0
+-- if item.lastSwing[owner] > CurTime() then
+-- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
+-- return end
+-- item.lastSwing[owner] = CurTime() + 1.33
+-- local movementtbl = {
+-- ["forward"] = function()
+-- --Do the animation
+-- owner:SetLuaAnimation("axe_swing_up")
+-- timer.Simple(2.33,function()
+-- owner:StopLuaAnimation("axe_swing_up")
+-- end)
+-- --Do the traces
+-- local times,pos = {},{}
+-- for k,v in ipairs(swingdata["fwd"]) do
+-- times[k] = 1 + v[1]
+-- pos[k] = Vector(v[2])
+-- pos[k]:Rotate(owner:GetAimVector():Angle())
+-- end
+-- --What to do when our weapon hits
+-- com.swingarc(owner,times,pos,function(tr)
+-- print("Calling the swingarc function")
+-- if not tr.Hit then return end
+-- print("We hit something!")
+-- print("takedamage is",tr.Entity.TakeDamage)
+-- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "forward" then
+-- ART.ApplyEffect(owner,"weapon_blocked")
+-- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- print("I hit a ", tr.Entity)
+-- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
+-- end
+-- end)
+--
+-- end,
+-- ["backward"] = function()
+--
+-- end,
+-- ["left"] = function()
+-- owner:SetLuaAnimation("axe_swing_left")
+-- timer.Simple(2.33,function()
+-- owner:StopLuaAnimation("axe_swing_left")
+-- end)
+-- timer.Simple(1,function()
+-- ART.TraceWeapon = true
+-- end)
+-- timer.Simple(1.33,function()
+-- ART.TraceWeapon = false
+-- end)
+--
+-- local times,pos = {},{}
+-- for k,v in ipairs(swingdata["lft"]) do
+-- times[k] = 1 + v[1]
+-- pos[k] = Vector(v[2])
+-- pos[k]:Rotate(owner:GetAimVector():Angle())
+-- end
+-- if pos[1] == nil then return end
+-- com.swingarc(owner,times,pos,function(tr)
+-- if not tr.Hit then return end
+-- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "left" then
+-- ART.ApplyEffect(owner,"weapon_blocked")
+-- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
+-- end
+-- end)
+-- end,
+-- ["right"] = function()
+-- owner:SetLuaAnimation("axe_swing_right")
+-- timer.Simple(2.33,function()
+-- owner:StopLuaAnimation("axe_swing_right")
+-- end)
+-- timer.Simple(1,function()
+-- ART.TraceWeapon = true
+-- end)
+-- timer.Simple(1.33,function()
+-- ART.TraceWeapon = false
+-- end)
+--
+-- local times,pos = {},{}
+-- for k,v in ipairs(swingdata["rig"]) do
+-- times[k] = 1 + v[1]
+-- pos[k] = Vector(v[2])
+-- pos[k]:Rotate(owner:GetAimVector():Angle())
+-- end
+-- if pos[1] == nil then return end
+-- com.swingarc(owner,times,pos,function(tr)
+-- if not tr.Hit then return end
+-- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "right" then
+-- ART.ApplyEffect(owner,"weapon_blocked")
+-- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
+-- end
+-- end)
+-- end,
+-- }
+-- print("At time of doing playermovedir, com is", com)
+-- movementtbl[com.playermovedir(owner)]()
+-- end
+-- ]]
+--
+--
+-- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
+-- item.onEquip = function(self,who)
+-- print("onEquip",who)
+-- if CLIENT then print("onEquip client!") end
+-- if SERVER then
+-- print("pac is", pac)
+-- PrintTable(pac)
+-- who:GetActiveWeapon():SetHoldType("melee")
+-- pac.ApplyPac(who,"rustyaxe")
+-- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
+-- --who:AttachPACPart(outfit)
+-- --print("onEquip server!")
+-- end
+-- end
+--
+-- --Optional, if we should do something speical on unequip(like setting animations back to normal)
+-- item.onUnEquip = function(self,who)
+-- print("Unequiping axe")
+-- who:GetActiveWeapon():SetHoldType("normal")
+-- if SERVER then pac.RemovePac(who,"rustyaxe") end
+-- end
+--
+-- item.onDropped = function(self, ent)
+-- if SERVER then pac.ApplyPac(ent,"rustyaxe") end
+-- end
+--
+-- print("Hello from rustyaxe.lua")
+-- --Don't forget to register the item!
+-- reg.RegisterItem(item)
diff --git a/gamemode/itemsystem/weapons/scraphammer.lua b/gamemode/itemsystem/weapons/scraphammer.lua
index 2534907..f281799 100644
--- a/gamemode/itemsystem/weapons/scraphammer.lua
+++ b/gamemode/itemsystem/weapons/scraphammer.lua
@@ -1,203 +1,203 @@
---[[
- An example item
-]]
-do return end
-local com = nrequire("core/inventory/common/weapons.lua")
-local itm = nrequire("core/inventory/common/items.lua")
-local reg = nrequire("core/inventory/item.lua")
-local pac,eff
-if SERVER then
- pac = nrequire("core/pac/sv_pac.lua")
-else
- eff = nrequire("core/clienteffects/blocked.lua")
-end
-
-local item = {}
-
---Required, a name, all item names must be unique
-item.Name = "Scrap Hammer"
-
---Optional, a tooltip to display
-item.Tooltip = "Bits of scrap put togeather to resemble a hammer"
-
---Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
-item.Serialize = function(self)
- return ""
-end
-
---Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
-item.DeSerialize = function(self,string)
- return self
-end
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
-function item.GetOptions(self)
- local options = {}
- options["test"] = function() print("You pressed test!") end
- options["toast"] = function() print("You pressed toast!") end
- options["Drop"] = itm.DropItem(self)
- return options
-end
-
-function item.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
-end
-
-function item.DoOnEquipPanel(dimagebutton)
- print("called with panel:",panel)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
-end
-
---Required, the shape of this item.
-item.Shape = {
- {true,true,true},
- {false,true},
- {false,true},
-}
-
---Optional, If this item can be equiped in any player slots, put them here.
-item.Equipable = "Right Hand"
-
-local swingdata = {
- ["fwd"] = {
- {0.007,Vector(-27,1,9)},
- {0.014,Vector(-20,3,16)},
- {0.020,Vector(-11,6,22)},
- {0.027,Vector(0,7,26)},
- {0.032,Vector(15,7,25)},
- {0.039,Vector(28,6,21)},
- {0.045,Vector(38,4,14)},
- {0.052,Vector(46,0,3)},
- {0.059,Vector(50,-3,-6)},
- {0.065,Vector(52,-6,-15)},
- {0.072,Vector(52,-8,-22)},
- {0.078,Vector(51,-10,-28)},
- {0.084,Vector(50,-11,-31)},
- {0.091,Vector(50,-11,-32)},
- {0.097,Vector(50,-11,-32)}
- },
- ["lft"] = {
- {0.007,Vector(-6,24,2)},
- {0.014,Vector(-1,26,2)},
- {0.020,Vector(5,28,1)},
- {0.027,Vector(12,28,-1)},
- {0.035,Vector(19,27,-4)},
- {0.042,Vector(27,24,-7)},
- {0.048,Vector(37,17,-13)},
- {0.055,Vector(42,12,-17)},
- {0.061,Vector(45,5,-20)},
- {0.068,Vector(48,-2,-23)},
- {0.075,Vector(49,-8,-25)},
- {0.084,Vector(49,-14,-26)},
- {0.091,Vector(49,-19,-27)},
- {0.097,Vector(48,-22,-27)},
- {0.104,Vector(48,-25,-27)},
- {0.110,Vector(48,-26,-27)},
- {0.117,Vector(48,-27,-27)},
- {0.123,Vector(48,-26,-27)},
- {0.131,Vector(48,-26,-27)}
- },
- ["rig"] = {
- {0.009,Vector(-3,25,2)},
- {0.017,Vector(3,27,1)},
- {0.025,Vector(11,28,-1)},
- {0.032,Vector(20,27,-4)},
- {0.040,Vector(28,24,-7)},
- {0.051,Vector(36,19,-12)},
- {0.059,Vector(42,11,-17)},
- {0.067,Vector(47,2,-22)},
- {0.075,Vector(49,-5,-25)},
- {0.083,Vector(49,-13,-27)},
- {0.090,Vector(49,-19,-28)},
- {0.098,Vector(48,-24,-28)},
- {0.106,Vector(48,-27,-28)},
- {0.114,Vector(48,-28,-28)},
- {0.121,Vector(48,-27,-28)},
- {0.129,Vector(48,-27,-27)}
- },
-}
-
-local attacks = {
- forward = {
- anim = "hammer_swing_up",
- animtime = 2.33,
- data = swingdata["fwd"],
- dammage = 5
- },
- left = {
- anim = "hammer_swing_left",
- animtime = 2.33,
- data = swingdata["lft"],
- dammage = 5
- },
- right = {
- anim = "hammer_swing_right",
- animtime = 2.33,
- data = swingdata["rig"],
- dammage = 5
- }
-}
-
---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 = {}
-item.onClick = function(self,owner)
- --Make sure we can swing (off cooldown)
- item.lastSwing[owner] = item.lastSwing[owner] or 0
- if item.lastSwing[owner] > CurTime() then return end
- item.lastSwing[owner] = CurTime()+1.33
-
- --[[
- local movementtbl = {}
- for k,v in pairs(attacks) do
- movementtbl[k] = function()
- owner:SetLuaAnimation(v.anim)
- timer.Simple(v.animtime,function()
- owner:StopLuaAnimation(v.anim)
- end)
- local times, pos = {},{}
- for i,j in pairs(v.data) do
- times[i] = 1 + j[1]
- pos[i] = Vector(j[2])
- pos[i]:Rotate(owner:GetAimVector():Angle())
- end
- if pos[1] == nil then return end
- com.swingarc(owner,times,pos,function(tr)
- if not tr.Hit then return end
- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == k then
- eff()
- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- tr.Entity:TakeDamage(v.dammage,owner,owner:GetActiveWeapon())
- end
- end)
- end
- end
- ]]
- local movementtbl = com.createattackstable(attacks)
-
- --Do the attack
- movementtbl[com.playermovedir(owner)]()
-end
-
---Optional, if we should do something special on equip(like draw the PAC for this weapon)
-item.onEquip = function(self,who)
- print("woo! i'm being used!")
- if SERVER then
- who:GetActiveWeapon():SetHoldType("melee2")
- pac.ApplyPac(who,"scraphammer")
- end
-end
-
---Optional, if we should do something speical on unequip(like setting animations back to normal)
-item.onUnEquip = function(self,who)
- print("aw, I'm being put away :(")
- who:GetActiveWeapon():SetHoldType("normal")
- pac.RemovePac(who,"scraphammer")
-end
-
-item.onDropped = function(self, ent)
- pac.ApplyPac(ent,"scraphammer")
-end
-
-print("Hello from scraphammer.lua")
---Don't forget to register the item!
-reg.RegisterItem(item)
+-- --[[
+-- An example item
+-- ]]
+-- do return end
+-- local com = nrequire("core/inventory/common/weapons.lua")
+-- local itm = nrequire("core/inventory/common/items.lua")
+-- local reg = nrequire("core/inventory/item.lua")
+-- local pac,eff
+-- if SERVER then
+-- pac = nrequire("core/pac/sv_pac.lua")
+-- else
+-- eff = nrequire("core/clienteffects/blocked.lua")
+-- end
+--
+-- local item = {}
+--
+-- --Required, a name, all item names must be unique
+-- item.Name = "Scrap Hammer"
+--
+-- --Optional, a tooltip to display
+-- item.Tooltip = "Bits of scrap put togeather to resemble a hammer"
+--
+-- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
+-- item.Serialize = function(self)
+-- return ""
+-- end
+--
+-- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
+-- item.DeSerialize = function(self,string)
+-- return self
+-- end
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
+-- function item.GetOptions(self)
+-- local options = {}
+-- options["test"] = function() print("You pressed test!") end
+-- options["toast"] = function() print("You pressed toast!") end
+-- options["Drop"] = itm.DropItem(self)
+-- return options
+-- end
+--
+-- function item.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
+-- end
+--
+-- function item.DoOnEquipPanel(dimagebutton)
+-- print("called with panel:",panel)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
+-- end
+--
+-- --Required, the shape of this item.
+-- item.Shape = {
+-- {true,true,true},
+-- {false,true},
+-- {false,true},
+-- }
+--
+-- --Optional, If this item can be equiped in any player slots, put them here.
+-- item.Equipable = "Right Hand"
+--
+-- local swingdata = {
+-- ["fwd"] = {
+-- {0.007,Vector(-27,1,9)},
+-- {0.014,Vector(-20,3,16)},
+-- {0.020,Vector(-11,6,22)},
+-- {0.027,Vector(0,7,26)},
+-- {0.032,Vector(15,7,25)},
+-- {0.039,Vector(28,6,21)},
+-- {0.045,Vector(38,4,14)},
+-- {0.052,Vector(46,0,3)},
+-- {0.059,Vector(50,-3,-6)},
+-- {0.065,Vector(52,-6,-15)},
+-- {0.072,Vector(52,-8,-22)},
+-- {0.078,Vector(51,-10,-28)},
+-- {0.084,Vector(50,-11,-31)},
+-- {0.091,Vector(50,-11,-32)},
+-- {0.097,Vector(50,-11,-32)}
+-- },
+-- ["lft"] = {
+-- {0.007,Vector(-6,24,2)},
+-- {0.014,Vector(-1,26,2)},
+-- {0.020,Vector(5,28,1)},
+-- {0.027,Vector(12,28,-1)},
+-- {0.035,Vector(19,27,-4)},
+-- {0.042,Vector(27,24,-7)},
+-- {0.048,Vector(37,17,-13)},
+-- {0.055,Vector(42,12,-17)},
+-- {0.061,Vector(45,5,-20)},
+-- {0.068,Vector(48,-2,-23)},
+-- {0.075,Vector(49,-8,-25)},
+-- {0.084,Vector(49,-14,-26)},
+-- {0.091,Vector(49,-19,-27)},
+-- {0.097,Vector(48,-22,-27)},
+-- {0.104,Vector(48,-25,-27)},
+-- {0.110,Vector(48,-26,-27)},
+-- {0.117,Vector(48,-27,-27)},
+-- {0.123,Vector(48,-26,-27)},
+-- {0.131,Vector(48,-26,-27)}
+-- },
+-- ["rig"] = {
+-- {0.009,Vector(-3,25,2)},
+-- {0.017,Vector(3,27,1)},
+-- {0.025,Vector(11,28,-1)},
+-- {0.032,Vector(20,27,-4)},
+-- {0.040,Vector(28,24,-7)},
+-- {0.051,Vector(36,19,-12)},
+-- {0.059,Vector(42,11,-17)},
+-- {0.067,Vector(47,2,-22)},
+-- {0.075,Vector(49,-5,-25)},
+-- {0.083,Vector(49,-13,-27)},
+-- {0.090,Vector(49,-19,-28)},
+-- {0.098,Vector(48,-24,-28)},
+-- {0.106,Vector(48,-27,-28)},
+-- {0.114,Vector(48,-28,-28)},
+-- {0.121,Vector(48,-27,-28)},
+-- {0.129,Vector(48,-27,-27)}
+-- },
+-- }
+--
+-- local attacks = {
+-- forward = {
+-- anim = "hammer_swing_up",
+-- animtime = 2.33,
+-- data = swingdata["fwd"],
+-- dammage = 5
+-- },
+-- left = {
+-- anim = "hammer_swing_left",
+-- animtime = 2.33,
+-- data = swingdata["lft"],
+-- dammage = 5
+-- },
+-- right = {
+-- anim = "hammer_swing_right",
+-- animtime = 2.33,
+-- data = swingdata["rig"],
+-- dammage = 5
+-- }
+-- }
+--
+-- --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 = {}
+-- item.onClick = function(self,owner)
+-- --Make sure we can swing (off cooldown)
+-- item.lastSwing[owner] = item.lastSwing[owner] or 0
+-- if item.lastSwing[owner] > CurTime() then return end
+-- item.lastSwing[owner] = CurTime()+1.33
+--
+-- --[[
+-- local movementtbl = {}
+-- for k,v in pairs(attacks) do
+-- movementtbl[k] = function()
+-- owner:SetLuaAnimation(v.anim)
+-- timer.Simple(v.animtime,function()
+-- owner:StopLuaAnimation(v.anim)
+-- end)
+-- local times, pos = {},{}
+-- for i,j in pairs(v.data) do
+-- times[i] = 1 + j[1]
+-- pos[i] = Vector(j[2])
+-- pos[i]:Rotate(owner:GetAimVector():Angle())
+-- end
+-- if pos[1] == nil then return end
+-- com.swingarc(owner,times,pos,function(tr)
+-- if not tr.Hit then return end
+-- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == k then
+-- eff()
+-- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- tr.Entity:TakeDamage(v.dammage,owner,owner:GetActiveWeapon())
+-- end
+-- end)
+-- end
+-- end
+-- ]]
+-- local movementtbl = com.createattackstable(attacks)
+--
+-- --Do the attack
+-- movementtbl[com.playermovedir(owner)]()
+-- end
+--
+-- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
+-- item.onEquip = function(self,who)
+-- print("woo! i'm being used!")
+-- if SERVER then
+-- who:GetActiveWeapon():SetHoldType("melee2")
+-- pac.ApplyPac(who,"scraphammer")
+-- end
+-- end
+--
+-- --Optional, if we should do something speical on unequip(like setting animations back to normal)
+-- item.onUnEquip = function(self,who)
+-- print("aw, I'm being put away :(")
+-- who:GetActiveWeapon():SetHoldType("normal")
+-- pac.RemovePac(who,"scraphammer")
+-- end
+--
+-- item.onDropped = function(self, ent)
+-- pac.ApplyPac(ent,"scraphammer")
+-- end
+--
+-- print("Hello from scraphammer.lua")
+-- --Don't forget to register the item!
+-- reg.RegisterItem(item)
diff --git a/gamemode/itemsystem/weapons/seratedknife.lua b/gamemode/itemsystem/weapons/seratedknife.lua
index 738beb6..b2e353c 100644
--- a/gamemode/itemsystem/weapons/seratedknife.lua
+++ b/gamemode/itemsystem/weapons/seratedknife.lua
@@ -1,200 +1,200 @@
---[[
- An example item
-]]
-do return end
-local item = {}
-
---Required, a name, all item names must be unique
-item.Name = "Serated Knife"
-
---Optional, a tooltip to display
-item.Tooltip = "Bits of scrap put togeather to resembel a hammer"
-
---Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
-item.Serialize = function(self)
- print("Trying to serailize!")
- return ""
-end
-
---Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
-item.DeSerialize = function(self,string)
- print("Trying to deserialize!")
- return self
-end
-
---Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
-function item.GetOptions(self)
- local options = {}
- options["test"] = function() print("You pressed test!") end
- options["toste"] = function() print("You pressed toste!") end
- options["Drop"] = ART.DropItem(self)
- return options
-end
-
-function item.DoOnPanel(dimagebutton)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
-end
-
-function item.DoOnEquipPanel(dimagebutton)
- print("called with panel:",panel)
- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
-end
-
---[[
-function item.Paint(self,width,height)
- --print("painting with values",self,width,height)
- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
-end
-
-function item.PaintEquiped(self,width,height)
- --print("painting with values",self,width,height)
- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
-end
-]]
-
---Required, the shape of this item.
-item.Shape = {
- {true,true},
-}
-
---Optional, If this item can be equiped in any player slots, put them here.
-item.Equipable = "Right"
-
-local function attacktrace(tr,owner)
- if not tr.Hit then return end
- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
- 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
-item.onClick = function(self,owner)
- item.lastSwing[owner] = item.lastSwing[owner] or 0
- if item.lastSwing[owner] > CurTime() then
- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
- return end
- item.lastSwing[owner] = CurTime()+animationtime
- local fow,rig,up = owner:GetForward(),owner:GetRight(),owner:GetUp()
- local movementtbl = {
- ["forward"] = function()
- owner:SetLuaAnimation("knife_swing_up")
- timer.Simple(animationtime,function()
- owner:StopLuaAnimation("knife_swing_up")
- end)
- local hits = ART.swingarc(owner,{
- 0.5,0.611,0.722,0.833
- },{
- fow*20 + up*90,
- fow*45 + up*70,
- fow*35 + up*45,
- fow*20 + up*30,
- },function(tr)
- if not tr.Hit then return end
- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "forward" then
- print("Entity blocked!")
- ART.ApplyEffect(owner,"weapon_blocked")
- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- print("Got past blocking, it was",tr.Entity.Blocking)
- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
- end
- end)
- end,
- ["backward"] = function()
- owner:SetLuaAnimation("knife_swing_down")
- timer.Simple(animationtime,function()
- owner:StopLuaAnimation("knife_swing_down")
- end)
- local hits = ART.swingarc(owner,{
- 0.5,0.611,0.722,0.833
- },{
- fow*15 + up*30,
- fow*35 + up*45,
- fow*25 + up*70,
- fow*15 + up*90,
- },function(tr)
- if not tr.Hit then return end
- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "backward" then
- print("Entity blocked!")
- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- print("Got past blocking, it was",tr.Entity.Blocking)
- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
- end
- end)
- end,
- ["left"] = function()
- owner:SetLuaAnimation("knife_swing_left")
- timer.Simple(animationtime,function()
- owner:StopLuaAnimation("knife_swing_left")
- end)
- local hits = ART.swingarc(owner,{
- 0.5,0.611,0.722,0.833
- },{
- rig*30 + up*59,
- rig*10 + fow*30 + up*55,
- rig*-10 + fow*30 + up*54,
- rig*-30 + up*50,
- },function(tr)
- if not tr.Hit then return end
- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "left" then
- print("Entity blocked!")
- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- print("Got past blocking, it was",tr.Entity.Blocking)
- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
- end
- end)
- end,
- ["right"] = function()
- owner:SetLuaAnimation("knife_swing_right")
- timer.Simple(animationtime,function()
- owner:StopLuaAnimation("knife_swing_right")
- end)
- local hits = ART.swingarc(owner,{
- 0.5,0.611,0.722,0.833
- },{
- rig*-30 + up*59,
- rig*-10 + fow*30 + up*55,
- rig*10 + fow*30 + up*54,
- rig*30 + up*50,
- },function(tr)
- if not tr.Hit then return end
- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "right" then
- print("Entity blocked!")
- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
- print("Got past blocking, it was",tr.Entity.Blocking)
- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
- end
- end)
- end,
- }
- movementtbl[ART.playermovedir(owner)]()
-end
-
---Optional, if we should do something special on equip(like draw the PAC for this weapon)
-item.onEquip = function(self,who)
- print("onEquip",who)
- if CLIENT then print("onEquip client!") end
- if SERVER then
- PrintTable(pac)
- who:GetActiveWeapon():SetHoldType("knife")
- ART.ApplyPAC(who,"seratedknife")
- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
- --who:AttachPACPart(outfit)
- --print("onEquip server!")
- end
-end
-
---Optional, if we should do something speical on unequip(like setting animations back to normal)
-item.onUnEquip = function(self,who)
- who:GetActiveWeapon():SetHoldType("normal")
- ART.RemovePAC(who,"seratedknife")
-end
-
-item.onDropped = function(self, ent)
- ART.ApplyPAC(ent,"seratedknife")
-end
-
---Don't forget to register the item!
-nrequire("item.lua").RegisterItem(item)
+-- --[[
+-- An example item
+-- ]]
+-- do return end
+-- local item = {}
+--
+-- --Required, a name, all item names must be unique
+-- item.Name = "Serated Knife"
+--
+-- --Optional, a tooltip to display
+-- item.Tooltip = "Bits of scrap put togeather to resembel a hammer"
+--
+-- --Required Returns the data needed to rebuild this item, should only contain the minimum data nessessary since this gets sent over the network
+-- item.Serialize = function(self)
+-- print("Trying to serailize!")
+-- return ""
+-- end
+--
+-- --Required, Rebuilds the item from data created in Serialize, if the item is different from the "main" copy of the item, it should retun a tabl.Copy(self), with the appropriate fields set.
+-- item.DeSerialize = function(self,string)
+-- print("Trying to deserialize!")
+-- return self
+-- end
+--
+-- --Optional, when the player clicks this item, a menu will show up, if the menu item is clicked, the function is ran. This is all run client side, so if you want it to do something, you'll need to use the net library.
+-- function item.GetOptions(self)
+-- local options = {}
+-- options["test"] = function() print("You pressed test!") end
+-- options["toste"] = function() print("You pressed toste!") end
+-- options["Drop"] = ART.DropItem(self)
+-- return options
+-- end
+--
+-- function item.DoOnPanel(dimagebutton)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png")
+-- end
+--
+-- function item.DoOnEquipPanel(dimagebutton)
+-- print("called with panel:",panel)
+-- dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png")
+-- end
+--
+-- --[[
+-- function item.Paint(self,width,height)
+-- --print("painting with values",self,width,height)
+-- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
+-- end
+--
+-- function item.PaintEquiped(self,width,height)
+-- --print("painting with values",self,width,height)
+-- draw.RoundedBox(4, 0,0,width,height,Color(0,100,0))
+-- end
+-- ]]
+--
+-- --Required, the shape of this item.
+-- item.Shape = {
+-- {true,true},
+-- }
+--
+-- --Optional, If this item can be equiped in any player slots, put them here.
+-- item.Equipable = "Right"
+--
+-- local function attacktrace(tr,owner)
+-- if not tr.Hit then return end
+-- if tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
+-- 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
+-- item.onClick = function(self,owner)
+-- item.lastSwing[owner] = item.lastSwing[owner] or 0
+-- if item.lastSwing[owner] > CurTime() then
+-- print("returning because item.lastSwing is " .. item.lastSwing[owner], "but Curtime is",CurTime())
+-- return end
+-- item.lastSwing[owner] = CurTime()+animationtime
+-- local fow,rig,up = owner:GetForward(),owner:GetRight(),owner:GetUp()
+-- local movementtbl = {
+-- ["forward"] = function()
+-- owner:SetLuaAnimation("knife_swing_up")
+-- timer.Simple(animationtime,function()
+-- owner:StopLuaAnimation("knife_swing_up")
+-- end)
+-- local hits = ART.swingarc(owner,{
+-- 0.5,0.611,0.722,0.833
+-- },{
+-- fow*20 + up*90,
+-- fow*45 + up*70,
+-- fow*35 + up*45,
+-- fow*20 + up*30,
+-- },function(tr)
+-- if not tr.Hit then return end
+-- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "forward" then
+-- print("Entity blocked!")
+-- ART.ApplyEffect(owner,"weapon_blocked")
+-- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- print("Got past blocking, it was",tr.Entity.Blocking)
+-- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
+-- end
+-- end)
+-- end,
+-- ["backward"] = function()
+-- owner:SetLuaAnimation("knife_swing_down")
+-- timer.Simple(animationtime,function()
+-- owner:StopLuaAnimation("knife_swing_down")
+-- end)
+-- local hits = ART.swingarc(owner,{
+-- 0.5,0.611,0.722,0.833
+-- },{
+-- fow*15 + up*30,
+-- fow*35 + up*45,
+-- fow*25 + up*70,
+-- fow*15 + up*90,
+-- },function(tr)
+-- if not tr.Hit then return end
+-- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "backward" then
+-- print("Entity blocked!")
+-- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- print("Got past blocking, it was",tr.Entity.Blocking)
+-- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
+-- end
+-- end)
+-- end,
+-- ["left"] = function()
+-- owner:SetLuaAnimation("knife_swing_left")
+-- timer.Simple(animationtime,function()
+-- owner:StopLuaAnimation("knife_swing_left")
+-- end)
+-- local hits = ART.swingarc(owner,{
+-- 0.5,0.611,0.722,0.833
+-- },{
+-- rig*30 + up*59,
+-- rig*10 + fow*30 + up*55,
+-- rig*-10 + fow*30 + up*54,
+-- rig*-30 + up*50,
+-- },function(tr)
+-- if not tr.Hit then return end
+-- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "left" then
+-- print("Entity blocked!")
+-- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- print("Got past blocking, it was",tr.Entity.Blocking)
+-- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
+-- end
+-- end)
+-- end,
+-- ["right"] = function()
+-- owner:SetLuaAnimation("knife_swing_right")
+-- timer.Simple(animationtime,function()
+-- owner:StopLuaAnimation("knife_swing_right")
+-- end)
+-- local hits = ART.swingarc(owner,{
+-- 0.5,0.611,0.722,0.833
+-- },{
+-- rig*-30 + up*59,
+-- rig*-10 + fow*30 + up*55,
+-- rig*10 + fow*30 + up*54,
+-- rig*30 + up*50,
+-- },function(tr)
+-- if not tr.Hit then return end
+-- if tr.Entity.Blocking ~= nil and tr.Entity.Blocking == "right" then
+-- print("Entity blocked!")
+-- elseif tr.Entity.TakeDamage ~= nil and tr.Entity ~= owner then
+-- print("Got past blocking, it was",tr.Entity.Blocking)
+-- tr.Entity:TakeDamage(5, owner, owner:GetActiveWeapon())
+-- end
+-- end)
+-- end,
+-- }
+-- movementtbl[ART.playermovedir(owner)]()
+-- end
+--
+-- --Optional, if we should do something special on equip(like draw the PAC for this weapon)
+-- item.onEquip = function(self,who)
+-- print("onEquip",who)
+-- if CLIENT then print("onEquip client!") end
+-- if SERVER then
+-- PrintTable(pac)
+-- who:GetActiveWeapon():SetHoldType("knife")
+-- ART.ApplyPAC(who,"seratedknife")
+-- --local outfit = pac.luadata.ReadFile("pac3/mech.txt")
+-- --who:AttachPACPart(outfit)
+-- --print("onEquip server!")
+-- end
+-- end
+--
+-- --Optional, if we should do something speical on unequip(like setting animations back to normal)
+-- item.onUnEquip = function(self,who)
+-- who:GetActiveWeapon():SetHoldType("normal")
+-- ART.RemovePAC(who,"seratedknife")
+-- end
+--
+-- item.onDropped = function(self, ent)
+-- ART.ApplyPAC(ent,"seratedknife")
+-- end
+--
+-- --Don't forget to register the item!
+-- nrequire("item.lua").RegisterItem(item)