All pastes #808886 Raw Edit

Stuff

public lua v1 · immutable
·published 2007-12-08 00:10 UTC
rendered paste body
function ENT:ExplosionDamage(owner,pos,damage,radius)	local tb = ents.FindInSphere(pos,radius) or {}		for k,v in pairs(tb) do		if v:IsPlayer() then			v.DeathType = "explosion"		end	end		util.BlastDamage( owner, owner, pos, radius, damage )	util.ScreenShake( pos, math.Rand(2,5),220, math.random(3,6), radius + 50 ) 	local tracedata = {}	tracedata.start = pos + Vector(0,0,20)	tracedata.endpos = pos+Vector(0,0,-250)	tracedata.filter = self	local trace = util.TraceLine(tracedata)	if trace.HitWorld then		util.Decal("Scorch",trace.HitPos+trace.HitNormal,trace.HitPos-trace.HitNormal)		local effectdata = EffectData()		effectdata:SetOrigin(trace.HitPos)		util.Effect("smoke_crater", effectdata)	end		for k,v in pairs(tb) do		v:Extinguish()		local phys = v:GetPhysicsObject()		if phys:IsValid() then			local dir = (v:GetPos() - self:GetPos()):Normalize()			phys:ApplyForceCenter(dir * ((damage^2) * phys:GetMass()))		end		if v:GetClass() == "prop_ragdoll" then			for i=1,math.random(3,6) do				local effectdata = EffectData()				effectdata:SetOrigin(v:GetPos())				util.Effect("corpse_gib", effectdata)			end			v:Remove()		end	endend