---------------------------------------------------------------------------- Explode ----------------------------------------------------------------------------
| 1384 | // Explode |
| 1385 | //---------------------------------------------------------------------------- |
| 1386 | bool Explosion::explode() |
| 1387 | { |
| 1388 | mActive = true; |
| 1389 | |
| 1390 | GameConnection* conn = GameConnection::getConnectionToServer(); |
| 1391 | if(!conn) |
| 1392 | return false; |
| 1393 | |
| 1394 | launchDebris( mInitialNormal ); |
| 1395 | spawnSubExplosions(); |
| 1396 | |
| 1397 | if (bool(mDataBlock->mExplosionShape) && mDataBlock->explosionAnimation != -1) { |
| 1398 | mExplosionInstance = new TSShapeInstance(mDataBlock->mExplosionShape, true); |
| 1399 | |
| 1400 | mExplosionThread = mExplosionInstance->addThread(); |
| 1401 | mExplosionInstance->setSequence(mExplosionThread, mDataBlock->explosionAnimation, 0); |
| 1402 | mExplosionInstance->setTimeScale(mExplosionThread, mDataBlock->playSpeed); |
| 1403 | |
| 1404 | mCurrMS = 0; |
| 1405 | mEndingMS = U32(mExplosionInstance->getScaledDuration(mExplosionThread) * 1000.0f); |
| 1406 | |
| 1407 | mObjScale.convolve(mDataBlock->explosionScale); |
| 1408 | mObjBox = mDataBlock->mExplosionShape->mBounds; |
| 1409 | resetWorldBox(); |
| 1410 | } |
| 1411 | |
| 1412 | SFXProfile* sound_prof = mDataBlock->getSoundProfile(); |
| 1413 | if (sound_prof) |
| 1414 | { |
| 1415 | soundProfile_clone = sound_prof->cloneAndPerformSubstitutions(ss_object, ss_index); |
| 1416 | SFX->playOnce( soundProfile_clone, &getTransform() ); |
| 1417 | if (!soundProfile_clone->isTempClone()) |
| 1418 | soundProfile_clone = 0; |
| 1419 | } |
| 1420 | |
| 1421 | if (mDataBlock->particleEmitter) { |
| 1422 | mMainEmitter = new ParticleEmitter; |
| 1423 | mMainEmitter->setDataBlock(mDataBlock->particleEmitter->cloneAndPerformSubstitutions(ss_object, ss_index)); |
| 1424 | mMainEmitter->registerObject(); |
| 1425 | |
| 1426 | mMainEmitter->emitParticles(getPosition(), mInitialNormal, mDataBlock->particleRadius, |
| 1427 | Point3F::Zero, U32(mDataBlock->particleDensity * mFade)); |
| 1428 | } |
| 1429 | |
| 1430 | for( S32 i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ ) |
| 1431 | { |
| 1432 | if( mDataBlock->emitterList[i] != NULL ) |
| 1433 | { |
| 1434 | ParticleEmitter * pEmitter = new ParticleEmitter; |
| 1435 | pEmitter->setDataBlock(mDataBlock->emitterList[i]->cloneAndPerformSubstitutions(ss_object, ss_index)); |
| 1436 | if( !pEmitter->registerObject() ) |
| 1437 | { |
| 1438 | Con::warnf( ConsoleLogEntry::General, "Could not register emitter for particle of class: %s", mDataBlock->getName() ); |
| 1439 | SAFE_DELETE(pEmitter); |
| 1440 | } |
| 1441 | mEmitterList[i] = pEmitter; |
| 1442 | } |
| 1443 | } |
nothing calls this directly
no test coverage detected