Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AISettingsComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/AI", description: "Component for utility AI system calculations")]
2 class SCR_AISettingsComponentClass : ScriptComponentClass
3 {
4 }
5 
6 class SCR_AISettingsComponent : ScriptComponent
7 {
8  // rewrite if condition below if adding new lines!!!
9  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Enable debug visualization")]
10  protected bool m_EnableVisualization;
11 
12  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Allow movement")]
14 
15  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Allow reacting on danger events")]
17 
18  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Allow reacting on perceived targets")]
20 
21  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Allow shooting and attacking in general")]
23 
24  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Allow finding and taking cover")]
26 
27  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Allow aiming and gestures in general")]
29 
30  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Allow sending messages")]
32 
33  [Attribute(defvalue: "1", uiwidget: UIWidgets.CheckBox, desc: "Allow artificial aiming error for AI")]
35 
36  [Attribute(defvalue: "0", uiwidget: UIWidgets.CheckBox, desc: "Allow leader to stop when formation is deformed")]
38 
39  [Attribute(defvalue: "", uiwidget: UIWidgets.EditBox, desc: "Title for world description")]
40  protected string m_sDescriptionTitle;
41 
42  [Attribute(defvalue: "", uiwidget: UIWidgets.EditBox, desc: "World description")]
43  protected string m_sDescriptionText;
44 
45  private Widget m_wHint;
46  private Widget m_wOverlay;
47 
49  protected static SCR_AISettingsComponent m_sInstance;
50 
51  //------------------------------------------------------------------------------------------------
53  static SCR_AISettingsComponent GetInstance()
54  {
55  return m_sInstance;
56  }
57 
58  //------------------------------------------------------------------------------------------------
61  {
62  if (!m_EnableVisualization)
63  return;
64 
65  GetGame().GetCallqueue().CallLater(UpdateDebug,10,true);
66 
67  // Create debug layout
68  WorkspaceWidget workspace = GetGame().GetWorkspace();
69  m_wOverlay = workspace.CreateWidgets("{7C4EE3995E17845B}UI/layouts/Debug/AIInfoDebug.layout");
70  if (m_wOverlay.GetNumHandlers() > 0)
72 
73  if (m_sDescriptionText != string.Empty || m_sDescriptionTitle != string.Empty)
74  SCR_HintManagerComponent.ShowCustomHint(m_sDescriptionText, m_sDescriptionTitle, 12);
75  }
76 
77  //------------------------------------------------------------------------------------------------
79  protected void UpdateDebug()
80  {
81  if (!m_EnableVisualization)
82  return;
83 
84  m_UIComponent.UpdateUI();
85  }
86 
87  //------------------------------------------------------------------------------------------------
88  override void OnPostInit(IEntity owner)
89  {
90  super.OnPostInit(owner);
91  m_sInstance = this;
92 #ifdef AI_DEBUG
93  if (m_EnableVisualization)
95 #endif
96  }
97 
98  //------------------------------------------------------------------------------------------------
99  // destructor
101  {
102  if (m_wOverlay)
103  m_wOverlay.RemoveFromHierarchy();
104 
105  if (m_wHint)
106  m_wHint.RemoveFromHierarchy();
107  }
108 }
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
m_EnableMovement
bool m_EnableMovement
Definition: SCR_AISettingsComponent.c:13
m_EnableLeaderStop
bool m_EnableLeaderStop
Definition: SCR_AISettingsComponent.c:37
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
~SCR_AISettingsComponent
void ~SCR_AISettingsComponent()
Definition: SCR_AISettingsComponent.c:100
GetInstance
SCR_TextsTaskManagerComponentClass ScriptComponentClass GetInstance()
Definition: SCR_TextsTaskManagerComponent.c:50
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_wHint
private Widget m_wHint
Definition: SCR_AISettingsComponent.c:45
m_sDescriptionText
protected string m_sDescriptionText
Definition: SCR_AISettingsComponent.c:43
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
m_UIComponent
protected SCR_AIDebugInfoComponent m_UIComponent
Definition: SCR_AISettingsComponent.c:48
SCR_AISettingsComponentClass
Definition: SCR_AISettingsComponent.c:2
m_EnableTakeCover
bool m_EnableTakeCover
Definition: SCR_AISettingsComponent.c:25
m_EnableDangerEvents
bool m_EnableDangerEvents
Definition: SCR_AISettingsComponent.c:16
InitVisualization
void InitVisualization()
Definition: SCR_AISettingsComponent.c:60
m_EnableAimError
bool m_EnableAimError
Definition: SCR_AISettingsComponent.c:34
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_AISettingsComponent.c:88
m_EnablePerception
bool m_EnablePerception
Definition: SCR_AISettingsComponent.c:19
SCR_AIDebugInfoComponent
Definition: SCR_AIDebugInfoComponent.c:1
m_sDescriptionTitle
protected string m_sDescriptionTitle
Definition: SCR_AISettingsComponent.c:40
m_EnableCommunication
bool m_EnableCommunication
Definition: SCR_AISettingsComponent.c:31
UpdateDebug
protected void UpdateDebug()
Definition: SCR_AISettingsComponent.c:79
m_wOverlay
private Widget m_wOverlay
Definition: SCR_AISettingsComponent.c:46
m_EnableLooking
bool m_EnableLooking
Definition: SCR_AISettingsComponent.c:28
Attribute
SCR_AISettingsComponentClass ScriptComponentClass Attribute(defvalue:"1", uiwidget:UIWidgets.CheckBox, desc:"Enable debug visualization")] protected bool m_EnableVisualization
m_EnableAttack
bool m_EnableAttack
Definition: SCR_AISettingsComponent.c:22
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180