//----------------------------------------------------------------------------- // Purpose: // Input : *pHandleEntity - // contentsMask - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CASW_Trace_Filter_Doors::ShouldHitEntity( IHandleEntity *pHandleEntity, int contentsMask ) { if ( !StandardFilterRules( pHandleEntity, contentsMask ) ) return false; // Don't test if the game code tells us we should ignore this collision... CBaseEntity *pEntity = EntityFromEntityHandle( pHandleEntity ); const CBaseEntity *pEntPass = EntityFromEntityHandle( m_pPassEnt ); // don't hurt ourself if ( pEntPass == pEntity ) return false; if ( !pEntity || pEntity->Classify() != CLASS_ASW_DOOR ) return false; CASW_Door *pDoor = assert_cast<CASW_Door*>( pEntity ); if ( !pDoor ) return false; if ( m_bRequireLockedOrSealed ) { if ( pDoor->GetSealAmount() > 0 || !pDoor->IsAutoOpen() ) { return true; } else { return false; } } return true; }
void CASW_Button_Area::UpdateWaitingForInput() { bool bOldWaitingForInput = m_bWaitingForInput; bool bSet = false; if ( m_bIsDoorButton ) { CASW_Door *pDoor = GetDoor(); if ( pDoor && pDoor->IsAutoOpen() ) { m_bWaitingForInput = false; bSet = true; } } if ( !bSet ) { m_bWaitingForInput = ASWGameRules()->GetGameState() == ASW_GS_INGAME && ( !m_bNoPower && !m_bIsInUse && ( m_bIsLocked || ( !m_bWasLocked && m_fLastButtonUseTime == 0 ) ) ); } if ( !bOldWaitingForInput && m_bWaitingForInput ) { VisibilityMonitor_AddEntity( this, asw_visrange_generic.GetFloat() * 0.9f, &CASW_Button_Area::WaitingForInputVismonCallback, &CASW_Button_Area::WaitingForInputVismonEvaluator ); } else if ( bOldWaitingForInput && !m_bWaitingForInput ) { VisibilityMonitor_RemoveEntity( this ); IGameEvent * event = gameeventmanager->CreateEvent( "button_area_inactive" ); if ( event ) { event->SetInt( "entindex", entindex() ); gameeventmanager->FireEvent( event ); } } }