void CBaseDoor::DoorTouch( CBaseEntity *pOther ) { if( !FStringNull( m_iChainTarget )) ChainTouch( pOther ); m_bDoorTouched = true; // ignore touches by anything but players and pushables if( !pOther->IsPlayer() && !pOther->IsPushable()) return; m_hActivator = pOther; // remember who activated the door // If door has master, and it's not ready to trigger, // play 'locked' sound if( IsLockedByMaster( )) PlayLockSounds( pev, &m_ls, TRUE, FALSE ); // If door is somebody's target, then touching does nothing. // You have to activate the owner (e.g. button). // g-cont. but allow touch for chain doors if( !FStringNull( pev->targetname ) && FStringNull( m_iChainTarget )) { // play locked sound PlayLockSounds( pev, &m_ls, TRUE, FALSE ); return; } if( DoorActivate( )) { // temporarily disable the touch function, until movement is finished. SetTouch( NULL ); } }
//----------------------------------------------------------------------------- // Purpose: Doors not tied to anything (e.g. button, another door) can be touched, // to make them activate. // Input : *pOther - //----------------------------------------------------------------------------- void CBaseDoor::DoorTouch( CBaseEntity *pOther ) { if( m_ChainTarget != NULL_STRING ) ChainTouch( pOther ); // Ignore touches by anything but players. if ( !pOther->IsPlayer() ) { #ifdef HL1_DLL if( PassesBlockTouchFilter( pOther ) && m_toggle_state == TS_GOING_DOWN ) { DoorGoUp(); } #endif return; } // If door is not opened by touch, do nothing. if ( !HasSpawnFlags(SF_DOOR_PTOUCH) ) { #ifdef HL1_DLL if( m_toggle_state == TS_AT_BOTTOM ) { PlayLockSounds(this, &m_ls, TRUE, FALSE); } #endif//HL1_DLL return; } // If door has master, and it's not ready to trigger, // play 'locked' sound. if (m_sMaster != NULL_STRING && !UTIL_IsMasterTriggered(m_sMaster, pOther)) { PlayLockSounds(this, &m_ls, TRUE, FALSE); } if (m_bLocked) { m_OnLockedUse.FireOutput( pOther, pOther ); PlayLockSounds(this, &m_ls, TRUE, FALSE); return; } // Remember who activated the door. m_hActivator = pOther; if (DoorActivate( )) { // Temporarily disable the touch function, until movement is finished. SetTouch( NULL ); } }