summaryrefslogtreecommitdiff
path: root/game/server/tf2/trigger_fall.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/tf2/trigger_fall.cpp
downloadarchived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz
archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip
Diffstat (limited to 'game/server/tf2/trigger_fall.cpp')
-rw-r--r--game/server/tf2/trigger_fall.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/game/server/tf2/trigger_fall.cpp b/game/server/tf2/trigger_fall.cpp
new file mode 100644
index 0000000..3a4a1c8
--- /dev/null
+++ b/game/server/tf2/trigger_fall.cpp
@@ -0,0 +1,72 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Used at the bottom of maps where objects should fall away to infinity
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "cbase.h"
+#include "triggers.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: Used at the bottom of maps where objects should fall away to infinity
+//-----------------------------------------------------------------------------
+class CTriggerFall : public CBaseTrigger
+{
+ DECLARE_CLASS( CTriggerFall, CBaseTrigger );
+public:
+ void Spawn( void );
+ void FallTouch( CBaseEntity *pOther );
+
+ DECLARE_DATADESC();
+
+ // Outputs
+ COutputEvent m_OnFallingObject;
+};
+
+BEGIN_DATADESC( CTriggerFall )
+
+ // Function Pointers
+ DEFINE_FUNCTION( FallTouch ),
+
+ // Outputs
+ DEFINE_OUTPUT( m_OnFallingObject, "OnFallingObject" ),
+
+END_DATADESC()
+
+
+LINK_ENTITY_TO_CLASS( trigger_fall, CTriggerFall );
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Called when spawning, after keyvalues have been handled.
+//-----------------------------------------------------------------------------
+void CTriggerFall::Spawn( void )
+{
+ BaseClass::Spawn();
+ InitTrigger();
+ SetTouch( FallTouch );
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Make the object fall away
+// Input : pOther - The entity that is touching us.
+//-----------------------------------------------------------------------------
+void CTriggerFall::FallTouch( CBaseEntity *pOther )
+{
+ // If it's a player, just kill him for now
+ if ( pOther->IsPlayer() )
+ {
+ if ( pOther->IsAlive() == false )
+ return;
+
+ pOther->TakeDamage( CTakeDamageInfo( this, this, 200, DMG_FALL ) );
+ }
+ else
+ {
+ // Just remove the entity
+ UTIL_Remove( pOther );
+ }
+
+ // Fire our output
+ m_OnFallingObject.FireOutput( pOther, this );
+}