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_AIDecoTestIsOutVehicleCondition.c
Go to the documentation of this file.
1
class
SCR_AIDecoTestIsOutVehicleCondition
:
DecoratorTestScripted
2
{
3
// this tests AIWaypoint waypoint completion condition: either characters are out of vehicles
4
protected
override
bool
TestFunction
(AIAgent agent,
IEntity
controlled)
5
{
6
SCR_AIBoardingParameters
allowance;
7
EAIWaypointCompletionType
completionType;
8
AIWaypoint wp = AIWaypoint.Cast(controlled);
9
if
(!wp)
10
return
false
;
11
completionType = wp.GetCompletionType();
12
SCR_BoardingWaypoint
bwp =
SCR_BoardingWaypoint
.Cast(controlled);
13
if
(bwp)
14
allowance = bwp.GetAllowance();
15
16
SCR_AIGroup
group =
SCR_AIGroup
.Cast(agent);
17
if
(!group)
18
{
19
Debug
.Error(
"Running on AIAgent that is not a SCR_AIGroup group!"
);
20
return
false
;
21
}
22
23
array<AIAgent> agents = {};
24
25
switch
(completionType)
26
{
27
case
EAIWaypointCompletionType
.All :
28
{
29
group.GetAgents(agents);
30
foreach
(AIAgent a: agents)
31
{
32
ChimeraCharacter
character =
ChimeraCharacter
.Cast(a.GetControlledEntity());
33
if
(!character)
34
continue
;
35
CompartmentAccessComponent acc = character.GetCompartmentAccessComponent();
36
if
(!acc)
37
continue
;
38
BaseCompartmentSlot
slot = acc.GetCompartment();
39
if
(slot &&
IsCompartmentAllowedToLeave
(slot, allowance))
40
return
false
;
41
}
42
return
true
;
43
}
44
case
EAIWaypointCompletionType
.Leader :
45
{
46
ChimeraCharacter
character =
ChimeraCharacter
.Cast(group.GetLeaderEntity());
47
if
(!character)
48
return
false
;
49
CompartmentAccessComponent acc = character.GetCompartmentAccessComponent();
50
if
(!acc)
51
return
false
;
52
BaseCompartmentSlot
slot = acc.GetCompartment();
53
if
(!slot)
54
return
true
;
55
return
!
IsCompartmentAllowedToLeave
(slot, allowance);
// leader is not allowed to leave compartment --> condition is true
56
}
57
case
EAIWaypointCompletionType
.Any :
58
{
59
group.GetAgents(agents);
60
foreach
(AIAgent a: agents)
61
{
62
ChimeraCharacter
character =
ChimeraCharacter
.Cast(a.GetControlledEntity());
63
if
(!character)
64
continue
;
65
if
(!character.IsInVehicle())
66
return
true
;
67
}
68
return
false
;
69
}
70
}
71
return
false
;
72
}
73
74
//---------------------------------------------------------------------------------------------------
75
protected
bool
IsCompartmentAllowedToLeave
(notnull
BaseCompartmentSlot
slot,
SCR_AIBoardingParameters
allowance)
76
{
77
if
(!allowance)
78
return
true
;
79
else
if
(
PilotCompartmentSlot
.Cast(slot) && allowance.m_bIsDriverAllowed)
80
return
true
;
81
else
if
(
TurretCompartmentSlot
.Cast(slot) && allowance.m_bIsGunnerAllowed)
82
return
true
;
83
else
if
(
CargoCompartmentSlot
.Cast(slot) && allowance.m_bIsCargoAllowed)
84
return
true
;
85
return
false
;
86
}
87
};
BaseCompartmentSlot
Definition
BaseCompartmentSlot.c:2
CargoCompartmentSlot
Definition
CargoCompartmentSlot.c:13
ChimeraCharacter
Definition
ChimeraCharacter.c:13
Debug
Definition
Debug.c:13
DecoratorTestScripted
Definition
DecoratorTestScripted.c:13
IEntity
Definition
IEntity.c:13
PilotCompartmentSlot
Definition
PilotCompartmentSlot.c:13
SCR_AIBoardingParameters
Definition
SCR_BoardingWaypoint.c:6
SCR_AIDecoTestIsOutVehicleCondition
Definition
SCR_AIDecoTestIsOutVehicleCondition.c:2
SCR_AIDecoTestIsOutVehicleCondition::TestFunction
override bool TestFunction(AIAgent agent, IEntity controlled)
Definition
SCR_AIDecoTestIsOutVehicleCondition.c:4
SCR_AIDecoTestIsOutVehicleCondition::IsCompartmentAllowedToLeave
bool IsCompartmentAllowedToLeave(notnull BaseCompartmentSlot slot, SCR_AIBoardingParameters allowance)
Definition
SCR_AIDecoTestIsOutVehicleCondition.c:75
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_BoardingWaypoint
Definition
SCR_BoardingWaypoint.c:48
TurretCompartmentSlot
Definition
TurretCompartmentSlot.c:13
EAIWaypointCompletionType
EAIWaypointCompletionType
Definition
EAIWaypointCompletionType.c:13
scripts
Game
AI
ScriptedNodes
Vehicles
SCR_AIDecoTestIsOutVehicleCondition.c
Generated by
1.17.0