From 8c01f8754ff0b82db430272eee88a8f25e5e070c Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sun, 24 Nov 2019 23:32:48 +0500 Subject: [PATCH] Add trigger_playerfreeze. --- dlls/triggers.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 2c0888c9..01dddb85 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -2039,6 +2039,26 @@ void CTriggerGravity::GravityTouch( CBaseEntity *pOther ) pOther->pev->gravity = pev->gravity; } +class CTriggerPlayerFreeze : public CBaseDelay +{ +public: + void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); + int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; } +}; + +LINK_ENTITY_TO_CLASS( trigger_playerfreeze, CTriggerPlayerFreeze ) + +void CTriggerPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) +{ + if( !pActivator || !pActivator->IsPlayer() ) + pActivator = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) ); + + if( pActivator->pev->flags & FL_FROZEN ) + ( (CBasePlayer*)( pActivator ) )->EnableControl( TRUE ); + else + ( (CBasePlayer*)( pActivator ) )->EnableControl( FALSE ); +}; + // this is a really bad idea. class CTriggerChangeTarget : public CBaseDelay {