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_VehiclePilotVacancyCheck.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_VehiclePilotVacancyCheck
: SCR_VehicleConditionCheck
3
{
4
protected
SCR_AIGroup
m_IgnoredAiGroup
;
5
6
//------------------------------------------------------------------------------------------------
7
override
bool
CheckCondition
(
Vehicle
vehicle)
8
{
9
if
(!super.CheckCondition(vehicle))
10
return
false
;
11
12
return
CheckPilotVacancy
(vehicle);
13
}
14
15
//------------------------------------------------------------------------------------------------
16
SCR_AIGroup
GetIgnoredAiGroup
()
17
{
18
return
m_IgnoredAiGroup
;
19
}
20
21
//------------------------------------------------------------------------------------------------
22
void
SetIgnoredAiGroup
(
SCR_AIGroup
aiGroup)
23
{
24
m_IgnoredAiGroup
= aiGroup;
25
}
26
27
//------------------------------------------------------------------------------------------------
28
protected
bool
CheckPilotVacancy
(notnull
Vehicle
vehicle)
29
{
30
PilotCompartmentSlot
pilotCompartment =
GetPilotCompartment
(vehicle);
31
if
(!pilotCompartment)
32
return
true
;
33
34
if
(!
m_IgnoredAiGroup
)
35
return
!pilotCompartment.
IsOccupied
();
36
37
// If the slot is unoccupied, the condition is met.
38
if
(!pilotCompartment.
IsOccupied
())
39
return
true
;
40
41
IEntity
occupant = pilotCompartment.GetOccupant();
42
if
(!occupant)
43
return
true
;
44
45
AIAgent occupantAgent =
SCR_AIUtils
.GetAIAgent(occupant);
46
if
(!occupantAgent)
47
return
true
;
48
49
// If the occupant does not belong to the ignored group, the pilot compartment is considered occupied.
50
if
(occupantAgent.GetParentGroup() !=
m_IgnoredAiGroup
)
51
return
false
;
52
53
return
true
;
54
}
55
56
//------------------------------------------------------------------------------------------------
57
protected
PilotCompartmentSlot
GetPilotCompartment
(notnull
Vehicle
vehicle)
58
{
59
SCR_BaseCompartmentManagerComponent compartmentMan = SCR_BaseCompartmentManagerComponent.Cast(vehicle.FindComponent(SCR_BaseCompartmentManagerComponent));
60
if
(!compartmentMan)
61
return
null;
62
63
array<BaseCompartmentSlot> compartmentSlots = {};
64
compartmentMan.GetCompartments(compartmentSlots);
65
PilotCompartmentSlot
pilotComp;
66
foreach
(
BaseCompartmentSlot
slot : compartmentSlots)
67
{
68
pilotComp =
PilotCompartmentSlot
.Cast(slot);
69
if
(pilotComp)
70
return
pilotComp;
71
}
72
73
return
null;
74
}
75
76
//------------------------------------------------------------------------------------------------
77
void
SCR_VehiclePilotVacancyCheck
()
78
{
79
m_eConditionType =
SCR_EVehicleConditionCheckType
.VEHICLE_PILOT_TAKEN;
80
}
81
}
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_EVehicleConditionCheckType
SCR_EVehicleConditionCheckType
Definition
SCR_VehicleConditionCheck.c:3
BaseCompartmentSlot
Definition
BaseCompartmentSlot.c:2
BaseCompartmentSlot::IsOccupied
bool IsOccupied()
Definition
BaseCompartmentSlot.c:135
IEntity
Definition
IEntity.c:13
PilotCompartmentSlot
Definition
PilotCompartmentSlot.c:13
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_AIUtils
Definition
SCR_AIUtils.c:667
SCR_VehiclePilotVacancyCheck::CheckPilotVacancy
bool CheckPilotVacancy(notnull Vehicle vehicle)
Definition
SCR_VehiclePilotVacancyCheck.c:28
SCR_VehiclePilotVacancyCheck::SetIgnoredAiGroup
void SetIgnoredAiGroup(SCR_AIGroup aiGroup)
Definition
SCR_VehiclePilotVacancyCheck.c:22
SCR_VehiclePilotVacancyCheck::m_IgnoredAiGroup
SCR_AIGroup m_IgnoredAiGroup
Definition
SCR_VehiclePilotVacancyCheck.c:4
SCR_VehiclePilotVacancyCheck::SCR_VehiclePilotVacancyCheck
void SCR_VehiclePilotVacancyCheck()
Definition
SCR_VehiclePilotVacancyCheck.c:77
SCR_VehiclePilotVacancyCheck::GetPilotCompartment
PilotCompartmentSlot GetPilotCompartment(notnull Vehicle vehicle)
Definition
SCR_VehiclePilotVacancyCheck.c:57
SCR_VehiclePilotVacancyCheck::CheckCondition
override bool CheckCondition(Vehicle vehicle)
Definition
SCR_VehiclePilotVacancyCheck.c:7
SCR_VehiclePilotVacancyCheck::GetIgnoredAiGroup
SCR_AIGroup GetIgnoredAiGroup()
Definition
SCR_VehiclePilotVacancyCheck.c:16
Vehicle
enum EPhysicsLayerPresets Vehicle
Definition
gameLib.c:24
scripts
Game
TaskSolver
VehicleCondition
SCR_VehiclePilotVacancyCheck.c
Generated by
1.17.0