DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
UniversalTemperatureSource.c
См. документацию.
26
27class UniversalTemperatureSourceResult
28{
31
33 float m_Temperature = 0;
34}
35
37class UniversalTemperatureSourceTimer : Timer
38{
39 override void OnTimer()
40 {
41 if (m_params)
42 {
43 GetGame().GameScript.CallFunctionParams(m_target, m_function, null, m_params);
44 }
45 else
46 {
47 GetGame().GameScript.CallFunction(m_target, m_function, null, 0);
48 }
49 }
50
51 override void Stop()
52 {
53 SetRunning(false);
54 m_time = 0;
55 }
56
57 void SetParams(Param params)
58 {
59 m_params = params;
60 }
61}
62
63typedef UniversalTemperatureSource UTemperatureSource;
64
66{
68
69 protected bool m_Active
70 protected ref UniversalTemperatureSourceTimer m_Timer;
72 protected ref UniversalTemperatureSourceResult m_ResultValues;
74
76 {
77 m_Active = false;
78 m_Settings = pSettings;
79 m_Lambda = pLambda;
80 m_ResultValues = new UniversalTemperatureSourceResult();
81 m_Timer = new UniversalTemperatureSourceTimer();
82
83 Init(pParent);
84 }
85
87
88 void Init(EntityAI pParent)
89 {
90 if (pParent)
91 {
92 pParent.SetUniversalTemperatureSource(this);
93
94 m_Settings.m_Parent = pParent;
95 m_Settings.m_Position = pParent.GetPosition();
96 }
97
98 if (!m_Settings.m_ManualUpdate)
99 {
101
102 m_Timer.Run(m_Settings.m_UpdateInterval, this, "Update", params, m_Settings.m_Updateable);
103 SetActive(false);
104 }
105
106 if (m_Settings.m_IsWorldOverriden)
107 m_Settings.m_TemperatureCap += g_Game.GetMission().GetWorldData().GetUniversalTemperatureSourceCapModifier();
108 }
109
111 {
112 return m_Settings.m_Position;
113 }
114
116 {
117 return m_Settings.m_RangeFull;
118 }
119
121 {
122 return m_Settings.m_RangeMax;
123 }
124
126 {
127 return m_Settings.m_TemperatureCap;
128 }
129
131 {
132 return m_Settings.m_TemperatureItemCap;
133 }
134
136 {
137 return m_Settings.m_TemperatureItemCoef;
138 }
139
141 {
142 return m_Settings.m_Parent;
143 }
144
149
150 bool IsActive()
151 {
152 if (m_Settings.m_ManualUpdate)
153 {
154 return m_Active;
155 }
156
157 return m_Timer && m_Timer.IsRunning();
158 }
159
160 void SetActive(bool pActive)
161 {
162 if (pActive)
163 m_Lambda.OnUTSActivate();
164 else
165 m_Lambda.OnUTSDeactivate();
166
167 if (m_Settings.m_ManualUpdate)
168 {
169 m_Active = pActive;
170 return;
171 }
172
173 if (pActive && !m_Timer.IsRunning())
174 {
175 m_Timer.Continue();
176 }
177 else
178 {
179 m_Timer.Stop();
180 }
181 }
182
183 void SetDefferedActive(bool pActive, float pSeconds)
184 {
185 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLaterByName(this, "SetActive", pSeconds * 1000, false, new Param1<bool>(pActive));
186 }
187
192
194 {
195 if (settings.m_EnableOnTemperatureControl)
196 {
197 float parentTemperature = GetParent().GetTemperature();
198 float temperatureDifference = parentTemperature - m_ParentTemperaturePrevious;
199
200 if (parentTemperature >= settings.m_ActiveTemperatureThreshold && temperatureDifference > 0)
201 SetActive(true);
202
203 if (parentTemperature < settings.m_InactiveTemperatureThreshold && temperatureDifference < 0)
204 SetActive(false);
205
206 m_ParentTemperaturePrevious = parentTemperature;
207 }
208
209 if (!IsActive())
210 return;
211
212 if (lambda)
213 {
214 settings.m_Position = settings.m_Parent.GetUniversalTemperatureSourcePosition();
215 lambda.OnBeforeExecute();
216 lambda.Execute(settings, m_ResultValues);
217 lambda.OnAfterExecute();
218 }
219
220 }
221
226 {
227 return m_Settings.m_TemperatureMin;
228 }
229
231 {
232 return m_Settings.m_TemperatureMax;
233 }
234
236 {
237 return GetTemperatureRaw();
238 }
239
241 {
242 if (m_ResultValues)
243 return m_ResultValues.m_Temperature;
244
245 return 0;
246 }
247}
248
249typedef UniversalTemperatureSourceDebug UTemperatureSourceDebug
250
252{
253 const string DELIMITER_DATA = "|";
254 const string DELIMITER_KEYPAIR = ":";
255
256 string m_Header;
257 string m_Data;
261
263 {
264 m_Header = "";
265 m_Data = "";
266 m_Pairs = new array<string>();
267 m_Names = new array<string>();
268 m_Values = new array<string>();
269 }
270
271 void AddHeader(string header)
272 {
273 m_Header = header;
274 }
275
276 void Add(string name, string value)
277 {
278 m_Data = string.Format("%1%2:%3%4", m_Data, name, value, DELIMITER_DATA);
279 }
280
281 void Commit()
282 {
283 m_Pairs = ParseData();
285 }
286
288 {
289 return m_Pairs.Count();
290 }
291
292 string GetHeader()
293 {
294 return m_Header;
295 }
296
297 string GetName(int pIndex)
298 {
299 if (m_Names.Count() - 1 < pIndex)
300 {
301 Debug.Log(string.Format("GetName index: %1 from data of length: %2", pIndex, m_Names.Count()), "UniversalTemperatureSourceDebug");
302 return "";
303 }
304
305 return m_Names.Get(pIndex);
306 }
307
308 string GetValue(int pIndex)
309 {
310 if (m_Values.Count() - 1 < pIndex)
311 {
312 Debug.Log(string.Format("GetValue index: %1 from data of length: %2", pIndex, m_Values.Count()), "UniversalTemperatureSourceDebug");
313 return "";
314 }
315
316 return m_Values.Get(pIndex);
317 }
318
320 {
321
322 array<string> parsed = new array<string>();
323 if (m_Data)
324 {
325 m_Data.Split(DELIMITER_DATA, parsed);
326 }
327
328 return parsed;
329 }
330
331 protected void ParseKeyPairs()
332 {
333 m_Names.Clear();
334 m_Values.Clear();
335
336 if (m_Pairs)
337 {
338 for (int i = 0; i < m_Pairs.Count(); i++)
339 {
340 array<string> keypair = new array<string>();
341
342 m_Pairs.Get(i).Split(DELIMITER_KEYPAIR, keypair);
343 m_Names.Insert(keypair[0]);
344 m_Values.Insert(keypair[1]);
345 }
346 }
347 }
348
349 void Debug()
350 {
351 for (int i = 0; i < m_Names.Count(); i++)
352 {
353 Debug.Log(string.Format("%1: %2", m_Names.Get(i), m_Values.Get(i)), "UniversalTemperatureSourceDebug");
354 }
355 }
356}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:3868
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:414
string GetHeader()
Определения UniversalTemperatureSource.c:292
float m_Temperature
Player HC target(?) value.
Определения UniversalTemperatureSource.c:33
class UniversalTemperatureSourceSettings m_TemperatureItem
ref array< string > m_Pairs
values parsed from m_Pairs
Определения UniversalTemperatureSource.c:260
ref array< string > m_Names
Определения UniversalTemperatureSource.c:258
float m_TemperatureHeatcomfort
Item target temperature.
Определения UniversalTemperatureSource.c:30
array< string > ParseData()
Определения UniversalTemperatureSource.c:319
void AddHeader(string header)
Определения UniversalTemperatureSource.c:271
int PairsCount()
Определения UniversalTemperatureSource.c:287
void Add(string name, string value)
Определения UniversalTemperatureSource.c:276
string m_Data
Определения UniversalTemperatureSource.c:257
const string DELIMITER_KEYPAIR
Определения UniversalTemperatureSource.c:254
ref array< string > m_Values
names parsed from m_Pairs
Определения UniversalTemperatureSource.c:259
void ParseKeyPairs()
Определения UniversalTemperatureSource.c:331
void Commit()
Определения UniversalTemperatureSource.c:281
void Debug()
Определения UniversalTemperatureSource.c:349
void UniversalTemperatureSourceDebug()
keeps first iteration of parsed data from the m_Data
Определения UniversalTemperatureSource.c:262
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
ScriptModule GameScript
Определения Game.c:12
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.
Определения Debug.c:122
Определения Debug.c:2
Определения Building.c:6
Определения constants.c:659
Определения PPEConstants.c:68
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
proto void CallLaterByName(Class obj, string fnName, int delay=0, bool repeat=false, Param params=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
Определения DayZPlayerImplement.c:63
void SetParams(Param params)
Определения UniversalTemperatureSource.c:57
override void OnTimer()
Определения UniversalTemperatureSource.c:39
override void Stop()
Определения UniversalTemperatureSource.c:51
void Init(EntityAI pParent)
Определения UniversalTemperatureSource.c:88
void UniversalTemperatureSource(EntityAI pParent, UniversalTemperatureSourceSettings pSettings, UniversalTemperatureSourceLambdaBase pLambda)
Определения UniversalTemperatureSource.c:75
UniversalTemperatureSourceLambdaBase GetLambda()
Определения UniversalTemperatureSource.c:145
void SetDefferedActive(bool pActive, float pSeconds)
Определения UniversalTemperatureSource.c:183
ref UniversalTemperatureSourceTimer m_Timer
Определения UniversalTemperatureSource.c:70
UniversalTemperatureSourceSettings m_Settings
Определения UniversalTemperatureSource.c:71
void ChangeSettings(UniversalTemperatureSourceSettings pSettings)
Определения UniversalTemperatureSource.c:188
void SetActive(bool pActive)
Определения UniversalTemperatureSource.c:160
ref UniversalTemperatureSourceLambdaBase m_Lambda
Определения UniversalTemperatureSource.c:73
void Update(UniversalTemperatureSourceSettings settings, UniversalTemperatureSourceLambdaBase lambda)
Определения UniversalTemperatureSource.c:193
ref UniversalTemperatureSourceResult m_ResultValues
Определения UniversalTemperatureSource.c:72
original Timer deletes m_params which is unwanted
Определения UniversalTemperatureSource.c:38
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:18
bool m_Updateable
UTS will be inactive on temperature < to this value.
Определения UniversalTemperatureSource.c:14
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_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:16
bool m_EnableOnTemperatureControl
maximum range where the receiver can get some temperature
Определения UniversalTemperatureSource.c:10
bool m_ManualUpdate
if the Update is running periodically
Определения UniversalTemperatureSource.c:15
float m_ActiveTemperatureThreshold
enable or disable activation/deactivation on set temperature
Определения UniversalTemperatureSource.c:11
bool m_AffectStat
parent Entity of the UTS
Определения UniversalTemperatureSource.c:22
float m_InactiveTemperatureThreshold
UTS will be active on temperature >= to this value.
Определения UniversalTemperatureSource.c:12
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static const vector Zero
Определения EnConvert.c:110
Определения EnConvert.c:106
proto native CGame GetGame()
proto volatile int CallFunctionParams(Class inst, string function, out void returnVal, Class parms)
proto volatile int CallFunction(Class inst, string function, out void returnVal, void parm)
const float TEMP_COEF_UTS
Определения constants.c:945
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
float m_time
Определения tools.c:224
void SetRunning(bool running)
Определения tools.c:351
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407
proto native owned string GetName()
Test name getter. Strictly for UI porposes!
Определения SyncedValue.c:119