Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AIOnWaypointPropertiesChange.c
Go to the documentation of this file.
1
class
SCR_AIOnWaypointPropertiesChange
:
AITaskScripted
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
10
protected
ScriptInvoker
m_OnWaypointChanged
,
m_OnWaypointPropertiesChanged
;
11
protected
bool
m_bWaypointPropertiesChanged
;
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
{
38
m_OnWaypointChanged
= group.
GetOnCurrentWaypointChanged
();
39
m_OnWaypointChanged
.Insert(
OnCurrentWaypointChanged
);
40
OnCurrentWaypointChanged
(group.GetCurrentWaypoint(), null);
// register next changes to set waypoint
41
return
ENodeResult
.SUCCESS;
42
}
43
44
if
(
m_bWaypointPropertiesChanged
)
45
{
46
m_bWaypointPropertiesChanged
=
false
;
47
return
ENodeResult
.SUCCESS;
48
}
49
return
ENodeResult
.RUNNING;
50
}
51
52
//------------------------------------------------------------------------------------------------------------
53
void
OnCurrentWaypointChanged
(AIWaypoint currentWp, AIWaypoint prevWp)
54
{
55
if
(
m_OnWaypointPropertiesChanged
)
56
m_OnWaypointPropertiesChanged
.Remove(
OnWaypointPropertiesChanged
);
57
SCR_AIWaypoint
wp =
SCR_AIWaypoint
.Cast(currentWp);
58
if
(!wp)
59
{
60
m_OnWaypointPropertiesChanged
= null;
61
return
;
62
}
63
64
m_OnWaypointPropertiesChanged
= wp.
GetOnWaypointPropertiesChanged
();
65
m_OnWaypointPropertiesChanged
.Insert(
OnWaypointPropertiesChanged
);
66
}
67
68
//------------------------------------------------------------------------------------------------------------
69
void
OnWaypointPropertiesChanged
()
70
{
71
m_bWaypointPropertiesChanged
=
true
;
72
}
73
74
//------------------------------------------------------------------------------------------------------------
75
override
void
OnAbort
(AIAgent owner,
Node
nodeCausingAbort)
76
{
77
if
(nodeCausingAbort && nodeCausingAbort !=
this
)
78
{
79
if
(
m_OnWaypointChanged
)
80
m_OnWaypointChanged
.Remove(
OnCurrentWaypointChanged
);
81
if
(
m_OnWaypointPropertiesChanged
)
82
m_OnWaypointPropertiesChanged
.Remove(
OnWaypointPropertiesChanged
);
83
m_bWaypointPropertiesChanged
=
false
;
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
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
SCR_AgentMustBeAIGroup
void SCR_AgentMustBeAIGroup(Node node, AIAgent owner)
Definition
NodeError.c:14
AITaskScripted
Definition
AITaskScripted.c:13
Math
Definition
Math.c:13
Node
Definition
Node.c:13
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_AIGroup::GetOnCurrentWaypointChanged
ScriptInvoker GetOnCurrentWaypointChanged()
Definition
SCR_AIGroup.c:2288
SCR_AIOnWaypointPropertiesChange
Definition
SCR_AIOnWaypointPropertiesChange.c:2
SCR_AIOnWaypointPropertiesChange::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AIOnWaypointPropertiesChange.c:94
SCR_AIOnWaypointPropertiesChange::CanReturnRunning
static override bool CanReturnRunning()
Definition
SCR_AIOnWaypointPropertiesChange.c:97
SCR_AIOnWaypointPropertiesChange::OnCurrentWaypointChanged
void OnCurrentWaypointChanged(AIWaypoint currentWp, AIWaypoint prevWp)
Definition
SCR_AIOnWaypointPropertiesChange.c:53
SCR_AIOnWaypointPropertiesChange::m_fTimeout_ms
float m_fTimeout_ms
Definition
SCR_AIOnWaypointPropertiesChange.c:13
SCR_AIOnWaypointPropertiesChange::OnEnter
override void OnEnter(AIAgent owner)
Definition
SCR_AIOnWaypointPropertiesChange.c:16
SCR_AIOnWaypointPropertiesChange::OnAbort
override void OnAbort(AIAgent owner, Node nodeCausingAbort)
Definition
SCR_AIOnWaypointPropertiesChange.c:75
SCR_AIOnWaypointPropertiesChange::m_bWaypointPropertiesChanged
bool m_bWaypointPropertiesChanged
Definition
SCR_AIOnWaypointPropertiesChange.c:11
SCR_AIOnWaypointPropertiesChange::OnWaypointPropertiesChanged
void OnWaypointPropertiesChanged()
Definition
SCR_AIOnWaypointPropertiesChange.c:69
SCR_AIOnWaypointPropertiesChange::m_fActualTime_ms
float m_fActualTime_ms
Definition
SCR_AIOnWaypointPropertiesChange.c:12
SCR_AIOnWaypointPropertiesChange::EOnTaskSimulate
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
Definition
SCR_AIOnWaypointPropertiesChange.c:24
SCR_AIOnWaypointPropertiesChange::m_OnWaypointPropertiesChanged
ScriptInvoker m_OnWaypointPropertiesChanged
Definition
SCR_AIOnWaypointPropertiesChange.c:10
SCR_AIOnWaypointPropertiesChange::GetOnHoverDescription
static override string GetOnHoverDescription()
Definition
SCR_AIOnWaypointPropertiesChange.c:88
SCR_AIOnWaypointPropertiesChange::m_OnWaypointChanged
ScriptInvoker m_OnWaypointChanged
Definition
SCR_AIOnWaypointPropertiesChange.c:10
SCR_AIWaypoint
Definition
SCR_AIWaypoint.c:6
SCR_AIWaypoint::GetOnWaypointPropertiesChanged
ScriptInvoker GetOnWaypointPropertiesChanged()
Definition
SCR_AIWaypoint.c:41
UIWidgets
Definition
attributes.c:40
ENodeResult
ENodeResult
Definition
ENodeResult.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
AI
ScriptedNodes
Groups
SCR_AIOnWaypointPropertiesChange.c
Generated by
1.17.0