//----------------------------------------------------------------------------- // Purpose: Called everytime the player respawns //----------------------------------------------------------------------------- void CHL2WarsPlayer::Spawn( void ) { SetModel( "models/error.mdl" ); // Default faction if we have no faction selected yet if( m_FactionName == NULL_STRING ) { const char *pFaction = GetDefaultFaction() ? GetDefaultFaction() : "rebels" ; ChangeFaction(pFaction); } BaseClass::Spawn(); UpdateCameraSettings(); m_Local.m_iHideHUD |= HIDEHUD_UNIT; SetStrategicMode( true ); // Hook spawn to a signal #ifdef ENABLE_PYTHON if( SrcPySystem()->IsPythonRunning() ) { // Setup dict for sending a signal boost::python::dict kwargs; kwargs["sender"] = boost::python::object(); kwargs["player"] = GetPyHandle(); boost::python::object signal = SrcPySystem()->Get( "playerspawned", "core.signals", true ); SrcPySystem()->CallSignal( signal, kwargs ); } #endif // ENABLE_PYTHON }
void CASW_Bait::Spawn( void ) { Precache( ); SetModel( BAIT_MODEL ); UTIL_SetSize( this, Vector( -2, -2, -2 ), Vector( 2, 2, 2 ) ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_SOLID ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); m_takedamage = DAMAGE_NO; SetFriction( 0.6f ); m_flTimeBurnOut = gpGlobals->curtime + 30; AddEffects( EF_NOSHADOW|EF_NORECEIVESHADOW ); AddFlag( FL_OBJECT ); SetCollisionGroup( ASW_COLLISION_GROUP_IGNORE_NPCS ); //CreateVPhysics(); // Tumble in air QAngle vecAngVelocity( 0, random->RandomFloat ( -100, -500 ), 0 ); SetLocalAngularVelocity( vecAngVelocity ); SetTouch( &CASW_Bait::BaitTouch ); SetThink( &CASW_Bait::BaitThink ); // join the flares team so that aliens will hate us ChangeFaction( FACTION_BAIT ); if ( ASW_BAIT_LIFETIME > 0 ) { m_flTimeBurnOut = gpGlobals->curtime + ASW_BAIT_LIFETIME; } else { m_flTimeBurnOut = -1.0f; } SetNextThink( gpGlobals->curtime + 0.1f ); g_AI_SensedObjectsManager.AddEntity( this ); }