DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
UniversalTemperatureSource.c
См. документацию.
27
28class UniversalTemperatureSourceResult
29{
32
34 float m_Temperature = 0;
35}
36
38class UniversalTemperatureSourceTimer : Timer
39{
40 override void OnTimer()
41 {
42 if (m_params)
43 {
44 g_Game.GameScript.CallFunctionParams(m_target, m_function, null, m_params);
45 }
46 else
47 {
48 g_Game.GameScript.CallFunction(m_target, m_function, null, 0);
49 }
50 }
51
52 override void Stop()
53 {
54 SetRunning(false);
55 m_time = 0;
56 }
57
58 void SetParams(Param params)
59 {
60 m_params = params;
61 }
62}
63
64typedef UniversalTemperatureSource UTemperatureSource;
65
67{
69
70 protected bool m_Active
71 protected ref UniversalTemperatureSourceTimer m_Timer;
73 protected ref UniversalTemperatureSourceResult m_ResultValues;
75
77 {
78 m_Active = false;
79 m_Settings = pSettings;
80 m_Lambda = pLambda;
81 m_ResultValues = new UniversalTemperatureSourceResult();
82 m_Timer = new UniversalTemperatureSourceTimer();
83
84 Init(pParent);
85 }
86
88 {
89 if (m_Timer)
90 m_Timer.Stop();
91 };
92
93 void Init(EntityAI pParent)
94 {
95 if (pParent)
96 {
97 pParent.SetUniversalTemperatureSource(this);
98
99 m_Settings.m_Parent = pParent;
100 m_Settings.m_Position = pParent.GetPosition();
101 }
102
103 if (m_Settings && !m_Settings.m_ManualUpdate)
104 {
106
107 m_Timer.Run(m_Settings.m_UpdateInterval, this, "Update", params, m_Settings.m_Updateable);
108 SetActive(false);
109 }
110
111 if (m_Settings && m_Settings.m_IsWorldOverriden)
112 m_Settings.m_TemperatureCap += g_Game.GetMission().GetWorldData().GetUniversalTemperatureSourceCapModifier();
113 }
114
116 {
117 if (m_Settings.m_Parent)
118 return m_Settings.m_Parent.GetPosition();
119
120 return m_Settings.m_Position;
121 }
122
124 {
125 return m_Settings.m_RangeFull;
126 }
127
129 {
130 return m_Settings.m_RangeMax;
131 }
132
134 {
135 return m_Settings.m_TemperatureCap;
136 }
137
139 {
140 return m_Settings.m_TemperatureItemCap;
141 }
142
144 {
145 return m_Settings.m_TemperatureItemCoef;
146 }
147
149 {
150 return m_Settings.m_Parent;
151 }
152
157
158 bool IsActive()
159 {
160 if (m_Settings && m_Settings.m_ManualUpdate)
161 {
162 return m_Active;
163 }
164
165 return m_Timer && m_Timer.IsRunning();
166 }
167
168 void SetActive(bool pActive)
169 {
170 if (pActive)
171 m_Lambda.OnUTSActivate();
172 else
173 m_Lambda.OnUTSDeactivate();
174
175 if (m_Settings && m_Settings.m_ManualUpdate)
176 {
177 m_Active = pActive;
178 return;
179 }
180
181 if (pActive && !m_Timer.IsRunning())
182 {
183 m_Timer.Continue();
184 }
185 else
186 {
187 m_Timer.Stop();
188 }
189 }
190
191 void SetDefferedActive(bool pActive, float pSeconds)
192 {
193 if (m_Settings)
194 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLaterByName(this, "SetActive", pSeconds * 1000, false, new Param1<bool>(pActive));
195 }
196
202
204 {
205 if (!settings)
206 return;
207
208 if (settings.m_EnableOnTemperatureControl)
209 {
210 float parentTemperature = GetParent().GetTemperature();
211 float temperatureDifference = parentTemperature - m_ParentTemperaturePrevious;
212
213 if (parentTemperature >= settings.m_ActiveTemperatureThreshold && temperatureDifference > 0)
214 SetActive(true);
215
216 if (parentTemperature < settings.m_InactiveTemperatureThreshold && temperatureDifference < 0)
217 SetActive(false);
218
219 m_ParentTemperaturePrevious = parentTemperature;
220 }
221
222 if (!IsActive())
223 return;
224
225 if (lambda)
226 {
227 settings.m_Position = settings.m_Parent.GetUniversalTemperatureSourcePosition();
228 lambda.OnBeforeExecute();
229 lambda.Execute(settings, m_ResultValues);
230 lambda.OnAfterExecute();
231 }
232
233 }
234
239 {
240 return m_Settings.m_TemperatureMin;
241 }
242
244 {
245 return m_Settings.m_TemperatureMax;
246 }
247
249 {
250 return GetTemperatureRaw();
251 }
252
254 {
255 if (m_ResultValues)
256 return m_ResultValues.m_Temperature;
257
258 return 0;
259 }
260}
261
262typedef UniversalTemperatureSourceDebug UTemperatureSourceDebug;
263
265{
266 const string DELIMITER_DATA = "|";
267 const string DELIMITER_KEYPAIR = ":";
268
269 string m_Header;
270 string m_Data;
274
276 {
277 m_Header = "";
278 m_Data = "";
279 m_Pairs = new array<string>();
280 m_Names = new array<string>();
281 m_Values = new array<string>();
282 }
283
284 void AddHeader(string header)
285 {
286 m_Header = header;
287 }
288
289 void Add(string name, string value)
290 {
291 m_Data = string.Format("%1%2:%3%4", m_Data, name, value, DELIMITER_DATA);
292 }
293
294 void Commit()
295 {
296 m_Pairs = ParseData();
298 }
299
301 {
302 return m_Pairs.Count();
303 }
304
305 string GetHeader()
306 {
307 return m_Header;
308 }
309
310 string GetName(int pIndex)
311 {
312 if (m_Names.Count() - 1 < pIndex)
313 {
314 Debug.Log(string.Format("GetName index: %1 from data of length: %2", pIndex, m_Names.Count()), "UniversalTemperatureSourceDebug");
315 return "";
316 }
317
318 return m_Names.Get(pIndex);
319 }
320
321 string GetValue(int pIndex)
322 {
323 if (m_Values.Count() - 1 < pIndex)
324 {
325 Debug.Log(string.Format("GetValue index: %1 from data of length: %2", pIndex, m_Values.Count()), "UniversalTemperatureSourceDebug");
326 return "";
327 }
328
329 return m_Values.Get(pIndex);
330 }
331
333 {
334
335 array<string> parsed = new array<string>();
336 if (m_Data)
337 {
338 m_Data.Split(DELIMITER_DATA, parsed);
339 }
340
341 return parsed;
342 }
343
344 protected void ParseKeyPairs()
345 {
346 m_Names.Clear();
347 m_Values.Clear();
348
349 if (m_Pairs)
350 {
351 for (int i = 0; i < m_Pairs.Count(); i++)
352 {
353 array<string> keypair = new array<string>();
354
355 m_Pairs.Get(i).Split(DELIMITER_KEYPAIR, keypair);
356 m_Names.Insert(keypair[0]);
357 m_Values.Insert(keypair[1]);
358 }
359 }
360 }
361
362 void Debug()
363 {
364 for (int i = 0; i < m_Names.Count(); i++)
365 {
366 Debug.Log(string.Format("%1: %2", m_Names.Get(i), m_Values.Get(i)), "UniversalTemperatureSourceDebug");
367 }
368 }
369}
bool IsActive()
Определения BunkerBroadcastComponent.c:255
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:4074
override Widget Init()
Определения DayZGame.c:127
void SetActive()
Определения TrapBase.c:413
float m_Temperature
Player HC target(?) value.
Определения UniversalTemperatureSource.c:34
class UniversalTemperatureSourceSettings m_TemperatureItem
float m_TemperatureHeatcomfort
Item target temperature.
Определения UniversalTemperatureSource.c:31
Определения PPEConstants.c:68
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения DayZPlayerImplement.c:39
void SetParams(Param params)
Определения UniversalTemperatureSource.c:58
override void OnTimer()
Определения UniversalTemperatureSource.c:40
override void Stop()
Определения UniversalTemperatureSource.c:52
void Init(EntityAI pParent)
Определения UniversalTemperatureSource.c:93
string GetValue(int pIndex)
Определения UniversalTemperatureSource.c:321
void UniversalTemperatureSource(EntityAI pParent, UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceLambdaBase pLambda)
Определения UniversalTemperatureSource.c:76
void Add(string name, string value)
Определения UniversalTemperatureSource.c:289
UniversalTemperatureSourceLambdaBase GetLambda()
Определения UniversalTemperatureSource.c:153
void SetDefferedActive(bool pActive, float pSeconds)
Определения UniversalTemperatureSource.c:191
ref array< string > m_Values
names parsed from m_Pairs
Определения UniversalTemperatureSource.c:272
ref UniversalTemperatureSourceTimer m_Timer
Определения UniversalTemperatureSource.c:71
UniversalTemperatureSourceSettings m_Settings
Определения UniversalTemperatureSource.c:72
void AddHeader(string header)
Определения UniversalTemperatureSource.c:284
ref array< string > m_Names
Определения UniversalTemperatureSource.c:271
array< string > ParseData()
Определения UniversalTemperatureSource.c:332
ref array< string > m_Pairs
values parsed from m_Pairs
Определения UniversalTemperatureSource.c:273
void ChangeSettings(UniversalTemperatureSourceSettings pSettings)
Определения UniversalTemperatureSource.c:197
void UniversalTemperatureSourceDebug()
keeps first iteration of parsed data from the m_Data
Определения UniversalTemperatureSource.c:275
void SetActive(bool pActive)
Определения UniversalTemperatureSource.c:168
string GetName(int pIndex)
Определения UniversalTemperatureSource.c:310
ref UniversalTemperatureSourceLambdaBase m_Lambda
Определения UniversalTemperatureSource.c:74
void Update(UniversalTemperatureSourceSettings settings, UniversalTemperatureSourceLambdaBase lambda)
Определения UniversalTemperatureSource.c:203
ref UniversalTemperatureSourceResult m_ResultValues
Определения UniversalTemperatureSource.c:73
original Timer deletes m_params which is unwanted
Определения UniversalTemperatureSource.c:39
void Execute(UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceResult resultValues)
vector m_Position
if the stats can be overriden by coefficient/variables from WorldData (currently TemperatureCap only)
Определения UniversalTemperatureSource.c:19
bool m_Updateable
UTS will be inactive on temperature < to this value.
Определения UniversalTemperatureSource.c:15
float m_RangeFull
temperature cap that will limit the return value from GetTemperature method
Определения UniversalTemperatureSource.c:7
float m_TemperatureCap
used to determine speed of temperature change, and some temperature subsystems
Определения UniversalTemperatureSource.c:6
float m_ItemDryModifier
maximum range where the receiver can get some temperature
Определения UniversalTemperatureSource.c:9
float m_TemperatureItemCoef
max temperature 'non-IsSelfAdjustingTemperature' entity in vicinity will get per update (cap);
Определения UniversalTemperatureSource.c:5
float m_RangeMax
range where the full temperature is given to receiver
Определения UniversalTemperatureSource.c:8
float m_TemperatureItemCap
how often the Update is ticking
Определения UniversalTemperatureSource.c:4
bool m_IsWorldOverriden
update is called manually (ex. own tick of parent entity)
Определения UniversalTemperatureSource.c:17
bool m_ManualUpdate
if the Update is running periodically
Определения UniversalTemperatureSource.c:16
float m_ActiveTemperatureThreshold
enable or disable activation/deactivation on set temperature
Определения UniversalTemperatureSource.c:12
bool m_AffectStat
parent Entity of the UTS
Определения UniversalTemperatureSource.c:23
float m_InactiveTemperatureThreshold
UTS will be active on temperature >= to this value.
Определения UniversalTemperatureSource.c:13
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static const vector Zero
Определения EnConvert.c:123
Определения EnConvert.c:119
const float TEMP_COEF_UTS
Определения 3_Game/DayZ/constants.c:1008
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/DayZ/constants.c:856
float m_time
Определения 3_Game/DayZ/tools/tools.c:224
void SetRunning(bool running)
Определения 3_Game/DayZ/tools/tools.c:351
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/DayZ/tools/tools.c:10
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:422