Authoring a Brush Entity/Code

From Valve Developer Community
Jump to navigation Jump to search

here sweet tits britney spears hardcore apartment building financing guano apes mp3 ultimate messy directory gangbang sqaud home san jose grand prix home nudist pic isle of palms home bj wholesale nude pictures free incestcartoons jasmine porn smooth girl sexual stamina chicago commercial real estate free gagging on cum movies big black bitches homes las vegas realty fly fishing trips country boys maui whale watching tours free adult video chat manga girl first line drugs strep throat soft porn old man sex moms can fuck home rectal temperature free wired pussy horny spanish flies here habanos cigars starry eyed surprise crafts for kids kelley clarkson cream pie pussy map porn star movies page have a little faith in me jersey shore vacation rentals underage nude models gearfetish russian lesbian mom and boy bionca map aaaa very young nude perv hot asian porn adult bed wetting dwarf sex page chill out gay bang page map banging bus adult vod fit tv sports illustrated swimsuit models trx450r fkk bilder xxxpics shape poems non surgical face lift aloe vera product freeteenporn sheryl crow naked no exam life insurance sucking clit atlanta apartments livejasmin milf finder naked soccer moms moorhuhn3 sheep sex map mom and daughter sex page actresses naked girls in panties buster xl ht guys fingering girls wholesale pet products kids next door porn sexual transmitted disease male images close up cunt belly dance costumes free lesbian video innocent pussy hot black teens

//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ========
//
// Purpose: Simple brush entity that moves when touched
//
//=============================================================================

#include "cbase.h"

class CMyBrushEntity : public CBaseToggle
{
public:
	DECLARE_CLASS( CMyBrushEntity, CBaseToggle );
	DECLARE_DATADESC();

	void Spawn( void );
	bool CreateVPhysics( void );

	void BrushTouch( CBaseEntity *pOther );
};

LINK_ENTITY_TO_CLASS( my_brush_entity, CMyBrushEntity );

// Start of our data description for the class
BEGIN_DATADESC( CMyBrushEntity )
	
	// Declare this function as being a touch function
	DEFINE_ENTITYFUNC( BrushTouch ),

END_DATADESC()

//-----------------------------------------------------------------------------
// Purpose: Sets up the entity's initial state
//-----------------------------------------------------------------------------
void CMyBrushEntity::Spawn( void )
{
	// We want to capture touches from other entities
	SetTouch( &CMyBrushEntity::BrushTouch );

	// We should collide with physics
	SetSolid( SOLID_VPHYSICS );
	
	// We push things out of our way
	SetMoveType( MOVETYPE_PUSH );
	
	// Use our brushmodel
	SetModel( STRING( GetModelName() ) );

	// Create our physics hull information
	CreateVPhysics();
}

//-----------------------------------------------------------------------------
// Purpose: Setup our physics information so we collide properly
//-----------------------------------------------------------------------------
bool CMyBrushEntity::CreateVPhysics( void )
{
	// For collisions with physics objects
	VPhysicsInitShadow( false, false );

	return true;
}

//-----------------------------------------------------------------------------
// Purpose: Move away from an entity that touched us
// Input  : *pOther - the entity we touched
//-----------------------------------------------------------------------------
void CMyBrushEntity::BrushTouch( CBaseEntity *pOther )
{
	// Get the collision information
	const trace_t &tr = GetTouchTrace();

	// We want to move away from the impact point along our surface
	Vector	vecPushDir = tr.plane.normal;
	vecPushDir.Negate();
	vecPushDir.z = 0.0f;

	// Move slowly in that direction
	LinearMove( GetAbsOrigin() + ( vecPushDir * 64.0f ), 32.0f );
}