DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Debug.c
См. документацию.
1class Debug
2{
3 private static const string LOG_DEBUG = "Debug";
4 private static const string LOG_DEBUG_ACTION = "Action";
5 private static const string LOG_DEBUG_SYMPTOM = "Symptom";
6 private static const string LOG_DEBUG_INV_MOVE = "Inv Move";
7 private static const string LOG_DEBUG_INV_RESERVATION = "Inv Rrsv";
8 private static const string LOG_DEBUG_INV_HFSM = "HFSM";
9 private static const string LOG_DEBUG_QUICKBAR = "Quickbar";
10 private static const string LOG_DEBUG_BASEBUILDING = "Base Building";
11 private static const string LOG_DEBUG_BLEEDING_CHANCES = "Bleeding";
12 private static const string LOG_DEBUG_TRIGGER = "Trigger";
13 private static const string LOG_DEBUG_PARTICLE = "Particle";
14 private static const string LOG_DEBUG_TF = "TestFramework";
15 private static const string LOG_DEBUG_WEIGHT = "Weight";
16 private static const string LOG_DEBUG_MELEE = "Melee";
17 private static const string LOG_DEBUG_WEATHER = "Weather";
18
19 private static const string LOG_INFO = "Info";
20 private static const string LOG_WARNING = "Warning";
21 private static const string LOG_ERROR = "Error";
22 private static const string LOG_DEFAULT = "n/a";
23
24 private static ref array<Shape> m_DebugShapes;
25
27 static CanvasWidget m_CanvasDebug;
28
29 static string GetDebugName(Managed entity)
30 {
31 if (!entity)
32 return "";
33
34 Object obj;
35 if (CastTo(obj, entity))
36 return obj.GetDebugNameNative();
37
38 return entity.GetDebugName();
39 }
40
41 static void InitCanvas()
42 {
44 {
45 m_DebugLayoutCanvas = GetGame().GetWorkspace().CreateWidgets("gui/layouts/debug/day_z_debugcanvas.layout");
46 m_CanvasDebug = CanvasWidget.Cast( m_DebugLayoutCanvas.FindAnyWidget( "CanvasWidget" ) );
47 }
48 }
49
50 static void ClearCanvas()
51 {
52 if (m_CanvasDebug)
53 m_CanvasDebug.Clear();
54 }
55
56 static void CanvasDrawLine(float x1, float y1, float x2, float y2, float width, int color)
57 {
58 InitCanvas();
59 m_CanvasDebug.DrawLine(x1, y1, x2, y2, width, color);
60 }
61
72
73 static void CanvasDrawPoint(float x1, float y1, int color)
74 {
75 CanvasDrawLine(x1, y1, x1+1, y1, 1, color);
76 }
77
78 static void Init()
79 {
81 }
82
83 static void DestroyAllShapes()
84 {
85 for ( int i = 0; i < m_DebugShapes.Count(); ++i )
86 {
87 if ( m_DebugShapes.Get(i) )
88 {
89 m_DebugShapes.Get(i).Destroy();
90 }
91 }
92
93 m_DebugShapes.Clear();
94 }
95
96 static void RemoveShape(out Shape shape)
97 {
98 if (!shape) return;
99 for ( int i = 0; i < m_DebugShapes.Count(); i++ )
100 {
101 Shape found_shape = m_DebugShapes.Get(i);
102
103 if ( found_shape && found_shape == shape )
104 {
105 found_shape.Destroy();
106 m_DebugShapes.Remove(i); // Mandatory! Otherwise the Destroy() function causes crash!
107 shape = null;
108 return;
109 }
110 }
111 }
112
122 static void Log(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
123 {
124 LogMessage(LOG_DEBUG, plugin, entity, author, label, message);
125 }
126
127 static void ActionLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
128 {
129 LogMessage(LOG_DEBUG_ACTION, plugin, entity, author, label, message);
130 }
131
132 static void SymptomLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
133 {
134 LogMessage(LOG_DEBUG_SYMPTOM, plugin, entity, author, label, message);
135 }
136
137 static void InventoryMoveLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
138 {
139 LogMessage(LOG_DEBUG_INV_MOVE, plugin, entity, author, label, message);
140 }
141
142 static void InventoryReservationLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
143 {
144 LogMessage(LOG_DEBUG_INV_RESERVATION, plugin, entity, author, label, message);
145 }
146
147 static void InventoryHFSMLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
148 {
149 LogMessage(LOG_DEBUG_INV_HFSM, plugin, entity, author, label, message);
150 }
151
152 static void QuickbarLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
153 {
154 LogMessage(LOG_DEBUG_QUICKBAR, plugin, entity, author, label, message);
155 }
156
157 static void BaseBuildingLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
158 {
159 LogMessage(LOG_DEBUG_BASEBUILDING, plugin, entity, author, label, message);
160 }
161
162 static void BleedingChancesLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
163 {
164 LogMessage(LOG_DEBUG_BLEEDING_CHANCES, plugin, entity, author, label, message);
165 }
166
167 static void TriggerLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
168 {
169 LogMessage(LOG_DEBUG_TRIGGER, plugin, entity, author, label, message);
170 }
171
172 static void ParticleLog(string message = LOG_DEFAULT, Managed caller = null, string function = "", Managed entity = null)
173 {
174 LogMessage(LOG_DEBUG_PARTICLE, GetDebugName(caller), GetDebugName(entity), "", function, message);
175 }
176
177 static void TFLog(string message = LOG_DEFAULT, TestFramework caller = null, string function = "")
178 {
179 LogMessage(LOG_DEBUG_TF, GetDebugName(caller), "", "", function, message);
180 }
181
182 static void WeightLog(string message = LOG_DEFAULT, Managed caller = null, string function = "", Managed entity = null)
183 {
184 /*
185 LogMessage(LOG_DEBUG_WEIGHT, GetDebugName(caller), GetDebugName(entity), "", function, message);
186 */
187 }
188
189 static void MeleeLog(Entity entity, string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT)
190 {
191 string logMessage = string.Format("%1: %2", entity.GetSimulationTimeStamp(), message);
192 LogMessage(LOG_DEBUG_MELEE, plugin, GetDebugName(entity), author, label, logMessage);
193 }
194
195 static void WeatherLog(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
196 {
198 {
199 return;
200 }
201
202 LogMessage(LOG_DEBUG_WEATHER, plugin, entity, author, label, message);
203 }
204
215 static void LogInfo(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
216 {
217 LogMessage(LOG_INFO, plugin, entity, author, label, message);
218 }
219
230 static void LogWarning(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
231 {
232 LogMessage(LOG_WARNING, plugin, entity, author, label, message);
233 }
234
245 static void LogError(string message = LOG_DEFAULT, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
246 {
247 LogMessage(LOG_ERROR, plugin, entity, author, label, message);
248 }
249
250 static void LogArrayInt(array<int> arr = NULL, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
251 {
252 if (arr == null)
253 return;
254 for (int i = 0; i < arr.Count(); i++)
255 {
256 LogMessage(LOG_DEBUG, plugin, entity, author, label, arr.Get(i).ToString());
257 }
258 }
259
260 static void LogArrayString(array<string> arr = NULL, string plugin = LOG_DEFAULT, string author = LOG_DEFAULT, string label = LOG_DEFAULT, string entity = LOG_DEFAULT)
261 {
262 if (arr == null)
263 return;
264
265 for (int i = 0; i < arr.Count(); i++)
266 {
267 LogMessage(LOG_DEBUG, plugin, entity, author, label, arr.Get(i));
268 }
269 }
270
271 static void ReceivedLogMessageFromServer(string message)
272 {
274 {
275 return;
276 }
277
278 SaveLog(message);
279 }
280
281 static void ClearScriptLogs()
282 {
283 ClearLogs();
284 }
285
286 static Shape DrawBox(vector pos1, vector pos2, int color = 0x1fff7f7f)
287 {
288 return DrawBoxEx(pos1, pos2, color, ShapeFlags.TRANSP|ShapeFlags.NOZWRITE);
289 }
290
291 static Shape DrawBoxEx(vector pos1, vector pos2, int color = 0x1fff7f7f, ShapeFlags flags = ShapeFlags.TRANSP|ShapeFlags.NOZWRITE)
292 {
293 Shape shape = Shape.Create(ShapeType.BBOX, color, flags, pos1, pos2);
294 if (( flags & ShapeFlags.ONCE ) == 0)
295 m_DebugShapes.Insert(shape);
296 return shape;
297 }
298
299 static Shape DrawCube(vector pos, float size = 1, int color = 0x1fff7f7f)
300 {
301 vector min = pos;
302 vector max = pos;
303
304 float size_h = size * 0.5;
305
306 min[0] = min[0] - size_h;
307 min[1] = min[1] - size_h;
308 min[2] = min[2] - size_h;
309
310 max[0] = max[0] + size_h;
311 max[1] = max[1] + size_h;
312 max[2] = max[2] + size_h;
313
314 Shape shape = Shape.Create(ShapeType.DIAMOND, color, ShapeFlags.TRANSP|ShapeFlags.NOZWRITE, min, max);
315 m_DebugShapes.Insert(shape);
316 return shape;
317 }
318
319 static Shape DrawSphere(vector pos, float size = 1, int color = 0x1fff7f7f, ShapeFlags flags = ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
320 {
321 Shape shape = Shape.CreateSphere(color, flags, pos, size);
322 if (( flags & ShapeFlags.ONCE ) == 0)
323 m_DebugShapes.Insert(shape);
324 return shape;
325 }
326
327 static Shape DrawFrustum(float horizontalAngle, float verticalAngle, float length, int color = 0x1fff7f7f, ShapeFlags flags = ShapeFlags.TRANSP|ShapeFlags.WIREFRAME)
328 {
329 Shape shape = Shape.CreateFrustum(horizontalAngle, verticalAngle, length, color, flags);
330 if (( flags & ShapeFlags.ONCE ) == 0)
331 m_DebugShapes.Insert(shape);
332 return shape;
333 }
334
335 static Shape DrawCylinder(vector pos, float radius, float height = 1, int color = 0x1fff7f7f, ShapeFlags flags = ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE )
336 {
337 Shape shape = Shape.CreateCylinder(color, flags, pos, radius, height);
338 if (( flags & ShapeFlags.ONCE ) == 0)
339 m_DebugShapes.Insert(shape);
340 return shape;
341 }
342
343 static array<Shape> DrawCone(vector pos, float lenght, float halfAngle, float offsetAngle, int color = 0xFFFFFFFF, int flags = 0)
344 {
345 array<Shape> shapes = new array<Shape>;
346
347 vector endL, endR;
348 Math3D.ConePoints(pos, lenght, halfAngle, offsetAngle, endL, endR);
349
350 // Left side
351 shapes.Insert( Debug.DrawLine(pos, endL, color, flags) );
352 // Rigth side
353 shapes.Insert( Debug.DrawLine(pos, endR, color, flags) );
354 // Top side
355 shapes.Insert( Debug.DrawLine(endL, endR, color, flags) );
356 // Middle (height) line
357 shapes.Insert( Debug.DrawLine(pos, pos + Vector(Math.Cos(offsetAngle), 0, Math.Sin(offsetAngle)).Normalized() * lenght, color, flags) );
358
359 return shapes;
360 }
361
362 static void CleanupDrawShapes(array<Shape> shapes)
363 {
364 foreach (Shape shape : shapes)
365 Debug.RemoveShape(shape);
366
367 shapes.Clear();
368 }
369
382 static Shape DrawLine(vector from, vector to, int color = 0xFFFFFFFF, int flags = 0)
383 {
384 vector pts[2]
385 pts[0] = from;
386 pts[1] = to;
387
388 Shape shape = Shape.CreateLines(color, flags, pts, 2);
389 if (( flags & ShapeFlags.ONCE ) == 0)
390 m_DebugShapes.Insert(shape);
391 //m_DebugShapes.Debug();
392 return shape;
393 }
394
395 static Shape DrawLines(vector[] positions, int count, int color = 0xFFFFFFFF, int flags = 0)
396 {
397
398 Shape shape = Shape.CreateLines(color, flags, positions, count);
399 if (( flags & ShapeFlags.ONCE ) == 0)
400 m_DebugShapes.Insert(shape);
401 return shape;
402 }
403
404 static Shape DrawArrow(vector from, vector to, float size = 0.5, int color = 0xFFFFFFFF, int flags = 0)
405 {
406 Shape shape = Shape.CreateArrow(from, to, size, color, flags);
407 m_DebugShapes.Insert(shape);
408 return shape;
409 }
410
411
412
417 static void GetBaseConfigClasses( out TStringArray base_classes )
418 {
419 base_classes.Clear();
420 base_classes.Insert(CFG_VEHICLESPATH);
421 base_classes.Insert(CFG_WEAPONSPATH);
422 base_classes.Insert(CFG_MAGAZINESPATH);
423 base_classes.Insert(CFG_AMMO);
424 base_classes.Insert(CFG_WORLDS);
425 base_classes.Insert(CFG_SURFACES);
426 base_classes.Insert(CFG_SOUND_SETS);
427 base_classes.Insert(CFG_SOUND_SHADERS);
428 base_classes.Insert(CFG_NONAI_VEHICLES);
429 base_classes.Insert(CFG_SOUND_TABLES);
430 }
431
438 static void GetFiltredConfigClasses( string search_string, out TStringArray filtered_classes, bool only_public = true )
439 {
440 TStringArray searching_in = new TStringArray;
441 GetBaseConfigClasses( searching_in );
442
443 filtered_classes.Clear();
444
445 search_string.ToLower();
446
447 for ( int s = 0; s < searching_in.Count(); ++s )
448 {
449 string config_path = searching_in.Get(s);
450
451 int objects_count = GetGame().ConfigGetChildrenCount(config_path);
452 for (int i = 0; i < objects_count; i++)
453 {
454 string childName;
455 GetGame().ConfigGetChildName(config_path, i, childName);
456
457 if ( only_public )
458 {
459 int scope = GetGame().ConfigGetInt( config_path + " " + childName + " scope" );
460 if ( scope == 0 )
461 {
462 continue;
463 }
464 }
465
466 string nchName = childName;
467 nchName.ToLower();
468
469 if ( nchName.Contains(search_string) != -1)
470 {
471 filtered_classes.Insert(childName);
472 }
473 }
474 }
475 }
476
477 //---------------------------------------------------------------
478 //-------private
479
480 private static bool m_EnabledLogs;
481
482 private static string LogMessage(string level, string plugin, string entity, string author, string label, string message)
483 {
484 if (GetGame() == null || !LogManager.IsLogsEnable())
485 return string.Empty;
486
487 bool is_server_log = ( GetGame().IsServer() && GetGame().IsMultiplayer() );
488
489
490 // Formation output to external file
491 // %date{MM-dd HH:mm:ss} | %Enviroment | %Level | %Module | %Entity | %Author | %Label | %Message
492 string date = GetDate();
493 string env = "Client";
494 string msg = string.Empty;
495
496 if ( is_server_log )
497 {
498 env = "Server";
499 }
500
501 msg = string.Format("%1 | %2 | %3 | %4 | %5 | %6 | %7", date, env, level, plugin, entity, label, message);
502
503 if ( is_server_log )
504 {
505 SaveLog(msg);
506
507#ifdef DIAG_DEVELOPER // do not send log to clients on retail
508 Param1<string> msg_p = new Param1<string>(msg);
510#endif
511 }
512 else
513 {
514 SaveLog(msg);
515 }
516
517 return msg;
518 }
519
520 private static void SaveLog(string log_message)
521 {
522 if (log_message.Length() == 0)
523 return;
524
526#ifdef DIAG_DEVELOPER
527#ifndef SERVER
528 CachedObjectsParams.PARAM1_STRING.param1 = log_message;
530#endif
531#endif
532
534#ifdef DIAG_DEVELOPER
536#ifdef LOG_TO_FILE
537 FileHandle fileHandle = OpenFile(GetFileName(), FileMode.APPEND);
538 if (fileHandle != 0)
539 {
540 FPrintln(fileHandle, log_message);
541 CloseFile(fileHandle);
542 }
543#endif
544#endif
545
547#ifdef LOG_TO_RPT
548 PrintToRPT("" + log_message);
549#endif
550
552#ifdef LOG_TO_SCRIPT
553 Print(string.Format("%1", log_message));
554#endif
555 }
556
557 static void ClearLogs()
558 {
559 if (FileExist(GetFileName()))
560 {
561 FileHandle fileHandle = OpenFile(GetFileName(), FileMode.WRITE);
562 if (fileHandle == 0)
563 return;
564
565 FPrintln(fileHandle, "");
566 CloseFile(fileHandle);
567 }
568 }
569
570 static string GetFileName()
571 {
573 }
574
575 private static string GetDate()
576 {
577 int year;
578 int month;
579 int day;
580 int hour;
581 int minute;
582 int second;
583
584 GetYearMonthDay(year, month, day);
585 GetHourMinuteSecond(hour, minute, second);
586
587 string date = month.ToStringLen(2) + "-" + day.ToStringLen(2) + " " + hour.ToStringLen(2) + ":" + minute.ToStringLen(2) + ":" + second.ToStringLen(2);
588
589 return date;
590 }
591};
592
594{
595 static bool m_DoLogs;
601 static bool m_DoSyncLog;
602 static bool m_DoQuickbarLog;
604 static bool m_DoWeaponLog;
605 static bool m_DoWeatherLog;
607
608 static void Init()
609 {
610 #ifdef ENABLE_LOGGING
611 m_DoLogs = true;
612 #else
613 m_DoLogs = IsCLIParam("doLogs");
614 #endif
615
616 m_DoActionDebugLog = IsCLIParam("doActionLog");
617 m_DoSymptomDebugLog = IsCLIParam("doSymptomLog");
618 m_DoInventoryMoveLog = IsCLIParam("doInvMoveLog");
619 m_DoInventoryReservationLog = IsCLIParam("doInvReservLog");
620 m_DoInventoryHFSMLog = IsCLIParam("doInvHFSMLog");
621 m_DoSyncLog = IsCLIParam("doSyncLog");
622 m_DoQuickbarLog = IsCLIParam("doQuickbarLog");
623 m_DoBaseBuildingLog = IsCLIParam("doBaseBuildingLog");
624 m_DoWeaponLog = IsCLIParam("doWeaponLog");
625 m_DoWeatherLog = IsCLIParam("doWeatherLog");
626 }
627
628 static bool IsLogsEnable()
629 {
630 return m_DoLogs;
631 }
632
633 static void SetLogsEnabled(bool enable)
634 {
635 m_DoLogs = enable;
636 }
637
638 static bool IsActionLogEnable()
639 {
640 return m_DoActionDebugLog;
641 }
642
643 static void ActionLogEnable(bool enable)
644 {
645 m_DoActionDebugLog = enable;
646 }
647
649 {
651 }
652
653 static void InventoryMoveLogEnable(bool enable)
654 {
655 m_DoInventoryMoveLog = enable;
656 }
657
662
663 static void InventoryReservationLogEnable(bool enable)
664 {
666 }
667
669 {
671 }
672
673 static void InventoryHFSMLogEnable(bool enable)
674 {
675 m_DoInventoryHFSMLog = enable;
676 }
677
678 static bool IsSyncLogEnable()
679 {
680 return m_DoSyncLog;
681 }
682
683 static void SyncLogEnable(bool enable)
684 {
685 m_DoSyncLog = enable;
686 }
687
689 {
690 return m_DoQuickbarLog;
691 }
692
693 static void QuickbarLogEnable(bool enable)
694 {
695 m_DoQuickbarLog = enable;
696 }
697
699 {
700 return m_DoBaseBuildingLog;
701 }
702
703 static void BaseBuildingLogEnable(bool enable)
704 {
705 m_DoBaseBuildingLog = enable;
706 }
707
708 static bool IsSymptomLogEnable()
709 {
710 return m_DoSymptomDebugLog;
711 }
712
713 static void SymptomLogEnable(bool enable)
714 {
715 m_DoSymptomDebugLog = enable;
716 }
717
718 static bool IsWeaponLogEnable()
719 {
720 return m_DoWeaponLog;
721 }
722
723 static void WeaponLogEnable(bool enable)
724 {
725 m_DoWeaponLog = enable;
726 }
727
729 {
730 return m_DoWeatherLog;
731 }
732
734 {
736 }
737
738 static void BleedingChancesLogEnable(bool enable)
739 {
740 m_DoBleedingChanceLog = enable;
741 }
742}
743
744enum WeightDebugType
745{
746 NONE = 0,
751}
752
753class WeightDebug
754{
756 static WeightDebugType m_VerbosityFlags;
757
758 //-------------------------------------------------------------
760 {
761 if (!m_WeightDebugData.Get(entity))
762 {
763 WeightDebugData data = new WeightDebugData(entity);
764 m_WeightDebugData.Insert(entity,data);
765 return data;
766 }
767 return m_WeightDebugData.Get(entity);
768 }
769 //-------------------------------------------------------------
770 static void ClearWeightDebug()
771 {
772 m_WeightDebugData.Clear();
773 }
774 //-------------------------------------------------------------
775 static void PrintAll(EntityAI entity)
776 {
777 GameInventory inv = entity.GetInventory();
778 if (!inv)
779 return;
781 inv.EnumerateInventory(InventoryTraversalType.PREORDER, items);
782 for(int i = 0; i < items.Count(); i++)
783 {
784 EntityAI item = items.Get(i);
785 if (m_WeightDebugData.Get(item))
786 {
787 m_WeightDebugData.Get(item).Output();
788 }
789 }
790 }
791 //-------------------------------------------------------------
792 static void SetVerbosityFlags(WeightDebugType type)
793 {
794 m_VerbosityFlags = type;
795 }
796}
797
799{
801 string m_Weight;
804 //-------------------------------------------------------------
806 {
807 m_Classname = entity.GetType();
808 m_InventoryDepth = entity.GetHierarchyLevel();
809 }
810 //-------------------------------------------------------------
811 void SetWeight(float weight)
812 {
813 m_Weight = weight.ToString();
814 }
815 //-------------------------------------------------------------
816 void SetCalcDetails(string details)
817 {
818 m_CalcDetails = details;
819 }
820
821 //-------------------------------------------------------------
822 void AddCalcDetails(string details)
823 {
824 m_CalcDetails += "+ "+details;
825 }
826 //-------------------------------------------------------------
827 void Output()
828 {
829 string spaces;
830 for(int i = 0; i < m_InventoryDepth;i++)
831 spaces+="--------";
832
833 Print(spaces+">" + m_Classname + " Overall entity weight: "+ m_Weight + " Calculation details:" + m_CalcDetails);
834 }
835 //-------------------------------------------------------------
836
837}
static void ClearWeightDebug()
Определения Debug.c:770
class LogManager RECALC_FORCED
static void PrintAll(EntityAI entity)
Определения Debug.c:775
static WeightDebugData GetWeightDebug(EntityAI entity)
Определения Debug.c:759
static void SetVerbosityFlags(WeightDebugType type)
Определения Debug.c:792
class LogManager SET_DIRTY_FLAG
class LogManager DUMP_STACK
class LogManager RECALC_DIRTY
static WeightDebugType m_VerbosityFlags
Определения Debug.c:756
class LogManager m_WeightDebugData
class LogManager EntityAI
map
Определения ControlsXboxNew.c:4
Dispatcher GetDispatcher()
Определения Dispatcher.c:20
const CallID CALL_ID_SEND_LOG
Определения Dispatcher.c:3
const CallID CALL_ID_SCR_CNSL_ADD_PRINT
Определения Dispatcher.c:6
Param CallMethod(CallID call_id, Param params)
Определения Dispatcher.c:36
void TestFramework()
Определения TestFramework.c:217
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 int ConfigGetInt(string path)
Get int value from config on path.
proto native bool IsServer()
proto native WorkspaceWidget GetWorkspace()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
static ref Param1< string > PARAM1_STRING
Определения UtilityClasses.c:14
static ref array< Shape > m_DebugShapes
Определения Debug.c:24
static const string LOG_DEBUG_MELEE
Определения Debug.c:16
static const string LOG_DEBUG_BLEEDING_CHANCES
Определения Debug.c:11
static void BaseBuildingLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:157
static const string LOG_DEBUG_INV_RESERVATION
Определения Debug.c:7
static void TFLog(string message=LOG_DEFAULT, TestFramework caller=null, string function="")
Определения Debug.c:177
static Shape DrawLines(vector[] positions, int count, int color=0xFFFFFFFF, int flags=0)
Определения Debug.c:395
static void InitCanvas()
Определения Debug.c:41
static bool m_EnabledLogs
Определения Debug.c:480
static void QuickbarLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:152
static const string LOG_DEBUG_ACTION
Определения Debug.c:4
static void GetBaseConfigClasses(out TStringArray base_classes)
Returns some of base config classes strings like CfgVehicles, CfgWeapons, etc. for searching purposes...
Определения Debug.c:417
static const string LOG_DEBUG
Определения Debug.c:3
static CanvasWidget m_CanvasDebug
Определения Debug.c:27
static const string LOG_DEBUG_PARTICLE
Определения Debug.c:13
static void SymptomLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:132
static Shape DrawCylinder(vector pos, float radius, float height=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Определения Debug.c:335
static void InventoryReservationLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:142
static void ParticleLog(string message=LOG_DEFAULT, Managed caller=null, string function="", Managed entity=null)
Определения Debug.c:172
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Определения Debug.c:286
static string GetFileName()
Определения Debug.c:570
static const string LOG_DEBUG_WEIGHT
Определения Debug.c:15
static const string LOG_DEBUG_TF
Определения Debug.c:14
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.
Определения Debug.c:230
static void CanvasDrawLine(float x1, float y1, float x2, float y2, float width, int color)
Определения Debug.c:56
static void ClearLogs()
Определения Debug.c:557
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.
Определения Debug.c:215
static const string LOG_DEBUG_WEATHER
Определения Debug.c:17
static void BleedingChancesLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:162
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
Определения Debug.c:319
static void GetFiltredConfigClasses(string search_string, out TStringArray filtered_classes, bool only_public=true)
Returns config classes containing search_string in name.
Определения Debug.c:438
static void WeightLog(string message=LOG_DEFAULT, Managed caller=null, string function="", Managed entity=null)
Определения Debug.c:182
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.
Определения Debug.c:245
static void MeleeLog(Entity entity, string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT)
Определения Debug.c:189
static Shape DrawFrustum(float horizontalAngle, float verticalAngle, float length, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.WIREFRAME)
Определения Debug.c:327
static const string LOG_DEBUG_BASEBUILDING
Определения Debug.c:10
static const string LOG_DEBUG_TRIGGER
Определения Debug.c:12
static void SaveLog(string log_message)
Определения Debug.c:520
static const string LOG_DEBUG_QUICKBAR
Определения Debug.c:9
static Shape DrawCube(vector pos, float size=1, int color=0x1fff7f7f)
Определения Debug.c:299
static const string LOG_INFO
Определения Debug.c:19
static void ClearCanvas()
Определения Debug.c:50
static const string LOG_DEBUG_SYMPTOM
Определения Debug.c:5
static void ReceivedLogMessageFromServer(string message)
Определения Debug.c:271
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
Определения Debug.c:404
static void TriggerLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:167
static void CleanupDrawShapes(array< Shape > shapes)
Определения Debug.c:362
static const string LOG_DEBUG_INV_MOVE
Определения Debug.c:6
static array< Shape > DrawCone(vector pos, float lenght, float halfAngle, float offsetAngle, int color=0xFFFFFFFF, int flags=0)
Определения Debug.c:343
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...
Определения Debug.c:73
static const string LOG_WARNING
Определения Debug.c:20
static void InventoryHFSMLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:147
static string GetDate()
Определения Debug.c:575
static void DestroyAllShapes()
Определения Debug.c:83
static Shape DrawBoxEx(vector pos1, vector pos2, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOZWRITE)
Определения Debug.c:291
static void WeatherLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:195
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
static void LogArrayInt(array< int > arr=NULL, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:250
static void ClearScriptLogs()
Определения Debug.c:281
static const string LOG_DEFAULT
Определения Debug.c:22
static Widget m_DebugLayoutCanvas
Определения Debug.c:26
static void Init()
Определения Debug.c:78
static void LogArrayString(array< string > arr=NULL, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:260
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:137
static const string LOG_ERROR
Определения Debug.c:21
static void RemoveShape(out Shape shape)
Определения Debug.c:96
static string GetDebugName(Managed entity)
Определения Debug.c:29
static const string LOG_DEBUG_INV_HFSM
Определения Debug.c:8
static Shape DrawLine(vector from, vector to, int color=0xFFFFFFFF, int flags=0)
Определения Debug.c:382
static string LogMessage(string level, string plugin, string entity, string author, string label, string message)
DEPRECATED.
Определения Debug.c:482
static void ActionLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:127
Определения Debug.c:2
Param CallMethod(CallID call_id, Param params)
Определения Dispatcher.c:15
Определения Building.c:6
Определения Camera.c:2
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
script counterpart to engine's class Inventory
Определения Inventory.c:79
static void InventoryHFSMLogEnable(bool enable)
Определения Debug.c:673
static void InventoryReservationLogEnable(bool enable)
Определения Debug.c:663
static void SymptomLogEnable(bool enable)
Определения Debug.c:713
static void SyncLogEnable(bool enable)
Определения Debug.c:683
static bool IsWeaponLogEnable()
Определения Debug.c:718
static bool m_DoSyncLog
Определения Debug.c:601
static void BleedingChancesLogEnable(bool enable)
Определения Debug.c:738
static bool m_DoActionDebugLog
Определения Debug.c:596
static bool m_DoLogs
Определения Debug.c:595
static bool m_DoInventoryHFSMLog
Определения Debug.c:600
static void WeaponLogEnable(bool enable)
Определения Debug.c:723
static void Init()
Определения Debug.c:608
static bool m_DoSymptomDebugLog
Определения Debug.c:597
static bool IsBaseBuildingLogEnable()
Определения Debug.c:698
static bool m_DoInventoryReservationLog
Определения Debug.c:599
static bool IsWeatherLogEnabled()
Определения Debug.c:728
static void SetLogsEnabled(bool enable)
Определения Debug.c:633
static bool IsInventoryReservationLogEnable()
Определения Debug.c:658
static bool IsSymptomLogEnable()
Определения Debug.c:708
static bool IsSyncLogEnable()
Определения Debug.c:678
static bool IsInventoryHFSMLogEnable()
Определения Debug.c:668
static bool IsLogsEnable()
Определения Debug.c:628
static bool m_DoBleedingChanceLog
Определения Debug.c:606
static bool m_DoBaseBuildingLog
Определения Debug.c:603
static void QuickbarLogEnable(bool enable)
Определения Debug.c:693
static void ActionLogEnable(bool enable)
Определения Debug.c:643
static void InventoryMoveLogEnable(bool enable)
Определения Debug.c:653
static bool m_DoWeatherLog
Определения Debug.c:605
static bool IsBleedingChancesLogEnable()
Определения Debug.c:733
static bool IsInventoryMoveLogEnable()
Определения Debug.c:648
static bool IsActionLogEnable()
Определения Debug.c:638
static void BaseBuildingLogEnable(bool enable)
Определения Debug.c:703
static bool m_DoWeaponLog
Определения Debug.c:604
static bool IsQuickbarLogEnable()
Определения Debug.c:688
static bool m_DoInventoryMoveLog
Определения Debug.c:598
static bool m_DoQuickbarLog
Определения Debug.c:602
Определения Debug.c:594
TODO doc.
Определения EnScript.c:118
Определения EnMath3D.c:28
Определения EnMath.c:7
Определения ObjectTyped.c:2
string m_Weight
Определения Debug.c:801
string m_CalcDetails
Определения Debug.c:803
void AddCalcDetails(string details)
Определения Debug.c:822
string m_Classname
Определения Debug.c:800
void SetCalcDetails(string details)
Определения Debug.c:816
void Output()
Определения Debug.c:827
void SetWeight(float weight)
Определения Debug.c:811
void WeightDebugData(EntityAI entity)
Определения Debug.c:805
int m_InventoryDepth
Определения Debug.c:802
Определения Debug.c:799
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
Определения EnConvert.c:106
override string GetDebugName()
Определения dayzplayer.c:1170
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
const string CFG_FILE_SCRIPT_LOG_EXT
Определения constants.c:248
proto void Print(void var)
Prints content of variable to console/log.
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
ShapeType
Определения EnDebug.c:116
ShapeFlags
Определения EnDebug.c:126
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
array< string > TStringArray
Определения EnScript.c:685
FileMode
Определения EnSystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
int[] FileHandle
Определения 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
Определения constants.c:228
const string CFG_AMMO
Определения constants.c:223
const string CFG_VEHICLESPATH
Определения constants.c:220
const string CFG_NONAI_VEHICLES
Определения constants.c:229
const string CFG_SOUND_SHADERS
Определения constants.c:227
const string CFG_SOUND_TABLES
Определения constants.c:230
const string CFG_SURFACES
Определения constants.c:225
const string CFG_WEAPONSPATH
Определения constants.c:221
const string CFG_WORLDS
Определения constants.c:224
const string CFG_MAGAZINESPATH
Определения constants.c:222
@ NONE
No flags.
Определения EnProfiler.c:11
proto native int Length()
Returns length of string.
bool Contains(string sample)
Returns true if sample is substring of string.
Определения EnString.c:286
static const string Empty
Определения EnString.c:7
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.
proto int ToLower()
Changes string to lowercase. Returns length.
proto void GetYearMonthDay(out int year, out int month, out int day)
Returns system date.
proto void GetHourMinuteSecond(out int hour, out int minute, out int second)
Returns system 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.