Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDangerReaction_PhysicsContact.c
Go to the documentation of this file.
3{
4 override bool PerformReaction(notnull SCR_AIUtilityComponent utility, notnull SCR_AIThreatSystem threatSystem, AIDangerEvent dangerEvent, int dangerEventCount)
5 {
6 IEntity target = dangerEvent.GetObject();
7
8 if (!target)
9 return true;
10
11 // Ignore if we are in vehicle, we can't do anything
12 SCR_AIInfoComponent infoComp = utility.m_AIInfo;
13 if (infoComp)
14 {
15 if (infoComp.HasUnitState(EUnitState.IN_VEHICLE) || infoComp.HasUnitState(EUnitState.IN_TURRET))
16 return true;
17 }
18
19 // Ignore non characters
20 CharacterControllerComponent targetCharacterController = CharacterControllerComponent.Cast(target.FindComponent(CharacterControllerComponent));
21 if (!targetCharacterController)
22 return true;
23
24 // Ignore unconscious and dead
25 if (targetCharacterController.GetLifeState() != ECharacterLifeState.ALIVE)
26 return true;
27
28 // Ignore if it's another AI who is activated. We only care about players colliding into us.
29 AIControlComponent targetAiControlComp = AIControlComponent.Cast(target.FindComponent(AIControlComponent));
30 if (targetAiControlComp && targetAiControlComp.IsAIActivated())
31 return true;
32
33 if (utility.HasActionOfType(SCR_AIAvoidCharacterBehavior))
34 return true;
35
36 vector targetVelocity = vector.Zero;
37 Physics phy = target.GetPhysics();
38 if (phy)
39 targetVelocity = phy.GetVelocity();
40
41 SCR_AIAvoidCharacterBehavior action = new SCR_AIAvoidCharacterBehavior(utility, null, target.GetOrigin(), targetVelocity);
42 utility.AddAction(action);
43
44 return true;
45 }
46}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Event which gets broadcasted from danger-causing places to AI.
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external Physics GetPhysics()
bool HasUnitState(EUnitState state)
ECharacterLifeState