//----------------------------------------------------------------------------- // Teleport the passed player to our destination //----------------------------------------------------------------------------- void CObjectTeleporter_Entrance::TeleporterSend( CTFPlayer *pPlayer ) { if ( !pPlayer ) return; SetTeleportingPlayer( pPlayer ); pPlayer->m_Shared.AddCond( TF_COND_SELECTED_TO_TELEPORT ); Vector origin = GetAbsOrigin(); CPVSFilter filter( origin ); switch( pPlayer->GetTeamNumber() ) { case TF_TEAM_RED: TE_TFParticleEffect( filter, 0.0, "teleported_red", origin, vec3_angle ); TE_TFParticleEffect( filter, 0.0, "player_sparkles_red", origin, vec3_angle, pPlayer, PATTACH_POINT ); break; case TF_TEAM_BLUE: TE_TFParticleEffect( filter, 0.0, "teleported_blue", origin, vec3_angle ); TE_TFParticleEffect( filter, 0.0, "player_sparkles_blue", origin, vec3_angle, pPlayer, PATTACH_POINT ); break; default: break; } EmitSound( "Building_Teleporter.Send" ); SetState( TELEPORTER_STATE_SENDING ); m_flMyNextThink = gpGlobals->curtime + 0.1; m_iTimesUsed++; }
//----------------------------------------------------------------------------- // Teleport the passed player to our destination //----------------------------------------------------------------------------- void CObjectTeleporter::TeleporterSend( CTFPlayer *pPlayer ) { if ( !pPlayer ) return; SetTeleportingPlayer( pPlayer ); pPlayer->m_Shared.AddCond( TF_COND_SELECTED_TO_TELEPORT ); Vector origin = GetAbsOrigin(); CPVSFilter filter( origin ); int iTeam = pPlayer->GetTeamNumber(); if ( pPlayer->m_Shared.InCond( TF_COND_DISGUISED ) ) { iTeam = pPlayer->m_Shared.GetDisguiseTeam(); } const char *pszTeleportedEffect = ConstructTeamParticle( "teleported_%s", iTeam ); const char *pszSparklesEffect = ConstructTeamParticle( "player_sparkles_%s", iTeam ); TE_TFParticleEffect( filter, 0.0, pszTeleportedEffect, origin, vec3_angle ); TE_TFParticleEffect( filter, 0.0, pszSparklesEffect, origin, vec3_angle, pPlayer, PATTACH_POINT ); EmitSound( "Building_Teleporter.Send" ); SetState( TELEPORTER_STATE_SENDING ); m_flMyNextThink = gpGlobals->curtime + 0.1; m_iTimesUsed++; }
//----------------------------------------------------------------------------- // Receive a teleporting player //----------------------------------------------------------------------------- void CObjectTeleporter_Exit::TeleporterReceive( CTFPlayer *pPlayer, float flDelay ) { if ( !pPlayer ) return; SetTeleportingPlayer( pPlayer ); Vector origin = GetAbsOrigin(); CPVSFilter filter( origin ); switch( pPlayer->GetTeamNumber() ) { case TF_TEAM_RED: TE_TFParticleEffect( filter, 0.0, "teleportedin_red", origin, vec3_angle ); break; case TF_TEAM_BLUE: TE_TFParticleEffect( filter, 0.0, "teleportedin_blue", origin, vec3_angle ); break; default: break; } EmitSound( "Building_Teleporter.Receive" ); SetState( TELEPORTER_STATE_RECEIVING ); m_flMyNextThink = gpGlobals->curtime + BUILD_TELEPORTER_FADEOUT_TIME; m_iTimesUsed++; }
ActionResult<CTFBot> CTFBotMvMEngineerTeleportSpawn::Update(CTFBot *actor, float dt) { if (!this->m_ctPushAway.HasStarted()) { this->m_ctPushAway.Start(0.1f); if (this->m_hintEntity != nullptr) { TFGameRules()->PushAllPlayersAway(this->m_hintEntity->GetAbsOrigin(), 400.0f, 500.0f, TF_TEAM_RED, nullptr); } return ActionResult<CTFBot>::Continue(); } if (!this->m_ctPushAway.IsElapsed()) { return ActionResult<CTFBot>::Continue(); } if (this->m_hintEntity == nullptr) { return ActionResult<CTFBot>::Done("Cannot teleport to hint as m_hintEntity is NULL"); } Vector tele_pos = this->m_hintEntity->GetAbsOrigin(); QAngle tele_ang = this->m_hintEntity->GetAbsAngles(); actor->Teleport(tele_pos, tele_ang, nullptr); CPVSFilter filter(tele_pos); TE_TFParticleEffect(filter, 0.0f, "teleported_blue", tele_pos, vec3_angle); TE_TFParticleEffect(filter, 0.0f, "player_sparkles_blue", tele_pos, vec3_angle); if (this->m_bNonSilent) { TE_TFParticleEffect(filter, 0.0f, "teleported_mvm_bot", tele_pos, vec3_angle); actor->EmitSound("Engineer.MvM_BattleCry07"); this->m_hintEntity->EmitSound("MvM.Robot_Engineer_Spawn"); if (g_pPopulationManager != nullptr) { CWave *wave = g_pPopulationManager->GetCurrentWave(); if (wave != nullptr) { if (wave->m_iEngiesTeleportedIn == 0) { TFGameRules()->BroadcastSound(255, "Announcer.MvM_First_Engineer_Teleport_Spawned"); } else { TFGameRules()->BroadcastSound(255, "Announcer.MvM_Another_Engineer_Teleport_Spawned"); } ++wave->m_iEngiesTeleportedIn; } } } return ActionResult<CTFBot>::Done("Teleported"); }
//----------------------------------------------------------------------------- // Receive a teleporting player //----------------------------------------------------------------------------- void CObjectTeleporter::TeleporterReceive( CTFPlayer *pPlayer, float flDelay ) { if ( !pPlayer ) return; SetTeleportingPlayer( pPlayer ); Vector origin = GetAbsOrigin(); CPVSFilter filter( origin ); int iTeam = pPlayer->GetTeamNumber(); if ( pPlayer->m_Shared.InCond( TF_COND_DISGUISED ) ) { iTeam = pPlayer->m_Shared.GetDisguiseTeam(); } const char *pszEffectName = ConstructTeamParticle( "teleportedin_%s", iTeam ); TE_TFParticleEffect( filter, 0.0, pszEffectName, origin, vec3_angle ); EmitSound( "Building_Teleporter.Receive" ); SetState( TELEPORTER_STATE_RECEIVING ); m_flMyNextThink = gpGlobals->curtime + BUILD_TELEPORTER_FADEOUT_TIME; if ( pPlayer != GetBuilder() ) m_iTimesUsed++; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void TE_TFParticleEffect( IRecipientFilter &filter, float flDelay, const char *pszParticleName, ParticleAttachment_t iAttachType, CBaseEntity *pEntity, const char *pszAttachmentName, bool bResetAllParticlesOnEntity ) { int iAttachment = -1; if ( pEntity && pEntity->GetBaseAnimating() ) { // Find the attachment point index iAttachment = pEntity->GetBaseAnimating()->LookupAttachment( pszAttachmentName ); if ( iAttachment == -1 ) { Warning("Model '%s' doesn't have attachment '%s' to attach particle system '%s' to.\n", STRING(pEntity->GetBaseAnimating()->GetModelName()), pszAttachmentName, pszParticleName ); return; } } TE_TFParticleEffect( filter, flDelay, pszParticleName, iAttachType, pEntity, iAttachment, bResetAllParticlesOnEntity ); }
//----------------------------------------------------------------------------- // Purpose: Yet another overload, lets us supply vecStart //----------------------------------------------------------------------------- void TE_TFParticleEffect( IRecipientFilter &filter, float flDelay, const char *pszParticleName, Vector vecOrigin, Vector vecStart, QAngle vecAngles, CBaseEntity *pEntity ) { int iIndex = GetParticleSystemIndex( pszParticleName ); TE_TFParticleEffect( filter, flDelay, iIndex, vecOrigin, vecStart, vecAngles, pEntity ); }