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_ScenarioFrameworkAIAddWaypoint.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_ContainerAIActionTitle
()]
2
class
SCR_ScenarioFrameworkAIAddWaypoint
:
SCR_ScenarioFrameworkAIAction
3
{
4
[
Attribute
(
desc
:
"SlotWaypoint that spawns waypoint - Use GetLayerBase"
)];
5
ref
SCR_ScenarioFrameworkGet
m_Getter;
6
7
[
Attribute
(
desc
:
"True checked, this waypoint will be added on a first position. Otherwise it will append it at the end of the waypoint queue."
)];
8
bool
m_bAddOnTopOfQueue;
9
10
[
Attribute
(
desc
:
"True checked, previous waypoints should be cleared."
)];
11
bool
m_bClearPreviousWaypoints;
12
13
AIWaypoint m_Waypoint;
14
15
//------------------------------------------------------------------------------------------------
16
override
void
OnActivate
()
17
{
18
if
(!m_Getter)
19
return
;
20
21
SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
22
if
(!entityWrapper)
23
{
24
Print
(
string
.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1."
,
this
),
LogLevel
.ERROR);
25
return
;
26
}
27
28
IEntity
entity = entityWrapper.GetValue();
29
if
(!entity)
30
{
31
Print
(
string
.Format(
"ScenarioFramework Action: Entity not found for Action %1."
,
this
),
LogLevel
.ERROR);
32
return
;
33
}
34
35
m_Waypoint = AIWaypoint.Cast(entity);
36
if
(!m_Waypoint)
37
{
38
SCR_ScenarioFrameworkLayerBase
layer
=
SCR_ScenarioFrameworkLayerBase
.Cast(entity.
FindComponent
(
SCR_ScenarioFrameworkLayerBase
));
39
if
(!
layer
)
40
{
41
Print
(
string
.Format(
"ScenarioFramework Action: Entity is not Layer Base for Action %1."
,
this
),
LogLevel
.ERROR);
42
return
;
43
}
44
45
IEntity
spawnedEntity =
layer
.GetSpawnedEntity();
46
if
(!spawnedEntity)
47
{
48
layer
.GetOnAllChildrenSpawned().Insert(OnWaypointSpawned);
49
return
;
50
}
51
52
m_Waypoint = AIWaypoint.Cast(spawnedEntity);
53
if
(!m_Waypoint)
54
{
55
Print
(
string
.Format(
"ScenarioFramework Action: Waypoint not found for Action %1."
,
this
),
LogLevel
.ERROR);
56
return
;
57
}
58
}
59
60
if
(m_bClearPreviousWaypoints)
61
ClearCurrentWaypoints();
62
63
if
(m_bAddOnTopOfQueue)
64
m_AIGroup.AddWaypointAt(m_Waypoint, 0);
65
else
66
m_AIGroup.AddWaypoint(m_Waypoint);
67
}
68
69
//------------------------------------------------------------------------------------------------
70
void
ClearCurrentWaypoints()
71
{
72
array<AIWaypoint> currentWaypoints = {};
73
m_AIGroup.GetWaypoints(currentWaypoints);
74
foreach
(AIWaypoint waypoint : currentWaypoints)
75
{
76
m_AIGroup.RemoveWaypointFromGroup(waypoint);
77
}
78
}
79
80
//------------------------------------------------------------------------------------------------
81
void
OnWaypointSpawned(
SCR_ScenarioFrameworkLayerBase
layer
)
82
{
83
layer
.GetOnAllChildrenSpawned().Remove(OnWaypointSpawned);
84
85
IEntity
spawnedEntity =
layer
.GetSpawnedEntity();
86
if
(!spawnedEntity)
87
return
;
88
89
m_Waypoint = AIWaypoint.Cast(spawnedEntity);
90
if
(!m_Waypoint)
91
{
92
Print
(
string
.Format(
"ScenarioFramework Action: Waypoint not found for Action %1."
,
this
),
LogLevel
.ERROR);
93
return
;
94
}
95
96
if
(m_bClearPreviousWaypoints)
97
ClearCurrentWaypoints();
98
99
if
(m_bAddOnTopOfQueue)
100
m_AIGroup.AddWaypointAt(m_Waypoint, 0);
101
else
102
m_AIGroup.AddWaypoint(m_Waypoint);
103
}
104
}
layer
LayerPresets layer
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
OnActivate
override void OnActivate()
Definition
SCR_CharacterCommandLoiter.c:31
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
SCR_ScenarioFrameworkLayerBase
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_ScenarioFrameworkLayerBase.c:1411
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_ContainerAIActionTitle
Definition
SCR_ContainerAIActionTitle.c:2
SCR_ScenarioFrameworkAIAction
Definition
SCR_ScenarioFrameworkAIAction.c:3
SCR_ScenarioFrameworkAIAddWaypoint
Definition
SCR_ScenarioFrameworkAIAddWaypoint.c:3
SCR_ScenarioFrameworkGet
Definition
SCR_ScenarioFrameworkGet.c:3
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
ScenarioFramework
Actions
AIActions
SCR_ScenarioFrameworkAIAddWaypoint.c
Generated by
1.17.0