DayZ 1.29
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 return m_Settings.m_Position;
118 }
119
121 {
122 return m_Settings.m_RangeFull;
123 }
124
126 {
127 return m_Settings.m_RangeMax;
128 }
129
131 {
132 return m_Settings.m_TemperatureCap;
133 }
134
136 {
137 return m_Settings.m_TemperatureItemCap;
138 }
139
141 {
142 return m_Settings.m_TemperatureItemCoef;
143 }
144
146 {
147 return m_Settings.m_Parent;
148 }
149
154
155 bool IsActive()
156 {
157 if (m_Settings && m_Settings.m_ManualUpdate)
158 {
159 return m_Active;
160 }
161
162 return m_Timer && m_Timer.IsRunning();
163 }
164
165 void SetActive(bool pActive)
166 {
167 if (pActive)
168 m_Lambda.OnUTSActivate();
169 else
170 m_Lambda.OnUTSDeactivate();
171
172 if (m_Settings && m_Settings.m_ManualUpdate)
173 {
174 m_Active = pActive;
175 return;
176 }
177
178 if (pActive && !m_Timer.IsRunning())
179 {
180 m_Timer.Continue();
181 }
182 else
183 {
184 m_Timer.Stop();
185 }
186 }
187
188 void SetDefferedActive(bool pActive, float pSeconds)
189 {
190 if (m_Settings)
191 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLaterByName(this, "SetActive", pSeconds * 1000, false, new Param1<bool>(pActive));
192 }
193
199
201 {
202 if (!settings)
203 return;
204
205 if (settings.m_EnableOnTemperatureControl)
206 {
207 float parentTemperature = GetParent().GetTemperature();
208 float temperatureDifference = parentTemperature - m_ParentTemperaturePrevious;
209
210 if (parentTemperature >= settings.m_ActiveTemperatureThreshold && temperatureDifference > 0)
211 SetActive(true);
212
213 if (parentTemperature < settings.m_InactiveTemperatureThreshold && temperatureDifference < 0)
214 SetActive(false);
215
216 m_ParentTemperaturePrevious = parentTemperature;
217 }
218
219 if (!IsActive())
220 return;
221
222 if (lambda)
223 {
224 settings.m_Position = settings.m_Parent.GetUniversalTemperatureSourcePosition();
225 lambda.OnBeforeExecute();
226 lambda.Execute(settings, m_ResultValues);
227 lambda.OnAfterExecute();
228 }
229
230 }
231
236 {
237 return m_Settings.m_TemperatureMin;
238 }
239
241 {
242 return m_Settings.m_TemperatureMax;
243 }
244
246 {
247 return GetTemperatureRaw();
248 }
249
251 {
252 if (m_ResultValues)
253 return m_ResultValues.m_Temperature;
254
255 return 0;
256 }
257}
258
259typedef UniversalTemperatureSourceDebug UTemperatureSourceDebug
260
262{
263 const string DELIMITER_DATA = "|";
264 const string DELIMITER_KEYPAIR = ":";
265
266 string m_Header;
267 string m_Data;
271
273 {
274 m_Header = "";
275 m_Data = "";
276 m_Pairs = new array<string>();
277 m_Names = new array<string>();
278 m_Values = new array<string>();
279 }
280
281 void AddHeader(string header)
282 {
283 m_Header = header;
284 }
285
286 void Add(string name, string value)
287 {
288 m_Data = string.Format("%1%2:%3%4", m_Data, name, value, DELIMITER_DATA);
289 }
290
291 void Commit()
292 {
293 m_Pairs = ParseData();
295 }
296
298 {
299 return m_Pairs.Count();
300 }
301
302 string GetHeader()
303 {
304 return m_Header;
305 }
306
307 string GetName(int pIndex)
308 {
309 if (m_Names.Count() - 1 < pIndex)
310 {
311 Debug.Log(string.Format("GetName index: %1 from data of length: %2", pIndex, m_Names.Count()), "UniversalTemperatureSourceDebug");
312 return "";
313 }
314
315 return m_Names.Get(pIndex);
316 }
317
318 string GetValue(int pIndex)
319 {
320 if (m_Values.Count() - 1 < pIndex)
321 {
322 Debug.Log(string.Format("GetValue index: %1 from data of length: %2", pIndex, m_Values.Count()), "UniversalTemperatureSourceDebug");
323 return "";
324 }
325
326 return m_Values.Get(pIndex);
327 }
328
330 {
331
332 array<string> parsed = new array<string>();
333 if (m_Data)
334 {
335 m_Data.Split(DELIMITER_DATA, parsed);
336 }
337
338 return parsed;
339 }
340
341 protected void ParseKeyPairs()
342 {
343 m_Names.Clear();
344 m_Values.Clear();
345
346 if (m_Pairs)
347 {
348 for (int i = 0; i < m_Pairs.Count(); i++)
349 {
350 array<string> keypair = new array<string>();
351
352 m_Pairs.Get(i).Split(DELIMITER_KEYPAIR, keypair);
353 m_Names.Insert(keypair[0]);
354 m_Values.Insert(keypair[1]);
355 }
356 }
357 }
358
359 void Debug()
360 {
361 for (int i = 0; i < m_Names.Count(); i++)
362 {
363 Debug.Log(string.Format("%1: %2", m_Names.Get(i), m_Values.Get(i)), "UniversalTemperatureSourceDebug");
364 }
365 }
366}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:3942
override Widget Init()
Определения DayZGame.c:127
class ErrorHandlerModule m_Header
This is where to input logic and extend functionality of ErrorHandlerModule.
bool IsActive()
Определения ModifierBase.c:130
float GetValue()
Определения SyncedValue.c:55
void SetActive()
Определения TrapBase.c:404
string GetHeader()
Определения UniversalTemperatureSource.c:302
float m_Temperature
Player HC target(?) value.
Определения UniversalTemperatureSource.c:34
class UniversalTemperatureSourceSettings m_TemperatureItem
ref array< string > m_Pairs
values parsed from m_Pairs
Определения UniversalTemperatureSource.c:270
ref array< string > m_Names
Определения UniversalTemperatureSource.c:268
float m_TemperatureHeatcomfort
Item target temperature.
Определения UniversalTemperatureSource.c:31
array< string > ParseData()
Определения UniversalTemperatureSource.c:329
void AddHeader(string header)
Определения UniversalTemperatureSource.c:281
int PairsCount()
Определения UniversalTemperatureSource.c:297
void Add(string name, string value)
Определения UniversalTemperatureSource.c:286
string m_Data
Определения UniversalTemperatureSource.c:267
const string DELIMITER_KEYPAIR
Определения UniversalTemperatureSource.c:264
ref array< string > m_Values
names parsed from m_Pairs
Определения UniversalTemperatureSource.c:269
void ParseKeyPairs()
Определения UniversalTemperatureSource.c:341
void Commit()
Определения UniversalTemperatureSource.c:291
void Debug()
Определения UniversalTemperatureSource.c:359
void UniversalTemperatureSourceDebug()
keeps first iteration of parsed data from the m_Data
Определения UniversalTemperatureSource.c:272
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Определения 3_Game/DayZ/tools/Debug.c:182
Определения 3_Game/DayZ/tools/Debug.c:2
Определения 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
void UniversalTemperatureSource(EntityAI pParent, UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceLambdaBase pLambda)
Определения UniversalTemperatureSource.c:76
UniversalTemperatureSourceLambdaBase GetLambda()
Определения UniversalTemperatureSource.c:150
void SetDefferedActive(bool pActive, float pSeconds)
Определения UniversalTemperatureSource.c:188
ref UniversalTemperatureSourceTimer m_Timer
Определения UniversalTemperatureSource.c:71
UniversalTemperatureSourceSettings m_Settings
Определения UniversalTemperatureSource.c:72
void ChangeSettings(UniversalTemperatureSourceSettings pSettings)
Определения UniversalTemperatureSource.c:194
void SetActive(bool pActive)
Определения UniversalTemperatureSource.c:165
ref UniversalTemperatureSourceLambdaBase m_Lambda
Определения UniversalTemperatureSource.c:74
void Update(UniversalTemperatureSourceSettings settings, UniversalTemperatureSourceLambdaBase lambda)
Определения UniversalTemperatureSource.c:200
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:950
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/DayZ/constants.c:811
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
proto native owned string GetName()
Test name getter. Strictly for UI porposes!
Определения SyncedValue.c:119