Skip to content

Commit

Permalink
Make client-side physics prop breakables disappear after the frame th…
Browse files Browse the repository at this point in the history
…ey are destroyed to avoid bullets hitting something that ceases to exist while they are still examining it.

Thanks to the Strata Source team for finding this.
  • Loading branch information
BenLubar committed Jan 6, 2025
1 parent cf9bc7f commit 19716f4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/game/client/physpropclientside.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ void C_PhysPropClientside::StartFadeOut( float fDelay )

void C_PhysPropClientside::Break()
{
if ( IsMarkedForDeletion() )
return;

m_takedamage = DAMAGE_NO;

IPhysicsObject *pPhysics = VPhysicsGetObject();
Expand Down Expand Up @@ -443,10 +446,12 @@ void C_PhysPropClientside::Break()
// no damage/damage force? set a burst of 100 for some movement
params.defBurstScale = 100;

// spwan break chunks
// spawn break chunks
PropBreakableCreateAll( GetModelIndex(), pPhysics, params, this, -1, false );

Release(); // destroy object
// destroy object at end of frame
SetRemovalFlag( true );
AddToEntityList( ENTITY_LIST_DELETE );
}

void C_PhysPropClientside::Clone( Vector &velocity )
Expand Down

0 comments on commit 19716f4

Please sign in to comment.