summaryrefslogtreecommitdiff
path: root/game/server/dod/dod_basegrenade.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/dod/dod_basegrenade.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/dod/dod_basegrenade.h')
-rw-r--r--game/server/dod/dod_basegrenade.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/game/server/dod/dod_basegrenade.h b/game/server/dod/dod_basegrenade.h
new file mode 100644
index 0000000..2af0d7a
--- /dev/null
+++ b/game/server/dod/dod_basegrenade.h
@@ -0,0 +1,106 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#ifndef DOD_BASEGRENADE_H
+#define DOD_BASEGRENADE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "weapon_dodbase.h"
+#include "basegrenade_shared.h"
+
+class CGrenadeTrail;
+
+class CGrenadeController : public IMotionEvent
+{
+ DECLARE_SIMPLE_DATADESC();
+public:
+ virtual simresult_e Simulate( IPhysicsMotionController *pController, IPhysicsObject *pObject, float deltaTime, Vector &linear, AngularImpulse &angular );
+};
+
+class CDODBaseGrenade : public CBaseGrenade
+{
+public:
+ DECLARE_CLASS( CDODBaseGrenade, CBaseGrenade );
+
+ DECLARE_DATADESC();
+
+ DECLARE_SERVERCLASS();
+
+ CDODBaseGrenade();
+ virtual ~CDODBaseGrenade();
+
+ virtual void Spawn();
+ virtual void Precache( void );
+
+ static inline float GetGrenadeGravity() { return 0.4f; }
+ static inline const float GetGrenadeFriction() { return 0.5f; }
+ static inline const float GetGrenadeElasticity() { return 0.2f; }
+
+ void DetonateThink( void );
+
+ virtual void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
+
+ virtual char *GetExplodingClassname( void );
+
+ virtual int ObjectCaps( void ) { return BaseClass::ObjectCaps() | FCAP_IMPULSE_USE | FCAP_USE_IN_RADIUS; }
+
+ virtual int OnTakeDamage( const CTakeDamageInfo &info );
+
+ virtual void Detonate();
+
+ bool CreateVPhysics();
+ virtual void VPhysicsUpdate( IPhysicsObject *pPhysics );
+ virtual void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent );
+
+ virtual void Explode( trace_t *pTrace, int bitsDamageType );
+
+ void SetupInitialTransmittedGrenadeVelocity( const Vector &velocity )
+ {
+ m_vInitialVelocity = velocity;
+ }
+
+ CGrenadeController m_GrenadeController;
+ IPhysicsMotionController *m_pMotionController;
+
+ virtual bool CanBePickedUp( void ) { return true; }
+
+ virtual void OnPickedUp( void ) {}
+
+ virtual float GetElasticity();
+
+ virtual DODWeaponID GetEmitterWeaponID() { return m_EmitterWeaponID; }
+
+protected:
+
+ //Set the time to detonate ( now + timer )
+ virtual void SetDetonateTimerLength( float timer );
+ float m_flDetonateTime;
+
+ //Custom collision to allow for constant elasticity on hit surfaces
+ virtual void ResolveFlyCollisionCustom( trace_t &trace, Vector &vecVelocity );
+
+ bool m_bUseVPhysics;
+
+ DODWeaponID m_EmitterWeaponID;
+
+private:
+
+ CDODBaseGrenade( const CDODBaseGrenade & );
+
+ bool m_bInSolid;
+
+ // This gets sent to the client and placed in the client's interpolation history
+ // so the projectile starts out moving right off the bat.
+ CNetworkVector( m_vInitialVelocity );
+
+ float m_flCollideWithTeammatesTime;
+ bool m_bCollideWithTeammates;
+};
+
+
+#endif // DOD_BASEGRENADE_H