Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDangerReaction_ProjectileHit.c
Go to the documentation of this file.
3 {
4  protected static const float BULLET_IMPACT_DISTANCE_MAX_SQ = 10*10;
5 
6  override bool PerformReaction(notnull SCR_AIUtilityComponent utility, notnull SCR_AIThreatSystem threatSystem, AIDangerEvent dangerEvent)
7  {
8  float distanceSq = vector.DistanceSq(utility.GetOrigin(), dangerEvent.GetPosition());
9  if (distanceSq > BULLET_IMPACT_DISTANCE_MAX_SQ)
10  return false;
11 
12  IEntity shooter = dangerEvent.GetObject();
13 
14  if (!shooter)
15  return false;
16 
17  SCR_ChimeraAIAgent agent = SCR_ChimeraAIAgent.Cast(utility.GetOwner());
18  IEntity shooterRoot = shooter.GetRootParent();
19  if (!agent || !agent.IsEnemy(shooterRoot))
20  return false;
21 
22  vector shooterPos = shooter.GetOrigin();
23 
24  float distanceToShooter = vector.Distance(utility.GetOrigin(), shooterPos);
25 
26  if (utility.m_CombatComponent.GetCurrentTarget() == null && distanceToShooter > SCR_AICombatComponent.LONG_RANGE_FIRE_DISTANCE && shooter)
27  {
28  utility.AddAction(new SCR_AIMoveFromUnknownFire(utility, null, shooterPos, shooter));
29  //TODO: change combat type from SILENT
30  }
31 
32  threatSystem.ThreatBulletImpact(dangerEvent.GetCount());
33 
34  return true;
35  }
36 };
SCR_AIDangerReaction
Definition: SCR_AIDangerReaction.c:4
SCR_ChimeraAIAgent
Definition: SCR_ChimeraAIAgent.c:5
SCR_AIDangerReaction_ProjectileHit
Definition: SCR_AIDangerReaction_ProjectileHit.c:2
SCR_AIMoveFromUnknownFire
Definition: SCR_AIMoveFromDanger.c:46
SCR_AIThreatSystem
Definition: SCR_AIThreatSystem.c:17
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