| 1023 | } |
| 1024 | |
| 1025 | void Projectile::explode( const Point3F &p, const Point3F &n, const U32 collideType ) |
| 1026 | { |
| 1027 | // Make sure we don't explode twice... |
| 1028 | if ( mHasExploded ) |
| 1029 | return; |
| 1030 | |
| 1031 | mHasExploded = true; |
| 1032 | |
| 1033 | // Move the explosion point slightly off the surface to avoid problems with radius damage |
| 1034 | Point3F explodePos = p + n * 0.001f; |
| 1035 | |
| 1036 | if ( isServerObject() ) |
| 1037 | { |
| 1038 | // Do what the server needs to do, damage the surrounding objects, etc. |
| 1039 | mExplosionPosition = explodePos; |
| 1040 | mExplosionNormal = n; |
| 1041 | mCollideHitType = collideType; |
| 1042 | |
| 1043 | mDataBlock->onExplode_callback( this, mExplosionPosition, mFadeValue ); |
| 1044 | |
| 1045 | setMaskBits(ExplosionMask); |
| 1046 | |
| 1047 | // Just wait till the timeout to self delete. This |
| 1048 | // gives server object time to get ghosted to the client. |
| 1049 | } |
| 1050 | else |
| 1051 | { |
| 1052 | // Client just plays the explosion at the right place... |
| 1053 | // |
| 1054 | Explosion* pExplosion = NULL; |
| 1055 | |
| 1056 | if (mDataBlock->waterExplosion && pointInWater(p)) |
| 1057 | { |
| 1058 | pExplosion = new Explosion; |
| 1059 | pExplosion->onNewDataBlock(mDataBlock->waterExplosion, false); |
| 1060 | } |
| 1061 | else |
| 1062 | if (mDataBlock->explosion) |
| 1063 | { |
| 1064 | pExplosion = new Explosion; |
| 1065 | pExplosion->onNewDataBlock(mDataBlock->explosion, false); |
| 1066 | } |
| 1067 | |
| 1068 | if( pExplosion ) |
| 1069 | { |
| 1070 | MatrixF xform(true); |
| 1071 | xform.setPosition(explodePos); |
| 1072 | pExplosion->setTransform(xform); |
| 1073 | pExplosion->setInitialState(explodePos, n); |
| 1074 | pExplosion->setCollideType( collideType ); |
| 1075 | if (pExplosion->registerObject() == false) |
| 1076 | { |
| 1077 | Con::errorf(ConsoleLogEntry::General, "Projectile(%s)::explode: couldn't register explosion", |
| 1078 | mDataBlock->getName() ); |
| 1079 | delete pExplosion; |
| 1080 | pExplosion = NULL; |
| 1081 | } |
| 1082 | } |
nothing calls this directly
no test coverage detected