Залив
This commit is contained in:
3
lua/entities/mg_arrow_knockback/cl_init.lua
Normal file
3
lua/entities/mg_arrow_knockback/cl_init.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
include("shared.lua")
|
||||
|
||||
killicon.Add("mg_arrow_knockback", "VGUI/entities/mg_crossbow", Color(255, 0, 0, 255))
|
||||
33
lua/entities/mg_arrow_knockback/init.lua
Normal file
33
lua/entities/mg_arrow_knockback/init.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
ENT.Model = Model("models/viper/mw/attachments/crossbow/attachment_vm_sn_crossbow_mag_firebolt.mdl")
|
||||
ENT.AoeEntity = nil
|
||||
|
||||
local BaseClass = baseclass.Get(ENT.Base)
|
||||
|
||||
function ENT:Impact(tr, phys, bHull)
|
||||
BaseClass.Impact(self, tr, phys, bHull)
|
||||
|
||||
if (tr.HitSky) then
|
||||
return
|
||||
end
|
||||
|
||||
self:EmitSound("MW19_Crossbow.Knockback")
|
||||
|
||||
local radius = self.KnockbackRadius
|
||||
|
||||
for _, e in pairs(ents.FindInSphere(tr.HitPos, radius)) do
|
||||
if ((e:IsPlayer() || e:IsNPC()) && !e:IsLineOfSightClear(tr.HitPos + tr.HitNormal * 10)) then
|
||||
continue
|
||||
end
|
||||
|
||||
local force = self.KnockbackForce * (e:IsNPC() && 1.5 || 1)
|
||||
|
||||
local dir = (e:WorldSpaceCenter() - tr.HitPos):GetNormalized()
|
||||
local curVel = e:GetVelocity()
|
||||
e:SetVelocity(Vector(curVel.x, curVel.y, 200) + dir * force)
|
||||
end
|
||||
end
|
||||
14
lua/entities/mg_arrow_knockback/shared.lua
Normal file
14
lua/entities/mg_arrow_knockback/shared.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
ENT.Base = "mg_arrow"
|
||||
ENT.Type = "anim"
|
||||
|
||||
ENT.KnockbackRadius = 320
|
||||
ENT.KnockbackForce = 300
|
||||
|
||||
sound.Add({
|
||||
name = "MW19_Crossbow.Knockback",
|
||||
channel = CHAN_BODY,
|
||||
volume = 1,
|
||||
level = 100,
|
||||
pitch = {95, 105},
|
||||
sound = {"@viper/shared/smoke_expl_body_01.ogg"}
|
||||
})
|
||||
Reference in New Issue
Block a user