Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VehiclePilotVacancyCheck.c
Go to the documentation of this file.
2class SCR_VehiclePilotVacancyCheck : SCR_VehicleConditionCheck
3{
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 //------------------------------------------------------------------------------------------------
20
21 //------------------------------------------------------------------------------------------------
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
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 //------------------------------------------------------------------------------------------------
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 //------------------------------------------------------------------------------------------------
78 {
79 m_eConditionType = SCR_EVehicleConditionCheckType.VEHICLE_PILOT_TAKEN;
80 }
81}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_EVehicleConditionCheckType
bool CheckPilotVacancy(notnull Vehicle vehicle)
void SetIgnoredAiGroup(SCR_AIGroup aiGroup)
PilotCompartmentSlot GetPilotCompartment(notnull Vehicle vehicle)
override bool CheckCondition(Vehicle vehicle)
enum EPhysicsLayerPresets Vehicle
Definition gameLib.c:24