Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDangerReaction_Vehicle.c
Go to the documentation of this file.
3 {
4  override bool PerformReaction(notnull SCR_AIUtilityComponent utility, notnull SCR_AIThreatSystem threatSystem, AIDangerEvent dangerEvent)
5  {
6  SCR_ChimeraAIAgent agent = SCR_ChimeraAIAgent.Cast(utility.GetOwner());
7 
8  IEntity vehicleEntity = dangerEvent.GetVictim();
9  if (!vehicleEntity)
10  return false;
11 
12  // Ignore if we already have an action to move from that vehicle
13  if (SCR_AIMoveFromDangerBehavior.ExistsBehaviorForEntity(utility, vehicleEntity))
14  return false;
15 
16  SCR_BaseCompartmentManagerComponent compManager = SCR_BaseCompartmentManagerComponent.Cast(vehicleEntity.FindComponent(SCR_BaseCompartmentManagerComponent));
17  if (!compManager)
18  return false;
19 
20  array<IEntity> occupants = {};
21  compManager.GetOccupantsOfType(occupants, ECompartmentType.Pilot);
22 
23  // Ignore if no driver or driver is friendly
24  if (occupants.Count() == 0)
25  return false;
26  if (!agent.IsEnemy(occupants[0]))
27  return false;
28 
29  // Ignore if the behavior would fail immediately after start
30  if (!SCR_AIMoveFromIncomingVehicleBehavior.ExecuteBehaviorCondition(utility, vehicleEntity))
31  return false;
32 
33  SCR_AIMoveFromDangerBehavior behavior = new SCR_AIMoveFromIncomingVehicleBehavior(utility, null, vector.Zero, dangerEntity: vehicleEntity);
34  utility.AddAction(behavior);
35 
36  return true;
37  }
38 };
SCR_AIMoveFromIncomingVehicleBehavior
void SCR_AIMoveFromIncomingVehicleBehavior(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, vector dangerPos, IEntity dangerEntity)
Definition: SCR_AIMoveFromDanger.c:168
ECompartmentType
ECompartmentType
Definition: ECompartmentType.c:7
SCR_AIDangerReaction
Definition: SCR_AIDangerReaction.c:4
SCR_ChimeraAIAgent
Definition: SCR_ChimeraAIAgent.c:5
SCR_AIMoveFromDangerBehavior
Definition: SCR_AIMoveFromDanger.c:4
SCR_AIDangerReaction_Vehicle
Definition: SCR_AIDangerReaction_Vehicle.c:2
SCR_AIThreatSystem
Definition: SCR_AIThreatSystem.c:17
SCR_AIMoveFromIncomingVehicleBehavior
Definition: SCR_AIMoveFromDanger.c:180
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468