Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIGetRandomLookPosition.c
Go to the documentation of this file.
2{
3 // Inputs
4 protected static const string PORT_IN_POS = "InPos";
5
6 // Outputs
7 protected static const string PORT_OUT_POS = "OutPos";
8
9 [Attribute("0.5", UIWidgets.EditBox, params: "0 1", desc: "Radius of random position is calculated based on distance multiplied by this value")]
10 protected float m_fTangent;
11
12 //----------------------------------------------------------------------
13 override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
14 {
15 IEntity controlledEntity = owner.GetControlledEntity();
16 if (!controlledEntity)
17 return ENodeResult.FAIL;
18
19 vector inPos;
20 if (!GetVariableIn(PORT_IN_POS, inPos))
21 return ENodeResult.FAIL;
22
23 float distance = vector.Distance(controlledEntity.GetOrigin(), inPos);
24
25 vector outPos = s_AIRandomGenerator.GenerateRandomPointInRadius(0, distance*m_fTangent, inPos, true);
26 outPos[1] = inPos[1];
27
29
30 return ENodeResult.SUCCESS;
31 }
32
33 //----------------------------------------------------------------------
34 protected static ref TStringArray s_aVarsOut = { PORT_OUT_POS };
36
37 protected static ref TStringArray s_aVarsIn = { PORT_IN_POS };
38 override TStringArray GetVariablesIn() { return s_aVarsIn; }
39
40 override static string GetOnHoverDescription()
41 {
42 return "Generates randomized positions based on estimated target position, to look at them randomly.";
43 }
44
45 override string GetNodeMiddleText()
46 {
47 return string.Format("Tangent: %1", m_fTangent);
48 }
49
50 override static bool VisibleInPalette() { return true; }
51}
class SCR_AINodePortsHelpers s_AIRandomGenerator
float distance
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external vector GetOrigin()
proto void SetVariableOut(string name, void val)
proto bool GetVariableIn(string name, out void val)
static override string GetOnHoverDescription()
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
ENodeResult
Definition ENodeResult.c:13
SCR_FieldOfViewSettings Attribute
array< string > TStringArray
Definition Types.c:385