Quote:
|
ther approach will be constantly broadcasting this message on a "thinking forward".
|
After looking through the regamedll source code, noticed that this is how CS handles the smoke grenade. By doing the same, you may get rid of the bug.
Code:
void CGrenade::SG_Smoke()
{
int iMaxSmokePuffs = 100;
float flSmokeInterval;
if (UTIL_PointContents(pev->origin) == CONTENTS_WATER)
{
UTIL_Bubbles(pev->origin - Vector(64, 64, 64), pev->origin + Vector(64, 64, 64), 100);
}
else
{
Vector origin, angle;
real_t x_old, y_old, R_angle;
UTIL_MakeVectors(pev->angles);
origin = gpGlobals->v_forward * RANDOM_FLOAT(3, 8);
flSmokeInterval = RANDOM_FLOAT(1.5f, 3.5f) * iMaxSmokePuffs;
R_angle = m_angle / (180.00433335 / M_PI);
x_old = Q_cos(real_t(R_angle));
y_old = Q_sin(real_t(R_angle));
angle.x = origin.x * x_old - origin.y * y_old;
angle.y = origin.x * y_old + origin.y * x_old;
m_angle = (m_angle + 30) % 360;
PLAYBACK_EVENT_FULL(0, nullptr, m_usEvent, 0, pev->origin, m_vSmokeDetonate, angle.x, angle.y, flSmokeInterval, 4, m_bLightSmoke, 6);
}
if (m_SGSmoke <= 20)
{
pev->nextthink = gpGlobals->time + 1.0f;
SetThink(&CGrenade::SG_Smoke);
m_SGSmoke++;
}
else
{
pev->effects |= EF_NODRAW;
if (TheBots)
{
TheBots->RemoveGrenade(this);
}
UTIL_Remove(this);
}
}
https://github.com/s1lentq/ReGameDLL...enade.cpp#L480
__________________