mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-08 19:12:51 +00:00
Try to stop orbs getting stuck on items
This commit is contained in:
parent
a62efecf62
commit
c176360448
1 changed files with 13 additions and 2 deletions
|
@ -1566,6 +1566,18 @@ void CPropCombineBall::VPhysicsCollision( int index, gamevcollisionevent_t *pEve
|
|||
{
|
||||
Vector preVelocity = pEvent->preVelocity[index];
|
||||
float flSpeed = VectorNormalize( preVelocity );
|
||||
CBaseEntity *pHitEntity = pEvent->pEntities[ !index ];
|
||||
|
||||
if ( FClassnameIs( pHitEntity, "npc_satchel" ) || // don't slow down on satchel charges
|
||||
FClassnameIs( pHitEntity, "npc_grenade_frag" ) || // not on frag grenades either
|
||||
StringHasPrefix( pHitEntity->GetClassname(), "weapon_" ) || // much less on weapons
|
||||
StringHasPrefix( pHitEntity->GetClassname(), "item_" ) ) // the same for items
|
||||
{
|
||||
Vector vecBounceVelocity = -preVelocity;
|
||||
vecBounceVelocity *= GetSpeed();
|
||||
PhysCallbackSetVelocity( pEvent->pObjects[ index ], vecBounceVelocity );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_nMaxBounces == -1 )
|
||||
{
|
||||
|
@ -1573,7 +1585,7 @@ void CPropCombineBall::VPhysicsCollision( int index, gamevcollisionevent_t *pEve
|
|||
|
||||
if( pHit->game.material != CHAR_TEX_FLESH || !hl2_episodic.GetBool() )
|
||||
{
|
||||
CBaseEntity *pHitEntity = pEvent->pEntities[!index];
|
||||
|
||||
if ( pHitEntity && IsHittableEntity( pHitEntity ) )
|
||||
{
|
||||
OnHitEntity( pHitEntity, flSpeed, index, pEvent );
|
||||
|
@ -1610,7 +1622,6 @@ void CPropCombineBall::VPhysicsCollision( int index, gamevcollisionevent_t *pEve
|
|||
vecFinalVelocity *= GetSpeed();
|
||||
PhysCallbackSetVelocity( pEvent->pObjects[index], vecFinalVelocity );
|
||||
|
||||
CBaseEntity *pHitEntity = pEvent->pEntities[!index];
|
||||
if ( pHitEntity && IsHittableEntity( pHitEntity ) )
|
||||
{
|
||||
OnHitEntity( pHitEntity, flSpeed, index, pEvent );
|
||||
|
|
Loading…
Reference in a new issue