Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDecoTestIsOutOfVehicle.c
Go to the documentation of this file.
2{
3 // this test either test group / character out of (any) vehicle or group / character out of specific vehicle given in controlled
4 // if controlled provided -> it returns TRUE if somebody is inside a different vehicle than the controlled!
5 protected override bool TestFunction(AIAgent agent, IEntity controlled)
6 {
7 bool onlySingleVehicleTest = controlled != null;
8 ChimeraCharacter character;
9 CompartmentAccessComponent compAccComp;
10
11 AIGroup gr = AIGroup.Cast(agent);
12 if (gr)
13 {
14 array<AIAgent> agents = new array<AIAgent>();
15 gr.GetAgents(agents);
16
17 foreach (AIAgent ag : agents)
18 {
19 character = ChimeraCharacter.Cast(ag.GetControlledEntity());
20 compAccComp = character.GetCompartmentAccessComponent();
21 if (!character || !compAccComp)
22 continue;
23 if (character.IsInVehicle() && onlySingleVehicleTest && compAccComp.GetVehicleIn(character) == controlled)
24 return false;
25 else if (character.IsInVehicle() && !onlySingleVehicleTest)
26 return false;
27 }
28 return true;
29 }
30 // agent is not group, we must be provided with vehicle we check
31 character = ChimeraCharacter.Cast(agent.GetControlledEntity());
32 compAccComp = character.GetCompartmentAccessComponent();
33 if (!character || !compAccComp)
34 return false;
35
36 if (onlySingleVehicleTest && compAccComp.GetVehicleIn(character) != controlled) // inside different vehicle than tested against
37 return true;
38 else if (!onlySingleVehicleTest)
39 return character.IsInVehicle();
40 return false;
41 }
42};
override bool TestFunction(AIAgent agent, IEntity controlled)