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_DecoTestVehicleIsMoving.c
Go to the documentation of this file.
1
class
SCR_AIDecoTestVehicleIsMoving
:
DecoratorTestScripted
2
{
3
protected
const
float
MIN_SPEED_MPS
= 0.5;
4
protected
const
float
MIN_SPEED_RADS
= 0.5;
5
protected
BaseVehicle
m_vehicle
;
6
protected
VehicleHelicopterSimulation
m_heliSimulation
;
7
8
protected
override
bool
TestFunction
(AIAgent agent,
IEntity
controlled)
9
{
10
if
(!controlled)
11
return
false
;
12
13
// Iterate parents of entity until we find first Vehicle entity
14
IEntity
parent = controlled;
15
BaseVehicle
vehicle =
BaseVehicle
.Cast(controlled);
16
bool
isMoving, isRotating, isInAir;
17
18
while
(vehicle == null && parent != null)
19
{
20
parent = parent.
GetParent
();
21
if
(parent)
22
vehicle =
BaseVehicle
.Cast(parent);
23
}
24
25
if
(!vehicle)
26
return
false
;
27
28
if
(
m_vehicle
!= vehicle)
29
{
30
m_vehicle
= vehicle;
31
m_heliSimulation
=
VehicleHelicopterSimulation
.Cast(vehicle.FindComponent(
VehicleHelicopterSimulation
));
32
}
33
34
Physics
ph =
m_vehicle
.GetPhysics();
35
if
(!ph || !ph.IsActive())
36
return
false
;
37
38
isMoving = ph.GetVelocity().Length() >
MIN_SPEED_MPS
;
39
isRotating = ph.GetAngularVelocity().Length() >
MIN_SPEED_RADS
;
40
41
if
(
m_heliSimulation
)
42
{
43
vector
positionActual;
44
positionActual = vehicle.GetOrigin();
45
isInAir = !
m_heliSimulation
.HasAnyGroundContact();
46
return
isInAir || isMoving || isRotating;
47
}
48
return
isMoving || isRotating;
49
}
50
};
BaseVehicle
Definition
BaseVehicle.c:13
DecoratorTestScripted
Definition
DecoratorTestScripted.c:13
IEntity
Definition
IEntity.c:13
IEntity::GetParent
proto external IEntity GetParent()
Physics
Definition
Physics.c:22
SCR_AIDecoTestVehicleIsMoving
Definition
SCR_DecoTestVehicleIsMoving.c:2
SCR_AIDecoTestVehicleIsMoving::MIN_SPEED_RADS
const float MIN_SPEED_RADS
Definition
SCR_DecoTestVehicleIsMoving.c:4
SCR_AIDecoTestVehicleIsMoving::MIN_SPEED_MPS
const float MIN_SPEED_MPS
Definition
SCR_DecoTestVehicleIsMoving.c:3
SCR_AIDecoTestVehicleIsMoving::TestFunction
override bool TestFunction(AIAgent agent, IEntity controlled)
Definition
SCR_DecoTestVehicleIsMoving.c:8
SCR_AIDecoTestVehicleIsMoving::m_vehicle
BaseVehicle m_vehicle
Definition
SCR_DecoTestVehicleIsMoving.c:5
SCR_AIDecoTestVehicleIsMoving::m_heliSimulation
VehicleHelicopterSimulation m_heliSimulation
Definition
SCR_DecoTestVehicleIsMoving.c:6
VehicleHelicopterSimulation
Definition
VehicleHelicopterSimulation.c:13
vector
Definition
vector.c:13
scripts
Game
AI
ScriptedNodes
Vehicles
SCR_DecoTestVehicleIsMoving.c
Generated by
1.17.0