Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIOnWaypointPropertiesChange.c
Go to the documentation of this file.
2{
3
4 [Attribute("-1", UIWidgets.EditBox, "Timeout (ms) after it succeeds")];
5 float m_fTimeout_Base_ms;
6
7 [Attribute("0", UIWidgets.EditBox, "Random timeout delta")];
8 float m_fTimeout_Random_ms;
9
12 protected float m_fActualTime_ms;
13 protected float m_fTimeout_ms;
14
15
16 override void OnEnter(AIAgent owner)
17 {
18 m_fActualTime_ms = GetGame().GetWorld().GetWorldTime();
19 if (m_fTimeout_Base_ms >= 0)
20 m_fTimeout_ms = m_fTimeout_Base_ms + Math.RandomFloat(0, m_fTimeout_Random_ms);
21 }
22
23 //------------------------------------------------------------------------------------------------------------
24 override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
25 {
26 if (m_fTimeout_Base_ms > 0 && (GetGame().GetWorld().GetWorldTime() - m_fActualTime_ms) > m_fTimeout_ms)
27 return ENodeResult.SUCCESS;
28
29 SCR_AIGroup group = SCR_AIGroup.Cast(owner);
30 if (!group)
31 {
32 SCR_AgentMustBeAIGroup(this, owner);
33 return ENodeResult.FAIL;
34 }
35
36 if (!m_OnWaypointChanged) // register on event of changing the waypoint in group
37 {
40 OnCurrentWaypointChanged(group.GetCurrentWaypoint(), null); // register next changes to set waypoint
41 return ENodeResult.SUCCESS;
42 }
43
45 {
47 return ENodeResult.SUCCESS;
48 }
49 return ENodeResult.RUNNING;
50 }
51
52 //------------------------------------------------------------------------------------------------------------
67
68 //------------------------------------------------------------------------------------------------------------
73
74 //------------------------------------------------------------------------------------------------------------
75 override void OnAbort(AIAgent owner, Node nodeCausingAbort)
76 {
77 if (nodeCausingAbort && nodeCausingAbort != this)
78 {
84 }
85 }
86
87 //------------------------------------------------------------------------------------------------------------
88 static override string GetOnHoverDescription()
89 {
90 return "OnWaypointPropertiesChange: keeps running until group has SCR_AIWaypoint - waypoint. \nThen it keeps running until this waypoint has changed its properties or moved to different position.";
91 }
92
93 //------------------------------------------------------------------------------------------------------------
94 static override bool VisibleInPalette() { return true;}
95
96 //------------------------------------------------------------------------------------------------------------
97 static override bool CanReturnRunning() { return true;}
98}
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_AgentMustBeAIGroup(Node node, AIAgent owner)
Definition NodeError.c:14
Definition Math.c:13
Definition Node.c:13
ScriptInvoker GetOnCurrentWaypointChanged()
void OnCurrentWaypointChanged(AIWaypoint currentWp, AIWaypoint prevWp)
override void OnAbort(AIAgent owner, Node nodeCausingAbort)
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
ScriptInvoker GetOnWaypointPropertiesChanged()
ENodeResult
Definition ENodeResult.c:13
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134