MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / explode

Method explode

Engine/source/T3D/proximityMine.cpp:500–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498//----------------------------------------------------------------------------
499
500void ProximityMine::explode()
501{
502 // Make sure we don't explode twice
503 if ( mState == Exploded )
504 {
505 return;
506 }
507
508 mState = Exploded;
509 mStateTimeout = TickSec * gAutoDeleteTicks; // auto-delete on server N ticks after exploding
510
511 // Move the explosion point slightly off the surface to avoid problems with radius damage
512 Point3F normal = getTransform().getUpVector();
513 Point3F explodePos = getTransform().getPosition() + normal * mDataBlock->explosionOffset;
514
515 if ( isServerObject() )
516 {
517 // Do what the server needs to do, damage the surrounding objects, etc.
518 mDataBlock->onExplode_callback( this, explodePos );
519 setMaskBits( ExplosionMask );
520
521 // Wait till the timeout to self delete. This gives the server object time
522 // to get ghosted to the client
523 }
524 else
525 {
526 // Client just plays the explosion effect at the right place
527 if ( mDataBlock->explosion )
528 {
529 Explosion *pExplosion = new Explosion;
530 pExplosion->onNewDataBlock( mDataBlock->explosion, false );
531
532 MatrixF xform( true );
533 xform.setPosition( explodePos );
534 pExplosion->setTransform( xform );
535 pExplosion->setInitialState( explodePos, normal );
536 pExplosion->setCollideType( sTriggerCollisionMask );
537 if ( pExplosion->registerObject() == false )
538 {
539 Con::errorf( ConsoleLogEntry::General, "ProximityMine(%s)::explode: couldn't register explosion",
540 mDataBlock->getName() );
541 delete pExplosion;
542 }
543 }
544 }
545}
546
547void ProximityMine::advanceTime( F32 dt )
548{

Callers 1

proximityMine.cppFile · 0.45

Calls 10

getUpVectorMethod · 0.80
setCollideTypeMethod · 0.80
errorfFunction · 0.50
getPositionMethod · 0.45
onNewDataBlockMethod · 0.45
setPositionMethod · 0.45
setTransformMethod · 0.45
setInitialStateMethod · 0.45
registerObjectMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected