当前位置: 首页>>代码示例>>C++>>正文


C++ UTIL_Remove函数代码示例

本文整理汇总了C++中UTIL_Remove函数的典型用法代码示例。如果您正苦于以下问题:C++ UTIL_Remove函数的具体用法?C++ UTIL_Remove怎么用?C++ UTIL_Remove使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了UTIL_Remove函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UTIL_Remove

void CPlayerBall::RemovePlayerBall()
{
	UTIL_Remove(this);
}
开发者ID:rain2372,项目名称:IOS-1,代码行数:4,代码来源:player_ball.cpp

示例2: SetNextThink


//.........这里部分代码省略.........
// player's PVS, but this could be opposite of what we
// really want. We may only want to conduct the cleanup on
// weapons that are IN the player's PVS.
//---------------------------------------------------------
void CGameWeaponManager::Think()
{
    int i;

    // Don't have to think all that often.
    SetNextThink( gpGlobals->curtime + 2.0 );

    const char *pszWeaponName = STRING( m_iszWeaponName );

    CUtlVector<CBaseEntity *> candidates( 0, 64 );

    if ( m_bExpectingWeapon )
    {
        CBaseCombatWeapon *pWeapon = NULL;
        // Firstly, count the total number of weapons of this type in the world.
        // Also count how many of those can potentially be removed.
        pWeapon = assert_cast<CBaseCombatWeapon *>(gEntList.FindEntityByClassname( pWeapon, pszWeaponName ));

        while( pWeapon )
        {
            if( !pWeapon->IsEffectActive( EF_NODRAW ) && pWeapon->IsRemoveable() )
            {
                candidates.AddToTail( pWeapon );
            }

            pWeapon = assert_cast<CBaseCombatWeapon *>(gEntList.FindEntityByClassname( pWeapon, pszWeaponName ));
        }
    }
    else
    {
        for ( i = 0; i < m_ManagedNonWeapons.Count(); i++)
        {
            CBaseEntity *pEntity = m_ManagedNonWeapons[i];
            if ( pEntity )
            {
                Assert( pEntity->m_iClassname == m_iszWeaponName );
                if ( !pEntity->IsEffectActive( EF_NODRAW ) )
                {
                    candidates.AddToTail( pEntity );
                }
            }
            else
            {
                m_ManagedNonWeapons.FastRemove( i-- );
            }
        }
    }

    // Calculate the surplus.
    int surplus = candidates.Count() - m_iMaxPieces;

    // Based on what the player can see, try to clean up the world by removing weapons that
    // the player cannot see right at the moment.
    CBaseEntity *pCandidate;
    for ( i = 0; i < candidates.Count() && surplus > 0; i++ )
    {
        bool fRemovedOne = false;

        pCandidate = candidates[i];
        Assert( !pCandidate->IsEffectActive( EF_NODRAW ) );

        if ( gpGlobals->maxClients == 1 )
        {
            CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
            // Nodraw serves as a flag that this weapon is already being removed since
            // all we're really doing inside this loop is marking them for removal by
            // the entity system. We don't want to count the same weapon as removed
            // more than once.
            if( !UTIL_FindClientInPVS( pCandidate->edict() ) )
            {
                fRemovedOne = true;
            }
            else if( !pPlayer->FInViewCone( pCandidate ) )
            {
                fRemovedOne = true;
            }
            else if ( UTIL_DistApprox( pPlayer->GetAbsOrigin(), pCandidate->GetAbsOrigin() ) > (30*12) )
            {
                fRemovedOne = true;
            }
        }
        else
        {
            fRemovedOne = true;
        }

        if( fRemovedOne )
        {
            pCandidate->AddEffects( EF_NODRAW );
            UTIL_Remove( pCandidate );

            DevMsg( 2, "Surplus %s removed\n", pszWeaponName);
            surplus--;
        }
    }
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:101,代码来源:gameweaponmanager.cpp

示例3: UTIL_Remove

void CTankProj::Killed (entvars_t *pevAttacker, int iGib)
{
	UTIL_Remove( this );
}
开发者ID:mittorn,项目名称:hlwe_src,代码行数:4,代码来源:proj_tankproj.cpp

示例4: HandleAnimEvent


//.........这里部分代码省略.........
			{
				EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, m_voicePitch );
			}
		}
		break;

		case ISLAVE_AE_ZAP_POWERUP:
		{
			// speed up attack when on hard
			if (g_iSkillLevel == SKILL_HARD)
				pev->framerate = 1.5;

			UTIL_MakeAimVectors( pev->angles );

			if (m_iBeams == 0)
			{
				Vector vecSrc = pev->origin + gpGlobals->v_forward * 2;
				MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
					WRITE_BYTE(TE_DLIGHT);
					WRITE_COORD(vecSrc.x);	// X
					WRITE_COORD(vecSrc.y);	// Y
					WRITE_COORD(vecSrc.z);	// Z
					WRITE_BYTE( 12 );		// radius * 0.1
					WRITE_BYTE( 255 );		// r
					WRITE_BYTE( 180 );		// g
					WRITE_BYTE( 96 );		// b
					WRITE_BYTE( 20 / pev->framerate );		// time * 10
					WRITE_BYTE( 0 );		// decay * 0.1
				MESSAGE_END( );

			}
			if (m_hDead != 0)
			{
				WackBeam( -1, m_hDead );
				WackBeam( 1, m_hDead );
			}
			else
			{
				ArmBeam( -1 );
				ArmBeam( 1 );
				BeamGlow( );
			}

			EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0, 100 + m_iBeams * 10 );
			pev->skin = m_iBeams / 2;
		}
		break;

		case ISLAVE_AE_ZAP_SHOOT:
		{
			ClearBeams( );

			if (m_hDead != 0)
			{
				Vector vecDest = m_hDead->pev->origin + Vector( 0, 0, 38 );
				TraceResult trace;
				UTIL_TraceHull( vecDest, vecDest, dont_ignore_monsters, human_hull, m_hDead->edict(), &trace );

				if ( !trace.fStartSolid )
				{
					CBaseEntity *pNew = Create( "monster_alien_slave", m_hDead->pev->origin, m_hDead->pev->angles );
					pNew->pev->spawnflags |= 1;
					WackBeam( -1, pNew );
					WackBeam( 1, pNew );
					UTIL_Remove( m_hDead );
					EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "hassault/hw_shoot1.wav", 1, ATTN_NORM, 0, RANDOM_LONG( 130, 160 ) );

					/*
					CBaseEntity *pEffect = Create( "test_effect", pNew->Center(), pev->angles );
					pEffect->Use( this, this, USE_ON, 1 );
					*/
					break;
				}
			}
			ClearMultiDamage();

			UTIL_MakeAimVectors( pev->angles );

			ZapBeam( -1 );
			ZapBeam( 1 );

			EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "hassault/hw_shoot1.wav", 1, ATTN_NORM, 0, RANDOM_LONG( 130, 160 ) );
			// STOP_SOUND( ENT(pev), CHAN_WEAPON, "debris/zap4.wav" );
			ApplyMultiDamage(pev, pev);

			m_flNextAttack = gpGlobals->time + RANDOM_FLOAT( 0.5, 4.0 );
		}
		break;

		case ISLAVE_AE_ZAP_DONE:
		{
			ClearBeams( );
		}
		break;

		default:
			CSquadMonster::HandleAnimEvent( pEvent );
			break;
	}
}
开发者ID:Skumek,项目名称:hlsdk,代码行数:101,代码来源:islave.cpp

示例5: ClientPrint

// Pickup backpack
BOOL CItemBackpack::MyTouch( CBasePlayer *pPlayer )
{
	if (pPlayer->pev->health <= 0)
		return FALSE;
	if (gpGlobals->deathmatch == 4 && pPlayer->m_flInvincibleFinished > 0)
		return FALSE;


 
	if (gpGlobals->deathmatch == 4)
	{       
		pPlayer->pev->health += 10;
		ClientPrint( pPlayer->pev, HUD_PRINTNOTIFY, "#Additional_Health" );
		if ((pPlayer->pev->health > 250) && (pPlayer->pev->health < 300))
			EMIT_SOUND( ENT(pPlayer->pev), CHAN_ITEM, "items/protect3.wav", 1, ATTN_NORM );
		else
			EMIT_SOUND( ENT(pPlayer->pev), CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM );
		
		// Become invulnerable if the player's reached 300 health
		if (pPlayer->pev->health > 299)
		{               
			if (pPlayer->m_flInvincibleFinished == 0)
			{                       
				// Give player invincibility and quad
				pPlayer->m_flInvincibleFinished = gpGlobals->time + 30;
				pPlayer->m_flSuperDamageFinished = gpGlobals->time + 30;
				pPlayer->m_iQuakeItems |= (IT_INVULNERABILITY | IT_QUAD);
				pPlayer->m_iAmmoCells = 0;		

				// Make player glow red
				pPlayer->pev->renderfx = kRenderFxGlowShell;
				pPlayer->pev->rendercolor = Vector( 255, 128, 0 );	// RGB
				pPlayer->pev->renderamt = 100;	// Shell size

				EMIT_SOUND( ENT(pPlayer->pev), CHAN_VOICE, "items/sight1.wav", 1, ATTN_NORM );
				UTIL_ClientPrintAll( HUD_PRINTNOTIFY, "#Bonus_Power", STRING(pPlayer->pev->netname) );
			}
		}

		UTIL_Remove( this );

		// We've removed ourself, so don't let CQuakeItem handle respawn
		return FALSE;
	}

	// Get the weapon from the pack
	if (m_iItems)
	{
		if ( !(pPlayer->m_iQuakeItems & m_iItems) )
		{
			switch ( m_iItems )
			{
			case IT_SUPER_SHOTGUN:
				ClientPrint( pPlayer->pev, HUD_PRINTNOTIFY, "#You_Get_SS", UTIL_dtos1( ammo_shells ), UTIL_dtos2 ( ammo_nails ), UTIL_dtos3 ( ammo_rockets ), UTIL_dtos4 ( ammo_cells ) ); break;
			case IT_NAILGUN:
				ClientPrint( pPlayer->pev, HUD_PRINTNOTIFY, "#You_Get_NG", UTIL_dtos1( ammo_shells ), UTIL_dtos2 ( ammo_nails ), UTIL_dtos3 ( ammo_rockets ), UTIL_dtos4 ( ammo_cells ) ); break;
			case IT_SUPER_NAILGUN:
				ClientPrint( pPlayer->pev, HUD_PRINTNOTIFY, "#You_Get_SG", UTIL_dtos1( ammo_shells ), UTIL_dtos2 ( ammo_nails ), UTIL_dtos3 ( ammo_rockets ), UTIL_dtos4 ( ammo_cells ) ); break;
			case IT_GRENADE_LAUNCHER:
				ClientPrint( pPlayer->pev, HUD_PRINTNOTIFY, "#You_Get_GL", UTIL_dtos1( ammo_shells ), UTIL_dtos2 ( ammo_nails ), UTIL_dtos3 ( ammo_rockets ), UTIL_dtos4 ( ammo_cells ) ); break;
			case IT_ROCKET_LAUNCHER:
				ClientPrint( pPlayer->pev, HUD_PRINTNOTIFY, "#You_Get_RL", UTIL_dtos1( ammo_shells ), UTIL_dtos2 ( ammo_nails ), UTIL_dtos3 ( ammo_rockets ), UTIL_dtos4 ( ammo_cells ) ); break;
			case IT_LIGHTNING:
				ClientPrint( pPlayer->pev, HUD_PRINTNOTIFY, "#You_Get_LG", UTIL_dtos1( ammo_shells ), UTIL_dtos2 ( ammo_nails ), UTIL_dtos3 ( ammo_rockets ), UTIL_dtos4 ( ammo_cells ) ); break;
			}
		}
		else
			ClientPrint( pPlayer->pev, HUD_PRINTNOTIFY, "#You_Get_NoGun", UTIL_dtos1( ammo_shells ), UTIL_dtos2 ( ammo_nails ), UTIL_dtos3 ( ammo_rockets ), UTIL_dtos4 ( ammo_cells ) );
	}
 
	// Get ammo from pack
	pPlayer->m_iAmmoShells += ammo_shells;
	pPlayer->m_iAmmoNails += ammo_nails;
	pPlayer->m_iAmmoRockets += ammo_rockets;
	pPlayer->m_iAmmoCells += ammo_cells;
	pPlayer->CheckAmmo();

	int iNewWeapon = m_iItems;
	if (!iNewWeapon)
		iNewWeapon = pPlayer->m_iQuakeWeapon;
	int iOldWeapon = pPlayer->m_iQuakeItems;
	pPlayer->m_iQuakeItems |= m_iItems;

	// Give them at least 5 rockets in DM==3 and DM==5
	if ( (gpGlobals->deathmatch==3 || gpGlobals->deathmatch == 5) & ( (WeaponCode(iNewWeapon)==6) || (WeaponCode(iNewWeapon)==7) ) & (pPlayer->m_iAmmoRockets < 5) )
		pPlayer->m_iAmmoRockets = 5;

	EMIT_SOUND( ENT(pPlayer->pev), CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM );

	// Switch to a better weapon
	if ( WeaponCode(iNewWeapon) <= pPlayer->m_iBackpackSwitch )
	{
		if (pPlayer->pev->flags & FL_INWATER)
		{
			if (iNewWeapon != IT_LIGHTNING)
			{
				pPlayer->Deathmatch_Weapon(iOldWeapon, iNewWeapon);
			}
		}
//.........这里部分代码省略.........
开发者ID:Skumek,项目名称:hlsdk,代码行数:101,代码来源:quake_items.cpp

示例6: HuntThink

void CControllerHeadBall :: HuntThink( void  )
{
	pev->nextthink = gpGlobals->time + 0.1;

	pev->renderamt -= 5;

	MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
		WRITE_BYTE( TE_ELIGHT );
		WRITE_SHORT( entindex( ) );		// entity, attachment
		WRITE_COORD( pev->origin.x );		// origin
		WRITE_COORD( pev->origin.y );
		WRITE_COORD( pev->origin.z );
		WRITE_COORD( pev->renderamt / 16 );	// radius
		WRITE_BYTE( 255 );	// R
		WRITE_BYTE( 255 );	// G
		WRITE_BYTE( 255 );	// B
		WRITE_BYTE( 2 );	// life * 10
		WRITE_COORD( 0 ); // decay
	MESSAGE_END();

	// check world boundaries
	if (gpGlobals->time - pev->dmgtime > 5 || pev->renderamt < 64 || m_hEnemy == NULL || m_hOwner == NULL || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096)
	{
		SetTouch( NULL );
		UTIL_Remove( this );
		return;
	}

	MovetoTarget( m_hEnemy->Center( ) );

	if ((m_hEnemy->Center() - pev->origin).Length() < 64)
	{
		TraceResult tr;

		UTIL_TraceLine( pev->origin, m_hEnemy->Center(), dont_ignore_monsters, ENT(pev), &tr );

		CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
		if (pEntity != NULL && pEntity->pev->takedamage)
		{
			ClearMultiDamage( );
			pEntity->TraceAttack( m_hOwner->pev, gSkillData.controllerDmgZap, pev->velocity, &tr, DMG_SHOCK );
			ApplyMultiDamage( pev, m_hOwner->pev );
		}

		MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
			WRITE_BYTE( TE_BEAMENTPOINT );
			WRITE_SHORT( entindex() );
			WRITE_COORD( tr.vecEndPos.x );
			WRITE_COORD( tr.vecEndPos.y );
			WRITE_COORD( tr.vecEndPos.z );
			WRITE_SHORT( g_sModelIndexLaser );
			WRITE_BYTE( 0 ); // frame start
			WRITE_BYTE( 10 ); // framerate
			WRITE_BYTE( 3 ); // life
			WRITE_BYTE( 20 );  // width
			WRITE_BYTE( 0 );   // noise
			WRITE_BYTE( 255 );   // r, g, b
			WRITE_BYTE( 255 );   // r, g, b
			WRITE_BYTE( 255 );   // r, g, b
			WRITE_BYTE( 255 );	// brightness
			WRITE_BYTE( 10 );		// speed
		MESSAGE_END();

		UTIL_EmitAmbientSound( ENT(pev), tr.vecEndPos, "weapons/electro4.wav", 0.5, ATTN_NORM, 0, RANDOM_LONG( 140, 160 ) );

		m_flNextAttack = gpGlobals->time + 3.0;

		SetThink( DieThink );
		pev->nextthink = gpGlobals->time + 0.3;
	}

	// Crawl( );
}
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:73,代码来源:controller.cpp

示例7: Killed

void CBaseEntity :: Killed( entvars_t *pevAttacker, int iGib )
{
	pev->takedamage = DAMAGE_NO;
	pev->deadflag = DEAD_DEAD;
	UTIL_Remove( this );
}
开发者ID:6779660,项目名称:halflife,代码行数:6,代码来源:cbase.cpp

示例8: DieThink

void CTentacle :: DieThink( void )
{
	pev->nextthink = gpGlobals-> time + 0.1;

	DispatchAnimEvents( );
	StudioFrameAdvance( );

	ChangeYaw( 24 );

	if (m_fSequenceFinished)
	{
		if (pev->sequence == m_iGoalAnim)
		{
			switch( m_iGoalAnim )
			{
			case TENTACLE_ANIM_Engine_Idle:
			case TENTACLE_ANIM_Engine_Sway:
			case TENTACLE_ANIM_Engine_Swat:
			case TENTACLE_ANIM_Engine_Bob:
				m_iGoalAnim = TENTACLE_ANIM_Engine_Sway + RANDOM_LONG( 0, 2 );
				break;
			case TENTACLE_ANIM_Engine_Death1:
			case TENTACLE_ANIM_Engine_Death2:
			case TENTACLE_ANIM_Engine_Death3:
				UTIL_Remove( this );
				return;
			}
		}

		// ALERT( at_console, "%d : %d => ", pev->sequence, m_iGoalAnim );
		pev->sequence = FindTransition( pev->sequence, m_iGoalAnim, &m_iDir );
		// ALERT( at_console, "%d\n", pev->sequence );

		if (m_iDir > 0)
		{
			pev->frame = 0;
		}
		else
		{
			pev->frame = 255;
		}
		ResetSequenceInfo( );

		float dy;
		switch( pev->sequence )
		{
		case TENTACLE_ANIM_Floor_Rear:
		case TENTACLE_ANIM_Floor_Rear_Idle:
		case TENTACLE_ANIM_Lev1_Rear:
		case TENTACLE_ANIM_Lev1_Rear_Idle:
		case TENTACLE_ANIM_Lev2_Rear:
		case TENTACLE_ANIM_Lev2_Rear_Idle:
		case TENTACLE_ANIM_Lev3_Rear:
		case TENTACLE_ANIM_Lev3_Rear_Idle:
		case TENTACLE_ANIM_Engine_Idle:
		case TENTACLE_ANIM_Engine_Sway:
		case TENTACLE_ANIM_Engine_Swat:
		case TENTACLE_ANIM_Engine_Bob:
		case TENTACLE_ANIM_Engine_Death1:
		case TENTACLE_ANIM_Engine_Death2:
		case TENTACLE_ANIM_Engine_Death3:
			pev->framerate = RANDOM_FLOAT( m_iDir - 0.2, m_iDir + 0.2 );
			dy = 180;
			break;
		default:
			pev->framerate = 1.5;
			dy = 0;
			break;
		}
		pev->ideal_yaw = m_flInitialYaw + dy;
	}
}
开发者ID:XashDev,项目名称:XashXT,代码行数:72,代码来源:tentacle.cpp

示例9: InputOnBreak

	void InputOnBreak( inputdata_t &inputdata )
	{
		UTIL_Remove(this);
	}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:4,代码来源:physgun.cpp

示例10: filter

void CASW_Grenade_PRifle::Detonate()
{
	if ( !ASWGameResource() )
		return;

	m_takedamage	= DAMAGE_NO;	

	CPASFilter filter( GetAbsOrigin() );
						
	Vector vecForward = GetAbsVelocity();
	VectorNormalize(vecForward);
	trace_t		tr;

	Vector vecDir = -vecForward;
	//te->GaussExplosion( filter, 0.0,
				//GetAbsOrigin(), vecDir, 0 );
	CEffectData data;
	data.m_vOrigin = GetAbsOrigin();
	DispatchEffect( "aswstunexplo", data );

	EmitSound("ASW_Weapon_PRifle.StunGrenadeExplosion");

	UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SHOT, 
		this, COLLISION_GROUP_NONE, &tr);

	if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
	{
		// non-world needs smaller decals
		if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
		{
			UTIL_DecalTrace( &tr, "SmallScorch" );
		}
	}
	else
	{
		UTIL_DecalTrace( &tr, "Scorch" );
	}

	UTIL_ASW_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );

	int nPreviousStunnedAliens = ASWGameResource()->m_iElectroStunnedAliens;

	// do just 1 damage...
	CTakeDamageInfo info( this, GetOwnerEntity(), 1, DMG_SHOCK );
	info.SetWeapon( m_hCreatorWeapon );
	RadiusDamage ( info , GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );

	// count as a shot fired
	CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>(GetOwnerEntity());
	if ( pMarine && pMarine->GetMarineResource() )
	{
		CASW_Marine_Resource *pMR = pMarine->GetMarineResource();
		pMR->UsedWeapon(NULL, 1);

		int nAliensStunned = ASWGameResource()->m_iElectroStunnedAliens - nPreviousStunnedAliens;
		if ( nAliensStunned >= 6 && pMR->IsInhabited() && pMR->GetCommander() )
		{
			 pMR->GetCommander()->AwardAchievement( ACHIEVEMENT_ASW_STUN_GRENADE );
			 pMR->m_bStunGrenadeMedal = true;
		}
	}

	UTIL_Remove( this );
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:64,代码来源:asw_grenade_prifle.cpp

示例11: SetTouch

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pOther - 
//-----------------------------------------------------------------------------
void CItem::ItemTouch( CBaseEntity *pOther )
{
	// Vehicles can touch items + pick them up
	if ( pOther->GetServerVehicle() )
	{
		pOther = pOther->GetServerVehicle()->GetPassenger();
		if ( !pOther )
			return;
	}

	// if it's not a player, ignore
	if ( !pOther->IsPlayer() )
		return;

	CBasePlayer *pPlayer = (CBasePlayer *)pOther;

	// Must be a valid pickup scenario (no blocking). Though this is a more expensive
	// check than some that follow, this has to be first Obecause it's the only one
	// that inhibits firing the output OnCacheInteraction.
	if ( ItemCanBeTouchedByPlayer( pPlayer ) == false )
		return;

	m_OnCacheInteraction.FireOutput(pOther, this);

	// Can I even pick stuff up?
	if ( !pPlayer->IsAllowedToPickupWeapons() )
		return;

	// ok, a player is touching this item, but can he have it?
	if ( !g_pGameRules->CanHaveItem( pPlayer, this ) )
	{
		// no? Ignore the touch.
		return;
	}

	if ( MyTouch( pPlayer ) )
	{
		m_OnPlayerTouch.FireOutput(pOther, this);

		SetTouch( NULL );
		SetThink( NULL );

		// player grabbed the item. 
		g_pGameRules->PlayerGotItem( pPlayer, this );
		if ( g_pGameRules->ItemShouldRespawn( this ) == GR_ITEM_RESPAWN_YES )
		{
			Respawn(); 
		}
		else
		{
			UTIL_Remove( this );

#ifdef HL2MP
			HL2MPRules()->RemoveLevelDesignerPlacedObject( this );
#endif
		}
	}
	else if (gEvilImpulse101)
	{
		UTIL_Remove( this );
	}
}
开发者ID:Denzeriko,项目名称:hl2-mod,代码行数:66,代码来源:item_world.cpp

示例12: Precache

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CNPC_GroundTurret::Spawn( void )
{
	Precache();

	UTIL_SetModel( this, "models/combine_turrets/ground_turret.mdl" );

	SetNavType( NAV_FLY );
	SetSolid( SOLID_VPHYSICS );

	SetBloodColor( DONT_BLEED );
	m_iHealth			= 125;
	m_flFieldOfView		= cos( ((GROUNDTURRET_VIEWCONE / 2.0f) * M_PI / 180.0f) );
	m_NPCState			= NPC_STATE_NONE;

	m_vecSpread.x = 0.5;
	m_vecSpread.y = 0.5;
	m_vecSpread.z = 0.5;

	CapabilitiesClear();

	AddEFlags( EFL_NO_DISSOLVE );

	NPCInit();

	CapabilitiesAdd( bits_CAP_SIMPLE_RADIUS_DAMAGE );

	m_iAmmoType = GetAmmoDef()->Index( "PISTOL" );

	m_pSmoke = NULL;

	m_bHasExploded = false;
	m_bEnabled = false;

	if( ai_newgroundturret.GetBool() )
	{
		m_flSensingDist = 384;
		SetDistLook( m_flSensingDist );
	}
	else
	{
		m_flSensingDist = 2048;
	}

	if( !GetParent() )
	{
		DevMsg("ERROR! npc_ground_turret with no parent!\n");
		UTIL_Remove(this);
		return;
	}

	m_flTimeNextShoot = gpGlobals->curtime;
	m_flTimeNextPing = gpGlobals->curtime;

	m_vecClosedPos = GetAbsOrigin();

	StudioFrameAdvance();

	Vector vecPos;

	GetAttachment( "eyes", vecPos );
	SetViewOffset( vecPos - GetAbsOrigin() );

	GetAttachment( "light", vecPos );
	m_vecLightOffset = vecPos - GetAbsOrigin();
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:68,代码来源:npc_turret_ground.cpp

示例13: Assert


//.........这里部分代码省略.........
	//Do effect for the hit
	SporeExplosion *pSporeExplosion = SporeExplosion::CreateSporeExplosion();

	if ( pSporeExplosion )
	{
		Vector	dir = -GetAbsVelocity();
		VectorNormalize( dir );

		QAngle	angles;
		VectorAngles( dir, angles );

		pSporeExplosion->SetLocalAngles( angles );
		pSporeExplosion->SetLocalOrigin( GetAbsOrigin() );
		pSporeExplosion->m_flSpawnRate			= 1.0f;
		pSporeExplosion->m_flParticleLifetime	= 2.0f;
		pSporeExplosion->SetRenderColor( 0.0f, 0.5f, 0.25f, 0.15f );

		pSporeExplosion->m_flStartSize			= 0.0f;
		pSporeExplosion->m_flEndSize			= 32.0f;
		pSporeExplosion->m_flSpawnRadius		= 2.0f;

		pSporeExplosion->SetLifetime( bugbait_distract_time.GetFloat() );
		
		UTIL_Relink( pSporeExplosion );
	}

	trace_t	tr;
	Vector	traceDir, tracePos;

	Vector	directions[ NUM_SPLASHES ] =
	{
		Vector(  1,  0,  0 ),
		Vector( -1,  0,  0 ),
		Vector(  0,  1,  0 ),
		Vector(  0, -1,  0 ),
		Vector(  0,  0,  1 ),
		Vector(  0,  0, -1 ),
	};

	//Splatter decals everywhere
	for ( int i = 0; i < NUM_SPLASHES; i++ )
	{
		traceDir = directions[i];
		tracePos = GetAbsOrigin() + ( traceDir * 64.0f );

		UTIL_TraceLine( GetAbsOrigin(), tracePos, MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );

		if ( tr.fraction < 1.0f )
		{
			UTIL_DecalTrace( &tr, "BeerSplash" );	//TODO: Use real decal
		}
	}

	//Make a splat sound
	CPASAttenuationFilter filter( this );
	EmitSound( filter, entindex(), CHAN_WEAPON, "weapons/bugbait/splat.wav", 1.0f, ATTN_NORM );

	//Attempt to activate any spawners in a radius around the bugbait
	CBaseEntity*	pList[100];
	Vector			delta( 256, 256, 256 );
	bool			suppressCall = false;

	int count = UTIL_EntitiesInBox( pList, 100, GetAbsOrigin() - delta, GetAbsOrigin() + delta, 0 );
	
	//Iterate over all the possible targets
	for ( i = 0; i < count; i++ )
	{
		//See if this is a bugbait sensor
		if ( FClassnameIs( pList[i], "point_bugbait" ) )
		{
			CBugBaitSensor *pSensor = dynamic_cast<CBugBaitSensor *>(pList[i]);

			if ( pSensor == NULL )
				continue;

			//Make sure we're within range of the sensor
			if ( pSensor->GetRadius() > ( pSensor->GetAbsOrigin() - GetAbsOrigin() ).Length() )
			{
				//Tell the sensor it's been hit
				pSensor->Baited( GetOwner() );

				//If we're suppressing the call to antlions, then don't make a bugbait sound
				if ( pSensor->SuppressCall() )
				{
					suppressCall = true;
				}
			}
		}
	}

	//Make sure we want to call antlions
	if ( suppressCall == false )
	{
		//Alert any antlions around
		CSoundEnt::InsertSound( SOUND_BUGBAIT, GetAbsOrigin(), bugbait_hear_radius.GetInt(), bugbait_distract_time.GetFloat(), GetOwner() );
	}

	//Go away
	UTIL_Remove( this );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:101,代码来源:grenade_bugbait.cpp

示例14: UTIL_Remove

void CGrenadeEnergy::Detonate(void)
{
	m_takedamage	= DAMAGE_NO;	
	UTIL_Remove( this );
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:5,代码来源:grenade_energy.cpp

示例15: GetPlayerOwner


//.........这里部分代码省略.........
			else if( ( gpGlobals->curtime >= (m_fArmedTime - 0.75) ) && ( !m_bBombPlacedAnimation ) )
			{
				//call the c4 Placement animation 
				m_bBombPlacedAnimation = true;
				//SendWeaponAnim( C4_DROP, UseDecrement() ? 1: 0 );
				
#if !defined( CLIENT_DLL )
				// player "place" animation
				//pPlayer->SetAnimation( PLAYER_HOLDBOMB );
#endif
			}
		}
	}

	if ( PlaceBomb && m_bStartedArming )
	{
		m_bStartedArming = false;
		m_fArmedTime = 0;
		
		if( pPlayer->m_bInBombZone )
		{
#if !defined( CLIENT_DLL )
			//Broadcast("BOMBPL");

			CPlantedC4::ShootSatchelCharge( pPlayer, pPlayer->GetAbsOrigin(), QAngle(0,0,0) );

			// send director message, that something important happened here
			/*
			MESSAGE_BEGIN( MSG_SPEC, SVC_DIRECTOR );
				WRITE_BYTE ( 9 );	// command length in bytes
				WRITE_BYTE ( DRC_CMD_EVENT ); // bomb placed
				WRITE_SHORT( ENTINDEX(pPlayer->edict()) );
				WRITE_SHORT( 0 );
				WRITE_LONG( 11 | DRC_FLAG_FACEPLAYER );   // eventflags (priority and flags)
			MESSAGE_END();
			*/

			// tell the Ts the bomb has been planted (on radar)
			CTeam *pTeam = GetGlobalTeam( TEAM_TERRORIST );
			for ( int iPlayer=0; iPlayer < pTeam->GetNumPlayers(); iPlayer++ )
			{
				CBasePlayer *pTempPlayer = pTeam->GetPlayer( iPlayer );
				
				if ( pTempPlayer->m_lifeState != LIFE_DEAD )
				{
					/*
					MESSAGE_BEGIN( MSG_ONE, gmsgBombDrop, NULL, pTempPlayer->pev );
						WRITE_COORD( pBomb->pev->origin.x );
						WRITE_COORD( pBomb->pev->origin.y );
						WRITE_COORD( pBomb->pev->origin.z );
						WRITE_BYTE( 1 ); // bomb was planted
					MESSAGE_END();
					*/
				}			
			}

			UTIL_ClientPrintAll( HUD_PRINTCENTER,"#Bomb_Planted" );
			pPlayer->SetProgressBarTime( 0 );

			// tell bots the bomb has been planted
			//g_pBotControl->OnEvent( EVENT_BOMB_PLANTED, pPlayer );

			CSGameRules()->m_bBombDropped = false;

			// Play the plant sound.
			CPASAttenuationFilter filter( this );
			EmitSound( filter, entindex(), "c4.plant" );

			// release the player from being frozen
			pPlayer->ResetMaxSpeed();

			// Remove the C4 icon from the HUD
			//pPlayer->SetBombIcon();

			// No more c4!
			pPlayer->Weapon_Drop( this, NULL, NULL );
			UTIL_Remove( this );
#endif

			return;
		}
		else
		{
			ClientPrint( pPlayer, HUD_PRINTCENTER, "#C4_Activated_At_Bomb_Spot" );

#if !defined( CLIENT_DLL )
			//pPlayer->SetAnimation( PLAYER_HOLDBOMB );

			// release the player from being frozen
			pPlayer->ResetMaxSpeed();
#endif

			m_flNextPrimaryAttack = gpGlobals->curtime + 1.0;
			return;
		}
	}

	m_flNextPrimaryAttack = gpGlobals->curtime + 0.3;
	m_flTimeWeaponIdle = gpGlobals->curtime + random->RandomFloat ( 10, 15 );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:101,代码来源:weapon_c4.cpp


注:本文中的UTIL_Remove函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。