DayZ 1.24
Loading...
Searching...
No Matches
RainProcurementHandler.c
Go to the documentation of this file.
2{
7 protected const int UPDATE_BATCH_SIZE = 20; //Tweak this to adjust max batch size
8 const int UPDATE_TIME = 10; //seconds
9 protected bool m_Update;
10 protected bool m_ProcessComponents;
11 protected bool m_ProcessingFinished;
12 protected int m_NextToProcessIdx;
13 protected float m_UpdateTimer;
14 protected float m_LiquidAmountCoef;
15
28
34
40
41 void Update(float timeslice)
42 {
43 if (!m_Update)
44 return;
45
47 {
48 if (m_ProcessingFinished) //do on start and after the batch is finished
49 {
51 if (m_LiquidAmountCoef == 0) //skip processing when not raining
52 {
53 Reset();
54 return;
55 }
56 }
57
59
61 Reset();
62 }
63 else
64 {
67 {
69 Cleanup();
72 if (!m_Update)
73 Reset();
74 }
75 }
76 }
77
79 protected bool ProcessBatch()
80 {
81 bool ret = false;
82 int count = m_ActiveComponents.Count();
84
86 {
89 else
91 }
92
93 ret = target == count;
94 if (ret)
96
97 return ret;
98 }
99
100 protected void Cleanup()
101 {
102 int count = m_CleanupQueue.Count();
103 if (count == 0)
104 return;
105
106 for (int i = count - 1; i > -1; i--)
108 m_CleanupQueue.Clear();
109 }
110
111 protected void Reset()
112 {
113 m_ProcessComponents = false;
115 m_UpdateTimer = 0;
116 }
117
118 protected void HandleChangedComponents()
119 {
121 int count = m_ChangedQueue.Count();
122 int idx;
123
124 for (int i = 0; i < count; i++)
125 {
127 if (!component)
128 continue;
129
130 if (component.IsActive())
132 else
133 {
135 if (idx != -1)
136 m_ActiveComponents.Remove(idx);
137 }
138 }
139 m_ChangedQueue.Clear();
140 }
141
142 protected void CheckUpdating()
143 {
144 m_Update = m_ActiveComponents.Count() != 0;
145 }
146
148 {
149 return m_LiquidAmountCoef;
150 }
151
154 {
155 return GetGame().GetWeather().GetRain().GetActual();
156 }
157};
Param3 int
Mission mission
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
TODO doc.
Definition EnScript.c:118
Definition EnMath.c:7
float DetermineAmountCoef()
scalable on handler level
void QueueStart(RainProcurementComponentBase component)
void RainProcurementHandler(MissionBaseWorld mission)
bool ProcessBatch()
returns 'true' when all the batches are finished
void Update(float timeslice)
ref set< RainProcurementComponentBase > m_ActiveComponents
void QueueStop(RainProcurementComponentBase component)
ref set< RainProcurementComponentBase > m_ChangedQueue
proto native CGame GetGame()
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.