Залив
This commit is contained in:
3
lua/entities/mg_arrow_stim/cl_init.lua
Normal file
3
lua/entities/mg_arrow_stim/cl_init.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
include("shared.lua")
|
||||
|
||||
killicon.Add("mg_arrow_stim", "VGUI/entities/mg_crossbow", Color(255, 0, 0, 255))
|
||||
49
lua/entities/mg_arrow_stim/init.lua
Normal file
49
lua/entities/mg_arrow_stim/init.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
ENT.Model = Model("models/viper/mw/attachments/crossbow/attachment_vm_sn_crossbow_mag_stimbolt.mdl")
|
||||
ENT.AoeEntity = nil
|
||||
|
||||
local BaseClass = baseclass.Get(ENT.Base)
|
||||
|
||||
local function isCowerSupportedForNPC(npc)
|
||||
for _, a in pairs(npc:GetSequenceList()) do
|
||||
if (npc:GetSequenceActivity(npc:LookupSequence(a)) == ACT_COWER) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local function determineHealRelationship(ent, owner)
|
||||
if (ent:IsNPC()) then
|
||||
return ent:Disposition(owner) == D_LI
|
||||
end
|
||||
|
||||
if (ent:IsPlayer()) then
|
||||
return ent:Team() == owner:Team()
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:Impact(tr, phys, bHull)
|
||||
BaseClass.Impact(self, tr, phys, bHull)
|
||||
|
||||
if (tr.HitSky) then
|
||||
return
|
||||
end
|
||||
|
||||
if (!IsValid(tr.Entity)) then
|
||||
return
|
||||
end
|
||||
|
||||
if (determineHealRelationship(tr.Entity, self:GetOwner())) then
|
||||
tr.Entity:SetHealth(math.Clamp(tr.Entity:Health() + self.HealAmount, 0, tr.Entity:GetMaxHealth()))
|
||||
tr.Entity:EmitSound("MW19_Crossbow.Heal")
|
||||
ParticleEffect("arrow_heal", tr.HitPos, Angle(), nil, 0)
|
||||
end
|
||||
end
|
||||
16
lua/entities/mg_arrow_stim/shared.lua
Normal file
16
lua/entities/mg_arrow_stim/shared.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
ENT.Base = "mg_arrow"
|
||||
ENT.Type = "anim"
|
||||
|
||||
ENT.HealAmount = 40
|
||||
|
||||
game.AddParticles("particles/mw19_attachments.pcf")
|
||||
PrecacheParticleSystem("arrow_heal")
|
||||
|
||||
sound.Add({
|
||||
name = "MW19_Crossbow.Heal",
|
||||
channel = CHAN_BODY,
|
||||
volume = 1,
|
||||
level = 100,
|
||||
pitch = {95, 105},
|
||||
sound = {"@viper/shared/heal.wav"}
|
||||
})
|
||||
Reference in New Issue
Block a user