|
|
|
@ -135,71 +135,22 @@ LINK_ENTITY_TO_CLASS(trigger_geneworm_hit, CTriggerMultiple);
@@ -135,71 +135,22 @@ LINK_ENTITY_TO_CLASS(trigger_geneworm_hit, CTriggerMultiple);
|
|
|
|
|
// CPlayerFreeze
|
|
|
|
|
//=========================================================
|
|
|
|
|
|
|
|
|
|
class CPlayerFreeze : public CBaseDelay |
|
|
|
|
class CTriggerPlayerFreeze : public CBaseDelay |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
void Spawn(void); |
|
|
|
|
void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); |
|
|
|
|
|
|
|
|
|
virtual int Save(CSave &save); |
|
|
|
|
virtual int Restore(CRestore &restore); |
|
|
|
|
static TYPEDESCRIPTION m_SaveData[]; |
|
|
|
|
|
|
|
|
|
EHANDLE m_hPlayer; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
LINK_ENTITY_TO_CLASS(trigger_playerfreeze, CPlayerFreeze); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TYPEDESCRIPTION CPlayerFreeze::m_SaveData[] = |
|
|
|
|
{ |
|
|
|
|
DEFINE_FIELD(CPlayerFreeze, m_hPlayer, FIELD_EHANDLE), |
|
|
|
|
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); |
|
|
|
|
int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
IMPLEMENT_SAVERESTORE(CPlayerFreeze, CBaseDelay); |
|
|
|
|
LINK_ENTITY_TO_CLASS( trigger_playerfreeze, CTriggerPlayerFreeze ) |
|
|
|
|
|
|
|
|
|
void CPlayerFreeze::Spawn(void) |
|
|
|
|
void CTriggerPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) |
|
|
|
|
{ |
|
|
|
|
CBaseDelay::Spawn(); |
|
|
|
|
if( !pActivator || !pActivator->IsPlayer() ) |
|
|
|
|
pActivator = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) ); |
|
|
|
|
|
|
|
|
|
m_hPlayer.Set(NULL); |
|
|
|
|
|
|
|
|
|
CBaseEntity* pPlayer = UTIL_PlayerByIndex( 1 ); |
|
|
|
|
|
|
|
|
|
if (pPlayer) |
|
|
|
|
{ |
|
|
|
|
m_hPlayer = pPlayer; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CPlayerFreeze::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) |
|
|
|
|
{ |
|
|
|
|
CBaseEntity* pPlayer = NULL; |
|
|
|
|
|
|
|
|
|
if (!m_hPlayer.Get()) |
|
|
|
|
{ |
|
|
|
|
CBaseEntity* pPlayer = UTIL_PlayerByIndex(1); |
|
|
|
|
|
|
|
|
|
if (pPlayer) |
|
|
|
|
{ |
|
|
|
|
m_hPlayer = pPlayer; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (m_hPlayer.Get()) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
ASSERT(m_hPlayer != NULL); |
|
|
|
|
#endif |
|
|
|
|
m_hPlayer->pev->movetype = (m_hPlayer->pev->movetype == MOVETYPE_NONE) |
|
|
|
|
? MOVETYPE_WALK |
|
|
|
|
: MOVETYPE_NONE; |
|
|
|
|
} |
|
|
|
|
if( pActivator && (pActivator->pev->flags & FL_FROZEN) ) |
|
|
|
|
( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( TRUE ); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
ALERT(at_console, "ERROR: Couldn't find player entity.\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SetThink(&CPlayerFreeze::SUB_Remove); |
|
|
|
|
pev->nextthink = gpGlobals->time; |
|
|
|
|
} |
|
|
|
|
( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( FALSE ); |
|
|
|
|
} |
|
|
|
|