Esempio n. 1
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::OnFlechetteAttach( Vector &vecFlechetteVelocity )
{
	if ( m_bLaunched )
	{
		Vector vecForce = vecFlechetteVelocity;
		VectorNormalize( vecForce );

		vecForce *= 1000;
		vecForce.z = -5000;

		VPhysicsGetObject()->ApplyForceCenter( vecForce );
	}

	if ( !GetParent() || !GetParent()->ClassMatches( g_iszVehicle ) )
	{
		if ( !m_bNoseDiving )
		{
			//m_hGlowTrail->StopParticleSystem();
			StopParticleEffects( this );

			if( m_iBusterFlags & STRIDERBUSTER_FLAG_KNOCKED_OFF_STRIDER )
			{
				DispatchParticleEffect( "striderbuster_shotdown_trail", PATTACH_ABSORIGIN_FOLLOW, this );
			}
			else
			{
				DispatchParticleEffect( "striderbuster_flechette_attached", PATTACH_ABSORIGIN_FOLLOW, this );
			}
		}

		m_bNoseDiving = true;
	}
	m_nAttachedFlechettes++;
}
void CGERocket::Explode()
{
	StopParticleEffects( this );
	StopSound( "Weapon_RocketLauncher.Ignite" );

	BaseClass::Explode();
}
// Если крематор начинает двигаться к удаляющейся от него цели, он прекращает атаку.
// If target moves out of reach and a cremator starts going after it, put the flame off.
void CNPC_Cremator::OnChangeActivity( Activity eNewActivity ) 
{
	if ( eNewActivity == ACT_WALK || eNewActivity == ACT_RUN )
	{
		StopParticleEffects( this );
		StopSound( "Weapon_Immolator.Single" );
		EmitSound( "Weapon_Immolator.Stop" );
		DevMsg( "Activity Changed\n" );
	}
}
void CNPC_Cremator::RunTask( const Task_t *pTask )
{
	switch ( pTask->iTask )
	{
	case TASK_CREMATOR_RANGE_ATTACK1:
		{
			SetActivity( ACT_RANGE_ATTACK1 );

			Vector flEnemyLKP = GetEnemyLKP();
			GetMotor()->SetIdealYawToTargetAndUpdate( flEnemyLKP );

			if( m_iAmmo < 1 && IsActivityFinished() )
			{
				SetCondition( COND_CREMATOR_OUT_OF_AMMO );
								
				DevMsg( "NO PRIMARY AMMO\n" );

				StopParticleEffects(this);
				StopSound( "Weapon_Immolator.Single" );
				EmitSound( "Weapon_Immolator.Stop" );
				
				TaskComplete();
				SetNextThink( gpGlobals->curtime + 0.1f );
			}

			// THIS fixes the combat issue with the Cremator continuing to fire at a target that moved out of his reach
			if( GetEnemyLKP().DistTo( GetAbsOrigin()) > CREMATOR_MAX_RANGE )
			{
				// Cremator stops firing and attempts to close the distance.
				SetActivity( ACT_CREMATOR_DISARM );
				TaskComplete();
				Msg( "Enemy is too far\n" );

				SetNextThink( gpGlobals->curtime + 0.1f );
				return;
			}
	/*		// This is bugged and shouldn't be used. Necessary checks are made below, in OnChangeActivity( ).	
			if( IsActivityMovementPhased( ACT_WALK ) || IsActivityMovementPhased( ACT_RUN ) )
			{
				TaskFail( NULL );
				SetActivity( ACT_CREMATOR_DISARM );
				
				DevMsg( "ACT_CREMATOR_DISARM\n" );
				return;
			}
	*/
			break;
		}
		default:
		BaseClass::RunTask( pTask );
		break;
	}
}
Esempio n. 5
0
void CWeaponDrainGrenade::RemoveMe()
{
	StopParticleEffects( this );
	SetModelName( NULL_STRING );//invisible
	AddSolidFlags( FSOLID_NOT_SOLID );

	m_takedamage = DAMAGE_NO;

	SetThink( &CBaseGrenade::SUB_Remove );
	SetTouch( NULL );
	SetSolid( SOLID_NONE );
	
	AddEffects( EF_NODRAW );
	SetAbsVelocity( vec3_origin );

	SetNextThink( gpGlobals->curtime + 0.1 );
}
int CNPC_Cremator::SelectSchedule( void )
{
	switch	( m_NPCState )
	{
	case NPC_STATE_IDLE:
	case NPC_STATE_ALERT:
		{				
			if ( HasCondition ( COND_HEAR_COMBAT || COND_HEAR_PLAYER || COND_HEAR_BULLET_IMPACT ) )
				return SCHED_INVESTIGATE_SOUND;

			return SCHED_PATROL_WALK_LOOP;
		}
		break;
	case NPC_STATE_COMBAT:
		{
			if( HasCondition ( COND_CAN_RANGE_ATTACK1 ) && m_iAmmo > 0 )
			{
				return SCHED_RANGE_ATTACK1;
			}
			if( HasCondition( COND_TOO_FAR_TO_ATTACK && COND_SEE_ENEMY ) )
			{
				if( m_flNextRangeAttack2Time < gpGlobals->curtime )
				{
					return SCHED_RANGE_ATTACK2; // Это атака зажигательными гранатами. Они могут привести к вылету на дисплейсментах; в таком случае, закомментируй эту строку.
				}
				else
				{
					return SCHED_CREMATOR_CHASE;
				}
			}
			if( HasCondition( COND_TOO_FAR_TO_ATTACK && COND_ENEMY_OCCLUDED )) //&& HasCondition( COND_CREMATOR_HAS_THROWN_GRENADE ))
			{
				return SCHED_CREMATOR_CHASE;
				StopParticleEffects( this );
			}
		}
		break;
	}
	return BaseClass::SelectSchedule();
}
Esempio n. 7
0
//-----------------------------------------------------------------------------
// Purpose: Create the explosion effect for the final big boom
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::CreateDestroyedEffect( void )
{
	CBaseEntity *pTrail;

	StopParticleEffects( this );
	
	for ( int i = 0; i < 3; i++ )
	{
		pTrail = CreateEntityByName( "sparktrail" );
		pTrail->SetOwnerEntity( this );
		DispatchSpawn( pTrail );
	}
	
	DispatchParticleEffect( "striderbuster_explode_core", GetAbsOrigin(), GetAbsAngles() );

	// Create liquid fountain gushtacular effect here!
	CEffectData	data;

	int nNumSteps = 6;
	float flRadStep = (2*M_PI) / nNumSteps;
	for ( int i = 0; i < nNumSteps; i++ )
	{
		data.m_vOrigin = GetAbsOrigin() + RandomVector( -32.0f, 32.0f );
		data.m_vNormal.x = cos( flRadStep*i );
		data.m_vNormal.y = sin( flRadStep*i );
		data.m_vNormal.z = 0.0f;
		data.m_flScale = ( random->RandomInt( 0, 5 ) == 0 ) ? 1 : 2;

		DispatchEffect( "StriderBlood", data );
	}

	// More effects
	UTIL_ScreenShake( GetAbsOrigin(), 20.0f, 150.0, 1.0, 1250.0f, SHAKE_START );

	data.m_vOrigin = GetAbsOrigin();
	DispatchEffect( "cball_explode", data );
}
// Здесь происходит назначение различных ф-ций во время анимации. Аним-ивенты назначаются в .qc.
void CNPC_Cremator::HandleAnimEvent( animevent_t *pEvent )
{
	switch( pEvent->event )
	{
		case CREMATOR_AE_FLLEFT: // левый шаг
			{	
				LeftFootHit( pEvent->eventtime );
			}
			break;

		case CREMATOR_AE_FLRIGHT: // правый шаг
			{				
				RightFootHit( pEvent->eventtime );
			}
			break;

		case CREMATOR_AE_IMMO_START: // начало анимации атаки
			{
				//CBaseEntity *pEntity;

				DispatchSpray( this );
				DevMsg( "%i ammo left\n", m_iAmmo );

				Vector flEnemyLKP = GetEnemyLKP();
				GetMotor()->SetIdealYawToTargetAndUpdate( flEnemyLKP );
			}
			break;

		case CREMATOR_AE_IMMO_PARTICLE: // Маркер для запуска системы частиц огнемета
			{				
				DispatchParticleEffect( "flamethrower", PATTACH_POINT_FOLLOW, this, "muzzle" ); 
				// Если нужно заменить зеленый огонь оранжевым, замени "flamethrower" на "flamethrower_orange".
				EmitSound( "Weapon_Immolator.Single" );
			}
			break;

		case CREMATOR_AE_IMMO_PARTICLEOFF: // Маркер для отключения системы частиц огнемета
			{				
				StopParticleEffects( this );
				StopSound( "Weapon_Immolator.Single" );
				EmitSound( "Weapon_Immolator.Stop" );
			}
			break;

		case CREMATOR_AE_RELOAD:
			{
				ClearCondition( COND_CREMATOR_OUT_OF_AMMO );
				ClearCondition( COND_NO_PRIMARY_AMMO );
				m_iAmmo += 54; // Put your own int here. This defines for how long a cremator would be able to fire at an enemy.
				
				DevMsg( "AE_RELOAD\n" );
			}
			break;

		case CREMATOR_AE_THROWGRENADE: // Маркер для броска гранаты
			{				
				DevMsg( "Throwing incendiary grenade!\n" );
				ThrowIncendiaryGrenade();

				if( g_pGameRules->IsSkillLevel(SKILL_EASY) )
				{
					m_flNextRangeAttack2Time = gpGlobals->curtime + random->RandomFloat( 15.0f, 30.0f );
				}
				else if( g_pGameRules->IsSkillLevel(SKILL_HARD) )
				{
					m_flNextRangeAttack2Time = gpGlobals->curtime + random->RandomFloat( 5.0f, 10.0f );
				}
				else if (g_pGameRules->IsSkillLevel(SKILL_VERYHARD))
				{
					m_flNextRangeAttack2Time = gpGlobals->curtime + random->RandomFloat(3.0f, 5.0f);
				}
				else if (g_pGameRules->IsSkillLevel(SKILL_NIGHTMARE))
				{
					m_flNextRangeAttack2Time = gpGlobals->curtime + random->RandomFloat(1.0f, 3.0f);
				}
				else
				{
					m_flNextRangeAttack2Time = gpGlobals->curtime + random->RandomFloat( 10.0f, 20.0f );
				}
			}
			break;

		default:
			BaseClass::HandleAnimEvent( pEvent );
			break;
	}
}