Skip to content

Commit

Permalink
Fix tripmines blowing up after loading save game in c1a3d
Browse files Browse the repository at this point in the history
Resolves #172
  • Loading branch information
SamVanheer committed Sep 26, 2022
1 parent 85467c5 commit 6f0ae55
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dlls/tripmine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,16 @@ void CTripmineGrenade::BeamBreakThink()
// respawn detect.
if (!m_pBeam)
{
// 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, pev->origin - m_vecDir * 32, dont_ignore_monsters, ENT(pev), &tr2);
MakeBeam();
if (tr.pHit)
m_hOwner = CBaseEntity::Instance(tr.pHit); // reset owner too
if (tr2.pHit)
{
// reset owner too
pev->owner = tr2.pHit;
m_hOwner = CBaseEntity::Instance(tr2.pHit);
}
}

if (fabs(m_flBeamLength - tr.flFraction) > 0.001)
Expand Down

0 comments on commit 6f0ae55

Please sign in to comment.