2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 01:47:45 +01:00

Fix tripmines blowing up after loading save game in c1a3d with TRIPMINE_BEAM_DUPLICATION_FIX enabled (#332)

This commit is contained in:
Roman Chistokhodov 2022-09-26 17:55:19 +03:00 committed by GitHub
parent 5db68d4076
commit 901d1947fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -282,9 +282,23 @@ void CTripmineGrenade::BeamBreakThink( void )
// respawn detect.
if( !m_pBeam )
{
#if TRIPMINE_BEAM_DUPLICATION_FIX
// Use the same trace parameters as the original trace above so the right entity is hit.
TraceResult tr2;
UTIL_TraceLine( pev->origin + m_vecDir * 8.0f, pev->origin - m_vecDir * 32.0f, dont_ignore_monsters, ENT( pev ), &tr2 );
#endif
MakeBeam();
#if TRIPMINE_BEAM_DUPLICATION_FIX
if( tr2.pHit )
{
// reset owner too
pev->owner = tr2.pHit;
m_hOwner = CBaseEntity::Instance( tr2.pHit );
}
#else
if( tr.pHit )
m_hOwner = CBaseEntity::Instance( tr.pHit ); // reset owner too
#endif
}
if( fabs( m_flBeamLength - tr.flFraction ) > 0.001f )