mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-09 03:24:52 +00:00
Adjust melee hit trace
► Check if the specific entity can be hit by a melee attack. If the entity cannot be hit, it is ignored. ► If the attacker or the victim is not a combat character (like NPCs), apply the damage to passive entities (like props, objects, etc.).
This commit is contained in:
parent
a62efecf62
commit
a2dd2943bf
1 changed files with 5 additions and 1 deletions
|
@ -1139,6 +1139,9 @@ bool CTraceFilterMelee::ShouldHitEntity( IHandleEntity *pHandleEntity, int conte
|
|||
if ( pEntity->m_takedamage == DAMAGE_NO )
|
||||
return false;
|
||||
|
||||
if ( m_pPassEnt && !pEntity->CanBeHitByMeleeAttack( const_cast< CBaseEntity * >( EntityFromEntityHandle( m_pPassEnt ) ) ) )
|
||||
return false;
|
||||
|
||||
// FIXME: Do not translate this to the driver because the driver only accepts damage from the vehicle
|
||||
// Translate the vehicle into its driver for damage
|
||||
/*
|
||||
|
@ -1182,7 +1185,8 @@ bool CTraceFilterMelee::ShouldHitEntity( IHandleEntity *pHandleEntity, int conte
|
|||
}
|
||||
else
|
||||
{
|
||||
m_pHit = pEntity;
|
||||
if ( !m_pHit )
|
||||
m_pHit = pEntity;
|
||||
|
||||
// Make sure if the player is holding this, he drops it
|
||||
Pickup_ForcePlayerToDropThisObject( pEntity );
|
||||
|
|
Loading…
Reference in a new issue