Hello, is there any way to create a explosion through env_explosion entity but pass the TE_EXPLFLAG_NOSOUND? I tried to set SF_ENVEXPLOSION_NOFIREBALL but this won't will work because env_explosion will still call TE_EXPLOSION message with TE_EXPLFLAG_NONE.
Code:
void CEnvExplosion::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
TraceResult tr;
pev->model = iStringNull;// invisible
pev->solid = SOLID_NOT;// intangible
Vector vecSpot;// trace starts here!
vecSpot = pev->origin + Vector(0, 0, 8);
UTIL_TraceLine(vecSpot, vecSpot + Vector(0, 0, -40), ignore_monsters, ENT(pev), &tr);
// Pull out of the wall a bit
if (tr.flFraction != 1.0f)
{
pev->origin = tr.vecEndPos + (tr.vecPlaneNormal * (m_iMagnitude - 24) * 0.6f);
}
// draw decal
if (!(pev->spawnflags & SF_ENVEXPLOSION_NODECAL))
{
if (RANDOM_FLOAT(0, 1) < 0.5f)
{
UTIL_DecalTrace(&tr, DECAL_SCORCH1);
}
else
{
UTIL_DecalTrace(&tr, DECAL_SCORCH2);
}
}
// draw fireball
if (!(pev->spawnflags & SF_ENVEXPLOSION_NOFIREBALL))
{
MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin);
WRITE_BYTE(TE_EXPLOSION);
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_SHORT(g_sModelIndexFireball);
WRITE_BYTE(byte(m_spriteScale)); // scale * 10
WRITE_BYTE(15); // framerate
WRITE_BYTE(TE_EXPLFLAG_NONE);
MESSAGE_END();
}
else
{
MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin);
WRITE_BYTE(TE_EXPLOSION);
WRITE_COORD(pev->origin.x);
WRITE_COORD(pev->origin.y);
WRITE_COORD(pev->origin.z);
WRITE_SHORT(g_sModelIndexFireball);
WRITE_BYTE(0); // no sprite
WRITE_BYTE(15); // framerate
WRITE_BYTE(TE_EXPLFLAG_NONE);
MESSAGE_END();
}
// do damage
if (!(pev->spawnflags & SF_ENVEXPLOSION_NODAMAGE))
{
RadiusDamage(pev, pev, m_iMagnitude, CLASS_NONE, DMG_BLAST);
}
SetThink(&CEnvExplosion::Smoke);
pev->nextthink = gpGlobals->time + 0.3f;
// draw sparks
if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSPARKS))
{
int sparkCount = RANDOM_LONG(0, 3);
for (int i = 0; i < sparkCount; i++)
{
Create("spark_shower", pev->origin, tr.vecPlaneNormal, nullptr);
}
}
}
__________________