Files
wnsrc/lua/entities/arccw_uc_40mm_smoke.lua
lifestorm 9c918c46e5 Upload
2024-08-04 23:12:27 +03:00

48 lines
1.3 KiB
Lua

--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
AddCSLuaFile()
ENT.Base = "arccw_uc_40mm_he"
ENT.PrintName = "40mm Smoke Grenade"
ENT.GrenadeDamage = 50
ENT.GrenadeRadius = 150
ENT.ExplosionEffect = false
ENT.Scorch = false
function ENT:DoDetonation()
local effectdata = EffectData()
effectdata:SetOrigin(self:GetPos())
if self:WaterLevel() >= 1 then
util.Effect("WaterSurfaceExplosion", effectdata)
self:EmitSound("weapons/underwater_explode3.wav", 125, 100, 1, CHAN_AUTO)
else
effectdata:SetMagnitude(4)
effectdata:SetScale(1)
effectdata:SetRadius(4)
effectdata:SetNormal(self:GetVelocity():GetNormalized())
util.Effect("Sparks", effectdata)
self:EmitSound("physics/metal/metal_box_break1.wav", 100, 200, 0.5)
end
-- TODO: these sounds need to be replaced (dependency)!
self:EmitSound("weapons/arccw/smokegrenade/smoke_emit.wav", 90, 100, 1, CHAN_AUTO)
local cloud = ents.Create( "arccw_smoke" )
if !IsValid(cloud) then return end
cloud:SetPos(self:GetPos())
cloud:Spawn()
end