Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AIBaseUtilityComponent.c
Go to the documentation of this file.
1
[
ComponentEditorProps
(
category
:
"GameScripted/AI"
, description:
"Component for utility AI system calculations"
)]
2
class
SCR_AIBaseUtilityComponentClass
:
AIBaseUtilityComponentClass
3
{
4
}
5
6
// TODO:
7
// - For handling orders, use enums
8
9
class
SCR_AIBaseUtilityComponent : AIBaseUtilityComponent
10
{
11
// This can be set externally to request a breakpoint on next EvaluateBehavior
12
#ifdef AI_DEBUG
13
protected
bool
m_bEvaluationBreakpoint;
14
protected
int
m_iDiagCounter = 0;
15
#endif
16
17
//------------------------------------------------------------------------------------------------
21
void
SendMessage
(
AIMessage
msg, AIAgent receiver = null)
22
{
23
AICommunicationComponent commsComp = GetAIAgent().GetCommunicationComponent();
24
if
(!commsComp)
25
return
;
26
27
commsComp.RequestBroadcast(msg, receiver);
28
}
29
30
//------------------------------------------------------------------------------------------------
33
int
DiagGetCounter
()
34
{
35
#ifdef AI_DEBUG
36
return
m_iDiagCounter;
37
#else
38
return
0;
39
#endif
40
}
41
42
//------------------------------------------------------------------------------------------------
44
void
DiagIncreaseCounter
()
45
{
46
#ifdef AI_DEBUG
47
m_iDiagCounter++;
48
#endif
49
}
50
51
//------------------------------------------------------------------------------------------------
53
void
DiagSetBreakpoint
()
54
{
55
#ifdef AI_DEBUG
56
m_bEvaluationBreakpoint =
true
;
57
#endif
58
}
59
60
#ifdef AI_DEBUG
61
//------------------------------------------------------------------------------------------------
62
protected
void
AddDebugMessage(
string
str,
EAIDebugMsgType
messageType =
EAIDebugMsgType
.UTILITY)
63
{
64
SCR_AIInfoBaseComponent infoComp = SCR_AIInfoBaseComponent.Cast(
GetOwner
().FindComponent(SCR_AIInfoBaseComponent));
65
infoComp.AddDebugMessage(str, msgType: messageType);
66
}
67
68
//------------------------------------------------------------------------------------------------
69
protected
void
DebugLogActionsPriority()
70
{
71
array<ref AIActionBase> actions = {};
72
GetActions
(actions);
73
foreach
(AIActionBase action : actions)
74
{
75
string
actionStr = GetActionLogString(action);
76
AddDebugMessage(actionStr);
77
78
SCR_AICompositeActionParallel parallelAction = SCR_AICompositeActionParallel.Cast(action);
79
if
(parallelAction)
80
{
81
array<AIActionBase> subactions = {};
82
parallelAction.
GetSubactions
(subactions);
83
foreach
(AIActionBase subaction : subactions)
84
{
85
string
subactionStr =
" "
+ GetActionLogString(subaction);
86
AddDebugMessage(subactionStr);
87
}
88
}
89
90
}
91
}
92
93
//------------------------------------------------------------------------------------------------
94
protected
string
GetActionLogString(AIActionBase action)
95
{
96
SCR_AIActionBase scrActionBase = SCR_AIActionBase.Cast(action);
97
98
string
_strSuspended =
string
.Empty;
99
if
(action.GetActionIsSuspended())
100
_strSuspended =
"(S) "
;
101
float
score = action.Evaluate();
102
string
_strDebugInfo;
103
if
(scrActionBase)
104
_strDebugInfo = scrActionBase.GetActionDebugInfo();
105
106
return
string
.Format(
" %1%2 %3 %4"
, _strSuspended, score.ToString(3, 1), action.Type().ToString(), _strDebugInfo);
107
}
108
109
#endif
110
}
SendMessage
void SendMessage(AICommunicationComponent comms, SCR_AIActivityBase activity, vector position, float delay)
Definition
SCR_AIActivitySmokeCoverFeature.c:77
DiagGetCounter
int DiagGetCounter()
Definition
SCR_AIBaseUtilityComponent.c:33
DiagIncreaseCounter
void DiagIncreaseCounter()
Definition
SCR_AIBaseUtilityComponent.c:44
DiagSetBreakpoint
void DiagSetBreakpoint()
Definition
SCR_AIBaseUtilityComponent.c:53
EAIDebugMsgType
EAIDebugMsgType
Definition
SCR_AIDebugMessage.c:2
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
GetActions
array< ref SCR_MenuActionPreset > GetActions()
Definition
SCR_MenuActionsComponent.c:186
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
AIBaseUtilityComponentClass
Definition
AIBaseUtilityComponent.c:13
AIMessage
Base class for all messages related to AI.
Definition
AIMessage.c:14
SCR_AIBaseUtilityComponentClass
Definition
SCR_AIBaseUtilityComponent.c:3
SCR_AICompositeActionParallel::GetSubactions
void GetSubactions(notnull array< AIActionBase > outSubactions)
Definition
SCR_AICompositeActionParallel.c:5
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
scripts
Game
AI
Components
SCR_AIBaseUtilityComponent.c
Generated by
1.17.0