8 protected override bool TestFunction(AIAgent agent, IEntity controlled)
13 array<IEntity> vehicles = {};
14 array<AIAgent> agents = {};
15 group.GetUsableVehicles(vehicles);
16 if (vehicles.IsEmpty())
18 int agentsCount = group.GetAgents(agents);
22 foreach (AIAgent ag: agents)
24 IEntity agentEntity = ag.GetControlledEntity();
27 IEntity vehicleOfAgent = CompartmentAccessComponent.GetVehicleIn(agentEntity);
28 if (vehicles.Find(vehicleOfAgent) < 0)
31 CompartmentAccessComponent compAcc = CompartmentAccessComponent.Cast(agentEntity.FindComponent(CompartmentAccessComponent));
36 vehicleToUse = vehicleOfAgent;
42 BaseCompartmentSlot compartment;
43 ref array<BaseCompartmentSlot> compartments = {};
44 BaseCompartmentManagerComponent compMan;
48 while (!vehicles.IsEmpty() && agentsCount > 0 && vehicleToUse)
50 compMan = BaseCompartmentManagerComponent.Cast(vehicleToUse.FindComponent(BaseCompartmentManagerComponent));
53 compMan.GetCompartments(compartments);
54 foreach (BaseCompartmentSlot comp: compartments)
56 if (!comp.GetOccupant() && comp.IsCompartmentAccessible())
61 vehicles.Remove(vehicles.Find(vehicleToUse));
65 return agentsCount == 0;