summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weapon_decoy.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_decoy.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_decoy.cpp')
-rw-r--r--game/shared/tf/tf_weapon_decoy.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/game/shared/tf/tf_weapon_decoy.cpp b/game/shared/tf/tf_weapon_decoy.cpp
new file mode 100644
index 0000000..21442b7
--- /dev/null
+++ b/game/shared/tf/tf_weapon_decoy.cpp
@@ -0,0 +1,68 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//
+//=============================================================================
+#include "cbase.h"
+#include "tf_weapon_decoy.h"
+
+
+#if !defined( CLIENT_DLL )
+ #include "tf_player.h"
+ #include "bot_npc/bot_npc_decoy.h"
+#else
+ #include "c_tf_player.h"
+#endif
+
+
+IMPLEMENT_NETWORKCLASS_ALIASED( TFDecoy, DT_WeaponDecoy )
+
+BEGIN_NETWORK_TABLE( CTFDecoy, DT_WeaponDecoy )
+END_NETWORK_TABLE()
+
+
+/*
+// Server specific.
+#ifndef CLIENT_DLL
+BEGIN_DATADESC( CTFDecoy )
+END_DATADESC()
+#endif
+*/
+
+LINK_ENTITY_TO_CLASS( tf_weapon_decoy, CTFDecoy );
+PRECACHE_WEAPON_REGISTER( tf_weapon_decoy );
+
+
+//-----------------------------------------------------------------------------
+CTFDecoy::CTFDecoy()
+{
+}
+
+
+//-----------------------------------------------------------------------------
+void CTFDecoy::PrimaryAttack( void )
+{
+ // Are we capable of firing again?
+ if ( m_flNextPrimaryAttack > gpGlobals->curtime )
+ return;
+
+#if !defined( CLIENT_DLL )
+ CTFPlayer *pOwner = ToTFPlayer( GetOwner() );
+ if ( !pOwner )
+ {
+ return;
+ }
+
+ if ( !CanAttack() )
+ return;
+
+ CBotNPCDecoy *decoy = (CBotNPCDecoy *)CreateEntityByName( "bot_npc_decoy" );
+ if ( decoy )
+ {
+ decoy->SetOwnerEntity( pOwner );
+ DispatchSpawn( decoy );
+
+ m_flNextPrimaryAttack = gpGlobals->curtime + 5.0f;
+ }
+#endif // CLIENT_DLL
+}
+