DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ Event_OnStarted()

override void EffBulletImpactBase::Event_OnStarted ( )
inlineprivate

См. определение в файле BulletImpactBase.c строка 221

222 {
223 Particle p;
224 vector particle_orientation;
225 float outSpeedf = m_OutSpeed.Length();
226
227 ParticleManager gPM = ParticleManager.GetInstance();
228
229 if ( m_ImpactType == ImpactTypes.RICOCHET )
230 {
232
233 if (p)
234 {
235 particle_orientation = m_OutSpeed.VectorToAngles();
236 particle_orientation = particle_orientation + "0 -90 0";
237 p.SetOrientation(particle_orientation);
238
239 OnRicochetCalculations(p, outSpeedf);
240 }
241 }
242 else
243 {
245
246 if (p)
247 {
248 if (m_SurfNormal != INVALID)
249 {
250 particle_orientation = m_SurfNormal.VectorToAngles();
251 particle_orientation = particle_orientation + "0 270 0";
252 }
253 else
254 {
255 particle_orientation = "0 0 0"; // This vector is in angles
256 }
257
258 p.SetOrientation(particle_orientation);
259
261 }
262
263 if (outSpeedf > 0 && m_SurfNormal != INVALID)
264 {
266
267 if (p)
268 {
269 particle_orientation = m_OutSpeed.VectorToAngles();
270 particle_orientation = particle_orientation + "0 -90 0";
271 p.SetOrientation(particle_orientation);
272
273 OnExitCalculations(p, outSpeedf);
274 }
275 }
276 else
277 {
278 if (m_SurfNormal != INVALID)
279 {
280 vector surfNormalN = m_SurfNormal.Normalized();
281 vector inSpeedN = m_InSpeed.Normalized();
282 vector bounce_ori = surfNormalN + inSpeedN;
283
284 float dot = vector.Dot(bounce_ori, surfNormalN);
285
286 if ( dot > m_AngledEnter )
287 {
289
290 if (p)
291 {
292 particle_orientation = bounce_ori.VectorToAngles();
293 particle_orientation = particle_orientation + "0 -90 0";
294 p.SetOrientation(particle_orientation);
295
297 }
298 }
299 }
300 }
301 }
302
303 if (p)
304 {
305 SetParticle(p);
306 }
307
308
309 // Additional impact particle over long ranges. It shows players where their bullets land
310
311 if ( Type() != Hit_MeatBones )
312 {
313 vector camera_pos = GetGame().GetCurrentCameraPosition();
314 float distance = vector.Distance(camera_pos, m_Pos);
315
316 // Additional size increase by distance from camera
317 float scaling_by_distance = distance * 0.01;
318
319 // Now scale down the above size increase by player's zoom-in value
320 float current_FOV = Camera.GetCurrentFOV();
321 float config_FOV = GetDayZGame().GetUserFOVFromConfig();
322 float FOV_scale = current_FOV / config_FOV;
323 scaling_by_distance = 1 + scaling_by_distance * FOV_scale;
324
325 if (scaling_by_distance > 1.1)
326 {
327 Particle p_distant = gPM.PlayInWorld(ParticleList.IMPACT_DISTANT_DUST, m_Pos);
328
329 particle_orientation = m_SurfNormal.VectorToAngles();
330 particle_orientation[1] = particle_orientation[1] + 270;
331 p_distant.SetOrientation(particle_orientation);
332
333 p_distant.ScaleParticleParam(EmitorParam.SIZE, scaling_by_distance - 0.5);
334 p_distant.ScaleParticleParam(EmitorParam.BIRTH_RATE, scaling_by_distance * 0.1);
335 p_distant.ScaleParticleParam(EmitorParam.BIRTH_RATE_RND, scaling_by_distance * 0.1);
336 p_distant.ScaleParticleParam(EmitorParam.LIFETIME, scaling_by_distance * 0.3);
337 p_distant.ScaleParticleParam(EmitorParam.LIFETIME_RND, scaling_by_distance * 0.3);
338 }
339 }
340 }
DayZGame GetDayZGame()
Определения DayZGame.c:3870
ImpactTypes
Определения ImpactEffects.c:2
string Type
Определения JsonDataContaminatedArea.c:11
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
proto native vector GetCurrentCameraPosition()
vector m_SurfNormal
Определения BulletImpactBase.c:15
int m_ImpactType
Определения BulletImpactBase.c:12
void OnEnterAngledCalculations(Particle p)
Определения BulletImpactBase.c:199
static vector INVALID
Определения BulletImpactBase.c:21
vector m_OutSpeed
Определения BulletImpactBase.c:18
void OnEnterCalculations(Particle p)
Определения BulletImpactBase.c:102
vector m_ExitPos
Определения BulletImpactBase.c:16
int m_ParticleExit
Определения BulletImpactBase.c:25
int m_ParticleRicochet
Определения BulletImpactBase.c:26
void OnExitCalculations(Particle p, float outSpeedf)
Определения BulletImpactBase.c:155
float m_AngledEnter
Определения BulletImpactBase.c:33
int m_ParticleEnter
Определения BulletImpactBase.c:24
void OnRicochetCalculations(Particle p, float outspeedf)
Определения BulletImpactBase.c:177
vector m_Pos
Определения BulletImpactBase.c:14
vector m_InSpeed
Определения BulletImpactBase.c:17
void SetParticle(Particle p)
Sets the main particle which this Effect will manage.
Определения EffectParticle.c:134
static Particle PlayInWorld(int particle_id, vector global_pos)
Creates a particle emitter on the given position and activates it.
Определения Particle.c:174
void ScaleParticleParam(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their CURRENT value.
Определения Particle.c:697
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Определения EnConvert.c:271
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto native CGame GetGame()
EmitorParam
Определения EnVisual.c:114

Перекрестные ссылки vector::Distance(), vector::Dot(), CGame::GetCurrentCameraPosition(), GetDayZGame(), GetGame(), ParticleList::IMPACT_DISTANT_DUST, INVALID, m_AngledEnter, m_ExitPos, m_ImpactType, m_InSpeed, m_OutSpeed, m_ParticleEnter, m_ParticleExit, m_ParticleRicochet, m_Pos, m_SurfNormal, OnEnterAngledCalculations(), OnEnterCalculations(), OnExitCalculations(), OnRicochetCalculations(), ParticleManager(), Particle::PlayInWorld(), Particle::ScaleParticleParam(), EffectParticle::SetParticle(), Type и vector::VectorToAngles().