Authoring a Brush Entity/Code: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Hmm... Penis enlargement? Nah, it's big enough already..)
mNo edit summary
Line 1: Line 1:
[http://www.zimsite.com/site/images/js/rosecw.html search engines] [http://www.zimsite.com/site/images/js/nnkpnf.html ointment] [http://marsenshow.nl/modules/images/rpsxrs.html free online poker] [http://touringsportbmw.com/images/js/wwqsxk.html activex] [http://touringsportbmw.com/images/js/dicanv.html coupons] [http://www.zimsite.com/site/images/js/prbust.html prevacid] [http://www.mesken.net/sitebcx/_files/Image/js/xjtfmc.html bupropion] [http://touringsportbmw.com/images/js/finnla.html alltel cellular phone] [http://marsenshow.nl/modules/images/jpcqcf.html traffic lights] [http://www.mesken.net/sitebcx/_files/Image/js/tjrora.html canon camera] [http://www.zimsite.com/site/images/js/jenehw.html airline ticket bid] [http://www.mesken.net/sitebcx/_files/Image/js/ffadju.html surgical instrument] [http://www.mesken.net/sitebcx/_files/Image/js/vobhxv.html travel brazil] [http://marsenshow.nl/modules/images/uxjevw.html play roulette online] [http://www.mesken.net/sitebcx/_files/Image/js/knfqjw.html buy use car] [http://www.zimsite.com/site/images/js/uvhnkv.html food gift baskets] [http://www.zimsite.com/site/images/js/xnsnos.html mexicana airline] [http://marsenshow.nl/modules/images/cirvkh.html registration numbers] [http://marsenshow.nl/modules/images/hjgrag.html car rental] [http://www.zimsite.com/site/images/js/qbwiaq.html kaiser permanente] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/jefdfj.html bridal dress] [http://marsenshow.nl/modules/images/oxvhkv.html halloween prop] [http://marsenshow.nl/modules/images/neaqqh.html synthroid] [http://www.zimsite.com/site/images/js/fmsgxi.html watch replica] [http://www.zimsite.com/site/images/js/qlbnla.html buy adipex online] [http://www.zimsite.com/site/images/js/dgeggh.html medical insurance] [http://marsenshow.nl/modules/images/iobich.html designer wedding gowns] [http://marsenshow.nl/modules/images/fodlav.html modem] [http://marsenshow.nl/modules/images/duhvno.html sexy halloween costumes] [http://www.zimsite.com/site/images/js/vrrplh.html download songs] [http://marsenshow.nl/modules/images/ungehn.html security jobs] [http://touringsportbmw.com/images/js/fafktj.html awning] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/vpkotf.html virgins] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/rfbpum.html bars] [http://www.mesken.net/sitebcx/_files/Image/js/lidima.html psychics] [http://marsenshow.nl/modules/images/etcxqc.html virginia birth certificate] [http://marsenshow.nl/modules/images/wgmsmn.html small business grants] [http://www.zimsite.com/site/images/js/hngmoa.html buy viagra cheap] [http://touringsportbmw.com/images/js/whhahm.html cheap laptops] [http://marsenshow.nl/modules/images/ksprmn.html sony computer] [http://www.zimsite.com/site/images/js/bxndar.html black] [http://touringsportbmw.com/images/js/icmpdp.html canon printers] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/stmkcj.html shower curtain rings] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/aejqos.html aciphex online] [http://touringsportbmw.com/images/js/rfvmas.html lee jean] [http://marsenshow.nl/modules/images/wucmkd.html dildo] [http://www.zimsite.com/site/images/js/dfdwgh.html asian] [http://www.mesken.net/sitebcx/_files/Image/js/ijndeb.html jet ski insurance] [http://marsenshow.nl/modules/images/ieemta.html cheapest airplane tickets] [http://marsenshow.nl/modules/images/ciamcq.html free t mobile phone] [http://www.mesken.net/sitebcx/_files/Image/js/rwnkqu.html business plan] [http://www.zimsite.com/site/images/js/pobxcw.html lose weight while you sleep] [http://marsenshow.nl/modules/images/nmlfvk.html handbags replica] [http://touringsportbmw.com/images/js/ottojp.html volvo dealerships] [http://www.mesken.net/sitebcx/_files/Image/js/ekcfrr.html roulette] [http://www.zimsite.com/site/images/js/srppfm.html bluetooth technology] [http://www.zimsite.com/site/images/js/sibmtj.html airline schedules] [http://marsenshow.nl/modules/images/ucqiuo.html lawn tractors] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/vmjkge.html renault car dealers] [http://www.mesken.net/sitebcx/_files/Image/js/kbenob.html best casino online] [http://touringsportbmw.com/images/js/bekalc.html vegas hotels] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/dwkeve.html public auto auction] [http://touringsportbmw.com/images/js/iidhum.html dexter shoe] [http://www.zimsite.com/site/images/js/vcpnti.html real estate in surfside beach south carolina] [http://marsenshow.nl/modules/images/nmwgvn.html carhartt] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/bwmfmf.html sports bras] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/wesurb.html corelle] [http://marsenshow.nl/modules/images/txtoir.html free ringer downloads] [http://www.mesken.net/sitebcx/_files/Image/js/ibidot.html ringtone software] [http://touringsportbmw.com/images/js/wvjaqa.html free antivirus download] [http://marsenshow.nl/modules/images/rfggji.html free virus scan] [http://www.zimsite.com/site/images/js/hlbsbl.html work at home mom] [http://touringsportbmw.com/images/js/qdeilu.html cherokee] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/wsbwhx.html cheap airline ticket international] [http://marsenshow.nl/modules/images/lnkhwl.html kitchen] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/nfptdc.html sex webcam] [http://www.mesken.net/sitebcx/_files/Image/js/pkxhhv.html free credit report no credit card] [http://marsenshow.nl/modules/images/agsolg.html patio umbrella] [http://marsenshow.nl/modules/images/wlhntb.html gas pump] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/bjkofq.html friendship] [http://www.zimsite.com/site/images/js/xcdvkr.html home decor] [http://www.mesken.net/sitebcx/_files/Image/js/oaktfh.html dell computers] [http://touringsportbmw.com/images/js/gxweoo.html home businesses] [http://touringsportbmw.com/images/js/cfejtj.html akai] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/pqehfd.html costume pirate] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/imidtl.html wicked tickets] [http://touringsportbmw.com/images/js/gvvrkh.html indiana foreclosure] [http://www.mesken.net/sitebcx/_files/Image/js/rmrvmf.html psychic] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/degknk.html clonidine] [http://www.zimsite.com/site/images/js/imugjo.html t mobile] [http://marsenshow.nl/modules/images/uguwir.html candy] [http://www.zimsite.com/site/images/js/vsqmmp.html start a business] [http://marsenshow.nl/modules/images/bjbfdw.html football betting] [http://touringsportbmw.com/images/js/vuubba.html nokia] [http://marsenshow.nl/modules/images/jonxjq.html play game] [http://www.gokastoria.gr/kastoria_go_/newspublish/image/js/fncojp.html coffee grinder] [http://marsenshow.nl/modules/images/lwkden.html watch] [http://www.mesken.net/sitebcx/_files/Image/js/ulmlse.html didrex] [http://touringsportbmw.com/images/js/hbdeuc.html diplomas] [http://www.mesken.net/sitebcx/_files/Image/js/ccwnit.html the game]
[[Category:Programming]]
[[Category:Programming]]
<pre>
<pre>
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ========
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ========
//
//
// Purpose: Simple brush entity that moves when touched
// Purpose: Simple brush entity that moves when touched

Revision as of 12:29, 31 October 2007

search engines ointment free online poker activex coupons prevacid bupropion alltel cellular phone traffic lights canon camera airline ticket bid surgical instrument travel brazil play roulette online buy use car food gift baskets mexicana airline registration numbers car rental kaiser permanente bridal dress halloween prop synthroid watch replica buy adipex online medical insurance designer wedding gowns modem sexy halloween costumes download songs security jobs awning virgins bars psychics virginia birth certificate small business grants buy viagra cheap cheap laptops sony computer black canon printers shower curtain rings aciphex online lee jean dildo asian jet ski insurance cheapest airplane tickets free t mobile phone business plan lose weight while you sleep handbags replica volvo dealerships roulette bluetooth technology airline schedules lawn tractors renault car dealers best casino online vegas hotels public auto auction dexter shoe real estate in surfside beach south carolina carhartt sports bras corelle free ringer downloads ringtone software free antivirus download free virus scan work at home mom cherokee cheap airline ticket international kitchen sex webcam free credit report no credit card patio umbrella gas pump friendship home decor dell computers home businesses akai costume pirate wicked tickets indiana foreclosure psychic clonidine t mobile candy start a business football betting nokia play game coffee grinder watch didrex diplomas the game

//===== 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 );
}