Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AISetDefendWaypointParameters.c
Go to the documentation of this file.
2{
3 static const string PRESET_INDEX_PORT = "PresetIndexIn";
4 static const string FAST_INIT_PORT = "FastInitIn";
5 static const string WAYPOINT_PORT = "WaypointIn";
6
7 [Attribute("-1", UIWidgets.EditBox, "Set current preset index of defend waypoint")];
8 private int m_iNewPresetIndex;
9
10 [Attribute("-1", UIWidgets.EditBox, "Set fast init for of defend waypoint")];
11 private int m_iNewFastInit;
12
13 [Attribute("1", UIWidgets.CheckBox, "Should call invoker OnWaypointPropertiesChange?")];
14 private bool m_bCallInvoker;
15
16 //------------------------------------------------------------------------------------------------
17 protected static ref TStringArray s_aVarsIn = {
18 WAYPOINT_PORT,
19 PRESET_INDEX_PORT,
20 FAST_INIT_PORT
21 };
23 {
24 return s_aVarsIn;
25 }
26
27 //------------------------------------------------------------------------------------------------
28 override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
29 {
30 AIWaypoint waypoint;
32 int newIndex;
33
34 AIGroup group = AIGroup.Cast(owner);
35 if (!group)
36 {
37 SCR_AgentMustBeAIGroup(this, owner);
38 return ENodeResult.FAIL;
39 }
40
41 if (!GetVariableIn(WAYPOINT_PORT, waypoint))
42 {
43 waypoint = group.GetCurrentWaypoint();
44 }
45
46 wp = SCR_DefendWaypoint.Cast(waypoint);
47 if (!wp)
48 {
49 return NodeError(this, owner, "Did not provide defend waypoint to set!");
50 }
51
52 if (!GetVariableIn(PRESET_INDEX_PORT, newIndex))
53 newIndex = m_iNewPresetIndex;
54
55 if (newIndex > -1 && !wp.SetCurrentDefendPreset(newIndex)) // I want to change preset
56 {
57 return NodeError(this, owner, "Wrong index of preset provided");
58 }
59
60 if (!GetVariableIn(FAST_INIT_PORT, newIndex))
61 newIndex = m_iNewFastInit;
62
63 if (newIndex > -1) // I want to change fast init state
64 {
65 wp.SetFastInit(newIndex);
66 }
67
68 if (m_bCallInvoker)
69 {
70 wp.GetOnWaypointPropertiesChanged().Invoke();
71 }
72
73 return ENodeResult.SUCCESS;
74 }
75
76 //------------------------------------------------------------------------------------------------
77 protected static override bool VisibleInPalette()
78 {
79 return true;
80 }
81
82 //------------------------------------------------------------------------------------------------
83 protected static override string GetOnHoverDescription()
84 {
85 return "Changes preset of defend waypoint, defined in m_DefendPresets array of defend waypoint entity.";
86 }
87};
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition NodeError.c:3
void SCR_AgentMustBeAIGroup(Node node, AIAgent owner)
Definition NodeError.c:14
proto bool GetVariableIn(string name, out void val)
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
bool SetCurrentDefendPreset(int newDefendPresetIndex)
void SetFastInit(bool isFastInit)
ENodeResult
Definition ENodeResult.c:13
SCR_FieldOfViewSettings Attribute
array< string > TStringArray
Definition Types.c:385