DayZ 1.24
Loading...
Searching...
No Matches
EffBulletImpactBase Class Reference
Inheritance diagram for EffBulletImpactBase:
[legend]
Collaboration diagram for EffBulletImpactBase:
[legend]

Private Member Functions

void EffBulletImpactBase ()
 
override void OnCheckUpdate ()
 
void SetEnterParticle (int id)
 
void SetExitParticle (int id)
 
void SetRicochetParticle (int id)
 
void SetSingleParticle (int id)
 
void SetAngledEnterValue (float f)
 
void EvaluateEffect (Object directHit, int componentIndex, vector pos, int impact_type, vector surfNormal, vector exitPos, vector inSpeed, vector outSpeed, string ammoType)
 
float CalculateStoppingForce (float in_speedf, float out_speedf, string ammoType, float weight)
 
void OnEnterCalculations (Particle p)
 
void OnExitCalculations (Particle p, float outSpeedf)
 
void OnRicochetCalculations (Particle p, float outspeedf)
 
void OnEnterAngledCalculations (Particle p)
 
override void Event_OnStarted ()
 
- Private Member Functions inherited from EffectParticle
override EffectType GetEffectType ()
 Get what type of effect the Effect is.
 
override bool IsParticle ()
 Check whether the Effect is EffectParticle without casting.
 
void SetParticle (Particle p)
 Sets the main particle which this Effect will manage.
 
Particle GetParticle ()
 Gets the main particle which this Effect is managing.
 
override void Start ()
 Plays all elements this effect consists of.
 
override void Stop ()
 Stops all elements this effect consists of.
 
void AttachTo (Object obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_to_world=false)
 Read Particle.AddAsChild.
 
void ReAttach ()
 Helper method to attach to parent using stored settings.
 
void AddAsChild (Object obj, vector local_pos, vector local_ori, bool force_rotation_to_world)
 Helper method to attach to parent.
 
void Event_OnPlayStart ()
 Event which just simply exists (DEPRECATED)
 
void Event_OnPlayStarted ()
 Event which just simply exists (DEPRECATED)
 
void SetParticleID (int id)
 Sets the id of the particle to be used.
 
int GetParticleID ()
 Gets the id of the particle to be used.
 
void SetCurrentParticleID (int id)
 Sets the id of the particle to be used.
 
int GetCurrentParticleID ()
 Gets the current id of the managed Particle.
 
override void SetCurrentParent (Object parent_obj, bool updateCached=true)
 Set current parent of the managed Particle.
 
override Object GetCurrentParent ()
 Get the current parent of the managed Particle.
 
override void SetCurrentPosition (vector pos, bool updateCached=true)
 Set the current world position of the managed Particle.
 
override vector GetCurrentPosition ()
 Get the current world position of the managed Particle.
 
override void SetCurrentLocalPosition (vector pos, bool updateCached=true)
 Set the current local position of the managed Particle.
 
override vector GetCurrentLocalPosition ()
 Get the current local position of the managed Particle.
 
void SetOrientation (vector ori)
 Set orientation of the EffectParticle.
 
vector GetOrientation ()
 Get the orientation of the EffectParticle.
 
void SetCurrentOrientation (vector ori, bool updateCached=true)
 Set the current orientation of the managed Particle.
 
vector GetCurrentOrientation ()
 Get the current orientation of the managed Particle.
 
void ForceParticleRotationRelativeToWorld (bool state)
 Set orientation setting to be used by the effect when the Effect starts.
 
bool IsParticleRotationRelativeToWorld ()
 Get the orientation setting to be used by the effect when the Effect starts.
 
bool IsParticleCurrentRotationRelativeToWorld ()
 Get the current orientation setting to be used by the managed Particle.
 
void EffectParticle ()
 ctor
 
void ~EffectParticle ()
 dtor
 
override void InitEffect ()
 init
 
override string GetDebugName ()
 Override when getting debug information.
 
override void ValidateStart ()
 Validation whether an effect truly started playing or if the Effect should stop as none is present.
 
void CheckLifeSpan ()
 Was never called and probably should never be called.
 
void SetDecalOwner (Object o)
 

Private Attributes

float MIN_SCALING_PARAM = 0.1
 
Object m_DirectHit
 
float m_StoppingForce
 
float m_Weight
 
int m_ImpactType
 
int m_ComponentIndex
 
vector m_Pos
 
vector m_SurfNormal
 
vector m_ExitPos
 
vector m_InSpeed
 
vector m_OutSpeed
 
string m_AmmoType
 
int m_ParticleEnter = -1
 
int m_ParticleExit = -1
 
int m_ParticleRicochet = -1
 
float m_EnterSplashCoef = 0.003
 
float m_ExitSplashCoef = 0.002
 
float m_RicochetSplashCoef = 0.002
 
float m_EnterAngledSplashCoef = 0.01
 
float m_AngledEnter = 0.40
 
- Private Attributes inherited from EffectParticle
Particle m_ParticleObj
 The main Particle effect that this Effect wrapper manages.
 
int m_ParticleID
 The ID in the ParticleList to create Particle from.
 
vector m_Orientation
 Orientation set by SetOrientation.
 
bool m_ForceRotationRelativeToWorld
 Orientation setting to be used by the effect when the Effect starts.
 
vector m_ParticleOrientation
 
Object m_Object
 

Static Private Attributes

static const int SURVIVOR_HEAD = 0
 
static const int INFECTED_HEAD = 3
 
static float DEFAULT_PROJECTILE_WEIGHT = 0.015
 
static vector INVALID = "0 0 0"
 

Detailed Description

Definition at line 1 of file BulletImpactBase.c.

Constructor & Destructor Documentation

◆ EffBulletImpactBase()

void EffBulletImpactBase::EffBulletImpactBase ( )
inlineprivate

Definition at line 35 of file BulletImpactBase.c.

36 {
37
38 }

Member Function Documentation

◆ CalculateStoppingForce()

float EffBulletImpactBase::CalculateStoppingForce ( float in_speedf,
float out_speedf,
string ammoType,
float weight )
inlineprivate

Definition at line 88 of file BulletImpactBase.c.

89 {
90 if (m_ImpactType == ImpactTypes.MELEE)
91 return Math.RandomFloat(50, 100);
92
94
96
97 return stopping_force;
98 }
ImpactTypes
static float DEFAULT_PROJECTILE_WEIGHT
Definition EnMath.c:7
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].

References DEFAULT_PROJECTILE_WEIGHT, m_ImpactType, and Math::RandomFloat().

Referenced by EvaluateEffect().

◆ EvaluateEffect()

void EffBulletImpactBase::EvaluateEffect ( Object directHit,
int componentIndex,
vector pos,
int impact_type,
vector surfNormal,
vector exitPos,
vector inSpeed,
vector outSpeed,
string ammoType )
inlineprivate

Definition at line 72 of file BulletImpactBase.c.

73 {
75 m_Pos = pos;
83 m_Weight = GetGame().ConfigGetFloat("CfgAmmo " + ammoType + " weight");
84
86 }
float CalculateStoppingForce(float in_speedf, float out_speedf, string ammoType, float weight)
proto native float Length()
Returns length of vector (magnitude)
proto native CGame GetGame()

References CalculateStoppingForce(), GetGame(), vector::Length(), m_AmmoType, m_ComponentIndex, m_DirectHit, m_ExitPos, m_ImpactType, m_InSpeed, m_OutSpeed, m_Pos, m_StoppingForce, m_SurfNormal, and m_Weight.

◆ Event_OnStarted()

override void EffBulletImpactBase::Event_OnStarted ( )
inlineprivate

Definition at line 219 of file BulletImpactBase.c.

220 {
221 Particle p;
223 float outSpeedf = m_OutSpeed.Length();
224
225 ParticleManager gPM = ParticleManager.GetInstance();
226
227 if (m_ImpactType == ImpactTypes.RICOCHET)
228 {
229 p = gPM.PlayInWorld(m_ParticleRicochet, m_Pos);
230
231 if (p)
232 {
235 p.SetOrientation(particle_orientation);
236
238 }
239 }
240 else
241 {
242 p = gPM.PlayInWorld(m_ParticleEnter, m_Pos);
243
244 if (p)
245 {
246 if (m_SurfNormal != INVALID)
247 {
250 }
251 else
252 {
253 particle_orientation = "0 0 0"; // This vector is in angles
254 }
255
256 p.SetOrientation(particle_orientation);
257
259 }
260
261 if (outSpeedf > 0 && m_SurfNormal != INVALID)
262 {
263 p = gPM.PlayInWorld(m_ParticleExit, m_ExitPos);
264
265 if (p)
266 {
269 p.SetOrientation(particle_orientation);
270
272 }
273 }
274 else
275 {
276 if (m_SurfNormal != INVALID)
277 {
281
283
284 if (dot > m_AngledEnter)
285 {
286 p = gPM.PlayInWorld(m_ParticleRicochet, m_Pos);
287
288 if (p)
289 {
290 particle_orientation = bounce_ori.VectorToAngles();
292 p.SetOrientation(particle_orientation);
293
295 }
296 }
297 }
298 }
299 }
300
301 if (p)
302 SetParticle(p);
303
304
305 // Additional impact particle over long ranges. It shows players where their bullets land
306
307 if (Type() != Hit_MeatBones)
308 {
309 vector camera_pos = GetGame().GetCurrentCameraPosition();
311
312 // Additional size increase by distance from camera
313 float scaling_by_distance = distance * 0.01;
314
315 // Now scale down the above size increase by player's zoom-in value
316 float current_FOV = Camera.GetCurrentFOV();
317 float config_FOV = GetDayZGame().GetUserFOVFromConfig();
320
321 if (scaling_by_distance > 1.1)
322 {
324
327 p_distant.SetOrientation(particle_orientation);
328
329 p_distant.ScaleParticleParam(EmitorParam.SIZE, scaling_by_distance - 0.5);
330 p_distant.ScaleParticleParam(EmitorParam.BIRTH_RATE, scaling_by_distance * 0.1);
331 p_distant.ScaleParticleParam(EmitorParam.BIRTH_RATE_RND, scaling_by_distance * 0.1);
332 p_distant.ScaleParticleParam(EmitorParam.LIFETIME, scaling_by_distance * 0.3);
333 p_distant.ScaleParticleParam(EmitorParam.LIFETIME_RND, scaling_by_distance * 0.3);
334 }
335 }
336 }
DayZGame GetDayZGame()
Definition DayZGame.c:3530
string Type
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
void OnEnterAngledCalculations(Particle p)
void OnEnterCalculations(Particle p)
void OnExitCalculations(Particle p, float outSpeedf)
void OnRicochetCalculations(Particle p, float outspeedf)
void SetParticle(Particle p)
Sets the main particle which this Effect will manage.
Legacy way of using particles in the game.
Definition Particle.c:7
static const int IMPACT_DISTANT_DUST
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition 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.
EmitorParam
Definition EnVisual.c:114

References vector::Distance(), vector::Dot(), GetDayZGame(), GetGame(), ParticleList::IMPACT_DISTANT_DUST, INVALID, vector::Length(), m_AngledEnter, m_ExitPos, m_ImpactType, m_InSpeed, m_OutSpeed, m_ParticleEnter, m_ParticleExit, m_ParticleRicochet, m_Pos, m_SurfNormal, vector::Normalized(), OnEnterAngledCalculations(), OnEnterCalculations(), OnExitCalculations(), OnRicochetCalculations(), ParticleManager(), EffectParticle::SetParticle(), Type, and vector::VectorToAngles().

◆ OnCheckUpdate()

override void EffBulletImpactBase::OnCheckUpdate ( )
inlineprivate

Definition at line 40 of file BulletImpactBase.c.

41 {
42 //DbgUI.Text( m_ammoType );
43 }

◆ OnEnterAngledCalculations()

void EffBulletImpactBase::OnEnterAngledCalculations ( Particle p)
inlineprivate

Definition at line 197 of file BulletImpactBase.c.

198 {
203
206
209
212
213 p.ScaleParticleParam(EmitorParam.VELOCITY, velocity_min);
214 p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_max);
215 p.ScaleParticleParam(EmitorParam.SIZE, size);
216 p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate);
217 }

References m_EnterAngledSplashCoef, m_StoppingForce, and MIN_SCALING_PARAM.

Referenced by Event_OnStarted().

◆ OnEnterCalculations()

void EffBulletImpactBase::OnEnterCalculations ( Particle p)
inlineprivate

Definition at line 100 of file BulletImpactBase.c.

101 {
102 // All values represent scale
110
111 if (m_AmmoType == "Bullet_12GaugePellets")
112 {
113 birth_rate *= 0.5;
114 velocity_min *= 2;
115 velocity_max *= 2;
116 }
117
118
119 if (velocity_min < 0.75)
120 velocity_min = 0.75;
121
122 if (size < 0.75)
123 size = 0.75;
124
125 if (lifetime < 0.5)
126 lifetime = 0.5;
127
128 if (lifetime_rnd < 0.5)
129 lifetime_rnd = 0.5;
130
131 if (velocity_max < 1)
132 velocity_max = 1;
133
134 /*Print("===============");
135 Print(velocity_min);
136 Print(velocity_max);
137 Print(size);
138 Print(birth_rate);
139 Print(air_resistance);
140 Print(lifetime);
141 Print(lifetime_rnd);*/
142
143 p.ScaleParticleParam(EmitorParam.VELOCITY, velocity_min);
144 p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_max);
145 p.ScaleParticleParam(EmitorParam.SIZE, size);
146 p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate);
147 p.ScaleParticleParam(EmitorParam.AIR_RESISTANCE, air_resistance);
148 p.ScaleParticleParam(EmitorParam.AIR_RESISTANCE_RND, air_resistance);
149 p.ScaleParticleParam(EmitorParam.LIFETIME, lifetime);
150 p.ScaleParticleParam(EmitorParam.LIFETIME_RND, lifetime_rnd);
151 }

References m_AmmoType, m_EnterSplashCoef, and m_StoppingForce.

Referenced by Event_OnStarted().

◆ OnExitCalculations()

void EffBulletImpactBase::OnExitCalculations ( Particle p,
float outSpeedf )
inlineprivate

Definition at line 153 of file BulletImpactBase.c.

154 {
157 float size = 1 + (outSpeedf * m_ExitSplashCoef);
158 float birth_rate = 1 + (outSpeedf * m_ExitSplashCoef);
159
162
165
168
169 p.ScaleParticleParam(EmitorParam.VELOCITY, velocity_min);
170 p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_max);
171 p.ScaleParticleParam(EmitorParam.SIZE, size);
172 p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate);
173 }

References m_ExitSplashCoef, and MIN_SCALING_PARAM.

Referenced by Event_OnStarted().

◆ OnRicochetCalculations()

void EffBulletImpactBase::OnRicochetCalculations ( Particle p,
float outspeedf )
inlineprivate

Definition at line 175 of file BulletImpactBase.c.

176 {
181
184
187
190
191 p.ScaleParticleParam(EmitorParam.VELOCITY, velocity_min);
192 p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_max);
193 p.ScaleParticleParam(EmitorParam.SIZE, size);
194 p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate);
195 }

References m_RicochetSplashCoef, m_StoppingForce, and MIN_SCALING_PARAM.

Referenced by Event_OnStarted().

◆ SetAngledEnterValue()

void EffBulletImpactBase::SetAngledEnterValue ( float f)
inlineprivate

Definition at line 67 of file BulletImpactBase.c.

68 {
70 }

References m_AngledEnter.

◆ SetEnterParticle()

◆ SetExitParticle()

◆ SetRicochetParticle()

◆ SetSingleParticle()

Member Data Documentation

◆ DEFAULT_PROJECTILE_WEIGHT

float EffBulletImpactBase::DEFAULT_PROJECTILE_WEIGHT = 0.015
staticprivate

◆ INFECTED_HEAD

const int EffBulletImpactBase::INFECTED_HEAD = 3
staticprivate

Definition at line 4 of file BulletImpactBase.c.

◆ INVALID

vector EffBulletImpactBase::INVALID = "0 0 0"
staticprivate

Definition at line 21 of file BulletImpactBase.c.

Referenced by Event_OnStarted().

◆ m_AmmoType

string EffBulletImpactBase::m_AmmoType
private

◆ m_AngledEnter

float EffBulletImpactBase::m_AngledEnter = 0.40
private

◆ m_ComponentIndex

int EffBulletImpactBase::m_ComponentIndex
private

Definition at line 13 of file BulletImpactBase.c.

Referenced by EvaluateEffect().

◆ m_DirectHit

Object EffBulletImpactBase::m_DirectHit
private

Definition at line 9 of file BulletImpactBase.c.

Referenced by Hit_MeatBones::CalculateStoppingForce(), and EvaluateEffect().

◆ m_EnterAngledSplashCoef

float EffBulletImpactBase::m_EnterAngledSplashCoef = 0.01
private

Definition at line 32 of file BulletImpactBase.c.

Referenced by OnEnterAngledCalculations().

◆ m_EnterSplashCoef

float EffBulletImpactBase::m_EnterSplashCoef = 0.003
private

◆ m_ExitPos

vector EffBulletImpactBase::m_ExitPos
private

◆ m_ExitSplashCoef

float EffBulletImpactBase::m_ExitSplashCoef = 0.002
private

◆ m_ImpactType

◆ m_InSpeed

vector EffBulletImpactBase::m_InSpeed
private

◆ m_OutSpeed

vector EffBulletImpactBase::m_OutSpeed
private

◆ m_ParticleEnter

int EffBulletImpactBase::m_ParticleEnter = -1
private

Definition at line 24 of file BulletImpactBase.c.

Referenced by Event_OnStarted(), and SetEnterParticle().

◆ m_ParticleExit

int EffBulletImpactBase::m_ParticleExit = -1
private

Definition at line 25 of file BulletImpactBase.c.

Referenced by Event_OnStarted(), and SetExitParticle().

◆ m_ParticleRicochet

int EffBulletImpactBase::m_ParticleRicochet = -1
private

Definition at line 26 of file BulletImpactBase.c.

Referenced by Event_OnStarted(), and SetRicochetParticle().

◆ m_Pos

vector EffBulletImpactBase::m_Pos
private

◆ m_RicochetSplashCoef

float EffBulletImpactBase::m_RicochetSplashCoef = 0.002
private

Definition at line 31 of file BulletImpactBase.c.

Referenced by OnRicochetCalculations().

◆ m_StoppingForce

◆ m_SurfNormal

vector EffBulletImpactBase::m_SurfNormal
private

Definition at line 15 of file BulletImpactBase.c.

Referenced by EvaluateEffect(), Hit_Water::EvaluateEffect(), and Event_OnStarted().

◆ m_Weight

float EffBulletImpactBase::m_Weight
private

Definition at line 11 of file BulletImpactBase.c.

Referenced by EvaluateEffect().

◆ MIN_SCALING_PARAM

◆ SURVIVOR_HEAD

const int EffBulletImpactBase::SURVIVOR_HEAD = 0
staticprivate

Definition at line 3 of file BulletImpactBase.c.


The documentation for this class was generated from the following file: