//----------------------------------------------------------------------------- // Purpose: // Input : *pEntity - //----------------------------------------------------------------------------- bool LookerCouldSeeTargetInDarkness( CBaseEntity *pLooker, CBaseEntity *pTarget ) { if ( DarknessLightSourcesSystem()->IsEntityVisibleToTarget( pLooker, pTarget ) ) { //NDebugOverlay::Line( pTarget->WorldSpaceCenter(), pLooker->WorldSpaceCenter(), 0,255,0,true, 0.1); return true; } return false; }
virtual void Activate() { if ( m_bDisabled == false ) { DarknessLightSourcesSystem()->AddLightSource( this, m_flLightRadius ); if ( g_debug_darkness.GetBool() ) { SetThink( &CInfoDarknessLightSource::DebugThink ); SetNextThink( gpGlobals->curtime ); } } BaseClass::Activate(); }
void InputDisable( inputdata_t &inputdata ) { DarknessLightSourcesSystem()->RemoveLightSource( this ); m_bDisabled = true; }
void InputEnable( inputdata_t &inputdata ) { DarknessLightSourcesSystem()->AddLightSource( this, m_flLightRadius ); m_bDisabled = false; }
virtual void UpdateOnRemove() { DarknessLightSourcesSystem()->RemoveLightSource( this ); BaseClass::UpdateOnRemove(); }
//----------------------------------------------------------------------------- // Purpose: Return true if there is at least 1 darkness light source within // the specified radius of the looker. //----------------------------------------------------------------------------- bool DarknessLightSourceWithinRadius( CBaseEntity *pLooker, float flRadius ) { return DarknessLightSourcesSystem()->AreThereLightSourcesWithinRadius( pLooker, flRadius ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CV_Debug_Darkness( ConVar *var, char const *pOldString ) { DarknessLightSourcesSystem()->SetDebug( var->GetBool() ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CV_Debug_Darkness( IConVar *pConVar, const char *pOldString, float flOldValue ) { ConVarRef var( pConVar ); DarknessLightSourcesSystem()->SetDebug( var.GetBool() ); }