aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/server/env_player_surface_trigger.h
blob: 96eb0810d9c7982cad6da80d64df75ffae645526 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#ifndef ENV_PLAYER_SURFACE_TRIGGER_H
#define ENV_PLAYER_SURFACE_TRIGGER_H
#ifdef _WIN32
#pragma once
#endif

#include "baseentity.h"
#include "entityoutput.h"

//-----------------------------------------------------------------------------
// Purpose: Entity that fires outputs whenever the player stands on a different surface
//-----------------------------------------------------------------------------
class CEnvPlayerSurfaceTrigger : public CPointEntity
{
	DECLARE_CLASS( CEnvPlayerSurfaceTrigger, CPointEntity );
public:
	DECLARE_DATADESC();

	~CEnvPlayerSurfaceTrigger( void );
	void	Spawn( void );
	void	OnRestore( void );

	// Main interface to all surface triggers
	static void	SetPlayerSurface( CBasePlayer *pPlayer, char gameMaterial );

	void	UpdateMaterialThink( void );

private:
	void	PlayerSurfaceChanged( CBasePlayer *pPlayer, char gameMaterial );
	void	InputDisable( inputdata_t &inputdata );
	void	InputEnable( inputdata_t &inputdata );

private:
	int		m_iTargetGameMaterial;
	int		m_iCurrentGameMaterial;
	bool	m_bDisabled;

	// Outputs
	COutputEvent m_OnSurfaceChangedToTarget;
	COutputEvent m_OnSurfaceChangedFromTarget;
};

#endif // ENV_PLAYER_SURFACE_TRIGGER_H