DayZ 1.24
Loading...
Searching...
No Matches
FlareSimulation.c
Go to the documentation of this file.
2{
6 const static float MAX_FARLIGHT_DIST = 40;
7 const static float MIN_FARLIGHT_DIST = 5;
8
9 static ref NoiseParams m_NoisePar; // Contains the noise data ( template and strength )
10 float m_LastNoiseTime = -1;
11 float m_NoiseTimer = 0;
12 const float NOISE_DELAY = 5; // How much time between two consecutive noise pings
13
14 static protected typename m_ScriptedLight;
15 static protected int m_ParticleId;
16
22
24 {
25 if (!GetGame().IsServer() || !GetGame().IsMultiplayer())
26 {
27 m_FlareLight = FlareLight.Cast(ScriptedLightBase.CreateLight(m_ScriptedLight, Vector(0, 0, 0)));
28 if (m_FlareLight)
29 m_FlareLight.AttachOnObject(flare);
30
31 if (m_ParMainFire)
33
34 m_ParMainFire = ParticleManager.GetInstance().PlayOnObject(m_ParticleId, flare);
36
37 flare.PlaySoundSetLoop(m_BurningSound, "roadflareLoop_SoundSet", 0, 0);
38 }
39
40 if (GetGame().IsServer())
41 {
42 // Create and load noise parameters
43 m_NoisePar = new NoiseParams();
44 m_NoisePar.LoadFromPath("cfgWeapons Flaregun_Base NoiseFlare");
45 }
46 }
47
49 {
50 //MiscGameplayFunctions.GenerateAINoiseAtPosition(flare.GetPosition(), NOISE_DELAY, m_NoisePar);
51 }
52
54 {
55 //m_ParMainFire = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_FIRE, flare);
56 //m_ParMainFire.SetWiggle( 7, 0.3);
57 }
58
60 {
61 DayZPlayer player = GetGame().GetPlayer();
62 if (player)
63 vector playerPos = player.GetPosition();
64
65 float dist = vector.DistanceSq(flare.GetPosition(), playerPos);
66
69
72
73 //CastFlareAINoise( flare.GetPosition() );
74 }
75
77 {
78 if (m_LastNoiseTime < 0)
79 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
80
81 float delta_time = GetGame().GetTime() * 0.0033 - m_LastNoiseTime;
82 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
83
85
87 {
88 MiscGameplayFunctions.GenerateAINoiseAtPosition(position, NOISE_DELAY, m_NoisePar);
89
90 m_NoiseTimer = 0;
91 }
92 }
93
95 {
96 if (m_ParMainFire)
97 {
99 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME_RND, 0);
102 }
103 }
104
106 {
107 if (m_ParMainFire)
109
110 if (m_BurningSound)
112
113 if (m_FlareLight)
114 m_FlareLight.FadeOut();
115 }
116}
117
119{
126
134}
void FlareLightGreen()
Definition FlareLight.c:57
class FlareLightGreen extends FlareLight FlareLightBlue()
Definition FlareLight.c:56
class FlareLight extends PointLightBase FlareLightRed()
Definition FlareLight.c:38
void FlareLight()
Definition FlareLight.c:43
FlareSimulation_Green FlareSimulation FlareSimulation_Blue()
FlareSimulation Managed FlareSimulation_Red()
m_ScriptedLight
int m_ParticleId
class NoiseSystem NoiseParams()
Definition Noise.c:15
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
void SoundStop()
Stops sound.
Definition Camera.c:2
EffectSound m_BurningSound
Particle m_ParMainFire
FlareLight m_FlareLight
static const float MAX_FARLIGHT_DIST
void CastFlareAINoise(vector position)
static ref NoiseParams m_NoisePar
void OnTermination(Entity flare)
void OnActivation(Entity flare)
static const float MIN_FARLIGHT_DIST
void OnFire(Entity flare)
const float NOISE_DELAY
void Simulate(Entity flare)
TODO doc.
Definition EnScript.c:118
Legacy way of using particles in the game.
Definition Particle.c:7
void SetWiggle(float random_angle, float random_interval)
Makes the particle change direction by random_angle every random_interval seconds.
Definition Particle.c:742
void SetParameter(int emitter, int parameter, float value)
Set the value of a parameter of an emitor in the particle.
Definition Particle.c:603
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Definition Particle.c:262
static const int FLAREPROJ_ACTIVATE_GREEN
static const int FLAREPROJ_ACTIVATE
static const int FLAREPROJ_ACTIVATE_BLUE
static const int FLAREPROJ_ACTIVATE_RED
static proto native float DistanceSq(vector v1, vector v2)
Returns the square 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.
EmitorParam
Definition EnVisual.c:114