diff options
Diffstat (limited to 'gamemode/shared/itemsystem/weapons/seratedknife.lua')
| -rw-r--r-- | gamemode/shared/itemsystem/weapons/seratedknife.lua | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/gamemode/shared/itemsystem/weapons/seratedknife.lua b/gamemode/shared/itemsystem/weapons/seratedknife.lua index e57351d..2daec36 100644 --- a/gamemode/shared/itemsystem/weapons/seratedknife.lua +++ b/gamemode/shared/itemsystem/weapons/seratedknife.lua @@ -26,6 +26,7 @@ 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 @@ -58,6 +59,14 @@ item.Shape = { --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 @@ -82,10 +91,14 @@ item.onClick = function(self,owner) 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()) + 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 - print("Hit",tr.Entity) end) end, ["backward"] = function() @@ -101,10 +114,13 @@ item.onClick = function(self,owner) 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()) + 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 - print("Hit",tr.Entity) end) end, ["left"] = function() @@ -120,10 +136,13 @@ item.onClick = function(self,owner) 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()) + 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 - print("Hit",tr.Entity) end) end, ["right"] = function() @@ -139,10 +158,13 @@ item.onClick = function(self,owner) 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()) + 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 - print("Hit",tr.Entity) end) end, } |
