Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
hit_wood.c
Go to the documentation of this file.
2 {
3  void Hit_Wood()
4  {
5  SetEnterParticle(ParticleList.IMPACT_WOOD_ENTER);
6  SetExitParticle(ParticleList.IMPACT_WOOD_EXIT);
7  SetRicochetParticle(ParticleList.IMPACT_WOOD_RICOCHET);
8  }
9 
10  override void OnEnterCalculations( Particle p )
11  {
12  // All values represent scale
13  float velocity_min = MIN_SCALING_PARAM + (m_StoppingForce * m_EnterSplashCoef);
14  float velocity_max = MIN_SCALING_PARAM + (m_StoppingForce * m_EnterSplashCoef);
15  float size = MIN_SCALING_PARAM + ( m_StoppingForce * m_EnterSplashCoef)*0.5;
16  float birth_rate = MIN_SCALING_PARAM + (m_StoppingForce * m_EnterSplashCoef)*0.5;
17 
18  if (velocity_min < MIN_SCALING_PARAM)
19  velocity_min = MIN_SCALING_PARAM;
20 
21  if (size < MIN_SCALING_PARAM)
22  size = MIN_SCALING_PARAM;
23 
24  if (birth_rate < MIN_SCALING_PARAM)
25  birth_rate = MIN_SCALING_PARAM;
26 
27 
28 
29  p.ScaleParticleParam(EmitorParam.VELOCITY, velocity_min);
30  p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_max);
31  p.ScaleParticleParam(EmitorParam.SIZE, size);
32  p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate);
33  }
34 
35  override void OnExitCalculations(Particle p, float outSpeedf)
36  {
37  float velocity_min = 1 + (outSpeedf * m_ExitSplashCoef);
38  float velocity_max = 1 + (outSpeedf * m_ExitSplashCoef);
39  float size = 1 + ( outSpeedf * m_ExitSplashCoef)*0.5;
40  float birth_rate = 1 + (outSpeedf * m_ExitSplashCoef)*0.5;
41 
42  if (velocity_min < MIN_SCALING_PARAM)
43  velocity_min = MIN_SCALING_PARAM;
44 
45  if (size < MIN_SCALING_PARAM)
46  size = MIN_SCALING_PARAM;
47 
48  if (birth_rate < MIN_SCALING_PARAM)
49  birth_rate = MIN_SCALING_PARAM;
50 
51  p.ScaleParticleParam(EmitorParam.VELOCITY, velocity_min);
52  p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_max);
53  p.ScaleParticleParam(EmitorParam.SIZE, size);
54  p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate);
55  }
56 }
Particle
Legacy way of using particles in the game.
Definition: particle.c:6
EffBulletImpactBase
Definition: bulletimpactbase.c:1
EmitorParam
EmitorParam
Definition: envisual.c:113
ParticleList
Definition: particlelist.c:11
Hit_Wood
Definition: hit_wood.c:1