summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weapon_grenade_smoke_bomb.cpp
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/shared/tf/tf_weapon_grenade_smoke_bomb.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/shared/tf/tf_weapon_grenade_smoke_bomb.cpp')
-rw-r--r--game/shared/tf/tf_weapon_grenade_smoke_bomb.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/game/shared/tf/tf_weapon_grenade_smoke_bomb.cpp b/game/shared/tf/tf_weapon_grenade_smoke_bomb.cpp
new file mode 100644
index 0000000..a3b6ae3
--- /dev/null
+++ b/game/shared/tf/tf_weapon_grenade_smoke_bomb.cpp
@@ -0,0 +1,95 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: TF Gas Grenade.
+//
+//=============================================================================//
+#include "cbase.h"
+#include "tf_weaponbase.h"
+#include "tf_gamerules.h"
+#include "npcevent.h"
+#include "engine/IEngineSound.h"
+#include "tf_weapon_grenade_smoke_bomb.h"
+
+// Server specific.
+#ifdef GAME_DLL
+#include "tf_player.h"
+#include "items.h"
+#include "tf_weaponbase_grenadeproj.h"
+#include "soundent.h"
+#include "KeyValues.h"
+#include "particle_parse.h"
+#include "te_effect_dispatch.h"
+#endif
+
+//=============================================================================
+//
+// TF Smoke Bomb tables.
+//
+
+IMPLEMENT_NETWORKCLASS_ALIASED( TFGrenadeSmokeBomb, DT_TFGrenadeSmokeBomb )
+
+BEGIN_NETWORK_TABLE( CTFGrenadeSmokeBomb, DT_TFGrenadeSmokeBomb )
+END_NETWORK_TABLE()
+
+BEGIN_PREDICTION_DATA( CTFGrenadeSmokeBomb )
+END_PREDICTION_DATA()
+
+LINK_ENTITY_TO_CLASS( tf_weapon_grenade_smoke_bomb, CTFGrenadeSmokeBomb );
+PRECACHE_WEAPON_REGISTER( tf_weapon_grenade_smoke_bomb );
+
+//=============================================================================
+//
+// TF Smoke Bomb functions.
+//
+
+// Server specific.
+#ifdef GAME_DLL
+
+BEGIN_DATADESC( CTFGrenadeSmokeBomb )
+END_DATADESC()
+
+extern ConVar tf_smoke_bomb_time;
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+CTFWeaponBaseGrenadeProj *CTFGrenadeSmokeBomb::EmitGrenade( Vector vecSrc, QAngle vecAngles, Vector vecVel,
+ AngularImpulse angImpulse, CBasePlayer *pPlayer, float flTime, int iflags )
+{
+#if 0
+ CTFPlayer *pTFPlayer = ToTFPlayer( pPlayer );
+
+ if ( pTFPlayer )
+ {
+ CDisablePredictionFiltering disabler;
+
+ // Explosion effect on client
+ CEffectData explosionData;
+ explosionData.m_vOrigin = pPlayer->GetAbsOrigin();
+ explosionData.m_vAngles = pPlayer->GetAbsAngles();
+ explosionData.m_fFlags = GetWeaponID();
+// DispatchEffect( "TF_Explosion", explosionData );
+
+ // give them the smoke bomb condition
+ // ( invis for X seconds, able to move full speed )
+ // ( attacking removes the condition )
+
+ if ( pTFPlayer->CanGoInvisible() )
+ {
+ pTFPlayer->m_Shared.AddCond( TF_COND_SMOKE_BOMB, tf_smoke_bomb_time.GetFloat() );
+ }
+ }
+#endif
+
+ return NULL;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Don't explode automatically
+//-----------------------------------------------------------------------------
+bool CTFGrenadeSmokeBomb::ShouldDetonate( void )
+{
+ return false;
+}
+
+#endif // GAME_DLL