Limit gib attacks

This commit is contained in:
mittorn 2016-03-27 19:57:45 +00:00
parent a8754de564
commit 1b811d5644
2 changed files with 16 additions and 14 deletions

View File

@ -726,20 +726,21 @@ void CGib :: BounceGibTouch ( CBaseEntity *pOther )
}
else
{
if ( pev->velocity.Length() > 300)
{
entvars_t *pevOwner = pev;
if( pev->owner)
pevOwner = &pev->owner->v;
if(pevOwner)
if ( m_flNextAttack < gpGlobals->time && pev->velocity.Length() > 300 )
{
float dmg = 10 + pev->velocity.Length() / 50;
TraceResult tr = UTIL_GetGlobalTrace();
ClearMultiDamage();
pOther->TraceAttack(pevOwner, dmg, gpGlobals->v_forward, &tr, DMG_CLUB);
ApplyMultiDamage(pev, pevOwner);
entvars_t *pevOwner = pev;
if( pev->owner)
pevOwner = &pev->owner->v;
if(pevOwner)
{
float dmg = 10 + pev->velocity.Length() / 50;
TraceResult tr = UTIL_GetGlobalTrace();
ClearMultiDamage();
pOther->TraceAttack(pevOwner, dmg, gpGlobals->v_forward, &tr, DMG_CLUB);
ApplyMultiDamage(pev, pevOwner);
}
m_flNextAttack = gpGlobals->time + 1.0; // debounce
}
}
if ( g_Language != LANGUAGE_GERMAN && m_cBloodDecals > 0 && m_bloodColor != DONT_BLEED )
{
vecSpot = pev->origin + Vector ( 0 , 0 , 8 );//move up a bit, and trace down.
@ -811,8 +812,8 @@ void CGib :: Spawn( const char *szGibModel )
pev->nextthink = gpGlobals->time + 4;
m_lifeTime = 250;
SetThink( &WaitTillLand );
SetTouch( &BounceGibTouch );
SetThink( &CGib::WaitTillLand );
SetTouch( &CGib::BounceGibTouch );
m_material = matNone;
m_cBloodDecals = 5;// how many blood decals this gib can place (1 per bounce until none remain).

View File

@ -162,6 +162,7 @@ public:
return 700;
}
float m_flNextAttack;
int m_bloodColor;
int m_cBloodDecals;
int m_material;