DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
Debug.c
Go to the documentation of this file.
1// TODO:
2// 1. Alredy exist some key in array / map
3// 2. Object is null (check object & log error)
4// 3. Debug version only
5// 4. Destructor of static classes
6// 5. Debug Console Interface:
7// - Clear Log
8// - Filter
9// - Log per frame
10// 6. Per frame log ?
11// 7. Zapis do fajlu
12
13class Debug
14{
15 static private const string LOG_DEBUG = "Debug";
16 static private const string LOG_DEBUG_ACTION = "Action";
17 static private const string LOG_DEBUG_SYMPTOM = "Symptom";
18 static private const string LOG_DEBUG_INV_MOVE = "Inv Move";
19 static private const string LOG_DEBUG_INV_RESERVATION = "Inv Rrsv";
20 static private const string LOG_DEBUG_INV_HFSM = "HFSM";
21 static private const string LOG_DEBUG_TRIGGER = "Trigger";
22 static private const string LOG_DEBUG_PARTICLE = "Particle";
23 static private const string LOG_DEBUG_TF = "TestFramework";
24 static private const string LOG_DEBUG_WEIGHT = "Weight";
25 static private const string LOG_DEBUG_MELEE = "Melee";
26 static private const string LOG_DEBUG_WEATHER = "Weather";
27
28 static private const string LOG_INFO = "Info";
29 static private const string LOG_WARNING = "Warning";
30 static private const string LOG_ERROR = "Error";
31 static private const string LOG_DEFAULT = "n/a";
32
33 static private ref array<Shape> m_DebugShapes;
34
36 static CanvasWidget m_CanvasDebug;
37
38
39
40 static string GetDebugName(Managed entity)
41 {
42 if (!entity)
43 return "";
44
45 Object obj;
46 if (CastTo(obj, entity))
47 return obj.GetDebugNameNative();
48
49 return entity.GetDebugName();
50 }
51
52 static void InitCanvas()
53 {
55 {
56 m_DebugLayoutCanvas = GetGame().GetWorkspace().CreateWidgets("gui/layouts/debug/day_z_debugcanvas.layout");
57 m_CanvasDebug = CanvasWidget.Cast( m_DebugLayoutCanvas.FindAnyWidget( "CanvasWidget" ) );
58 }
59 }
60
61 static void ClearCanvas()
62 {
63 if (m_CanvasDebug)
64 m_CanvasDebug.Clear();
65 }
66
67 static void CanvasDrawLine(float x1, float y1, float x2, float y2, float width, int color)
68 {
69 InitCanvas();
70 m_CanvasDebug.DrawLine(x1, y1, x2, y2, width, color);
71 }
72
84 static void CanvasDrawPoint(float x1, float y1, int color)
85 {
86 CanvasDrawLine(x1, y1, x1+1, y1, 1, color);
87 }
88
89 static void Init()
90 {
92 }
93
94 static void DestroyAllShapes()
95 {
96 for ( int i = 0; i < m_DebugShapes.Count(); ++i )
97 {
98 if ( m_DebugShapes.Get(i) )
99 {
100 m_DebugShapes.Get(i).Destroy();
101 }
102 }
103
104 m_DebugShapes.Clear();
105 }
106
107 static void RemoveShape(out Shape shape)
108 {
109 if (!shape) return;
110 for ( int i = 0; i < m_DebugShapes.Count(); i++ )
111 {
112 Shape found_shape = m_DebugShapes.Get(i);
113
114 if ( found_shape && found_shape == shape )
115 {
116 found_shape.Destroy();
117 m_DebugShapes.Remove(i); // Mandatory! Otherwise the Destroy() function causes crash!
118 shape = null;
119 return;
120 }
121 }
122 }
133 static void Log(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
134 {
135 LogMessage(LOG_DEBUG, plugin, entity, author, label, message);
136 }
137
138 static void ActionLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
139 {
140 LogMessage(LOG_DEBUG_ACTION, plugin, entity, author, label, message);
141 }
142
143 static void SymptomLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
144 {
145 LogMessage(LOG_DEBUG_SYMPTOM, plugin, entity, author, label, message);
146 }
147
148 static void InventoryMoveLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
149 {
150 LogMessage(LOG_DEBUG_INV_MOVE, plugin, entity, author, label, message);
151 }
152
153 static void InventoryReservationLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
154 {
155 LogMessage(LOG_DEBUG_INV_RESERVATION, plugin, entity, author, label, message);
156 }
157
158 static void InventoryHFSMLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
159 {
160 LogMessage(LOG_DEBUG_INV_HFSM, plugin, entity, author, label, message);
161 }
162
163 static void TriggerLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
164 {
165 LogMessage(LOG_DEBUG_TRIGGER, plugin, entity, author, label, message);
166 }
167
168 static void ParticleLog(string message = LOG_DEFAULT, Managed caller = null, string function = "", Managed entity = null)
169 {
170 LogMessage(LOG_DEBUG_PARTICLE, GetDebugName(caller), GetDebugName(entity), "", function, message);
171 }
172
173 static void TFLog(string message = LOG_DEFAULT, TestFramework caller = null, string function = "")
174 {
175 LogMessage(LOG_DEBUG_TF, GetDebugName(caller), "", "", function, message);
176 }
177
178 static void WeightLog(string message = LOG_DEFAULT, Managed caller = null, string function = "", Managed entity = null)
179 {
180 //LogMessage(LOG_DEBUG_WEIGHT, GetDebugName(caller), GetDebugName(entity), "", function, message);
181 }
182
183 static void MeleeLog(Entity entity, string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT)
184 {
185 string logMessage = string.Format("%1: %2", entity.GetSimulationTimeStamp(), message);
186 LogMessage(LOG_DEBUG_MELEE, plugin, GetDebugName(entity), author, label, logMessage);
187 }
188
189 static void WeatherLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
190 {
192 LogMessage(LOG_DEBUG_WEATHER, plugin, entity, author, label, message);
193 }
194
205 static void LogInfo(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
206 {
207 LogMessage(LOG_INFO, plugin, entity, author, label, message);
208 }
209
220 static void LogWarning(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
221 {
222 LogMessage(LOG_WARNING, plugin, entity, author, label, message);
223 }
224
235 static void LogError(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
236 {
237 LogMessage(LOG_ERROR, plugin, entity, author, label, message);
238 }
239
240 static void LogArrayInt(array<int> arr = NULL, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
241 {
242 if (arr == null)
243 return;
244
245 for (int i = 0; i < arr.Count(); i++)
246 {
247 LogMessage(LOG_DEBUG, plugin, entity, author, label, arr.Get(i).ToString());
248 }
249 }
250
251 static void LogArrayString(array<string> arr = NULL, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
252 {
253 if (arr == null)
254 return;
255
256 for (int i = 0; i < arr.Count(); i++)
257 {
258 LogMessage(LOG_DEBUG, plugin, entity, author, label, arr.Get(i));
259 }
260 }
261
262 static void ReceivedLogMessageFromServer(string message)
263 {
265 SaveLog(message);
266 }
267
268 static void ClearScriptLogs()
269 {
270 ClearLogs();
271 }
272
273 static Shape DrawBox(vector pos1, vector pos2, int color = 0x1fff7f7f)
274 {
275 return DrawBoxEx(pos1, pos2, color, ShapeFlags.TRANSP|ShapeFlags.NOZWRITE);
276 }
277
278 static Shape DrawBoxEx(vector pos1, vector pos2, int color = 0x1fff7f7f, ShapeFlags flags = ShapeFlags.TRANSP|ShapeFlags.NOZWRITE)
279 {
280 Shape shape = Shape.Create(ShapeType.BBOX, color, flags, pos1, pos2);
281 if (( flags & ShapeFlags.ONCE ) == 0)
282 m_DebugShapes.Insert(shape);
283 return shape;
284 }
285
286 static Shape DrawCube(vector pos, float size = 1, int color = 0x1fff7f7f)
287 {
288 vector min = pos;
289 vector max = pos;
290
291 float size_h = size * 0.5;
292
293 min[0] = min[0] - size_h;
294 min[1] = min[1] - size_h;
295 min[2] = min[2] - size_h;
296
297 max[0] = max[0] + size_h;
298 max[1] = max[1] + size_h;
299 max[2] = max[2] + size_h;
300
301 Shape shape = Shape.Create(ShapeType.DIAMOND, color, ShapeFlags.TRANSP|ShapeFlags.NOZWRITE, min, max);
302 m_DebugShapes.Insert(shape);
303 return shape;
304 }
305
306 static Shape DrawSphere(vector pos, float size = 1, int color = 0x1fff7f7f, ShapeFlags flags = ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
307 {
308 Shape shape = Shape.CreateSphere(color, flags, pos, size);
309 if (( flags & ShapeFlags.ONCE ) == 0)
310 m_DebugShapes.Insert(shape);
311 return shape;
312 }
313
314 static Shape DrawFrustum(float horizontalAngle, float verticalAngle, float length, int color = 0x1fff7f7f, ShapeFlags flags = ShapeFlags.TRANSP|ShapeFlags.WIREFRAME)
315 {
316 Shape shape = Shape.CreateFrustum(horizontalAngle, verticalAngle, length, color, flags);
317 if (( flags & ShapeFlags.ONCE ) == 0)
318 m_DebugShapes.Insert(shape);
319 return shape;
320 }
321
322 static Shape DrawCylinder(vector pos, float radius, float height = 1, int color = 0x1fff7f7f, ShapeFlags flags = ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE )
323 {
324 Shape shape = Shape.CreateCylinder(color, flags, pos, radius, height);
325 if (( flags & ShapeFlags.ONCE ) == 0)
326 m_DebugShapes.Insert(shape);
327 return shape;
328 }
329
330 static array<Shape> DrawCone(vector pos, float lenght, float halfAngle, float offsetAngle, int color = 0xFFFFFFFF, int flags = 0)
331 {
332 array<Shape> shapes = new array<Shape>;
333
334 vector endL, endR;
335 Math3D.ConePoints(pos, lenght, halfAngle, offsetAngle, endL, endR);
336
337 // Left side
338 shapes.Insert( Debug.DrawLine(pos, endL, color, flags) );
339 // Rigth side
340 shapes.Insert( Debug.DrawLine(pos, endR, color, flags) );
341 // Top side
342 shapes.Insert( Debug.DrawLine(endL, endR, color, flags) );
343 // Middle (height) line
344 shapes.Insert( Debug.DrawLine(pos, pos + Vector(Math.Cos(offsetAngle), 0, Math.Sin(offsetAngle)).Normalized() * lenght, color, flags) );
345
346 return shapes;
347 }
348
361 static Shape DrawLine(vector from, vector to, int color = 0xFFFFFFFF, int flags = 0)
362 {
363 vector pts[2]
364 pts[0] = from;
365 pts[1] = to;
366
367 Shape shape = Shape.CreateLines(color, flags, pts, 2);
368 if (( flags & ShapeFlags.ONCE ) == 0)
369 m_DebugShapes.Insert(shape);
370 //m_DebugShapes.Debug();
371 return shape;
372 }
373
374 static Shape DrawLines(vector[] positions, int count, int color = 0xFFFFFFFF, int flags = 0)
375 {
376
377 Shape shape = Shape.CreateLines(color, flags, positions, count);
378 if (( flags & ShapeFlags.ONCE ) == 0)
379 m_DebugShapes.Insert(shape);
380 return shape;
381 }
382
383 static Shape DrawArrow(vector from, vector to, float size = 0.5, int color = 0xFFFFFFFF, int flags = 0)
384 {
385 Shape shape = Shape.CreateArrow(from, to, size, color, flags);
386 m_DebugShapes.Insert(shape);
387 return shape;
388 }
389
390
391
396 static void GetBaseConfigClasses( out TStringArray base_classes )
397 {
398 base_classes.Clear();
399 base_classes.Insert(CFG_VEHICLESPATH);
400 base_classes.Insert(CFG_WEAPONSPATH);
401 base_classes.Insert(CFG_MAGAZINESPATH);
402 base_classes.Insert(CFG_AMMO);
403 base_classes.Insert(CFG_WORLDS);
404 base_classes.Insert(CFG_SURFACES);
405 base_classes.Insert(CFG_SOUND_SETS);
406 base_classes.Insert(CFG_SOUND_SHADERS);
407 base_classes.Insert(CFG_NONAI_VEHICLES);
408 base_classes.Insert(CFG_SOUND_TABLES);
409 }
410
417 static void GetFiltredConfigClasses( string search_string, out TStringArray filtered_classes, bool only_public = true )
418 {
419 TStringArray searching_in = new TStringArray;
420 GetBaseConfigClasses( searching_in );
421
422 filtered_classes.Clear();
423
424 search_string.ToLower();
425
426 for ( int s = 0; s < searching_in.Count(); ++s )
427 {
428 string config_path = searching_in.Get(s);
429
430 int objects_count = GetGame().ConfigGetChildrenCount(config_path);
431 for (int i = 0; i < objects_count; i++)
432 {
433 string childName;
434 GetGame().ConfigGetChildName(config_path, i, childName);
435
436 if ( only_public )
437 {
438 int scope = GetGame().ConfigGetInt( config_path + " " + childName + " scope" );
439 if ( scope == 0 )
440 {
441 continue;
442 }
443 }
444
445 string nchName = childName;
446 nchName.ToLower();
447
448 if ( nchName.Contains(search_string) != -1)
449 {
450 filtered_classes.Insert(childName);
451 }
452 }
453 }
454 }
455
456 //---------------------------------------------------------------
457 //-------private
458
459 static private bool m_EnabledLogs;
460
461 static private void LogMessage(string level, string plugin, string entity, string author, string label, string message)
462 {
463 if (GetGame() == null || !LogManager.IsLogsEnable())
464 return;
465
466 bool is_server_log = ( GetGame().IsServer() && GetGame().IsMultiplayer() );
467
468
469 // Formation output to external file
470 // %date{MM-dd HH:mm:ss} | %Enviroment | %Level | %Module | %Entity | %Author | %Label | %Message
471 string date = GetDate();
472 string env = "Client";
473 string msg = string.Empty;
474
475 if ( is_server_log )
476 {
477 env = "Server";
478 }
479
480 msg = string.Format("%1 | %2 | %3 | %4 | %5 | %6 | %7", date, env, level, plugin, entity, label, message);
481
482 if ( is_server_log )
483 {
484 SaveLog(msg);
485 #ifdef DEVELOPER //not sendig log to clients on stable
486 Param1<string> msg_p = new Param1<string>(msg);
488 #endif
489 }
490 else
491 {
492 SaveLog(msg);
493 }
494 }
495
496 static private void SaveLog(string log_message)
497 {
498 #ifndef SERVER
499 CachedObjectsParams.PARAM1_STRING.param1 = log_message;
501 #endif
502
503 FileHandle fileHandle = OpenFile(GetFileName(), FileMode.APPEND);
504 if (fileHandle == 0)
505 return;
506
507 FPrintln(fileHandle, log_message);
508 CloseFile(fileHandle);
509
510 #ifdef DIAG_DEVELOPER
511 Print(string.Format("%1", log_message));
512 #endif
513
514 }
515
516 static void ClearLogs()
517 {
518 if (FileExist(GetFileName()))
519 {
520 FileHandle fileHandle = OpenFile(GetFileName(), FileMode.WRITE);
521 if (fileHandle == 0)
522 return;
523
524 FPrintln(fileHandle, "");
525 CloseFile(fileHandle);
526 }
527 }
528
529 static string GetFileName()
530 {
532 }
533
534 static private string GetDate()
535 {
536 int year;
537 int month;
538 int day;
539 int hour;
540 int minute;
541 int second;
542
543 GetYearMonthDay(year, month, day);
544 GetHourMinuteSecond(hour, minute, second);
545
546 string date = month.ToStringLen(2) + "-" + day.ToStringLen(2) + " " + hour.ToStringLen(2) + ":" + minute.ToStringLen(2) + ":" + second.ToStringLen(2);
547
548 return date;
549 }
550};
551
553{
554 static bool m_DoLogs;
560 static bool m_DoWeaponLog;
561 static bool m_DoWeatherLog;
562
563 static void Init()
564 {
565 #ifdef DIAG_DEVELOPER
566 m_DoLogs = true;
567 #else
568 m_DoLogs = IsCLIParam("doLogs");
569 #endif
570
571 m_DoActionDebugLog = IsCLIParam("doActionLog");
572 m_DoSymptomDebugLog = IsCLIParam("doSymptomLog");
573 m_DoInventoryMoveLog = IsCLIParam("doInvMoveLog");
574 m_DoInventoryReservationLog = IsCLIParam("doInvReservLog");
575 m_DoInventoryHFSMLog = IsCLIParam("doInvHFSMLog");
576 m_DoWeaponLog = IsCLIParam("doWeaponLog");
577 m_DoWeatherLog = IsCLIParam("doWeatherLog");
578 }
579
580 static bool IsLogsEnable()
581 {
582 return m_DoLogs;
583 }
584
585 static void SetLogsEnabled(bool enable)
586 {
587 m_DoLogs = enable;
588 }
589
590 static bool IsActionLogEnable()
591 {
592 return m_DoActionDebugLog;
593 }
594
595 static void ActionLogEnable(bool enable)
596 {
597 m_DoActionDebugLog = enable;
598 }
599
601 {
603 }
604
605 static void InventoryMoveLogEnable(bool enable)
606 {
607 m_DoInventoryMoveLog = enable;
608 }
609
611 {
613 }
614
615 static void InventoryReservationLogEnable(bool enable)
616 {
618 }
619
621 {
623 }
624
625 static void InventoryHFSMLogEnable(bool enable)
626 {
627 m_DoInventoryHFSMLog = enable;
628 }
629
630 static bool IsSymptomLogEnable()
631 {
632 return m_DoSymptomDebugLog;
633 }
634
635 static void SymptomLogEnable(bool enable)
636 {
637 m_DoSymptomDebugLog = enable;
638 }
639
640 static bool IsWeaponLogEnable()
641 {
642 return m_DoWeaponLog;
643 }
644
645 static void WeaponLogEnable(bool enable)
646 {
647 m_DoWeaponLog = enable;
648 }
649
651 {
652 return m_DoWeatherLog;
653 }
654}
655
656enum WeightDebugType
657{
658 NONE = 0,
663}
664
665class WeightDebug
666{
668 static WeightDebugType m_VerbosityFlags;
669
670 //-------------------------------------------------------------
672 {
673 if (!m_WeightDebugData.Get(entity))
674 {
675 WeightDebugData data = new WeightDebugData(entity);
676 m_WeightDebugData.Insert(entity,data);
677 return data;
678 }
679 return m_WeightDebugData.Get(entity);
680 }
681 //-------------------------------------------------------------
682 static void ClearWeightDebug()
683 {
684 m_WeightDebugData.Clear();
685 }
686 //-------------------------------------------------------------
687 static void PrintAll(EntityAI entity)
688 {
689 GameInventory inv = entity.GetInventory();
690 if (!inv)
691 return;
693 inv.EnumerateInventory(InventoryTraversalType.PREORDER, items);
694 for(int i = 0; i < items.Count(); i++)
695 {
696 EntityAI item = items.Get(i);
697 if (m_WeightDebugData.Get(item))
698 {
699 m_WeightDebugData.Get(item).Output();
700 }
701 }
702 }
703 //-------------------------------------------------------------
704 static void SetVerbosityFlags(WeightDebugType type)
705 {
706 m_VerbosityFlags = type;
707 }
708}
709
711{
713 string m_Weight;
716 //-------------------------------------------------------------
718 {
719 m_Classname = entity.GetType();
720 m_InventoryDepth = entity.GetHierarchyLevel();
721 }
722 //-------------------------------------------------------------
723 void SetWeight(float weight)
724 {
725 m_Weight = weight.ToString();
726 }
727 //-------------------------------------------------------------
728 void SetCalcDetails(string details)
729 {
730 m_CalcDetails = details;
731 }
732
733 //-------------------------------------------------------------
734 void AddCalcDetails(string details)
735 {
736 m_CalcDetails += "+ "+details;
737 }
738 //-------------------------------------------------------------
739 void Output()
740 {
741 string spaces;
742 for(int i = 0; i < m_InventoryDepth;i++)
743 spaces+="--------";
744
745 Print(spaces+">" + m_Classname + " Overall entity weight: "+ m_Weight + " Calculation details:" + m_CalcDetails);
746 }
747 //-------------------------------------------------------------
748
749}
static void ClearWeightDebug()
Definition Debug.c:682
class LogManager RECALC_FORCED
static void PrintAll(EntityAI entity)
Definition Debug.c:687
static WeightDebugData GetWeightDebug(EntityAI entity)
Definition Debug.c:671
static void SetVerbosityFlags(WeightDebugType type)
Definition Debug.c:704
class LogManager SET_DIRTY_FLAG
class LogManager NONE
class LogManager DUMP_STACK
class LogManager RECALC_DIRTY
static WeightDebugType m_VerbosityFlags
Definition Debug.c:668
class LogManager m_WeightDebugData
Dispatcher GetDispatcher()
Definition Dispatcher.c:20
const CallID CALL_ID_SEND_LOG
Definition Dispatcher.c:3
const CallID CALL_ID_SCR_CNSL_ADD_PRINT
Definition Dispatcher.c:6
Param CallMethod(CallID call_id, Param params)
Definition Dispatcher.c:36
override string GetDebugName()
Gets the debug name for the ParticleManager.
void TestFramework()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native int ConfigGetInt(string path)
Get int value from config on path.
proto native bool IsServer()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native bool IsMultiplayer()
proto native WorkspaceWidget GetWorkspace()
static ref Param1< string > PARAM1_STRING
Definition Debug.c:14
static void TriggerLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:163
static void SymptomLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:143
static void TFLog(string message=LOG_DEFAULT, TestFramework caller=null, string function="")
Definition Debug.c:173
static void GetFiltredConfigClasses(string search_string, out TStringArray filtered_classes, bool only_public=true)
Returns config classes containing search_string in name.
Definition Debug.c:417
static private const string LOG_DEBUG_WEIGHT
Definition Debug.c:24
static void Init()
Definition Debug.c:89
static private string GetDate()
Definition Debug.c:534
static Shape DrawLines(vector[] positions, int count, int color=0xFFFFFFFF, int flags=0)
Definition Debug.c:374
static private ref array< Shape > m_DebugShapes
Definition Debug.c:33
static private const string LOG_DEBUG_TF
Definition Debug.c:23
static Shape DrawBoxEx(vector pos1, vector pos2, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOZWRITE)
Definition Debug.c:278
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
Definition Debug.c:383
static void InitCanvas()
Definition Debug.c:52
static string GetDebugName(Managed entity)
Definition Debug.c:40
static private const string LOG_DEBUG_ACTION
Definition Debug.c:16
static private const string LOG_DEBUG_WEATHER
Definition Debug.c:26
static void WeatherLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:189
static private const string LOG_ERROR
Definition Debug.c:30
static void CanvasDrawLine(float x1, float y1, float x2, float y2, float width, int color)
Definition Debug.c:67
static private const string LOG_DEBUG_SYMPTOM
Definition Debug.c:17
static private bool m_EnabledLogs
Definition Debug.c:459
static void MeleeLog(Entity entity, string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT)
Definition Debug.c:183
static void ClearScriptLogs()
Definition Debug.c:268
static void DestroyAllShapes()
Definition Debug.c:94
static void LogArrayString(array< string > arr=NULL, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:251
static private const string LOG_DEBUG
Definition Debug.c:15
static void RemoveShape(out Shape shape)
Definition Debug.c:107
static string GetFileName()
Definition Debug.c:529
static private const string LOG_DEBUG_INV_HFSM
Definition Debug.c:20
static private void SaveLog(string log_message)
Definition Debug.c:496
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
Definition Debug.c:361
static Shape DrawCube(vector pos, float size=1, int color=0x1fff7f7f)
Definition Debug.c:286
static private const string LOG_DEFAULT
Definition Debug.c:31
static void WeightLog(string message=LOG_DEFAULT, Managed caller=null, string function="", Managed entity=null)
Definition Debug.c:178
static Shape DrawFrustum(float horizontalAngle, float verticalAngle, float length, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.WIREFRAME)
Definition Debug.c:314
static void InventoryReservationLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:153
static Widget m_DebugLayoutCanvas
Definition Debug.c:35
static private const string LOG_DEBUG_INV_RESERVATION
Definition Debug.c:19
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:138
static private const string LOG_DEBUG_TRIGGER
Definition Debug.c:21
static CanvasWidget m_CanvasDebug
Definition Debug.c:36
static private const string LOG_INFO
Definition Debug.c:28
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:235
static void InventoryHFSMLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:158
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Definition Debug.c:273
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:148
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Definition Debug.c:306
static private void LogMessage(string level, string plugin, string entity, string author, string label, string message)
DEPRECATED.
Definition Debug.c:461
static private const string LOG_DEBUG_MELEE
Definition Debug.c:25
static array< Shape > DrawCone(vector pos, float lenght, float halfAngle, float offsetAngle, int color=0xFFFFFFFF, int flags=0)
Definition Debug.c:330
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.
Definition Debug.c:133
static private const string LOG_DEBUG_INV_MOVE
Definition Debug.c:18
static void LogInfo(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.
Definition Debug.c:205
static void LogArrayInt(array< int > arr=NULL, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:240
static Shape DrawCylinder(vector pos, float radius, float height=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Definition Debug.c:322
static void GetBaseConfigClasses(out TStringArray base_classes)
Returns some of base config classes strings like CfgVehicles, CfgWeapons, etc. for searching purposes...
Definition Debug.c:396
static void ReceivedLogMessageFromServer(string message)
Definition Debug.c:262
static void ClearCanvas()
Definition Debug.c:61
static void CanvasDrawPoint(float x1, float y1, int color)
Draws a "point" on the screen at x,y coordinates Debug.ClearCanvas(); for(int i = 0; i < 700;i++) { f...
Definition Debug.c:84
static void LogWarning(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as warning message.
Definition Debug.c:220
static void ParticleLog(string message=LOG_DEFAULT, Managed caller=null, string function="", Managed entity=null)
Definition Debug.c:168
static private const string LOG_DEBUG_PARTICLE
Definition Debug.c:22
static void ClearLogs()
Definition Debug.c:516
static private const string LOG_WARNING
Definition Debug.c:29
Param CallMethod(CallID call_id, Param params)
Definition Dispatcher.c:15
Definition Camera.c:2
script counterpart to engine's class Inventory
Definition Inventory.c:77
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
static void Init()
Definition Debug.c:563
static bool IsInventoryHFSMLogEnable()
Definition Debug.c:620
static bool m_DoLogs
Definition Debug.c:554
static bool m_DoInventoryReservationLog
Definition Debug.c:558
static void SymptomLogEnable(bool enable)
Definition Debug.c:635
static void InventoryMoveLogEnable(bool enable)
Definition Debug.c:605
static bool IsInventoryMoveLogEnable()
Definition Debug.c:600
static void InventoryHFSMLogEnable(bool enable)
Definition Debug.c:625
static bool IsWeaponLogEnable()
Definition Debug.c:640
static bool IsLogsEnable()
Definition Debug.c:580
static bool IsWeatherLogEnabled()
Definition Debug.c:650
static void ActionLogEnable(bool enable)
Definition Debug.c:595
static void SetLogsEnabled(bool enable)
Definition Debug.c:585
static bool m_DoActionDebugLog
Definition Debug.c:555
static bool IsActionLogEnable()
Definition Debug.c:590
static bool m_DoSymptomDebugLog
Definition Debug.c:556
static bool m_DoInventoryMoveLog
Definition Debug.c:557
static bool m_DoWeaponLog
Definition Debug.c:560
static bool IsInventoryReservationLogEnable()
Definition Debug.c:610
static bool m_DoWeatherLog
Definition Debug.c:561
static bool IsSymptomLogEnable()
Definition Debug.c:630
static void WeaponLogEnable(bool enable)
Definition Debug.c:645
static bool m_DoInventoryHFSMLog
Definition Debug.c:559
static void InventoryReservationLogEnable(bool enable)
Definition Debug.c:615
TODO doc.
Definition EnScript.c:118
Definition EnMath.c:7
string m_Weight
Definition Debug.c:713
string m_CalcDetails
Definition Debug.c:715
void SetWeight(float weight)
Definition Debug.c:723
void WeightDebugData(EntityAI entity)
Definition Debug.c:717
void Output()
Definition Debug.c:739
void SetCalcDetails(string details)
Definition Debug.c:728
int m_InventoryDepth
Definition Debug.c:714
void AddCalcDetails(string details)
Definition Debug.c:734
string m_Classname
Definition Debug.c:712
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString()
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Definition gameplay.c:6
proto native CGame GetGame()
const string CFG_FILE_SCRIPT_LOG_EXT
Definition constants.c:223
proto void Print(void var)
Prints content of variable to console/log.
ShapeType
Definition EnDebug.c:116
ShapeFlags
Definition EnDebug.c:126
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
array< string > TStringArray
Definition EnScript.c:685
FileMode
Definition EnSystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
int[] FileHandle
Definition EnSystem.c:390
proto bool FileExist(string name)
Check existence of file.
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto void ConePoints(vector origin, float length, float halfAngle, float angleOffset, out vector leftPoint, out vector rightPoint)
Calculates the points of a right 2D cone in 3D space.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Sin(float angle)
Returns sinus of angle in radians.
const string CFG_SOUND_SETS
Definition constants.c:203
const string CFG_AMMO
Definition constants.c:198
const string CFG_VEHICLESPATH
Definition constants.c:195
const string CFG_NONAI_VEHICLES
Definition constants.c:204
const string CFG_SOUND_SHADERS
Definition constants.c:202
const string CFG_SOUND_TABLES
Definition constants.c:205
const string CFG_SURFACES
Definition constants.c:200
const string CFG_WEAPONSPATH
Definition constants.c:196
const string CFG_WORLDS
Definition constants.c:199
const string CFG_MAGAZINESPATH
Definition constants.c:197
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
string Get(int index)
Gets n-th character from string.
Definition EnString.c:434
bool Contains(string sample)
Returns true if sample is substring of string.
Definition EnString.c:286
proto int ToLower()
Changes string to lowercase. Returns length.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
proto void GetYearMonthDay(out int year, out int month, out int day)
Returns world date.
proto void GetHourMinuteSecond(out int hour, out int minute, out int second)
Returns world time.
proto native bool IsCLIParam(string param)
Returns if command line argument is present.
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.