blob: 3a4a1c81378790c7b8bf227f4f380e1026345b38 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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 );
}
|