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_AIActivity.c
Go to the documentation of this file.
1
5
enum
SCR_EAIActivityCause
6
{
7
SAFE
= 10,
8
ALWAYS
= 1000
// Special value for settings to run in all activities
9
}
10
11
class
SCR_AIActivityBase
: SCR_AIActionBase
12
{
13
SCR_AIGroupUtilityComponent
m_Utility
;
14
ref SCR_BTParam<bool>
m_bIsWaypointRelated
=
new
SCR_BTParam<bool>(
SCR_AIActionTask
.WAYPOINT_RELATED_PORT);
15
AIWaypoint
m_RelatedWaypoint
= null;
16
bool
m_bAllowFireteamRebalance
=
true
;
// Allows rebalancing of fireteams while this activity exists
17
18
array<ref SCR_AIActivityFeatureBase>
GetActivityFeatures
()
19
{
20
return
null;
21
}
22
23
SCR_AIActivityFeatureBase
FindActivityFeature
(
typename
featureType)
24
{
25
array<ref SCR_AIActivityFeatureBase> features =
GetActivityFeatures
();
26
if
(!features)
return
null;
27
28
foreach
(
SCR_AIActivityFeatureBase
feature : features)
29
if
(feature && feature.IsInherited(featureType))
30
return
feature;
31
32
return
null;
33
}
34
35
//---------------------------------------------------------------------------------------------------------------------------------
36
void
InitParameters
(AIWaypoint relatedWaypoint)
37
{
38
bool
isWaypointRelated = relatedWaypoint != null;
39
m_bIsWaypointRelated
.Init(
this
, isWaypointRelated);
40
m_RelatedWaypoint
= relatedWaypoint;
41
}
42
43
//---------------------------------------------------------------------------------------------------------------------------------
44
void
SCR_AIActivityBase
(
SCR_AIGroupUtilityComponent
utility, AIWaypoint relatedWaypoint)
45
{
46
m_Utility
= utility;
47
InitParameters
(relatedWaypoint);
48
}
49
50
//------------------------------------------------------------------------------------
51
protected
void
SendCancelMessagesToAllAgents
()
52
{
53
AICommunicationComponent comms =
m_Utility
.m_Owner.GetCommunicationComponent();
54
if
(!comms)
55
return
;
56
57
// Send to all agents
58
array<AIAgent> agents = {};
59
m_Utility
.m_Owner.GetAgents(agents);
60
foreach
(AIAgent agent : agents)
61
{
62
if
(!agent)
63
continue
;
64
65
SCR_AIMessage_Cancel
msg =
SCR_AIMessage_Cancel
.Create(
this
);
66
67
msg.SetReceiver(agent);
68
comms.RequestBroadcast(msg, agent);
69
}
70
}
71
72
//---------------------------------------------------------------------------------------------------------------------------------
75
void
Fail
(
bool
doNotCompleteWaypoint)
76
{
77
// If doNotCompleteWaypoint == true, the waypoint completed first and should not be completed for the second time
78
// we break the reference here deliberately and activity wont touch the waypoint from there on
79
if
(doNotCompleteWaypoint)
80
m_RelatedWaypoint
= null;
81
82
Fail
();
83
}
84
85
//---------------------------------------------------------------------------------------------------------------------------------
86
// Called from OnActionFailed and OnActionCompleted of the child behavior
87
void
OnChildBehaviorFinished
(
SCR_AIBehaviorBase
childBehavior);
88
89
//---------------------------------------------------------------------------------------------------------------------------------
90
// Called from constructor of the child behavior. Here we can register child behaviors.
91
void
OnChildBehaviorCreated
(
SCR_AIBehaviorBase
childBehavior);
92
93
//---------------------------------------------------------------------------------------------------------------------------------
94
#ifdef AI_DEBUG
95
override
void
AddDebugMessage(
string
str)
96
{
97
if
(!
m_Utility
|| !
m_Utility
.m_Owner)
98
return
;
99
SCR_AIInfoBaseComponent infoComp = SCR_AIInfoBaseComponent.Cast(
m_Utility
.m_Owner.FindComponent(SCR_AIInfoBaseComponent));
100
infoComp.AddDebugMessage(
string
.Format(
"%1: %2"
,
this
, str), msgType:
EAIDebugMsgType
.ACTION);
101
}
102
#endif
103
};
104
105
class
SCR_AIIdleActivity :
SCR_AIActivityBase
106
{
107
//---------------------------------------------------------------------------------------------------------------------------------
108
void
SCR_AIIdleActivity(
SCR_AIGroupUtilityComponent
utility, AIWaypoint relatedWaypoint)
109
{
110
m_sBehaviorTree
=
"AI/BehaviorTrees/Chimera/Group/ActivityIdle.bt"
;
111
SetPriority(1.0);
112
}
113
};
m_sBehaviorTree
ResourceName m_sBehaviorTree
Definition
SCR_AIAction.c:89
OnChildBehaviorFinished
void OnChildBehaviorFinished(SCR_AIBehaviorBase childBehavior)
FindActivityFeature
SCR_AIActivityFeatureBase FindActivityFeature(typename featureType)
Definition
SCR_AIActivity.c:23
Fail
void Fail(bool doNotCompleteWaypoint)
Definition
SCR_AIActivity.c:75
SendCancelMessagesToAllAgents
void SendCancelMessagesToAllAgents()
Definition
SCR_AIActivity.c:51
GetActivityFeatures
array< ref SCR_AIActivityFeatureBase > GetActivityFeatures()
Definition
SCR_AIActivity.c:18
m_bIsWaypointRelated
ref SCR_BTParam< bool > m_bIsWaypointRelated
Definition
SCR_AIActivity.c:14
SCR_AIActivityBase
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
Definition
SCR_AIActivity.c:44
InitParameters
void InitParameters(AIWaypoint relatedWaypoint)
Definition
SCR_AIActivity.c:36
m_Utility
enum SCR_EAIActivityCause m_Utility
OnChildBehaviorCreated
void OnChildBehaviorCreated(SCR_AIBehaviorBase childBehavior)
m_RelatedWaypoint
AIWaypoint m_RelatedWaypoint
Definition
SCR_AIActivity.c:15
m_bAllowFireteamRebalance
bool m_bAllowFireteamRebalance
Definition
SCR_AIActivity.c:16
SCR_EAIActivityCause
SCR_EAIActivityCause
Definition
SCR_AIActivity.c:6
ALWAYS
@ ALWAYS
Definition
SCR_AIActivity.c:8
SAFE
@ SAFE
Definition
SCR_AIActivity.c:7
SCR_AIBehaviorBase
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
Definition
SCR_AIBehavior.c:23
EAIDebugMsgType
EAIDebugMsgType
Definition
SCR_AIDebugMessage.c:2
SCR_AIActionTask
Definition
SCR_AIBehaviorTask.c:2
SCR_AIActivityFeatureBase
Definition
SCR_AIActivityFeatureBase.c:2
SCR_AIGroupUtilityComponent
Definition
SCR_AIGroupUtilityComponent.c:18
SCR_AIMessage_Cancel
Definition
SCR_AIMessage.c:269
scripts
Game
AI
Behavior
SCR_AIActivity.c
Generated by
1.17.0