4 protected override bool TestFunction(AIAgent agent, IEntity controlled)
7 EAIWaypointCompletionType completionType;
8 AIWaypoint wp = AIWaypoint.Cast(controlled);
11 completionType = wp.GetCompletionType();
14 allowance = bwp.GetAllowance();
17 allowance.m_bIsCargoAllowed =
true;
18 allowance.m_bIsGunnerAllowed =
true;
19 allowance.m_bIsDriverAllowed =
true;
25 Debug.Error(
"Running on AIAgent that is not a SCR_AIGroup group!");
29 array<AIAgent> agents = {};
31 ref array<IEntity> vehicles = {};
32 group.GetUsableVehicles(vehicles);
34 bool noAvailableVehicles =
true;
35 foreach (IEntity vehicle: vehicles)
37 if (vehicle && VehicleHasEmptyCompartments(vehicle, allowance))
39 noAvailableVehicles =
false;
44 switch (completionType)
46 case EAIWaypointCompletionType.All :
48 group.GetAgents(agents);
49 bool completeWaypoint =
true;
50 foreach (AIAgent a: agents)
52 ChimeraCharacter character = ChimeraCharacter.Cast(a.GetControlledEntity());
53 if (character && !character.IsInVehicle())
55 if (vehicles.IsEmpty())
57 completeWaypoint = noAvailableVehicles;
61 return completeWaypoint;
63 case EAIWaypointCompletionType.Leader :
65 ChimeraCharacter character = ChimeraCharacter.Cast(group.GetLeaderEntity());
68 if (character.IsInVehicle())
70 if (vehicles.IsEmpty())
72 return noAvailableVehicles;
74 case EAIWaypointCompletionType.Any :
76 group.GetAgents(agents);
77 foreach (AIAgent a: agents)
79 ChimeraCharacter character = ChimeraCharacter.Cast(a.GetControlledEntity());
82 if (character.IsInVehicle())
84 if (vehicles.IsEmpty())
86 return noAvailableVehicles;
97 BaseCompartmentManagerComponent compComp = BaseCompartmentManagerComponent.Cast(vehicle.FindComponent(BaseCompartmentManagerComponent));
101 array<BaseCompartmentSlot> compartmentSlots = {};
102 compComp.GetCompartments(compartmentSlots);
104 foreach (BaseCompartmentSlot slot : compartmentSlots)
115 if (!slot.AttachedOccupant())