mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-09 03:24:52 +00:00
Merge b2b2275e23
into 0565403b15
This commit is contained in:
commit
92a527b909
1 changed files with 18 additions and 7 deletions
|
@ -222,9 +222,14 @@ void CPhysicsCannister::CannisterActivate( CBaseEntity *pActivator, const Vector
|
|||
|
||||
Vector thrustDirection = CalcLocalThrust( thrustOffset );
|
||||
m_onActivate.FireOutput( pActivator, this, 0 );
|
||||
m_thruster.CalcThrust( m_thrustOrigin, thrustDirection, VPhysicsGetObject() );
|
||||
m_pController = physenv->CreateMotionController( &m_thruster );
|
||||
|
||||
IPhysicsObject *pPhys = VPhysicsGetObject();
|
||||
if ( !pPhys )
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_thruster.CalcThrust( m_thrustOrigin, thrustDirection, pPhys );
|
||||
m_pController = physenv->CreateMotionController( &m_thruster );
|
||||
m_pController->AttachObject( pPhys, true );
|
||||
// Make sure the object is simulated
|
||||
pPhys->Wake();
|
||||
|
@ -332,7 +337,11 @@ void CPhysicsCannister::Deactivate(void)
|
|||
if ( !m_pController )
|
||||
return;
|
||||
|
||||
m_pController->DetachObject( VPhysicsGetObject() );
|
||||
IPhysicsObject *pPhys = VPhysicsGetObject();
|
||||
if ( pPhys != NULL )
|
||||
{
|
||||
m_pController->DetachObject( pPhys );
|
||||
}
|
||||
physenv->DestroyMotionController( m_pController );
|
||||
m_pController = NULL;
|
||||
SetNextThink( TICK_NEVER_THINK );
|
||||
|
@ -361,9 +370,11 @@ void CPhysicsCannister::Explode( CBaseEntity *pAttacker )
|
|||
Vector velocity;
|
||||
AngularImpulse angVelocity;
|
||||
IPhysicsObject *pPhysics = VPhysicsGetObject();
|
||||
|
||||
pPhysics->GetVelocity( &velocity, &angVelocity );
|
||||
PropBreakableCreateAll( GetModelIndex(), pPhysics, GetAbsOrigin(), GetAbsAngles(), velocity, angVelocity, 1.0, 20, COLLISION_GROUP_DEBRIS );
|
||||
if ( pPhysics )
|
||||
{
|
||||
pPhysics->GetVelocity( &velocity, &angVelocity );
|
||||
PropBreakableCreateAll( GetModelIndex(), pPhysics, GetAbsOrigin(), GetAbsAngles(), velocity, angVelocity, 1.0, 20, COLLISION_GROUP_DEBRIS );
|
||||
}
|
||||
ExplosionCreate( GetAbsOrigin(), GetAbsAngles(), pAttacker, m_damage, 0, true );
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
@ -480,4 +491,4 @@ void CPhysicsCannister::VPhysicsUpdate( IPhysicsObject *pPhysics )
|
|||
RemoveSpawnFlags( SF_CANNISTER_ASLEEP );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue