void CGameText::Display( CBaseEntity *pActivator ) { if ( !CanFireForActivator( pActivator ) ) return; #ifdef SecobMod__Enable_Fixed_Multiplayer_AI // also send to all if we haven't got a specific activator player to send to if ( MessageToAll() || !pActivator || !pActivator->IsPlayer() ) #else if ( MessageToAll() ) #endif //SecobMod__Enable_Fixed_Multiplayer_AI if ( MessageToAll() ) { UTIL_HudMessageAll( m_textParms, MessageGet() ); } else { #ifdef SecobMod__Enable_Fixed_Multiplayer_AI UTIL_HudMessage( ToBasePlayer( pActivator ), m_textParms, MessageGet() ); #else // If we're in singleplayer, show the message to the player. if ( gpGlobals->maxClients == 1 ) { CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); UTIL_HudMessage( pPlayer, m_textParms, MessageGet() ); } // Otherwise show the message to the player that triggered us. else if ( pActivator && pActivator->IsNetClient() ) { UTIL_HudMessage( ToBasePlayer( pActivator ), m_textParms, MessageGet() ); } #endif //SecobMod__Enable_Fixed_Multiplayer_AI } }
void CGameEnd::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !CanFireForActivator( pActivator ) ) return; g_pGameRules->EndMultiplayerGame(); }
void CGameText::Display( CBaseEntity *pActivator ) { if ( !CanFireForActivator( pActivator ) ) return; char fontbuf[48]; FontGet(fontbuf); if ( MessageToAll() ) { UTIL_HudMessageAll( m_textParms, MessageGet(), fontbuf ); } else { // If we're in singleplayer, show the message to the player. if ( gpGlobals->maxClients == 1 ) { CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); UTIL_HudMessage( pPlayer, m_textParms, MessageGet(), fontbuf ); } // Otherwise show the message to the player that triggered us. else if ( pActivator && pActivator->IsNetClient() ) { UTIL_HudMessage( ToBasePlayer( pActivator ), m_textParms, MessageGet(), fontbuf ); } } }
void CGameCounter::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) return; switch (useType) { case USE_ON: case USE_TOGGLE: CountUp(); break; case USE_OFF: CountDown(); break; case USE_SET: SetCountValue((int)value); break; } if (HitLimit()) { SUB_UseTargets(pActivator, USE_TOGGLE, 0); if (RemoveOnFire()) { UTIL_Remove(this); } if (ResetOnFire()) { ResetCount(); } } }
void CGameTeamMaster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if( !CanFireForActivator( pActivator ) ) return; if( useType == USE_SET ) { if( value < 0 ) { m_teamIndex = -1; } else { m_teamIndex = g_pGameRules->GetTeamIndex( pActivator->TeamID() ); } return; } if( TeamMatch( pActivator ) ) { SUB_UseTargets( pActivator, triggerType, value ); if( RemoveOnFire() ) UTIL_Remove( this ); } }
void CGamePlayerEquip::Touch( CBaseEntity *pOther ) { if ( !CanFireForActivator( pOther ) ) return; if ( UseOnly() ) return; EquipPlayer( pOther ); }
void CGamePlayerZone::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int playersInCount = 0; int playersOutCount = 0; if (!CanFireForActivator(pActivator)) return; CBaseEntity *pPlayer = NULL; for (int i = 1; i <= gpGlobals->maxClients; i++) { pPlayer = UTIL_PlayerByIndex(i); if (pPlayer) { TraceResult trace; int hullNumber; hullNumber = human_hull; if (pPlayer->pev->flags & FL_DUCKING) { hullNumber = head_hull; } UTIL_TraceModel(pPlayer->pev->origin, pPlayer->pev->origin, hullNumber, edict(), &trace); if (trace.fStartSolid) { playersInCount++; if (m_iszInTarget) { FireTargets(STRING(m_iszInTarget), pPlayer, pActivator, useType, value); } } else { playersOutCount++; if (m_iszOutTarget) { FireTargets(STRING(m_iszOutTarget), pPlayer, pActivator, useType, value); } } } } if (m_iszInCount) { FireTargets(STRING(m_iszInCount), pActivator, this, USE_SET, playersInCount); } if (m_iszOutCount) { FireTargets(STRING(m_iszOutCount), pActivator, this, USE_SET, playersOutCount); } }
void CGameText::Display( CBaseEntity *pActivator ) { if ( !CanFireForActivator( pActivator ) ) return; // also send to all if we haven't got a specific activator player to send to if ( MessageToAll() || !pActivator || !pActivator->IsPlayer() ) UTIL_HudMessageAll( m_textParms, MessageGet() ); else UTIL_HudMessage( ToBasePlayer( pActivator ), m_textParms, MessageGet() ); }
void CGameCounterSet::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) return; SUB_UseTargets(pActivator, USE_SET, pev->frags); if (RemoveOnFire()) { UTIL_Remove(this); } }
void CGameText::Display( CBaseEntity *pActivator ) { if ( !CanFireForActivator( pActivator ) ) return; if (MessageToAll() || !pActivator || !pActivator->IsPlayer()) { UTIL_HudMessageAll( m_textParms, MessageGet() ); } else { UTIL_HudMessage(ToBasePlayer(pActivator), m_textParms, MessageGet()); } }
void CGameText::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!CanFireForActivator(pActivator)) return; if (MessageToAll()) { UTIL_HudMessageAll(m_textParms, MessageGet()); } else { if (pActivator->IsNetClient()) { UTIL_HudMessage(pActivator, m_textParms, MessageGet()); } } }
void CGameScore::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !CanFireForActivator( pActivator ) ) return; // Only players can use this if ( pActivator->IsPlayer() ) { if ( AwardToTeam() ) { pActivator->AddPointsToTeam( Points(), AllowNegativeScore() ); } else { pActivator->AddPoints( Points(), AllowNegativeScore() ); } } }
void CGameTeamSet::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if( !CanFireForActivator( pActivator ) ) return; if( ShouldClearTeam() ) { SUB_UseTargets( pActivator, USE_SET, -1 ); } else { SUB_UseTargets( pActivator, USE_SET, 0 ); } if( RemoveOnFire() ) { UTIL_Remove( this ); } }
//----------------------------------------------------------------------------- // Purpose: Counts all the players in the zone. Fires one output per player // in the zone, one output per player out of the zone, and outputs // with the total counts of players in and out of the zone. //----------------------------------------------------------------------------- void CGamePlayerZone::InputCountPlayersInZone( inputdata_t &inputdata ) { int playersInCount = 0; int playersOutCount = 0; if ( !CanFireForActivator( inputdata.pActivator ) ) return; CBaseEntity *pPlayer = NULL; for ( int i = 1; i <= gpGlobals->maxClients; i++ ) { pPlayer = UTIL_PlayerByIndex( i ); if ( pPlayer ) { trace_t trace; Hull_t hullType; hullType = HULL_HUMAN; if ( pPlayer->GetFlags() & FL_DUCKING ) { hullType = HULL_SMALL_CENTERED; } UTIL_TraceModel( pPlayer->GetAbsOrigin(), pPlayer->GetAbsOrigin(), NAI_Hull::Mins(hullType), NAI_Hull::Maxs(hullType), this, COLLISION_GROUP_NONE, &trace ); if ( trace.startsolid ) { playersInCount++; m_OnPlayerInZone.FireOutput(pPlayer, this); } else { playersOutCount++; m_OnPlayerOutZone.FireOutput(pPlayer, this); } } } m_PlayersInCount.Set(playersInCount, inputdata.pActivator, this); m_PlayersOutCount.Set(playersOutCount, inputdata.pActivator, this); }
void CGamePlayerTeam::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !CanFireForActivator( pActivator ) ) return; if ( pActivator->IsPlayer() ) { const char *pszTargetTeam = TargetTeamName( STRING(m_target), pActivator ); if ( pszTargetTeam ) { CBasePlayer *pPlayer = (CBasePlayer *)pActivator; g_pGameRules->ChangePlayerTeam( pPlayer, pszTargetTeam, ShouldKillPlayer(), ShouldGibPlayer() ); } } if ( RemoveOnFire() ) { UTIL_Remove( this ); } }
void CGamePlayerHurt::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if( !CanFireForActivator( pActivator ) ) return; if( pActivator->IsPlayer() ) { if( GetDamage() < 0 ) pActivator->GiveHealth( -GetDamage(), DMG_GENERIC ); else pActivator->TakeDamage( this, this, GetDamage(), DMG_GENERIC ); } SUB_UseTargets( pActivator, useType, value ); if( RemoveOnFire() ) { UTIL_Remove( this ); } }
void CGameScore::InputApplyScore( inputdata_t &inputdata ) { CBaseEntity *pActivator = inputdata.pActivator; if ( pActivator == NULL ) return; if ( CanFireForActivator( pActivator ) == false ) return; // Only players can use this if ( pActivator->IsPlayer() ) { if ( AwardToTeam() ) { pActivator->AddPointsToTeam( Points(), AllowNegativeScore() ); } else { pActivator->AddPoints( Points(), AllowNegativeScore() ); } } }