//========= Copyright © 1996-2005, Sander Corporation, All rights reserved. ============//
//
// Purpose: A brush that will react on a mouse click, adds the npc of the rts player, 
//           and orders those to move to this brush to do something (trigger it).
//
// $NoKeywords: $
//=============================================================================//

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

#include "hl2wars/rts_shareddefs.h"

class CMouseRTSBrush : public CBaseEntity
{
public:
	DECLARE_CLASS( CMouseRTSBrush, CBaseEntity );

	DECLARE_SERVERCLASS();
	DECLARE_DATADESC();

	CMouseRTSBrush();
	void Spawn( void );
	//bool CreateVPhysics( void );

	//void PostClientActive( void );

	virtual void OnClickRight( CBasePlayer *pActivator );
	virtual void OnClickLeft( CBasePlayer *pActivator );

	virtual void OnClickRightDouble( CBasePlayer *pActivator );
	virtual void OnClickLeftDouble( CBasePlayer *pActivator );

	virtual void OnCursorEntered( CBasePlayer *pActivator );
	virtual void OnCursorExited( CBasePlayer *pActivator );

	// important for the mouse detection!
	virtual bool			IsRTSBrush( void ) const { return true; }

	// if we are not solid, we should be ignored by almost all tracing rules
	virtual bool					StandardFilterIgnoreMe( void ) { return !m_bSolid; }

	// Outputs
	COutputEvent m_OnClickRight;
	COutputEvent m_OnClickLeft;

	COutputEvent m_OnClickRightDouble;
	COutputEvent m_OnClickLeftDouble;

	COutputEvent m_OnCursorEntered;
	COutputEvent m_OnCursorExited;

	// input functions
	void InputEnable( inputdata_t &inputdata )
	{
		m_bDisabled = false;
	}

	void InputDisable( inputdata_t &inputdata )
	{
		m_bDisabled = true;
	}

	// the entity needs to be send to the client, so we can inform the player visual about the brush on mouse over.
    virtual int UpdateTransmitState()
	{
		return SetTransmitState( FL_EDICT_ALWAYS );
	}

	EHANDLE			m_hActivator;

	virtual int GetBrushType( void ) { return MOUSEBRUSH_BASIC; };

private:
	bool			m_bDisabled;

	CNetworkVar( float, m_fYawSelection );

	CNetworkVar( bool, m_bSolid );
	//bool m_bSolid;
	bool m_bVisible;
};

#endif // CMOUSERTSBRUSH_H