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

#include "cbase.h"
#include "hl2wars/rts_client_brush.h"
#include "hl2_shareddefs.h"

LINK_ENTITY_TO_CLASS( rts_client_brush, CRTSClientBrush );

BEGIN_DATADESC( CRTSClientBrush )
	DEFINE_KEYFIELD( m_iLevel, FIELD_INTEGER, "level" ),
END_DATADESC()

//server data table describing networked member variables (SendProps)
IMPLEMENT_SERVERCLASS_ST( CRTSClientBrush, DT_RTSClientBrush )
	SendPropInt		(SENDINFO(m_iLevel), 3, SPROP_UNSIGNED ),
END_SEND_TABLE()


//-----------------------------------------------------------------------------
// Purpose: Called when spawning, after keyvalues have been handled.
//-----------------------------------------------------------------------------
void CRTSClientBrush::Spawn( )
{
	SetMoveType( MOVETYPE_NONE ); 
	//SetMoveType( MOVETYPE_PUSH );

	SetModel( STRING( GetModelName() ) );

	// If it can't move/go away, it's really part of the world
	if ( !GetEntityName() || !m_iParent )
		AddFlag( FL_WORLDBRUSH );

	SetSolid( SOLID_VPHYSICS );
	CreateVPhysics();
}

//-----------------------------------------------------------------------------

bool CRTSClientBrush::CreateVPhysics( void )
{
	VPhysicsInitStatic();

	// test
	/*IPhysicsObject *pPhys = VPhysicsInitShadow( false, false );
	if ( pPhys )
	{
		int contents = modelinfo->GetModelContents( GetModelIndex() );
		if ( ! (contents & (MASK_SOLID|MASK_PLAYERSOLID|MASK_NPCSOLID)) )
		{
			// leave the physics shadow there in case it has crap constrained to it
			// but disable collisions with it
			pPhys->EnableCollisions( false );
		}
	}*/

	return true;
}
