Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
contaminatedarea_dynamicbase.c
Go to the documentation of this file.
2{
3 INIT = 1, // The dynamic area is initializing
4 START = 2, // The dynamic area is starting
5 LIVE = 3, // The dynamic area is live
6 DECAY_START = 4, // The dynamic area decay has started
7 DECAY_END = 5, // The dynamic area will soon be deleted
8}
9
11{
12 protected int m_DecayState = eAreaDecayStage.INIT; // The current state in which the area is
13
14 // Constants used for dissapearing events
15 const float DECAY_START_PART_SIZE = 32;
17 const float DECAY_END_PART_SIZE = 17;
19 const float START_DECAY_LIFETIME = 900;
20 const float FINISH_DECAY_LIFETIME = 300;
21
23 {
24 m_Type = eZoneType.DYNAMIC;
25
26 RegisterNetSyncVariableInt("m_DecayState");
27 }
28
29
31 {
32 return GetLifetime();
33 }
34
36 {
38 }
39
41 {
43 }
44
45 // Set the new state of the Area
46 void SetDecayState(int newState)
47 {
48 if (m_DecayState != newState)
49 {
50 m_DecayState = newState;
51
52 // We update the trigger state values as we also want to update player bound effects
53 if ( m_Trigger )
54 ContaminatedTrigger_Dynamic.Cast( m_Trigger ).SetAreaState( m_DecayState );
55
56 SetSynchDirty();
57 }
58 }
59
60 // We spawn particles and setup trigger
61 override void InitZone()
62 {
64
65 super.InitZone();
66 }
67
68 override void InitZoneClient()
69 {
70 super.InitZoneClient();
71
72 // We spawn VFX on client
73 PlaceParticles(m_Position, m_Radius, m_InnerRings, m_InnerSpacing, m_OuterRingToggle, m_OuterSpacing, m_OuterRingOffset, m_ParticleID);
74 }
75
76 override void InitZoneServer()
77 {
78 super.InitZoneServer();
79
80 // We create the trigger on server
81 if (m_TriggerType != "")
82 CreateTrigger(m_PositionTrigger, m_Radius);
83 }
84
86 {
87 super.OnParticleAllocation(pm, particles);
88
90 {
91 foreach (ParticleSource p : particles)
92 {
93 if (m_DecayState == eAreaDecayStage.DECAY_END)
94 {
95 p.SetParameter(0, EmitorParam.BIRTH_RATE, DECAY_END_PART_BIRTH_RATE);
96 p.SetParameter(0, EmitorParam.SIZE, DECAY_END_PART_SIZE);
97 }
98 else
99 {
100 p.SetParameter(0, EmitorParam.BIRTH_RATE, DECAY_START_PART_BIRTH_RATE);
101 p.SetParameter(0, EmitorParam.SIZE, DECAY_START_PART_SIZE);
102 }
103 }
104 }
105 }
106
107 override void CreateTrigger(vector pos, int radius)
108 {
109 super.CreateTrigger(pos, radius);
110
111 // This handles the specific case of dynamic triggers as some additionnal parameters are present
112 ContaminatedTrigger_Dynamic dynaTrigger = ContaminatedTrigger_Dynamic.Cast(m_Trigger);
113 if (dynaTrigger)
114 {
115 dynaTrigger.SetLocalEffects(m_AroundParticleID, m_TinyParticleID, m_PPERequesterIdx);
116 dynaTrigger.SetAreaState(m_DecayState);
117 }
118 }
119
121 {
122 super.OnVariablesSynchronized();
123
124 if (!m_ToxicClouds)
125 m_ToxicClouds = new array<Particle>();
126
127 switch (m_DecayState)
128 {
129 case eAreaDecayStage.LIVE:
131 break;
132
133 case eAreaDecayStage.DECAY_START:
134 // We go through all the particles bound to this area and update relevant parameters
135 //Debug.Log("We start decay");
136 foreach ( Particle p : m_ToxicClouds )
137 {
138 p.SetParameter( 0, EmitorParam.BIRTH_RATE, DECAY_START_PART_BIRTH_RATE );
139 p.SetParameter( 0, EmitorParam.SIZE, DECAY_START_PART_SIZE );
140 }
141
142 break;
143
144 case eAreaDecayStage.DECAY_END:
145 // We go through all the particles bound to this area and update relevant parameters
146 //Debug.Log("We finish decay");
147 foreach ( Particle prt : m_ToxicClouds )
148 {
149 prt.SetParameter( 0, EmitorParam.BIRTH_RATE, DECAY_END_PART_BIRTH_RATE );
150 prt.SetParameter( 0, EmitorParam.SIZE, DECAY_END_PART_SIZE );
151 }
152
153 break;
154
155 default:
156 break;
157 }
158 }
159}
eBleedingSourceType m_Type
float m_Radius
Legacy way of using particles in the game.
Definition particle.c:7
Entity which has the particle instance as an ObjectComponent.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override void InitZoneServer()
override void InitZoneClient()
override void OnVariablesSynchronized()
override void OnParticleAllocation(ParticleManager pm, array< ParticleSource > particles)
override void InitZone()
const int DECAY_START_PART_BIRTH_RATE
float GetFinishDecayLifetime()
const float DECAY_START_PART_SIZE
void ContaminatedArea_DynamicBase()
const float FINISH_DECAY_LIFETIME
enum eAreaDecayStage m_DecayState
const float DECAY_END_PART_SIZE
float GetStartDecayLifetime()
const int DECAY_END_PART_BIRTH_RATE
const float START_DECAY_LIFETIME
void SetDecayState(int newState)
void ContaminatedTrigger_Dynamic()
vector m_Position
Cached world position.
Definition effect.c:43
eZoneType
Definition effectarea.c:5
class SEffectManager START
@ INIT
Definition enentity.c:81
EmitorParam
Definition envisual.c:114
float GetRemainingTime()
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor).
void CreateTrigger()
Definition trapbase.c:465