//===== Copyright © 1996-2005, Sander Corporation, All rights reserved. ========
//
// Purpose: 
//
//=============================================================================

#include "cbase.h"
#include "hl2wars/rts_shareddefs.h"

class CRTSFogGenerator : public CPointEntity
{
public:
	DECLARE_CLASS( CRTSFogGenerator , CPointEntity );
	DECLARE_DATADESC();
	DECLARE_SERVERCLASS();  // make this entity networkable

	// Constructor
	CRTSFogGenerator ( void );
	~CRTSFogGenerator ( void );

	void InputActivateFog( inputdata_t &inputdata );

	int UpdateTransmitState()	// set transmit filter to transmit always
	{
		return SetTransmitState( FL_EDICT_ALWAYS );
	}

private:
	CNetworkVar( float, m_fRadius );
	CNetworkVar( float, m_fDelay );
};

LINK_ENTITY_TO_CLASS( rts_foggenerator, CRTSFogGenerator  );
	
BEGIN_DATADESC( CRTSFogGenerator  )	
	DEFINE_KEYFIELD( m_fRadius, FIELD_FLOAT, "radius" ),	
	DEFINE_KEYFIELD( m_fDelay, FIELD_FLOAT, "delay" ),

	DEFINE_INPUTFUNC(FIELD_INTEGER, "InputActivateFog", InputActivateFog),
END_DATADESC()

IMPLEMENT_SERVERCLASS_ST( CRTSFogGenerator, DT_RTSFogGenerator )
	SendPropFloat	(SENDINFO(m_fRadius), 0, SPROP_NOSCALE),
	SendPropFloat	(SENDINFO(m_fDelay), 0, SPROP_NOSCALE),
END_SEND_TABLE()

CRTSFogGenerator::CRTSFogGenerator ()
{

}

CRTSFogGenerator::~CRTSFogGenerator ()
{
}

//------------------------------------------------------------------------------
// Purpose:
//------------------------------------------------------------------------------
void CRTSFogGenerator::InputActivateFog( inputdata_t &inputdata ) 
{
	// make sure it's an int, if it can't be converted just throw it away
	if ( !inputdata.value.Convert(FIELD_INTEGER) )
		return;

	EntityMessageBegin( this, true );
		WRITE_BYTE( inputdata.value.Int() );
	MessageEnd();
}
