Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDangerReaction_Explosion.c
Go to the documentation of this file.
3{
4 private static const float EXPLOSION_OBSERVE_DISTANCE = 220; // Maximal distance from explosion to trigger observe behavior
5
6 //------------------------------------------------------------------------------------------------
7 override bool PerformReaction(notnull SCR_AIUtilityComponent utility, notnull SCR_AIThreatSystem threatSystem, AIDangerEvent dangerEvent, int dangerEventCount)
8 {
9 IEntity ownerEntity = utility.m_OwnerEntity;
10
11 if (!ownerEntity)
12 return false;
13
14 vector position = dangerEvent.GetPosition();
15 float distance = vector.Distance(ownerEntity.GetOrigin(), position);
16
17 if (distance > SCR_AIThreatSystem.EXPLOSION_MAX_DISTANCE)
18 return false;
19
20 // Ignore if friendly
21 IEntity instigatorRoot = dangerEvent.GetObject();
22 if (instigatorRoot)
23 {
24 instigatorRoot = instigatorRoot.GetRootParent();
25 bool isMilitary = utility.IsMilitary();
26 SCR_ChimeraAIAgent agent = SCR_ChimeraAIAgent.Cast(utility.GetOwner());
27 if (isMilitary && (!agent || !agent.IsPerceivedEnemy(instigatorRoot)))
28 return false;
29 }
30
31 // Increase threat level
32 threatSystem.ThreatExplosion(distance);
33 utility.m_SectorThreatFilter.OnExplosion(position);
34
35 return true;
36 }
37};
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
float distance
vector position
Event which gets broadcasted from danger-causing places to AI.
proto external vector GetOrigin()
proto external IEntity GetRootParent()
bool IsPerceivedEnemy(IEntity entity)
Checks if this agent perceives the entity as enemy.