Files
VnUtest/garrysmod/addons/tacrp/lua/entities/tacrp_proj_40mm_gas.lua
2026-03-31 10:27:04 +03:00

40 lines
1.0 KiB
Lua

AddCSLuaFile()
ENT.Base = "tacrp_proj_base"
ENT.PrintName = "40mm CS Gas"
ENT.Spawnable = false
ENT.Model = "models/weapons/tacint/grenade_40mm.mdl"
ENT.IsRocket = false // projectile has a booster and will not drop.
ENT.InstantFuse = false // projectile is armed immediately after firing.
ENT.RemoteFuse = false // allow this projectile to be triggered by remote detonator.
ENT.ImpactFuse = true
ENT.ExplodeOnDamage = false // projectile explodes when it takes damage.
ENT.ExplodeUnderwater = true
ENT.Delay = 0
ENT.ExplodeSounds = {
"TacRP/weapons/grenade/smoke_explode-1.wav",
}
function ENT:Detonate()
if self:WaterLevel() > 0 then self:Remove() return end
local attacker = self.Attacker or self:GetOwner() or self
self:EmitSound(table.Random(self.ExplodeSounds), 75)
local cloud = ents.Create( "TacRP_gas_cloud" )
if !IsValid(cloud) then return end
cloud:SetPos(self:GetPos())
cloud:SetOwner(attacker)
cloud:Spawn()
self:Remove()
end