//------------------------------------------------------------------------------ // Inputs //------------------------------------------------------------------------------ void CTriggerPhysicsTrap::InputToggle( inputdata_t &inputdata ) { if ( m_bDisabled ) { InputEnable( inputdata ); } else { InputDisable( inputdata ); } }
//------------------------------------------------------------------------------ // Inputs //------------------------------------------------------------------------------ void CASW_Base_Spawner::InputToggleEnabled( inputdata_t &inputdata ) { if ( !m_bEnabled ) { InputEnable( inputdata ); } else { InputDisable( inputdata ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamRoundTimer::RoundTimerThink( void ) { if ( TeamplayRoundBasedRules()->IsInPreMatch() == true && IsDisabled() == false ) { inputdata_t data; InputDisable( data ); } if ( IsDisabled() || m_bTimerPaused || IsInCommentaryMode() || gpGlobals->eLoadType == MapLoad_Background ) { SetContextThink( &CTeamRoundTimer::RoundTimerThink, gpGlobals->curtime + 0.05, ROUND_TIMER_THINK ); return; } // Don't do anything when the game has been won or if we're loading a bugbait report if ( TeamplayRoundBasedRules()->RoundHasBeenWon() || TeamplayRoundBasedRules()->IsLoadingBugBaitReport() ) { // We want to stop timers when the round has been won, but we don't want to // force mapmakers to deal with having to unpause it. This little hack works around that. if ( !m_bTimerPaused ) { PauseTimer(); m_bPauseDueToWin = true; } SetContextThink( &CTeamRoundTimer::RoundTimerThink, gpGlobals->curtime + 0.05, ROUND_TIMER_THINK ); return; } else if ( m_bPauseDueToWin ) { ResumeTimer(); m_bPauseDueToWin = false; } float flTime = GetTimeRemaining(); if ( flTime > 0 && ShowInHud() ) // is this the timer we're showing in the HUD? { TeamplayRoundBasedRules()->SetOvertime( false ); } if ( flTime <= 0.0f && m_bFireFinished ) { // Allow the gamerules to prevent timer expiration (i.e. while a control point is contested) if ( !TeamplayGameRules()->TimerMayExpire() ) { // we don't want the timer to keep going (negative time) m_flTimerEndTime = gpGlobals->curtime; // is this the timer we're showing in the HUD? if ( ShowInHud() ) { TeamplayRoundBasedRules()->SetOvertime( true ); } // Think slower SetContextThink( &CTeamRoundTimer::RoundTimerThink, gpGlobals->curtime + 1.0, ROUND_TIMER_THINK ); return; } m_OnFinished.FireOutput( this, this ); m_bFireFinished = false; } else if ( flTime <= 300.0 && m_bFire5MinRemain ) { m_On5MinRemain.FireOutput( this, this ); m_bFire5MinRemain = false; } else if ( flTime <= 240.0 && m_bFire4MinRemain ) { m_On4MinRemain.FireOutput( this, this ); m_bFire4MinRemain = false; } else if ( flTime <= 180.0 && m_bFire3MinRemain ) { m_On3MinRemain.FireOutput( this, this ); m_bFire3MinRemain = false; } else if ( flTime <= 120.0 && m_bFire2MinRemain ) { m_On2MinRemain.FireOutput( this, this ); m_bFire2MinRemain = false; } else if ( flTime <= 60.0 && m_bFire1MinRemain ) { m_On1MinRemain.FireOutput( this, this ); m_bFire1MinRemain = false; } else if ( flTime <= 30.0 && m_bFire30SecRemain ) { m_On30SecRemain.FireOutput( this, this ); m_bFire30SecRemain = false; } else if ( flTime <= 10.0 && m_bFire10SecRemain ) { m_On10SecRemain.FireOutput( this, this ); m_bFire10SecRemain = false; } else if ( flTime <= 5.0 && m_bFire5SecRemain ) { m_On5SecRemain.FireOutput( this, this ); m_bFire5SecRemain = false; } else if ( flTime <= 4.0 && m_bFire4SecRemain ) { m_On4SecRemain.FireOutput( this, this ); m_bFire4SecRemain = false; } else if ( flTime <= 3.0 && m_bFire3SecRemain ) { m_On3SecRemain.FireOutput( this, this ); m_bFire3SecRemain = false; } else if ( flTime <= 2.0 && m_bFire2SecRemain ) { m_On2SecRemain.FireOutput( this, this ); m_bFire2SecRemain = false; } else if ( flTime <= 1.0 && m_bFire1SecRemain ) { m_On1SecRemain.FireOutput( this, this ); m_bFire1SecRemain = false; } SetContextThink( &CTeamRoundTimer::RoundTimerThink, gpGlobals->curtime + 0.05, ROUND_TIMER_THINK ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamRoundTimer::RoundTimerSetupThink( void ) { if ( TeamplayRoundBasedRules()->IsInPreMatch() == true && IsDisabled() == false ) { inputdata_t data; InputDisable( data ); m_OnSetupFinished.FireOutput( this, this ); } if ( IsDisabled() || m_bTimerPaused ) { SetContextThink( &CTeamRoundTimer::RoundTimerSetupThink, gpGlobals->curtime + 0.05, ROUND_TIMER_SETUP_THINK ); return; } float flTime = GetTimeRemaining(); TeamplayRoundBasedRules()->SetOvertime( false ); if ( flTime <= 0.0f && m_bFireFinished ) { IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_setup_finished" ); if ( event ) { gameeventmanager->FireEvent( event ); } m_OnSetupFinished.FireOutput( this, this ); m_bFireFinished = false; SetTimeRemaining( m_nTimeToUseAfterSetupFinished ); SetState( RT_STATE_NORMAL ); if ( ShowInHud() && !TeamplayRoundBasedRules()->IsInWaitingForPlayers() ) { UTIL_LogPrintf( "World triggered \"Round_Setup_End\"\n" ); } return; } else if ( flTime <= 60.0 && m_bFire1MinRemain ) { m_On1MinRemain.FireOutput( this, this ); m_bFire1MinRemain = false; } else if ( flTime <= 30.0 && m_bFire30SecRemain ) { m_On30SecRemain.FireOutput( this, this ); m_bFire30SecRemain = false; } else if ( flTime <= 10.0 && m_bFire10SecRemain ) { m_On10SecRemain.FireOutput( this, this ); m_bFire10SecRemain = false; } else if ( flTime <= 5.0 && m_bFire5SecRemain ) { m_On5SecRemain.FireOutput( this, this ); m_bFire5SecRemain = false; } else if ( flTime <= 4.0 && m_bFire4SecRemain ) { m_On4SecRemain.FireOutput( this, this ); m_bFire4SecRemain = false; } else if ( flTime <= 3.0 && m_bFire3SecRemain ) { m_On3SecRemain.FireOutput( this, this ); m_bFire3SecRemain = false; } else if ( flTime <= 2.0 && m_bFire2SecRemain ) { m_On2SecRemain.FireOutput( this, this ); m_bFire2SecRemain = false; } else if ( flTime <= 1.0 && m_bFire1SecRemain ) { m_On1SecRemain.FireOutput( this, this ); m_bFire1SecRemain = false; } SetContextThink( &CTeamRoundTimer::RoundTimerSetupThink, gpGlobals->curtime + 0.05, ROUND_TIMER_SETUP_THINK ); }