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_VehicleTakeControlsAction.c
Go to the documentation of this file.
1
class
SCR_VehicleTakeControlsAction
:
SCR_VehicleActionBase
2
{
3
protected
static
const
string
CONTROLS_LOCKED
=
"#AR-UserAction_Locked"
;
4
5
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
6
{
7
ChimeraCharacter
character =
ChimeraCharacter
.Cast(pUserEntity);
8
if
(character)
9
{
10
CompartmentAccessComponent compartmentAccess = character.GetCompartmentAccessComponent();
11
BaseCompartmentSlot
compartment = compartmentAccess.GetCompartment();
12
compartmentAccess.SetActivePilotCompartment(compartment);
13
}
14
}
15
16
override
bool
CanBeShownScript
(
IEntity
user)
17
{
18
// See if character is in vehicle
19
ChimeraCharacter
character =
ChimeraCharacter
.Cast(user);
20
if
(!character)
21
return
false
;
22
23
// We cannot be pilot nor interior, if we are not seated in vehicle at all.
24
if
(!character.IsInVehicle())
25
return
!(
m_bInteriorOnly
||
m_bPilotOnly
);
26
27
// See if character is in "this" (owner) vehicle
28
CompartmentAccessComponent compartmentAccess = character.GetCompartmentAccessComponent();
29
if
(!compartmentAccess)
30
return
false
;
31
32
// Character is in compartment
33
// that belongs to owner of this action
34
BaseCompartmentSlot
slot = compartmentAccess.GetCompartment();
35
if
(!slot)
36
return
false
;
37
38
// Check if we are a pilot compartmenr
39
if
(slot.GetType() !=
ECompartmentType
.PILOT)
40
return
false
;
41
42
// Check if we are controlling the vehicle
43
if
(slot.IsPiloting())
44
return
false
;
45
46
// Check interior only condition
47
if
(
m_bInteriorOnly
&& slot.GetOwner().GetRootParent() !=
GetOwner
().GetRootParent())
48
return
false
;
49
50
// Todo: make sure we're not switching any other compartment's user action
51
52
return
true
;
53
}
54
55
override
bool
CanBePerformedScript
(
IEntity
user)
56
{
57
VehicleControllerComponent controller = VehicleControllerComponent.Cast(
m_VehicleController
);
58
if
(controller)
59
{
60
if
(controller.ArePilotControlsLocked())
61
{
62
SetCannotPerformReason
(
CONTROLS_LOCKED
);
63
return
false
;
64
}
65
}
66
67
return
true
;
68
}
69
}
ECompartmentType
ECompartmentType
Definition
ECompartmentType.c:8
BaseCompartmentSlot
Definition
BaseCompartmentSlot.c:2
BaseUserAction::SetCannotPerformReason
void SetCannotPerformReason(string reason)
Definition
BaseUserAction.c:21
BaseUserAction::GetOwner
proto external IEntity GetOwner()
Returns the parent entity of this action.
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
SCR_VehicleActionBase
Definition
SCR_VehicleActionBase.c:2
SCR_VehicleActionBase::m_bInteriorOnly
bool m_bInteriorOnly
Available only for entities seated in a vehicle.
Definition
SCR_VehicleActionBase.c:25
SCR_VehicleActionBase::m_VehicleController
CompartmentControllerComponent m_VehicleController
Definition
SCR_VehicleActionBase.c:33
SCR_VehicleActionBase::m_bPilotOnly
bool m_bPilotOnly
Available only for entities seated in pilot compartment.
Definition
SCR_VehicleActionBase.c:21
SCR_VehicleTakeControlsAction
Definition
SCR_VehicleTakeControlsAction.c:2
SCR_VehicleTakeControlsAction::CONTROLS_LOCKED
static const string CONTROLS_LOCKED
Definition
SCR_VehicleTakeControlsAction.c:3
SCR_VehicleTakeControlsAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_VehicleTakeControlsAction.c:16
SCR_VehicleTakeControlsAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_VehicleTakeControlsAction.c:55
SCR_VehicleTakeControlsAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_VehicleTakeControlsAction.c:5
scripts
Game
UserActions
SCR_VehicleTakeControlsAction.c
Generated by
1.17.0