Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AISendMessageGenerated.c
Go to the documentation of this file.
2{
3 static const string PORT_RECEIVER = "Receiver";
4
5 [Attribute("", UIWidgets.EditBox)]
6 protected string m_sText;
7
8 //-----------------------------------------------------------------------------------------------------------------------------------------------
9 protected SCR_AIActivityBase GetRelatedActivity(AIAgent owner)
10 {
11 SCR_AIBaseUtilityComponent utilityComp = SCR_AIBaseUtilityComponent.Cast(owner.FindComponent(SCR_AIBaseUtilityComponent));
12 if (!utilityComp)
13 return null;
14
15 if (SCR_AIGroup.Cast(owner))
16 return SCR_AIActivityBase.Cast(utilityComp.GetExecutedAction());
17 else
18 {
19 SCR_AIBehaviorBase behavior = SCR_AIBehaviorBase.Cast(utilityComp.GetExecutedAction());
20 if (behavior)
21 return SCR_AIActivityBase.Cast(behavior.GetRelatedGroupActivity());
22 else
23 return null;
24 }
25
26 return null;
27 }
28
29 //-----------------------------------------------------------------------------------------------------------------------------------------------
30 protected AIWaypoint GetRelatedWaypoint(AIAgent owner)
31 {
32 AIGroup group = AIGroup.Cast(owner);
33 if (!group)
34 return null;
35 return group.GetCurrentWaypoint();
36 }
37
38 //-----------------------------------------------------------------------------------------------------------------------------------------------
39 protected bool SendMessage(AIAgent owner, AIAgent receiver, SCR_AIMessageBase msg)
40 {
41 AICommunicationComponent comms = owner.GetCommunicationComponent();
42 if (!comms || !receiver)
43 return false;
44
45 #ifdef AI_DEBUG
46 InitDebugData(msg.m_sSentFromBt);
47 #endif
48
49 return comms.RequestBroadcast(msg, receiver);
50 }
51
52 //-----------------------------------------------------------------------------------------------------------------------------------------------
53 protected bool SendMessage(AIAgent owner, AIAgent receiver, SCR_AIOrderBase msg)
54 {
55 AICommunicationComponent comms = owner.GetCommunicationComponent();
56 if (!comms || !receiver)
57 return false;
58
59 #ifdef AI_DEBUG
60 InitDebugData(msg.m_sSentFromBt);
61 #endif
62
63 return comms.RequestBroadcast(msg, receiver);
64 }
65
66 //-----------------------------------------------------------------------------------------------------------------------------------------------
67 protected void InitDebugData(out string outSentFromBt)
68 {
69 string parentTreeName;
70 GetParentTreeName(parentTreeName);
71 outSentFromBt = string.Format("%1, node: %2 %3", parentTreeName, GetNodeID(), this.Type());
72 }
73
74 //-----------------------------------------------------------------------------------------------------------------------------------------------
75 protected AIAgent GetReceiverAgent(AIAgent owner)
76 {
77 AIAgent receiver;
78 if (!GetVariableIn(PORT_RECEIVER, receiver))
79 receiver = owner;
80
81 return receiver;
82 }
83
84 //-----------------------------------------------------------------------------------------------------------------------------------------------
85 static override bool VisibleInPalette() { return false; }
86}
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
int Type
proto bool GetVariableIn(string name, out void val)
proto void GetParentTreeName(out string val)
proto external int GetNodeID()
SCR_AIActivityBase GetRelatedActivity(AIAgent owner)
bool SendMessage(AIAgent owner, AIAgent receiver, SCR_AIMessageBase msg)
static override bool VisibleInPalette()
AIAgent GetReceiverAgent(AIAgent owner)
AIWaypoint GetRelatedWaypoint(AIAgent owner)
bool SendMessage(AIAgent owner, AIAgent receiver, SCR_AIOrderBase msg)
void InitDebugData(out string outSentFromBt)
SCR_FieldOfViewSettings Attribute