07-29-2003, 03:48 PM
Code:
void CDisc::DiscTouch ( CBaseEntity *pOther )
{
// Push players backwards
if ( pOther->IsPlayer() )
{
if ( ((CBaseEntity*)m_hOwner) == pOther )
{
if (m_fDontTouchOwner < gpGlobals->time)
{
// Play catch sound
EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
ReturnToThrower();
}
return;
}
else if ( m_fDontTouchEnemies < gpGlobals->time)
{
if ( pev->team != pOther->pev->team )
{
((CBasePlayer*)pOther)->m_LastHitGroup = HITGROUP_GENERIC;
// Do freeze seperately so you can freeze and shatter a person with a single shot
if ( m_iPowerupFlags & POW_FREEZE && ((CBasePlayer*)pOther)->m_iFrozen == FALSE )
{
// Freeze the player and make them glow blue
EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "weapons/electro5.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
((CBasePlayer*)pOther)->Freeze();
// If it's not a decap, return now. If it's a decap, continue to shatter
if ( !m_bDecapitate )
{
m_fDontTouchEnemies = gpGlobals->time + 2.0;
return;
}
}
// Decap or push
if (m_bDecapitate)
{
// Decapitate!
if ( m_bTeleported )
((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;
((CBasePlayer*)pOther)->Decapitate( ((CBaseEntity*)m_hOwner)->pev );
m_fDontTouchEnemies = gpGlobals->time + 0.5;
}
else
{
// Play thwack sound
switch( RANDOM_LONG(0,2) )
{
case 0:
EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
case 1:
EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
case 2:
EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
break;
}
// Push the player
Vector vecDir = pev->velocity.Normalize();
pOther->pev->flags &= ~FL_ONGROUND;
((CBasePlayer*)pOther)->m_vecHitVelocity = vecDir * DISC_PUSH_MULTIPLIER;
// Shield flash only if the player isnt frozen
if ( ((CBasePlayer*)pOther)->m_iFrozen == false )
{
pOther->pev->renderfx = kRenderFxGlowShell;
pOther->pev->rendercolor.x = 255;
pOther->pev->renderamt = 150;
}
((CBasePlayer*)pOther)->m_hLastPlayerToHitMe = m_hOwner;
((CBasePlayer*)pOther)->m_flLastDiscHit = gpGlobals->time;
((CBasePlayer*)pOther)->m_flLastDiscBounces = m_iBounces;
if ( m_bTeleported )
((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;
m_fDontTouchEnemies = gpGlobals->time + 2.0;
}
}
}
}
Hmm. Seems to me that the else if ( m_fDontTouchEnemies < gpGlobals->time) also needs to check if a player is dead, since they shouldn't be touched either. Don't know if that has been cured already?:)