DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
MiscEffects.c
См. документацию.
2{
3 protected static const int VEGE_COLLISION_COOLDOWN = 3000; // ms
5
6 // Called by individual clients when player collides with a vegetation
8 {
10 if (m_VegeCollideColldowns.Get(object))
11 return;
12
13 int particleID;
14 string particleName;
15 string configPath = "CfgNonAIVehicles " + object.GetType() + " collisionParticle";
16 GetGame().ConfigGetText(configPath, particleName);
17 if (particleName == string.Empty) // no ptc assigned
18 return;
19
20 particleID = ParticleList.GetParticleIDByName(particleName);
21 vector playerPos = player.GetPosition();
22 vector ptcPos = playerPos - object.GetPosition();
23
24 ptcPos[0] = ptcPos[0] * Math.RandomFloat(0, 0.5); // randomize
25 ptcPos[2] = ptcPos[2] * Math.RandomFloat(0, 0.5);
26
27 ptcPos = playerPos - ptcPos;
28 ptcPos[1] = playerPos[1] + Math.RandomFloat(0.5, 1.5);
29
30 ParticleManager.GetInstance().PlayInWorld(particleID, ptcPos);
31
32 m_VegeCollideColldowns.Insert(object, GetWorldTime());
33 }
34
35 protected static void UpdateVegeCollisionCooldowns()
36 {
37 float time = GetWorldTime();
38 foreach (Object key, float cd : m_VegeCollideColldowns)
39 {
40 if ((time - cd) > VEGE_COLLISION_COOLDOWN)
41 {
42 m_VegeCollideColldowns.Remove(key);
43 break;
44 }
45 }
46 }
47}
map
Определения ControlsXboxNew.c:4
Empty
Определения Hand_States.c:14
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
Определения ManBase.c:2
TODO doc.
Определения EnScript.c:118
Определения EnMath.c:7
static void PlayVegetationCollideParticles(Object object, DayZPlayerImplement player)
Определения MiscEffects.c:7
static const int VEGE_COLLISION_COOLDOWN
Определения MiscEffects.c:3
static void UpdateVegeCollisionCooldowns()
Определения MiscEffects.c:35
static ref map< Object, float > m_VegeCollideColldowns
Определения MiscEffects.c:4
Определения MiscEffects.c:2
Определения ObjectTyped.c:2
static int GetParticleIDByName(string name)
Returns particle's ID based on the filename (without .ptc suffix)
Определения ParticleList.c:500
Определения ParticleList.c:12
Определения EnConvert.c:106
proto native CGame GetGame()
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
proto native float GetWorldTime()