Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDecoTestIsOutOfVehicle.c
Go to the documentation of this file.
1 class SCR_AIDecoTestIsOutOfVehicle : DecoratorTestScripted
2 {
3  CompartmentAccessComponent compAccComp;
4 
5  protected override bool TestFunction(AIAgent agent, IEntity controlled)
6  {
7  AIGroup gr = AIGroup.Cast(agent);
8  if (gr)
9  {
10  array<AIAgent> agents = new array<AIAgent>();
11  gr.GetAgents(agents);
12 
13  foreach (AIAgent ag : agents)
14  {
15  ChimeraCharacter char = ChimeraCharacter.Cast(ag.GetControlledEntity());
16  if (char)
17  {
18  if (char.IsInVehicle())
19  return false;
20  }
21  }
22  return true;
23  }
24  if (!controlled)
25  return false;
26 
27  if (!compAccComp)
28  compAccComp = CompartmentAccessComponent.Cast(controlled.FindComponent(CompartmentAccessComponent));
29  return !compAccComp.IsInCompartment();
30  }
31 };
SCR_AIDecoTestIsOutOfVehicle
Definition: SCR_AIDecoTestIsOutOfVehicle.c:1
IsInVehicle
proto external bool IsInVehicle()
Returns true if the character is inside a vehicle.