Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIActivity.c
Go to the documentation of this file.
2 {
3  SCR_AIGroupUtilityComponent m_Utility;
4  ref SCR_BTParam<bool> m_bIsWaypointRelated = new SCR_BTParam<bool>(SCR_AIActionTask.WAYPOINT_RELATED_PORT);
5  AIWaypoint m_RelatedWaypoint = null;
6  bool m_bAllowFireteamRebalance = true; // Allows rebalancing of fireteams while this activity exists
7 
8  array<ref SCR_AIActivityFeatureBase> GetActivityFeatures()
9  {
10  return null;
11  }
12 
13  SCR_AIActivityFeatureBase FindActivityFeature(typename featureType)
14  {
15  array<ref SCR_AIActivityFeatureBase> features = GetActivityFeatures();
16  if (!features) return null;
17 
18  foreach (SCR_AIActivityFeatureBase feature : features)
19  if (feature && feature.IsInherited(featureType))
20  return feature;
21 
22  return null;
23  }
24 
25  //---------------------------------------------------------------------------------------------------------------------------------
26  void InitParameters(AIWaypoint relatedWaypoint)
27  {
28  bool isWaypointRelated = relatedWaypoint != null;
29  m_bIsWaypointRelated.Init(this, isWaypointRelated);
30  m_RelatedWaypoint = relatedWaypoint;
31  }
32 
33  //---------------------------------------------------------------------------------------------------------------------------------
34  void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
35  {
36  m_Utility = utility;
37  InitParameters(relatedWaypoint);
38  }
39 
40  //------------------------------------------------------------------------------------
41  protected void SendCancelMessagesToAllAgents()
42  {
43  AICommunicationComponent comms = m_Utility.m_Owner.GetCommunicationComponent();
44  if (!comms)
45  return;
46 
47  // Send to all agents
48  array<AIAgent> agents = {};
49  m_Utility.m_Owner.GetAgents(agents);
50  foreach (AIAgent agent : agents)
51  {
52  if (!agent)
53  continue;
54 
55  SCR_AIMessage_Cancel msg = SCR_AIMessage_Cancel.Create(this);
56 
57  msg.SetReceiver(agent);
58  comms.RequestBroadcast(msg, agent);
59  }
60  }
61 
62  //---------------------------------------------------------------------------------------------------------------------------------
63  #ifdef AI_DEBUG
64  override void AddDebugMessage(string str)
65  {
66  SCR_AIInfoBaseComponent infoComp = SCR_AIInfoBaseComponent.Cast(m_Utility.GetOwner().FindComponent(SCR_AIInfoBaseComponent));
67  infoComp.AddDebugMessage(string.Format("%1: %2", this, str), msgType: EAIDebugMsgType.ACTION);
68  }
69  #endif
70 };
71 
73 {
74  //---------------------------------------------------------------------------------------------------------------------------------
75  void SCR_AIIdleActivity(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
76  {
77  m_sBehaviorTree = "AI/BehaviorTrees/Chimera/Group/ActivityIdle.bt";
78  SetPriority(1.0);
79  }
80 };
SCR_AIMessage_Cancel
Definition: SCR_AIMessage.c:263
SCR_AIIdleActivity
Definition: SCR_AIActivity.c:72
EAIDebugMsgType
EAIDebugMsgType
Definition: SCR_AIDebugMessage.c:1
SCR_AIActionBase
Definition: SCR_AIAction.c:1
m_bIsWaypointRelated
bool m_bIsWaypointRelated
Definition: SendGoalMessage.c:6
SCR_AIActivityBase
Definition: SCR_AIActivity.c:1
SCR_AIActivityFeatureBase
Definition: SCR_AIActivityFeatureBase.c:1
SCR_AIActionTask
Definition: SCR_AIBehaviorTask.c:1