DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
RainProcurementHandler.c
См. документацию.
2{
4 protected ref set<RainProcurementComponentBase> m_ActiveComponents;
5 protected ref set<RainProcurementComponentBase> m_ChangedQueue;
6 protected ref set<int> m_CleanupQueue;
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
17 {
19 m_Update = false;
20 m_ProcessComponents = false;
22 m_ActiveComponents = new set<RainProcurementComponentBase>;
23 m_ChangedQueue = new set<RainProcurementComponentBase>;
24 m_CleanupQueue = new set<int>;
26 m_UpdateTimer = 0;
27 }
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 {
62 Reset();
63 }
64 }
65 else
66 {
67 m_UpdateTimer += timeslice;
69 {
71 Cleanup();
74 if (!m_Update)
75 Reset();
76 }
77 }
78 }
79
81 protected bool ProcessBatch()
82 {
83 bool ret = false;
84 int count = m_ActiveComponents.Count();
85 int target = (int)Math.Clamp(m_NextToProcessIdx + UPDATE_BATCH_SIZE, 0, count);
86
88 {
91 else
93 }
94
95 ret = target == count;
96 if (ret)
97 {
99 }
100
101 return ret;
102 }
103
104 protected void Cleanup()
105 {
106 int count = m_CleanupQueue.Count();
107 if (count == 0)
108 return;
109
110 for (int i = count - 1; i > -1; i--)
111 {
113 }
114 m_CleanupQueue.Clear();
115 }
116
117 protected void Reset()
118 {
119 m_ProcessComponents = false;
121 m_UpdateTimer = 0;
122 }
123
124 protected void HandleChangedComponents()
125 {
126
127 int count = m_ChangedQueue.Count();
128 int idx;
129
131 {
132 if (!component)
133 continue;
134
135 if (component.IsActive())
136 {
138 }
139 else
140 {
141 idx = m_ActiveComponents.Find(component);
142 if (idx != -1)
143 m_ActiveComponents.Remove(idx);
144 }
145 }
146 m_ChangedQueue.Clear();
147 }
148
149 protected void CheckUpdating()
150 {
151 m_Update = m_ActiveComponents.Count() != 0;
152 }
153
155 {
156 return m_LiquidAmountCoef;
157 }
158
161 {
162 return g_Game.GetWeather().GetRain().GetActual() + g_Game.GetWeather().GetSnowfall().GetActual();
163 }
164};
Param3 int
DayZGame g_Game
Определения DayZGame.c:3942
Mission mission
Определения DisplayStatus.c:28
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
TODO doc.
Определения EnScript.c:118
Определения EnMath.c:7
Определения missionBase.c:2
ref set< int > m_CleanupQueue
Определения RainProcurementHandler.c:6
float DetermineAmountCoef()
scalable on handler level. Now also handles SNOW, total value can exceed 1.0
Определения RainProcurementHandler.c:160
void QueueStart(RainProcurementComponentBase component)
Определения RainProcurementHandler.c:29
void RainProcurementHandler(MissionBaseWorld mission)
Определения RainProcurementHandler.c:16
bool ProcessBatch()
returns 'true' when all the batches are finished
Определения RainProcurementHandler.c:81
float GetLiquidAmountCoef()
Определения RainProcurementHandler.c:154
void Update(float timeslice)
Определения RainProcurementHandler.c:41
ref set< RainProcurementComponentBase > m_ActiveComponents
Определения RainProcurementHandler.c:4
bool m_ProcessComponents
Определения RainProcurementHandler.c:10
bool m_ProcessingFinished
Определения RainProcurementHandler.c:11
const int UPDATE_BATCH_SIZE
Определения RainProcurementHandler.c:7
MissionBaseWorld m_Mission
Определения RainProcurementHandler.c:3
void HandleChangedComponents()
Определения RainProcurementHandler.c:124
void QueueStop(RainProcurementComponentBase component)
Определения RainProcurementHandler.c:35
float m_LiquidAmountCoef
Определения RainProcurementHandler.c:14
const int UPDATE_TIME
Определения RainProcurementHandler.c:8
ref set< RainProcurementComponentBase > m_ChangedQueue
Определения RainProcurementHandler.c:5
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'.