DayZ 1.24
Loading...
Searching...
No Matches
Hit_MeatBones.c
Go to the documentation of this file.
2{
4
18
19 override float CalculateStoppingForce(float in_speedf, float out_speedf, string ammoType, float weight)
20 {
21 if (m_ImpactType == ImpactTypes.MELEE)
22 return 400;
23
25
27
28 if (m_DirectHit)
29 {
30 /*
31 // TO DO: Doesn't work because IsAlive() is false, even when it shouldn't be.
32 if ( m_DirectHit.IsMan() && m_componentIndex == SURVIVOR_HEAD && m_DirectHit.IsAlive() ) // Is the victim a survivor?
33 {
34 stopping_force = stopping_force * 2;
35 }
36 */
37
38 /*
39 // TO DO: Doesn't work. Need to recognize a zombie somehow
40 else if ( m_DirectHit.IsInherited(DayZCreatureAIType) && m_componentIndex == INFECTED_HEAD ) // Is the victim a survivor that's hit in the head?
41 {
42 stopping_force = stopping_force * 2;
43 }*/
44 }
45
46 return stopping_force;
47 }
48
49 override void Event_OnStarted()
50 {
51 super.Event_OnStarted();
52
53 if (m_ImpactType != ImpactTypes.MELEE)
54 {
55 vector in_speed = m_InSpeed * (-1); // Compiler demands to have this variable
56
58
59 if (m_OutSpeed.Length() > 0)
61 }
62 }
63
65 {
66 vector pos = start_pos;
67 float power = m_StoppingForce;
68 float upscale = 1;
69 float rnd_offset = 0.5;
70 float rnd_offset_2 = rnd_offset * 0.5;
71
72 while (power > 200)
73 {
74 pos = pos + (speed_vector * 0.001);
76 pos[1] = GetGame().SurfaceY(pos[0], pos[2]);
77
79 eff.SetAutodestroy(true);
81
82 Particle blood = eff.GetParticle(); // TO DO: Handle particle changes inside the Effect instance itself! Not here!
83
84 vector ori = GetGame().GetSurfaceOrientation(pos[0], pos[2]);
85
86 blood.SetOrientation(ori);
87 blood.ScaleParticleParam(EmitorParam.SIZE, upscale);
88
90 blood_chunks.SetOrientation(ori);
91
93 upscale = upscale + Math.RandomFloat(0.1, 1);
94
96 }
97 }
98
100 {
101 // Commented out due to age rating process :(
102
103 /*
104 if (m_OutSpeed.Length() > 0)
105 {
106 Object projected_surface;
107 vector hit_pos;
108 vector hit_normal;
109 float hit_fraction;
110 DayZPhysics.RayCastBullet(m_ExitPos, m_ExitPos + m_OutSpeed, PhxInteractionLayers.BUILDING, m_Object, projected_surface, hit_pos, hit_normal, hit_fraction);
111
112 hit_normal = hit_normal.VectorToAngles();
113 hit_normal[1] = hit_normal[1] + 90;
114
115 EffectParticle eff = new BloodSplatter();
116 eff.SetAutodestroy(true);
117 SEffectManager.PlayInWorld(eff, hit_pos);
118 Particle blood = eff.GetParticle();
119 blood.SetOrientation(hit_normal);
120 }
121 */
122 }
123
125 {
126 // Calculate particle's size based on bullet's speed
131
132 if (m_AmmoType == "Bullet_12GaugePellets")
133 {
134 birth_rate *= 0.5;
135 velocity_min *= 2;
136 velocity_max *= 2;
137 }
138
139 // Additional size increase by distance from camera
140 vector camera_pos = GetGame().GetCurrentCameraPosition();
143
144 // Now scale down the above size increase by player's zoom-in value
145 float current_FOV = Camera.GetCurrentFOV();
146 float config_FOV = GetDayZGame().GetUserFOVFromConfig();
149
150 if (scaling_by_distance > 5)
152
156
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 }
174
176 {
180
183
186
187 if (size > 1)
188 size = 1;
189
192
193 p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_rnd);
194 p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate_rnd_def);
195 p.ScaleParticleParam(EmitorParam.SIZE, size);
196 }
197}
DayZGame GetDayZGame()
Definition DayZGame.c:3530
ImpactTypes
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
class JsonUndergroundAreaTriggerData GetPosition
void SetExitParticle(int id)
void SetEnterParticle(int id)
void SetRicochetParticle(int id)
static float DEFAULT_PROJECTILE_WEIGHT
Wrapper class for managing particles through SEffectManager.
override void Event_OnStarted()
override void OnEnterCalculations(Particle p)
void BloodSplatGround(vector start_pos, vector speed_vector, float decay_coef)
float m_ScalingByDistance
void BloodSplatWall()
override void OnExitCalculations(Particle p, float outSpeedf)
override float CalculateStoppingForce(float in_speedf, float out_speedf, string ammoType, float weight)
void Hit_MeatBones()
Definition EnMath.c:7
Legacy way of using particles in the game.
Definition Particle.c:7
static const int IMPACT_MEATBONES_ENTER
static const int BLOOD_SURFACE_CHUNKS
static const int IMPACT_MEATBONES_RICOCHET
static const int IMPACT_MEATBONES_EXIT
Manager class for managing Effect (EffectParticle, EffectSound)
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
proto native float Length()
Returns length of vector (magnitude)
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
EmitorParam
Definition EnVisual.c:114