void CASW_Rocket::Explode( void ) { // Don't explode against the skybox. Just pretend that // the missile flies off into the distance. Vector forward; GetVectors( &forward, NULL, NULL ); trace_t tr; UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + forward * 16, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); m_takedamage = DAMAGE_NO; SetSolid( SOLID_NONE ); if( tr.fraction == 1.0 || !(tr.surface.flags & SURF_SKY) ) { bool bHitCreature = tr.m_pEnt && tr.m_pEnt->IsNPC(); DoExplosion(!bHitCreature); } //UTIL_Remove( this ); SetTouch( NULL ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_NONE ); SetNextThink( gpGlobals->curtime + 0.2f ); SetThink( &CASW_Rocket::SUB_Remove ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CDODBaseRocket::Explode( void ) { // Don't explode against the skybox. Just pretend that // the missile flies off into the distance. Vector vecForward = GetAbsVelocity(); trace_t tr; UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); m_takedamage = DAMAGE_NO; if( tr.fraction == 1.0 || !(tr.surface.flags & SURF_SKY) ) { DoExplosion(); if ( !tr.m_pEnt->IsPlayer() ) UTIL_DecalTrace( &tr, "Scorch" ); } if( m_hRocketTrail ) { m_hRocketTrail->SetLifetime(0.1f); m_hRocketTrail = NULL; } StopSound( "Weapon_Bazooka.Shoot" ); UTIL_Remove( this ); }
void CASW_Boomer_Blob::Detonate( ) { m_takedamage = DAMAGE_NO; DoExplosion(); while ( m_iClusters > 0 ) { float fYaw = random->RandomFloat( 0.0f, 360.0f ); QAngle ang( 0.0f, fYaw, 0.0f ); Vector newVel; AngleVectors( ang, &newVel ); newVel *= random->RandomFloat( 150.0f, 200.0f ); newVel.z = random->RandomFloat( 200.0f, 400.0f ); CASW_Boomer_Blob *pGrenade = CASW_Boomer_Blob::Boomer_Blob_Create( m_flDamage, m_DmgRadius, 0, GetAbsOrigin(), ang, newVel, AngularImpulse( 0.0f, 0.0f, 0.0f ), m_hFirer.Get() ); if (pGrenade) { pGrenade->m_fEarliestAOEDetonationTime = 0; // children can go whenever they want pGrenade->m_fEarliestTouchDetonationTime = 0; pGrenade->m_takedamage = DAMAGE_NO; pGrenade->SetFuseLength( random->RandomFloat( asw_boomer_blob_child_fuse_min.GetFloat(), asw_boomer_blob_child_fuse_max.GetFloat() ) ); pGrenade->SetClusters( 0, false ); pGrenade->m_bKicked = m_bKicked; } m_iClusters--; } UTIL_Remove( this ); }
//------------------------------------------------------------------------------ // Contact grenade, explode when it touches something //------------------------------------------------------------------------------ void CQUAGrenadeHelicopter::ExplodeConcussion( CBaseEntity *pOther ) { if ( !pOther->IsSolid() ) return; if ( pOther->IsWorld() ) return; Vector vecVelocity; GetVelocity( &vecVelocity, NULL ); DoExplosion( GetAbsOrigin(), vecVelocity ); }
void CRocketMissile::Explode( void ) { // Don't explode against the skybox. Just pretend that // the missile flies off into the distance. Vector forward; GetVectors( &forward, NULL, NULL ); trace_t tr; UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + forward * 16, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); m_takedamage = DAMAGE_NO; SetSolid( SOLID_NONE ); if( tr.fraction == 1.0 || !(tr.surface.flags & SURF_SKY) ) { DoExplosion(); } if( m_hRocketTrail ) { m_hRocketTrail->SetLifetime(0.1f); m_hRocketTrail = NULL; } if( m_pGlowTrail ) { //m_pGlowTrail->SetLifetime(0.1f); m_pGlowTrail->StopFollowingEntity(); m_pGlowTrail->Remove(); m_pGlowTrail = NULL; } if ( m_hOwner != NULL ) { m_hOwner->NotifyRocketDied(); m_hOwner = NULL; } StopSound( "Missile.Ignite" ); UTIL_Remove( this ); }
uint32 CDestructibleModel::ObjectMessageFn(LPBASECLASS pObject, HOBJECT hSender, ILTMessage_Read *pMsg) { uint32 dwRet = CDestructible::ObjectMessageFn(pObject, hSender, pMsg); pMsg->SeekTo(0); uint32 messageID = pMsg->Readuint32(); switch(messageID) { case MID_DAMAGE: { if (IsDead() && !m_bCreatedDebris) { ILTServer* pServerDE = BaseClass::GetServerDE(); if (!pServerDE) break; SpawnItem(); CreateDebris(); CreateWorldModelDebris(); if (m_bCreateExplosion) { DoExplosion(); } RegisterDestroyedStimulus(); m_bCreatedDebris = LTTRUE; if (m_bRemoveOnDeath) { pServerDE->RemoveObject(m_hObject); } } } break; case MID_TRIGGER: { const char* szMsg = (const char*)pMsg->Readuint32(); // ConParse does not destroy szMsg, so this is safe ConParse parse; parse.Init((char*)szMsg); while (g_pCommonLT->Parse(&parse) == LT_OK) { if (parse.m_nArgs > 0 && parse.m_Args[0]) { if (!IsDead()) { if (_stricmp(parse.m_Args[0], "FIRE") == 0) { char* pTargetName = parse.m_nArgs > 1 ? parse.m_Args[1] : LTNULL; DoExplosion(pTargetName); } else if (_stricmp(parse.m_Args[0], "HIDDEN") == 0) { // Game Base will take care of the solid and visible flags for us... if (parse.m_nArgs > 1 && parse.m_Args[1]) { if ((_stricmp(parse.m_Args[1], "1") == 0) || (_stricmp(parse.m_Args[1], "TRUE") == 0)) { m_bSaveCanDamage = GetCanDamage(); m_bSaveNeverDestroy = GetNeverDestroy(); SetCanDamage(LTFALSE); SetNeverDestroy(LTTRUE); } else { if ((_stricmp(parse.m_Args[1], "0") == 0) || (_stricmp(parse.m_Args[1], "FALSE") == 0)) { SetCanDamage(m_bSaveCanDamage); SetNeverDestroy(m_bSaveNeverDestroy); } } } } } } } } break; default : break; } return dwRet; }
uint32 CDestructibleModel::ObjectMessageFn(LPBASECLASS pObject, HOBJECT hSender, uint32 messageID, HMESSAGEREAD hRead) { uint32 dwRet = CDestructible::ObjectMessageFn(pObject, hSender, messageID, hRead); switch(messageID) { case MID_DAMAGE: { if (IsDead() && !m_bCreatedDebris) { ILTServer* pServerDE = BaseClass::GetServerDE(); if (!pServerDE) break; SpawnItem(); CreateDebris(); CreateWorldModelDebris(); if (m_bCreateExplosion) { DoExplosion(); } m_bCreatedDebris = LTTRUE; if (m_bRemoveOnDeath) { pServerDE->RemoveObject(m_hObject); } } } break; case MID_TRIGGER: { const char* szMsg = (const char*)g_pLTServer->ReadFromMessageDWord(hRead); // ConParse does not destroy szMsg, so this is safe ConParse parse; parse.Init((char*)szMsg); while (g_pLTServer->Common()->Parse(&parse) == LT_OK) { if (parse.m_nArgs > 0 && parse.m_Args[0]) { if (!IsDead()) { if (_stricmp(parse.m_Args[0], "FIRE") == 0) { char* pTargetName = parse.m_nArgs > 1 ? parse.m_Args[1] : LTNULL; DoExplosion(pTargetName); } else if (_stricmp(parse.m_Args[0], "HIDDEN") == 0) { uint32 dwFlags = g_pLTServer->GetObjectFlags(m_hObject); if (parse.m_nArgs > 1 && parse.m_Args[1]) { if ((_stricmp(parse.m_Args[1], "1") == 0) || (_stricmp(parse.m_Args[1], "TRUE") == 0)) { dwFlags = 0; m_bSaveCanDamage = GetCanDamage(); m_bSaveNeverDestroy = GetNeverDestroy(); SetCanDamage(LTFALSE); SetNeverDestroy(LTTRUE); } else { if ((_stricmp(parse.m_Args[1], "0") == 0) || (_stricmp(parse.m_Args[1], "FALSE") == 0)) { dwFlags = m_dwOriginalFlags; dwFlags |= FLAG_VISIBLE; SetCanDamage(m_bSaveCanDamage); SetNeverDestroy(m_bSaveNeverDestroy); } } g_pLTServer->SetObjectFlags(m_hObject, dwFlags); } } } } } } break; default : break; } return dwRet; }
void CASW_Barrel_Explosive::ExplodeNow( const CTakeDamageInfo &info ) { Break( info.GetInflictor(), info ); DoExplosion(); }
//------------------------------------------------------------------------------ // I think I Pow! //------------------------------------------------------------------------------ void CQUAGrenadeHelicopter::ExplodeThink(void) { Vector vecVelocity; GetVelocity( &vecVelocity, NULL ); DoExplosion( GetAbsOrigin(), vecVelocity ); }