diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/hl2/rotorwash.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/server/hl2/rotorwash.cpp')
| -rw-r--r-- | game/server/hl2/rotorwash.cpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/game/server/hl2/rotorwash.cpp b/game/server/hl2/rotorwash.cpp new file mode 100644 index 0000000..10c6a1a --- /dev/null +++ b/game/server/hl2/rotorwash.cpp @@ -0,0 +1,103 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#include "cbase.h" +#include "rotorwash.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +// ============================================== +// Rotorwash entity +// ============================================== + +class CRotorWashEmitter : public CBaseEntity +{ +public: + DECLARE_CLASS( CRotorWashEmitter, CBaseEntity ); + DECLARE_SERVERCLASS(); + DECLARE_DATADESC(); + + void SetAltitude( float flAltitude ) { m_flAltitude = flAltitude; } + void SetEmit( bool state ) { m_bEmit = state; } + void Spawn ( void ); + void Precache( void ); + int ShouldTransmit( const CCheckTransmitInfo *pInfo ); + int UpdateTransmitState( void ); + +protected: + + CNetworkVar( bool, m_bEmit ); + CNetworkVar( float, m_flAltitude ); +}; + +IMPLEMENT_SERVERCLASS_ST( CRotorWashEmitter, DT_RotorWashEmitter ) + SendPropFloat(SENDINFO(m_flAltitude), -1, SPROP_NOSCALE ), +END_SEND_TABLE() + +LINK_ENTITY_TO_CLASS( env_rotorwash_emitter, CRotorWashEmitter ); + +BEGIN_DATADESC( CRotorWashEmitter ) + DEFINE_FIELD( m_bEmit, FIELD_BOOLEAN ), + DEFINE_KEYFIELD( m_flAltitude, FIELD_FLOAT, "altitude" ), +END_DATADESC() + +void CRotorWashEmitter::Spawn( void ) +{ + Precache(); + BaseClass::Spawn(); + SetEmit( false ); +} + +void CRotorWashEmitter::Precache( void ) +{ + PrecacheMaterial( "effects/splashwake3" ); +} + +int CRotorWashEmitter::ShouldTransmit( const CCheckTransmitInfo *pInfo ) +{ + if ( GetParent() ) + { + return GetParent()->ShouldTransmit( pInfo ); + } + + return FL_EDICT_PVSCHECK; +} + +int CRotorWashEmitter::UpdateTransmitState( void ) +{ + if ( GetParent() ) + { + return SetTransmitState( FL_EDICT_FULLCHECK ); + } + + return SetTransmitState( FL_EDICT_PVSCHECK ); +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : &localOrigin - +// &localAngles - +// *pOwner - +// flAltitude - +// Output : CBaseEntity +//----------------------------------------------------------------------------- +CBaseEntity *CreateRotorWashEmitter( const Vector &localOrigin, const QAngle &localAngles, CBaseEntity *pOwner, float flAltitude ) +{ + CRotorWashEmitter *pEmitter = (CRotorWashEmitter *) CreateEntityByName( "env_rotorwash_emitter" ); + + if ( pEmitter == NULL ) + return NULL; + + pEmitter->SetAbsOrigin( localOrigin ); + pEmitter->SetAbsAngles( localAngles ); + pEmitter->FollowEntity( pOwner ); + + pEmitter->SetAltitude( flAltitude ); + pEmitter->SetEmit( false ); + + return pEmitter; +}
\ No newline at end of file |