forked from HaodongMo/ArcCW
Implemented Hook_PlayerTakeDamage
This commit is contained in:
parent
132d1ee8df
commit
dbbf483175
18
lua/arccw/server/sv_takedamage.lua
Normal file
18
lua/arccw/server/sv_takedamage.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
hook.Add("EntityTakeDamage", "ArcCW_DoAttDMG", function(ent, dmg)
|
||||||
|
if !ent:IsPlayer() then return end
|
||||||
|
|
||||||
|
local wpn = ent:GetActiveWeapon()
|
||||||
|
|
||||||
|
if !wpn.ArcCW then return end
|
||||||
|
|
||||||
|
for i, k in pairs(wpn.Attachments) do
|
||||||
|
if !k.Installed then continue end
|
||||||
|
local atttbl = ArcCW.AttachmentTable[k.Installed]
|
||||||
|
|
||||||
|
if atttbl.Hook_PlayerTakeDamage then
|
||||||
|
atttbl.Hook_PlayerTakeDamage(wpn, {slot = i, atthp = k.HP, dmg = dmg})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
wpn:SendAttHP()
|
||||||
|
end)
|
@ -54,8 +54,9 @@ att.Model = ""
|
|||||||
att.HideModel = false
|
att.HideModel = false
|
||||||
att.ModelBodygroups = ""
|
att.ModelBodygroups = ""
|
||||||
att.ModelSkin = 0
|
att.ModelSkin = 0
|
||||||
att.ModelScale = 1
|
att.ModelScale = Vector(1, 1, 1)
|
||||||
att.ModelOffset = Vector(0, 0, 0)
|
att.ModelOffset = Vector(0, 0, 0)
|
||||||
|
att.OffsetAng = Angle(0, 0, 0)
|
||||||
att.ModelIsShield = false
|
att.ModelIsShield = false
|
||||||
att.DrawFunc = function(self, element, wm) end
|
att.DrawFunc = function(self, element, wm) end
|
||||||
|
|
||||||
@ -78,6 +79,9 @@ att.DamageOnShoot = 0
|
|||||||
att.DamageOnReload = 0
|
att.DamageOnReload = 0
|
||||||
att.DamagePerSecond = 0
|
att.DamagePerSecond = 0
|
||||||
|
|
||||||
|
-- {slot = int, atthp = float, dmg = DamageInfo}
|
||||||
|
att.Hook_PlayerTakeDamage = function(wep, data) end
|
||||||
|
|
||||||
-- {slot = int, oldhp = float, dmg = float}
|
-- {slot = int, oldhp = float, dmg = float}
|
||||||
att.Hook_AttTakeDamage = function(wep, data) end
|
att.Hook_AttTakeDamage = function(wep, data) end
|
||||||
|
|
||||||
|
@ -125,6 +125,15 @@ function SWEP:Reload()
|
|||||||
|
|
||||||
self:SetNWBool("reloading", true)
|
self:SetNWBool("reloading", true)
|
||||||
|
|
||||||
|
for i, k in pairs(self.Attachments) do
|
||||||
|
if !k.Installed then continue end
|
||||||
|
local atttbl = ArcCW.AttachmentTable[k.Installed]
|
||||||
|
|
||||||
|
if atttbl.DamageOnReload then
|
||||||
|
self:DamageAttachment(i, atttbl.DamageOnReload)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if !self.ReloadInSights then
|
if !self.ReloadInSights then
|
||||||
self:ExitSights()
|
self:ExitSights()
|
||||||
self.Sighted = false
|
self.Sighted = false
|
||||||
|
BIN
sound/weapons/arccw/supp_break.wav
Normal file
BIN
sound/weapons/arccw/supp_break.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user