Залив
This commit is contained in:
7
lua/entities/mg_frag_grenade/cl_init.lua
Normal file
7
lua/entities/mg_frag_grenade/cl_init.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Draw()
|
||||
|
||||
self:DrawModel()
|
||||
|
||||
end
|
||||
55
lua/entities/mg_frag_grenade/init.lua
Normal file
55
lua/entities/mg_frag_grenade/init.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/items/grenadeammo.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetColor(Color(0,0,0))
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
|
||||
phys:Wake()
|
||||
|
||||
end
|
||||
|
||||
self.DetonationTime = self.FuseTime + CurTime()
|
||||
|
||||
self:Throw()
|
||||
|
||||
end
|
||||
|
||||
|
||||
function ENT:PhysicsCollide( data, phys )
|
||||
if data.Speed > 40 then
|
||||
self:EmitSound("equipment/mike67/phy_frag_bounce_concrete_med_0"..math.random(1,8).."_ext.ogg",75, 100, math.Remap(data.Speed, 40, 80, 0, 1), CHAN_AUTO)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
|
||||
if self.DetonationTime <= CurTime() then
|
||||
self:Explode()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ENT:Explode()
|
||||
ParticleEffect( "Generic_explo_high", self:GetPos(), Angle(0,0,0))
|
||||
util.BlastDamage(self, self:GetOwner(), self:GetPos(), 475, 640)
|
||||
util.ScreenShake(self:GetPos(), 8, 3, 1, 700)
|
||||
self:EmitSound("^viper/shared/frag_expl.ogg", 0, 100, 1, CHAN_WEAPON)
|
||||
util.Decal( "Scorch", self:GetPos(), self:GetPos() + Vector(0, 0, -10), {self})
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
function ENT:Throw()
|
||||
local phys = self:GetPhysicsObject()
|
||||
phys:SetVelocity(self:GetOwner():GetAimVector() * 3000)
|
||||
phys:ApplyTorqueCenter( VectorRand( -3, 3) )
|
||||
end
|
||||
6
lua/entities/mg_frag_grenade/shared.lua
Normal file
6
lua/entities/mg_frag_grenade/shared.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Frag Grenade"
|
||||
ENT.Spawnable = false
|
||||
ENT.FuseTime = 5
|
||||
Reference in New Issue
Block a user