DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Hit_MeatBones.c
См. документацию.
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 {
23 return 400;
24 }
25
26 float projectile_weight_coef = weight / DEFAULT_PROJECTILE_WEIGHT;
27
28 float stopping_force = in_speedf * projectile_weight_coef;
29
30 if (m_DirectHit)
31 {
32 /*
33 // TO DO: Doesn't work because IsAlive() is false, even when it shouldn't be.
34 if ( m_DirectHit.IsMan() && m_componentIndex == SURVIVOR_HEAD && m_DirectHit.IsAlive() ) // Is the victim a survivor?
35 {
36 stopping_force = stopping_force * 2;
37 }
38 */
39
40 /*
41 // TO DO: Doesn't work. Need to recognize a zombie somehow
42 else if ( m_DirectHit.IsInherited(DayZCreatureAIType) && m_componentIndex == INFECTED_HEAD ) // Is the victim a survivor that's hit in the head?
43 {
44 stopping_force = stopping_force * 2;
45 }*/
46 }
47
48 return stopping_force;
49 }
50
51 override void Event_OnStarted()
52 {
53 super.Event_OnStarted();
54
55 if (m_ImpactType != ImpactTypes.MELEE)
56 {
57 vector in_speed = m_InSpeed * (-1); // Compiler demands to have this variable
58
59 BloodSplatGround( GetPosition(), in_speed , 0.5 );
60
61 if (m_OutSpeed.Length() > 0)
62 {
64 }
65 }
66 }
67
68 void BloodSplatGround( vector start_pos, vector speed_vector, float decay_coef )
69 {
70 vector pos = start_pos;
71 float power = m_StoppingForce;
72 float upscale = 1;
73 float rnd_offset = 0.5;
74 float rnd_offset_2 = rnd_offset * 0.5;
75
76 while (power > 200)
77 {
78 pos = pos + ( speed_vector * 0.001 );
79 pos = pos + Vector( rnd_offset_2 - Math.RandomFloat( 0, rnd_offset ), 0, rnd_offset_2 - Math.RandomFloat( 0, rnd_offset ) );
80 pos[1] = GetGame().SurfaceY(pos[0], pos[2]);
81
82 EffectParticle eff = new BloodSplatter();
83 eff.SetAutodestroy(true);
85
86 Particle blood = eff.GetParticle(); // TO DO: Handle particle changes inside the Effect instance itself! Not here!
87
88 vector ori = GetGame().GetSurfaceOrientation(pos[0], pos[2]);
89
90 blood.SetOrientation(ori);
91 blood.ScaleParticleParam(EmitorParam.SIZE, upscale);
92
93 Particle blood_chunks = ParticleManager.GetInstance().PlayInWorld(ParticleList.BLOOD_SURFACE_CHUNKS, pos);
94 blood_chunks.SetOrientation(ori);
95
96 power = power * decay_coef;
97 upscale = upscale + Math.RandomFloat(0.1, 1);
98
100 }
101 }
102
104 {
105 // Commented out due to age rating process :(
106
107 /*
108 if (m_OutSpeed.Length() > 0)
109 {
110 Object projected_surface;
111 vector hit_pos;
112 vector hit_normal;
113 float hit_fraction;
114 DayZPhysics.RayCastBullet(m_ExitPos, m_ExitPos + m_OutSpeed, PhxInteractionLayers.BUILDING, m_Object, projected_surface, hit_pos, hit_normal, hit_fraction);
115
116 hit_normal = hit_normal.VectorToAngles();
117 hit_normal[1] = hit_normal[1] + 90;
118
119 EffectParticle eff = new BloodSplatter();
120 eff.SetAutodestroy(true);
121 SEffectManager.PlayInWorld(eff, hit_pos);
122 Particle blood = eff.GetParticle();
123 blood.SetOrientation(hit_normal);
124 }
125 */
126 }
127
128 override void OnEnterCalculations( Particle p )
129 {
130 // Calculate particle's size based on bullet's speed
131 float velocity_min = MIN_SCALING_PARAM + (m_StoppingForce * m_EnterSplashCoef);
132 float velocity_max = MIN_SCALING_PARAM + (m_StoppingForce * m_EnterSplashCoef);
134 float birth_rate = MIN_SCALING_PARAM + (m_StoppingForce * m_EnterSplashCoef/2);
135
136 if ( m_AmmoType == "Bullet_12GaugePellets" )
137 {
138 birth_rate *= 0.5;
139 velocity_min *= 2;
140 velocity_max *= 2;
141 }
142
143 // Additional size increase by distance from camera
144 vector camera_pos = GetGame().GetCurrentCameraPosition();
145 float distance = vector.Distance(camera_pos, m_Pos);
146 float scaling_by_distance = (distance*1.2) * m_ScalingByDistance;
147
148 // Now scale down the above size increase by player's zoom-in value
149 float current_FOV = Camera.GetCurrentFOV();
150 float config_FOV = GetDayZGame().GetUserFOVFromConfig();
151 float FOV_scale = current_FOV / config_FOV;
152 scaling_by_distance = scaling_by_distance * FOV_scale;
153
154 if (scaling_by_distance > 5)
155 scaling_by_distance = 5;
156
157 size = size + scaling_by_distance;
158 velocity_min = velocity_min + scaling_by_distance;
159 velocity_max = velocity_max + scaling_by_distance;
160
161 if (velocity_min < MIN_SCALING_PARAM)
162 velocity_min = MIN_SCALING_PARAM;
163
164 if (velocity_max < MIN_SCALING_PARAM * 2)
165 velocity_max = MIN_SCALING_PARAM * 2;
166
167 if (size < MIN_SCALING_PARAM)
168 size = MIN_SCALING_PARAM;
169
170 if (birth_rate < MIN_SCALING_PARAM)
171 birth_rate = MIN_SCALING_PARAM;
172
173 p.ScaleParticleParam(EmitorParam.VELOCITY, velocity_min);
174 p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_max);
175 p.ScaleParticleParam(EmitorParam.SIZE, size);
176 p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate);
177 }
178
179 override void OnExitCalculations(Particle p, float outSpeedf)
180 {
181 float velocity_rnd = outSpeedf * m_ExitSplashCoef;
182 float birth_rate_rnd_def = outSpeedf * m_ExitSplashCoef;
183 float size = outSpeedf * m_ExitSplashCoef;
184
185 if (velocity_rnd < MIN_SCALING_PARAM)
186 velocity_rnd = MIN_SCALING_PARAM;
187
188 if (size < MIN_SCALING_PARAM)
189 size = MIN_SCALING_PARAM;
190
191 if (size > 1)
192 size = 1;
193
194 if (birth_rate_rnd_def < MIN_SCALING_PARAM)
195 birth_rate_rnd_def = MIN_SCALING_PARAM;
196
197 p.ScaleParticleParam(EmitorParam.VELOCITY_RND, velocity_rnd);
198 p.ScaleParticleParam(EmitorParam.BIRTH_RATE, birth_rate_rnd_def);
199 p.ScaleParticleParam(EmitorParam.SIZE, size);
200 }
201}
DayZGame GetDayZGame()
Определения DayZGame.c:3870
ImpactTypes
Определения ImpactEffects.c:2
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
Определения BloodSplatter.c:2
proto native float SurfaceY(float x, float z)
proto native vector GetCurrentCameraPosition()
vector GetSurfaceOrientation(float x, float z)
Returns tilt of the ground on the given position in degrees, so you can use this value to rotate any ...
Определения Game.c:1143
Определения Camera.c:85
int m_ImpactType
Определения BulletImpactBase.c:12
string m_AmmoType
Определения BulletImpactBase.c:19
vector m_OutSpeed
Определения BulletImpactBase.c:18
void SetExitParticle(int id)
Определения BulletImpactBase.c:50
vector m_ExitPos
Определения BulletImpactBase.c:16
void SetEnterParticle(int id)
Определения BulletImpactBase.c:45
float m_StoppingForce
Определения BulletImpactBase.c:10
float m_EnterSplashCoef
Определения BulletImpactBase.c:29
float m_AngledEnter
Определения BulletImpactBase.c:33
void EffBulletImpactBase()
Определения BulletImpactBase.c:35
void SetRicochetParticle(int id)
Определения BulletImpactBase.c:55
static float DEFAULT_PROJECTILE_WEIGHT
Определения BulletImpactBase.c:5
float m_ExitSplashCoef
Определения BulletImpactBase.c:30
Object m_DirectHit
Определения BulletImpactBase.c:9
float MIN_SCALING_PARAM
Определения BulletImpactBase.c:7
vector m_Pos
Определения BulletImpactBase.c:14
vector m_InSpeed
Определения BulletImpactBase.c:17
Particle GetParticle()
Gets the main particle which this Effect is managing.
Определения EffectParticle.c:162
void EffectParticle()
ctor
Определения EffectParticle.c:34
override void Event_OnStarted()
Определения Hit_MeatBones.c:51
override void OnEnterCalculations(Particle p)
Определения Hit_MeatBones.c:128
void BloodSplatGround(vector start_pos, vector speed_vector, float decay_coef)
Определения Hit_MeatBones.c:68
float m_ScalingByDistance
Определения Hit_MeatBones.c:3
void BloodSplatWall()
Определения Hit_MeatBones.c:103
override void OnExitCalculations(Particle p, float outSpeedf)
Определения Hit_MeatBones.c:179
override float CalculateStoppingForce(float in_speedf, float out_speedf, string ammoType, float weight)
Определения Hit_MeatBones.c:19
void Hit_MeatBones()
Определения Hit_MeatBones.c:5
Определения EnMath.c:7
void ScaleParticleParam(int parameter_id, float coef)
Scales the given parameter on all emitors relatively to their CURRENT value.
Определения Particle.c:697
Legacy way of using particles in the game.
Определения Particle.c:7
static const int IMPACT_MEATBONES_ENTER
Определения ParticleList.c:241
static const int BLOOD_SURFACE_CHUNKS
Определения ParticleList.c:148
static const int IMPACT_MEATBONES_RICOCHET
Определения ParticleList.c:242
static const int IMPACT_MEATBONES_EXIT
Определения ParticleList.c:243
Определения ParticleList.c:12
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
Определения EffectManager.c:47
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
Определения EnConvert.c:106
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
Определения EnVisual.c:114
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9