Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AIDangerReaction_PhysicsContact.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_AIDangerReaction_PhysicsContact
:
SCR_AIDangerReaction
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
}
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
AIDangerEvent
Event which gets broadcasted from danger-causing places to AI.
Definition
AIDangerEvent.c:14
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetOrigin
proto external vector GetOrigin()
IEntity::GetPhysics
proto external Physics GetPhysics()
Physics
Definition
Physics.c:22
SCR_AIAvoidCharacterBehavior
Definition
SCR_AIAvoidCharacterBehavior.c:2
SCR_AIDangerReaction_PhysicsContact
Definition
SCR_AIDangerReaction_PhysicsContact.c:3
SCR_AIDangerReaction
Definition
SCR_AIDangerReaction.c:5
SCR_AIInfoComponent
Definition
SCR_AIInfoComponent.c:46
SCR_AIInfoComponent::HasUnitState
bool HasUnitState(EUnitState state)
Definition
SCR_AIInfoComponent.c:261
SCR_AIThreatSystem
Definition
SCR_AIThreatSystem.c:18
vector
Definition
vector.c:13
ECharacterLifeState
ECharacterLifeState
Definition
ECharacterLifeState.c:13
scripts
Game
AI
Reaction
Danger
SCR_AIDangerReaction_PhysicsContact.c
Generated by
1.17.0