Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIIsFriendlyInAim.c
Go to the documentation of this file.
2{
3 protected PerceptionComponent m_PerceptionComponent;
4 #ifdef WORKBENCH
5 protected ref Shape m_FriendlyAimShape;
6 #endif
7 protected override bool TestFunction(AIAgent owner)
8 {
10 return false;
11
12 IEntity friendlyEntInAim = m_PerceptionComponent.GetFriendlyInLineOfFire();
13#ifdef WORKBENCH
14 if (friendlyEntInAim && DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_AI_SHOW_FRIENDLY_IN_AIM))
15 m_FriendlyAimShape = Shape.CreateSphere(COLOR_RED, ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER|ShapeFlags.TRANSP, friendlyEntInAim.GetOrigin() + Vector(0, 2, 0), 0.1);
16 else
17 m_FriendlyAimShape = null;
18#endif
19
20 return friendlyEntInAim != null;
21 }
22
23 override protected void OnInit(AIAgent owner)
24 {
25 IEntity ent = owner.GetControlledEntity();
26
27 if (!ent)
28 NodeError(this, owner, "SCR_AIIsFriendlyInAim must be used with soldiers");
29
30 m_PerceptionComponent = PerceptionComponent.Cast(ent.FindComponent(PerceptionComponent));
31
33 NodeError(this, owner, "Didn't find PerceptionComponent");
34 }
35
36 protected static override string GetOnHoverDescription()
37 {
38 return "SCR_AIIsFriendlyInAim: Returns true when we have a friendly unit in aim. Used for checking against friendly fire.";
39 }
40};
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition DebugMenuID.c:4
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition NodeError.c:3
Diagnostic and developer menu system.
Definition DiagMenu.c:18
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
void OnInit(AIAgent owner)
PerceptionComponent m_PerceptionComponent
static override string GetOnHoverDescription()
override bool TestFunction(AIAgent owner)
Instance of created debug visualizer.
Definition Shape.c:14
const int COLOR_RED
Definition constants.c:21
ShapeFlags
Definition ShapeFlags.c:13
proto native vector Vector(float x, float y, float z)