Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIAgentDebugPanel.c
Go to the documentation of this file.
1
4class SCR_AIAgentDebugPanel : Managed
5{
6 AIAgent m_Agent;
7 SCR_AIGroup m_Group;
8 IEntity m_Entity;
9 protected bool m_bRequestClose = false;
10
11 protected string m_sWindowTitle;
12
13 protected bool m_bShowPerception;
14
15 // The debug panel can be created for non-AI as well, for instance for vehicles.
16 void SCR_AIAgentDebugPanel(AIAgent agent, IEntity entity)
17 {
18 m_Agent = agent;
19 m_Group = SCR_AIGroup.Cast(agent);
20 m_Entity = entity;
21 }
22
23 bool Update(float timeSlice)
24 {
25 IEntity objForTitle;
26 if (m_Agent)
27 objForTitle = m_Agent;
28 else if (m_Entity)
29 objForTitle = m_Entity;
30 if (m_sWindowTitle.IsEmpty())
31 {
32 string entityPtrStr = GetEntityShortName(objForTitle);
33 m_sWindowTitle = string.Format("DbgPnl %1", entityPtrStr);
34 }
35
36 DbgUI.Begin(m_sWindowTitle);
37
38 SCR_AIInfoBaseComponent baseInfoComp;
39 SCR_AIInfoComponent infoComp; // For units
40 SCR_AIGroupInfoComponent groupInfoComp; // For groups
41 SCR_AIGroupUtilityComponent groupUtilityComp;
42 SCR_MailboxComponent mailboxComp;
43 PerceptionComponent perception;
44 PerceivableComponent perceivable;
45 SCR_AIBaseUtilityComponent utilityComp;
46 SCR_AIUtilityComponent unitUtilityComp;
47 SCR_AICombatComponent combatComp;
48 SCR_AISettingsBaseComponent settingsComp;
49
50 if (!m_Agent && !m_Group && !m_Entity)
51 {
52 DbgUI.Text("The target doesn't exist!");
53 }
54 else
55 {
56 // Agent name
57 string agentName = GetAgentDebugName();
58 DbgUI.Text(agentName);
59
60 if (m_Agent)
61 {
62 baseInfoComp = SCR_AIInfoBaseComponent.Cast(m_Agent.FindComponent(SCR_AIInfoBaseComponent));
63 infoComp = SCR_AIInfoComponent.Cast(baseInfoComp);
64 groupInfoComp = SCR_AIGroupInfoComponent.Cast(baseInfoComp);
65 mailboxComp = SCR_MailboxComponent.Cast(m_Agent.FindComponent(SCR_MailboxComponent));
66 utilityComp = SCR_AIBaseUtilityComponent.Cast(m_Agent.FindComponent(SCR_AIBaseUtilityComponent));
67 groupUtilityComp = SCR_AIGroupUtilityComponent.Cast(utilityComp);
68 unitUtilityComp = SCR_AIUtilityComponent.Cast(utilityComp);
69 settingsComp = SCR_AISettingsBaseComponent.Cast(m_Agent.FindComponent(SCR_AISettingsBaseComponent));
70 }
71
72
73 if (m_Entity)
74 {
75 combatComp = SCR_AICombatComponent.Cast(m_Entity.FindComponent(SCR_AICombatComponent));
76 perception = PerceptionComponent.Cast(m_Entity.FindComponent(PerceptionComponent));
77 perceivable = PerceivableComponent.Cast(m_Entity.FindComponent(PerceivableComponent));
78 }
79
80 if (m_Agent)
81 DbgUI.Text(string.Format("LOD: %1", m_Agent.GetLOD()));
82
83 if (infoComp)
84 {
85 string strUnitState = string.Format("Unit State: %1", EnumFlagsToString(EUnitState, infoComp.GetUnitStates()));
86 string strUnitRoles = string.Format("Unit Roles: %1", EnumFlagsToString(EUnitRole, infoComp.GetRoles()));
87 string strUnitBusy = string.Format("Unit Busy: %1", typename.EnumToString(EUnitAIState, infoComp.GetAIState()));
88 DbgUI.Text(strUnitState);
89 DbgUI.Text(strUnitRoles);
90 DbgUI.Text(strUnitBusy);
91 }
92 else if (groupInfoComp)
93 {
94 DbgUI.Text(string.Format("Control Mode: %1", typename.EnumToString(EGroupControlMode, groupInfoComp.GetGroupControlMode())));
95 }
96
97 if (combatComp)
98 {
99 BaseTarget currentEnemy = combatComp.GetCurrentTarget();
100 DbgUI.Text(string.Format("Enemy: %1", currentEnemy.ToString()));
101 }
102
103 if (mailboxComp)
104 {
105 int nRxMessages = mailboxComp.GetMessageCount();
106 int nRxOrders = mailboxComp.GetOrderCount();
107 int nRxDangers = m_Agent.GetDangerEventsCount();
108 DbgUI.Text(string.Format("Mailbox Queue: Msg: %1, Order: %2, Dngr: %3", nRxMessages, nRxOrders, nRxDangers));
109 }
110
111 // Utility component actions
112 if (utilityComp)
113 {
114 // Threat
115 if (unitUtilityComp)
116 {
117 EAIThreatState threatState = unitUtilityComp.m_ThreatSystem.GetState();
118 DbgUI.Text(string.Format("Threat: %1 %2", unitUtilityComp.m_ThreatSystem.GetThreatMeasure().ToString(6, 3), typename.EnumToString(EAIThreatState, threatState)));
119 }
120
121 AIActionBase currentAction = utilityComp.GetCurrentAction();
122 if (!currentAction)
123 DbgUI.Text("Current Action: null");
124 else
125 {
126 DbgUI.Text("Current Action:");
127 float actionPriority = currentAction.Evaluate();
128 string currentActionStr = string.Format(" > %1 %2", actionPriority.ToString(5, 1), currentAction.Type().ToString());
129 DbgUI.Text(currentActionStr);
130 }
131
132 // Spinner
133 array<string> spinnerStrings = {"[|]", "[/]", "[-]", "[\\]"};
134 string strSpinner = spinnerStrings[utilityComp.DiagGetCounter() % spinnerStrings.Count()];
135
136 DbgUI.Text(string.Format("%1 Actions:", strSpinner));
137 array<ref AIActionBase> allActions = {};
138 utilityComp.GetActions(allActions);
139 foreach (int i, AIActionBase action : allActions)
140 {
141 string actionStr = GetActionString(action, i);
142 DbgUI.Text(actionStr);
143
145 if (compositeAction)
146 {
147 array<AIActionBase> subactions = {};
148 compositeAction.GetSubactions(subactions);
149 foreach (AIActionBase subaction : subactions)
150 {
151 string subactionStr = " " + GetActionString(subaction, i);
152 DbgUI.Text(subactionStr);
153 }
154 }
155 }
156
157 delete allActions;
158 }
159
160 if (groupUtilityComp)
161 {
162 DbgUI.Text(groupUtilityComp.m_FireteamMgr.DiagGetFireteamsData());
163
164 DbgUI.Text(string.Format("Combat Mode External: %1",
165 typename.EnumToString(EAIGroupCombatMode, groupUtilityComp.GetCombatModeExternal())));
166
167 DbgUI.Text(string.Format("Combat Mode Actual: %1",
168 typename.EnumToString(EAIGroupCombatMode, groupUtilityComp.GetCombatModeActual())));
169
170 // Show group usable vehicles
171 bool showUsableVehicles;
172 DbgUI.Check("Show group usable vehicles", showUsableVehicles);
173 if (showUsableVehicles)
174 {
175 ShowGroupUsableVehicles(groupUtilityComp);
176 }
177 }
178
179 // Dump debug messages button
180 if (baseInfoComp)
181 {
182 int dumpDbgMsgsDuration;
183 EAIDebugMsgType dbgMsgType;
184 DbgUI.Text("Dump Debug Messages:");
185
186 DbgUI.Combo("Age", dumpDbgMsgsDuration, {"All", "120 sec", "30 sec", "5 sec"});
187
188 int dbgMsgTypeSelection;
189 array<string> dbgMsgTypeNames = {};
190 dbgMsgTypeNames.Copy(SCR_AIDebugMessage.s_aAiDebugMsgTypeLabels);
191 dbgMsgTypeNames.InsertAt("All", 0);
192 DbgUI.SameLine();
193 DbgUI.Combo("Type", dbgMsgTypeSelection, dbgMsgTypeNames);
194 dbgMsgType = dbgMsgTypeSelection - 1;
195 bool useDbgMsgTypeFilter = dbgMsgTypeSelection != 0;
196
197 DbgUI.SameLine();
198 bool dumpMsgs = DbgUI.Button("Dump");
199
200 if (dumpMsgs)
201 {
202 int msgAgeThresholdMs;
203 switch (dumpDbgMsgsDuration)
204 {
205 case 0: msgAgeThresholdMs = -1; break;
206 case 1: msgAgeThresholdMs = 120*1000; break;
207 case 2: msgAgeThresholdMs = 30*1000; break;
208 case 3: msgAgeThresholdMs = 5*1000; break;
209 }
210 #ifdef AI_DEBUG
211 baseInfoComp.DumpDebugMessages(useTypeFilter: useDbgMsgTypeFilter, msgTypeFilter: dbgMsgType, ageThresholdMs: msgAgeThresholdMs);
212 #endif
213 }
214 }
215
216 // Request breakpoint button
217 if (utilityComp)
218 {
219 DbgUI.Text("Breakpoint At:");
220 DbgUI.SameLine();
221 bool rqBreak = DbgUI.Button("Utility Comp.");
222 if (rqBreak && utilityComp)
223 {
224 utilityComp.DiagSetBreakpoint();
225 }
226 }
227
228 // Show settings
229 if (settingsComp)
230 {
231 bool showSettings;
232 DbgUI.Check("Show Settings", showSettings);
233 if (showSettings)
234 ShowSettingsComponent(settingsComp);
235 }
236
237 // Show perceivable component
238 if (perceivable)
239 {
240 bool showPerceivable;
241 DbgUI.Check("Show Perceivable", showPerceivable);
242 if (showPerceivable)
243 {
244 ShowPerceivableComponent(perceivable);
245 }
246 }
247
248 // Show perception
249 if (perception && combatComp)
250 {
251 DbgUI.Check("Show Targets", m_bShowPerception);
253 {
254 ShowPerceptionEnemies(m_Entity, perception, combatComp);
255 }
256 }
257
258 // Show combat move state
259 if (unitUtilityComp && unitUtilityComp.m_CombatMoveState)
260 {
261 bool showCombatMoveState;
262 DbgUI.Check("Show combat move state", showCombatMoveState);
263 if (showCombatMoveState)
264 {
265 ShowCombatMoveState(unitUtilityComp.m_CombatMoveState);
266 }
267 }
268 }
269
270 // Close button
271 m_bRequestClose = DbgUI.Button("Close");
272
273 // Locate button
274 DbgUI.SameLine();
275 bool locate = DbgUI.Button("Locate");
276 if (locate)
277 {
278 array<string> locateTexts = {"I am here!", "Look at me!", "Hey! Look here!", "Here I am!"};
279 IEntity ent;
280 if (m_Agent)
281 ent = m_Agent.GetControlledEntity();
282 else if (m_Group)
283 ent = m_Group;
284 else
285 ent = m_Entity;
286 SCR_AIDebugVisualization.VisualizeMessage(ent, locateTexts.GetRandomElement(), EAIDebugCategory.NONE, 0.75, Color.FromInt(Color.RED), fontSize: 20, ignoreCategory: true);
287 }
288
289 // Kill button
290 if (m_Agent && !m_Group)
291 {
292 DbgUI.SameLine();
293 bool forceDeath = DbgUI.Button("Kill");
294 if (forceDeath)
295 {
296 CharacterControllerComponent cntrlComp = CharacterControllerComponent.Cast(m_Entity.FindComponent(CharacterControllerComponent));
297 if (cntrlComp)
298 cntrlComp.ForceDeath();
299 }
300 }
301
302 DbgUI.End();
303
304 return m_bRequestClose;
305 }
306
307 string GetActionString(AIActionBase action, int actionId)
308 {
309 float actionPriority = action.Evaluate();
310 string strState = string.Format("(%1)", typename.EnumToString(EAIActionState, action.GetActionState()) );
311
312 string debugText;
313 SCR_AIActionBase scrActionBase = SCR_AIActionBase.Cast(action);
314 if (scrActionBase)
315 debugText = scrActionBase.GetDebugPanelText();
316
317 string actionStr = string.Format(" %1 %2 %3 %4 %5", actionId, strState, actionPriority.ToString(5, 1), action.Type().ToString(), debugText);
318
319 return actionStr;
320 }
321
323 void ShowPerceptionEnemies(IEntity myEntity, PerceptionComponent perception, SCR_AICombatComponent combatComponent)
324 {
325 vector myPos = myEntity.GetOrigin();
326
327
328 // Resolve which types to show
329 bool showUnknown;
330 bool showFriendly;
331 bool showEnemy;
332 DbgUI.Check(" Show Unknown", showUnknown);
333 DbgUI.Check(" Show Friendly", showFriendly);
334 DbgUI.Check(" Show Enemy", showEnemy);
335
336
337 array<ETargetCategory> targetCategories = {};
338 if (showUnknown)
339 targetCategories.Insert(ETargetCategory.UNKNOWN);
340 if (showFriendly)
341 targetCategories.Insert(ETargetCategory.FRIENDLY);
342 if (showEnemy)
343 {
344 targetCategories.Insert(ETargetCategory.DETECTED);
345 targetCategories.Insert(ETargetCategory.ENEMY);
346 }
347
348 FactionAffiliationComponent myFactionComp = FactionAffiliationComponent.Cast(myEntity.FindComponent(FactionAffiliationComponent));
349 Faction myFaction = myFactionComp.GetAffiliatedFaction();
350
351 BaseTarget selectedTarget = combatComponent.GetCurrentTarget();
352
353 DbgUI.Text("[ID Category TimeSinceSeen Dngr Type (Exp TraceFraction) (Detect Ident Sound)]");
354
355 array<BaseTarget> targets = {};
356 int targetId = 0;
357 foreach (ETargetCategory targetCategory : targetCategories)
358 {
359 targets.Clear();
360 perception.GetTargetsList(targets, targetCategory);
361 foreach (int i, BaseTarget baseTarget : targets)
362 {
363 IEntity targetEntity = baseTarget.GetTargetEntity();
364 if (!targetEntity)
365 continue;
366
367 // Don't list target if it has same faction as we do
368 //FactionAffiliationComponent targetFactionComp = FactionAffiliationComponent.Cast(targetEntity.FindComponent(FactionAffiliationComponent));
369 //if (targetFactionComp)
370 //{
371 // if (targetFactionComp.GetAffiliatedFaction() == myFaction)
372 // continue;
373 //}
374
375 EntityPrefabData prefabData = targetEntity.GetPrefabData();
376 ResourceName prefabName = prefabData.GetPrefabName();
377
378 /*
379 array<IEntity> __entities = {};
380 array<ResourceName> __prefabNames = {};
381
382 Print(string.Format("Target: %1", targetEntity));
383 IEntity __parent = targetEntity;
384 while (__parent)
385 {
386 __entities.Insert(__parent);
387 ResourceName __prefabName = __parent.GetPrefabData().GetPrefabName();
388 __prefabNames.Insert(__prefabName);
389
390 Print(string.Format(" %1 %2", __parent, __prefabName));
391
392 __parent = __parent.GetParent();
393 }
394
395 Print(" ");
396 */
397
398 string strTimeSinceSeenOrDetected = string.Format("(%1 %2)",
399 baseTarget.GetTimeSinceSeen().ToString(4, 1),
400 baseTarget.GetTimeSinceDetected().ToString(4, 1));
401 string strState;
402 if (baseTarget.IsEndangering())
403 strState = strState + "DNGR ";
404 if (baseTarget.IsDisarmed())
405 strState = strState + "DISARMED ";
406
407 array<string> substrings = {};
408 substrings.Clear();
409 string strPrefabName = string.Empty;
410 if (!prefabName.IsEmpty())
411 {
412 prefabName.Split("/", substrings, true);
413 if (!substrings.IsEmpty())
414 strPrefabName = substrings[substrings.Count()-1];
415 }
416
417 string strSelected = " ";
418 if (selectedTarget == baseTarget)
419 strSelected = ">";
420
421 string strDistance = vector.Distance(myPos, targetEntity.GetOrigin()).ToString(5, 2);
422
423 string strType = typename.EnumToString(EAIUnitType, baseTarget.GetUnitType());
424
425 float recognitionDetect;
426 float recognitionIdentify;
427 baseTarget.GetAccumulatedRecognition(recognitionDetect, recognitionIdentify);
428
429 // Same code as in ears sensor
430 float emittedSoundPower = baseTarget.GetPerceivableComponent().GetSoundPower();
431 float targetDistance = baseTarget.GetDistance();
432 float observedSoundIntensity = -999;
433 if (targetDistance != 0)
434 observedSoundIntensity = emittedSoundPower / (4.0 * Math.PI * targetDistance * targetDistance);
435 string strSoundIntensity;
436 if (observedSoundIntensity != 0)
437 strSoundIntensity = string.Format("%1 dB", (10*Math.Log10(observedSoundIntensity/1e-12)).ToString(5,1));
438 else
439 strSoundIntensity = "-inf dB";
440
441 string strExposure = string.Format("(%1 %2) ", baseTarget.GetExposure().ToString(3,2), baseTarget.GetTraceFraction().ToString(3, 2));
442
443 string strRecognition = string.Format("(%1 %2 %3)", recognitionDetect.ToString(3, 2), recognitionIdentify.ToString(3, 2), strSoundIntensity);
444
445 string str = string.Format("%1 %2 %3 %4s %5 %6 %7 %8",
446 targetId, // 1
447 strSelected, // 2
448 typename.EnumToString(ETargetCategory, targetCategory), // 3
449 strTimeSinceSeenOrDetected, // 4
450 strState, // 5
451 strType, // 6
452 strExposure, // 7
453 strRecognition); // 8
454 DbgUI.Text(str);
455
456 DbgUI.Text(string.Format("%1 %2 %3", targetId, GetEntityShortName(targetEntity), strPrefabName));
457
458 bool showRecognition = false;
459 DbgUI.Check(string.Format("%1 Recognition", targetId), showRecognition);
460 if (showRecognition)
461 {
462
463 DbgUI.Text(string.Format("%1 Exp: %2, Rec: Detect: %3 Identify: %4",
464 targetId, baseTarget.GetExposure().ToString(3, 2), recognitionDetect.ToString(3, 2), recognitionIdentify.ToString(3, 2)));
465
466 const int plotWidth = 200;
467 const int plotHeight = 150;
468 // int plotHistory = 800;
469 DbgUI.PlotLive(string.Format("%1 Detection", targetId), plotWidth, plotHeight, recognitionDetect, 300);
470 DbgUI.PlotLive(string.Format("%1 Identification", targetId), plotWidth, plotHeight, recognitionIdentify, 300);
471 }
472
473 targetId++;
474 }
475 }
476 }
477
479 {
480 DbgUI.Text("Recognition Factors:");
481 DbgUI.Text(string.Format(" Visual: %1", p.GetVisualRecognitionFactor()));
482 DbgUI.Text(string.Format(" Illumination: %1", p.GetIlluminationFactor()));
483
484 float soundPower = p.GetSoundPower();
485 string soundPowerStr;
486 if (soundPower == 0)
487 soundPowerStr = "- Inf";
488 else
489 soundPowerStr = string.Format("%1", 10*Math.Log10(soundPower/1e-12));
490 DbgUI.Text(string.Format(" Sound pwr: %1 dB", soundPowerStr));
491
492 DbgUI.Text(string.Format("Est. visual size: %1", p.GetEstimatedVisualSize()));
493 DbgUI.Text(string.Format("Ambient LV: %1", p.GetAmbientLV()));
494
495 FactionAffiliationComponent factionComp = p.GetFactionAffiliationComponent();
496 if (factionComp)
497 {
498 DbgUI.Text(string.Format("Faction: %1, Override: %2, Final: %3",
499 GetFactionKey(factionComp.GetAffiliatedFaction()),
500 GetFactionKey(p.GetPerceivedFactionOverride()),
501 GetFactionKey(p.GetPerceivedFaction())));
502 }
503
504 FactionManager fm = GetGame().GetFactionManager();
505 if (fm)
506 {
507 DbgUI.Text("SetPerceivedFactionOverride: ");
508 DbgUI.SameLine();
509
510 if (DbgUI.Button("Reset"))
511 p.SetPerceivedFactionOverride(null);
512 DbgUI.SameLine();
513
514 DbgUI.SameLine();
515 int factionCount = fm.GetFactionsCount();
516 for (int i = 0; i < factionCount; i++)
517 {
518 Faction f = fm.GetFactionByIndex(i);
519 if (DbgUI.Button(f.GetFactionKey()))
520 {
521 p.SetPerceivedFactionOverride(f);
522 }
523 if (i != factionCount-1)
524 DbgUI.SameLine();
525 }
526
527 }
528 }
529
530 void ShowCombatMoveState(SCR_AICombatMoveState s)
531 {
532 string strRqType;
533 string strRqState;
534
535 if (s.GetRequest())
536 {
537 strRqType = s.GetRequest().ToString();
538 strRqState = typename.EnumToString(SCR_EAICombatMoveRequestState, s.GetRequest().m_eState);
539 }
540 else
541 {
542 strRqType = "-";
543 strRqState = "-";
544 }
545
546 DbgUI.Text(string.Format("Request Type: %1", strRqType));
547 DbgUI.Text(string.Format("Request State: %1", strRqState));
548 DbgUI.Text(string.Format("TimerRequest: %1", s.m_fTimerRequest_s.ToString(5,2)));
549 DbgUI.Text(string.Format("TimerInCover: %1", s.m_fTimerInCover_s.ToString(5,2)));
550 DbgUI.Text(string.Format("TimerStopped: %1", s.m_fTimerStopped_s.ToString(5,2)));
551
552 string str;
553 if (s.m_bInCover)
554 str = str + "IN_COVER ";
555 if (s.m_bExposedInCover)
556 str = str + "EXPOSED_IN_COVER ";
557 if (s.m_bAimAtTarget)
558 str = str + "AIM_AT_TARGET";
559 if (!str.IsEmpty())
560 DbgUI.Text(str);
561 }
562
564 {
565 array<ref SCR_AIGroupVehicle> vehicles = {};
566 utility.m_VehicleMgr.GetAllVehicles(vehicles);
567
568 foreach (int i, SCR_AIGroupVehicle v : vehicles)
569 {
570 IEntity vehicleEntity;
571 if (v.GetVehicleUsageComponent())
572 vehicleEntity = v.GetVehicleUsageComponent().GetOwner();
573 string vehicleStr = string.Format("%1 - %2", i, GetEntityShortNameWithPrefabName(vehicleEntity));
574 DbgUI.Text(vehicleStr);
575 }
576 }
577
578 void ShowSettingsComponent(SCR_AISettingsBaseComponent settingsBaseComp)
579 {
580 array<SCR_AISettingBase> settings = {};
581
582 // Show own settings
583 settingsBaseComp.GetAllSettings(settings);
584 DbgUI.Text(string.Format("Settings: %1", settings.Count()));
585 ShowSettings(settings);
586 }
587
588 protected void ShowSettings(notnull array<SCR_AISettingBase> settings)
589 {
590 foreach (int i, SCR_AISettingBase s : settings)
591 {
592 string strSettingText = string.Format("%1 %2, Orig: %3, Prio: %4, %5",
593 i,
594 s,
595 typename.EnumToString(SCR_EAISettingOrigin, s.GetOrigin()),
596 s.GetPriority(),
597 s.GetDebugText());
598
599 DbgUI.Text(strSettingText);
600 }
601 }
602
605 {
606 if (m_Group)
607 {
608 // Group
609 string company, platoon, squad, character, format, returnString;
610 m_Group.GetCallsigns(company, platoon, squad, character, format);
611 returnString.Format(format, company, platoon, squad, character);
612 return returnString;
613
614 }
615 else if (m_Agent)
616 {
617 // Unit
618 SCR_CallsignCharacterComponent callsignComp = SCR_CallsignCharacterComponent.Cast(m_Agent.GetControlledEntity().FindComponent(SCR_CallsignCharacterComponent));
619
620 FactionAffiliationComponent factionComp = FactionAffiliationComponent.Cast(m_Agent.GetControlledEntity().FindComponent(FactionAffiliationComponent));
621
622 string str;
623
624 if (factionComp)
625 {
626 string faction = GetFactionKey(factionComp.GetAffiliatedFaction());
627 str = str + string.Format("[%1] ", faction);
628 }
629
630 if (callsignComp)
631 {
632 string company, platoon, squad, character, format;
633 bool setCallsign = callsignComp.GetCallsignNames(company, platoon, squad, character, format);
634 if (setCallsign)
635 {
636 string callsign = WidgetManager.Translate(format, company, platoon, squad, character);
637 str = str + string.Format(" %1", callsign);
638 }
639 }
640 return str;
641 }
642 else
643 {
644 return string.Empty;
645 }
646 }
647
649 static string EnumFlagsToString(typename t, int value)
650 {
651 int tVarCount = t.GetVariableCount();
652 string strOut;
653 for (int i = 0; i < tVarCount; i++)
654 {
655 int flag;
656 t.GetVariableValue(null, i, flag);
657 if (value & flag)
658 strOut = strOut + string.Format("%1 ", typename.EnumToString(t, flag));
659 }
660 return strOut;
661 }
662
663 static string GetEntityShortName(IEntity entity)
664 {
665 string entityRawName = string.Format("%1", entity);
666 int _a = entityRawName.IndexOf("<");
667 int _b = entityRawName.IndexOfFrom(_a, ">");
668 string entityPtrStr = entityRawName.Substring(_a+1, _b - _a - 1);
669 string entityClassNameStr = entity.ClassName();
670 return string.Format("%1 %2", entityClassNameStr, entityPtrStr);
671 }
672
674 {
675 string sBase = GetEntityShortName(entity);
676
677 string prefabName;
678 EntityPrefabData prefabData = entity.GetPrefabData();
679 if (prefabData)
680 prefabName = prefabData.GetPrefabName();
681
682 return string.Format("%1 %2", sBase, prefabName);
683 }
684
685 static string GetFactionKey(Faction f)
686 {
687 if (!f)
688 return "null";
689
690 return f.GetFactionKey();
691 }
692};
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_EAICombatMoveRequestState
EAIDebugMsgType
SCR_EAISettingOrigin
EAIDebugCategory
Definition SCR_AIWorld.c:12
FactionKey GetFactionKey()
Definition Color.c:13
Definition DbgUI.c:66
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external EntityPrefabData GetPrefabData()
Definition Math.c:13
void ShowSettings(notnull array< SCR_AISettingBase > settings)
string GetActionString(AIActionBase action, int actionId)
void ShowPerceivableComponent(PerceivableComponent p)
string GetAgentDebugName()
Returns agent name based on faction and callsign.
void SCR_AIAgentDebugPanel(AIAgent agent, IEntity entity)
void ShowPerceptionEnemies(IEntity myEntity, PerceptionComponent perception, SCR_AICombatComponent combatComponent)
Lists enemies from perception component.
static string GetEntityShortNameWithPrefabName(IEntity entity)
void ShowSettingsComponent(SCR_AISettingsBaseComponent settingsBaseComp)
void ShowCombatMoveState(SCR_AICombatMoveState s)
void ShowGroupUsableVehicles(SCR_AIGroupUtilityComponent utility)
static string GetFactionKey(Faction f)
static string GetEntityShortName(IEntity entity)
bool Update(float timeSlice)
static string EnumFlagsToString(typename t, int value)
Formats enum flags to string.
void GetSubactions(notnull array< AIActionBase > outSubactions)
static void VisualizeMessage(IEntity entity, string message, EAIDebugCategory category, float showTime, Color color=Color.White, float fontSize=16, bool ignoreCategory=false)
string DiagGetFireteamsData()
Returns string with data about fireteams.
EAIGroupCombatMode GetCombatModeActual()
Returns actual combat mode. See comment to EvaluateCombatMode method.
ref SCR_AIGroupFireteamManager m_FireteamMgr
EAIGroupCombatMode GetCombatModeExternal()
See SetCombatMode.
ref SCR_AIGroupVehicleManager m_VehicleMgr
This class is used for keeping track of vehicles assigned to group.
void GetAllVehicles(array< ref SCR_AIGroupVehicle > outAllVehicles)
EAIActionState
EAIUnitType
Definition EAIUnitType.c:13
ETargetCategory