summaryrefslogtreecommitdiff
path: root/game/server/cstrike/func_bomb_target.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/server/cstrike/func_bomb_target.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/cstrike/func_bomb_target.cpp')
-rw-r--r--game/server/cstrike/func_bomb_target.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/game/server/cstrike/func_bomb_target.cpp b/game/server/cstrike/func_bomb_target.cpp
new file mode 100644
index 0000000..a85d646
--- /dev/null
+++ b/game/server/cstrike/func_bomb_target.cpp
@@ -0,0 +1,84 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Bomb target area
+//
+//=============================================================================//
+
+#include "cbase.h"
+#include "cs_player.h"
+#include "func_bomb_target.h"
+#include "cs_gamerules.h"
+
+LINK_ENTITY_TO_CLASS( func_bomb_target, CBombTarget );
+
+BEGIN_DATADESC( CBombTarget )
+ DEFINE_FUNCTION( BombTargetTouch ),
+ DEFINE_FUNCTION( BombTargetUse ), //needed?
+
+ // Inputs
+ DEFINE_INPUTFUNC( FIELD_VOID, "BombExplode", OnBombExplode ),
+ DEFINE_INPUTFUNC( FIELD_VOID, "BombPlanted", OnBombPlanted ),
+ DEFINE_INPUTFUNC( FIELD_VOID, "BombDefused", OnBombDefused ),
+
+ // Outputs
+ DEFINE_OUTPUT( m_OnBombExplode, "BombExplode" ),
+ DEFINE_OUTPUT( m_OnBombPlanted, "BombPlanted" ),
+ DEFINE_OUTPUT( m_OnBombDefused, "BombDefused" ),
+ DEFINE_KEYFIELD( m_bIsHeistBombTarget, FIELD_BOOLEAN, "heistbomb" ),
+ DEFINE_KEYFIELD( m_szMountTarget, FIELD_STRING, "bomb_mount_target" ),
+
+END_DATADESC()
+
+CBombTarget::CBombTarget( void )
+{
+ m_bIsHeistBombTarget = false;
+ m_szMountTarget = NULL_STRING;
+}
+
+void CBombTarget::Spawn()
+{
+ InitTrigger();
+ SetTouch( &CBombTarget::BombTargetTouch );
+ SetUse( &CBombTarget::BombTargetUse );
+}
+
+void CBombTarget::BombTargetTouch( CBaseEntity* pOther )
+{
+ CCSPlayer *p = dynamic_cast< CCSPlayer* >( pOther );
+ if ( p )
+ {
+ if ( p->HasC4() && CSGameRules()->m_bBombPlanted == false )
+ {
+ p->m_bInBombZone = true;
+ p->m_iBombSiteIndex = entindex();
+ if ( !(p->m_iDisplayHistoryBits & DHF_IN_TARGET_ZONE) )
+ {
+ p->HintMessage( "#Hint_you_are_in_targetzone", false );
+ p->m_iDisplayHistoryBits |= DHF_IN_TARGET_ZONE;
+ }
+ }
+ }
+}
+
+void CBombTarget::BombTargetUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
+{
+ //SUB_UseTargets( NULL, USE_TOGGLE, 0 );
+ DevMsg( 2, "BombTargetUse does nothing\n" );
+}
+
+// Relay to our outputs
+void CBombTarget::OnBombExplode( inputdata_t &inputdata )
+{
+ m_OnBombExplode.FireOutput(this, this);
+}
+
+// Relay to our outputs
+void CBombTarget::OnBombPlanted( inputdata_t &inputdata )
+{
+ m_OnBombPlanted.FireOutput(this, this);
+}
+// Relay to our outputs
+void CBombTarget::OnBombDefused( inputdata_t &inputdata )
+{
+ m_OnBombDefused.FireOutput(this, this);
+} \ No newline at end of file