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_SwitchSeatUserAction.c
Go to the documentation of this file.
1
class
SCR_SwitchSeatAction
:
SCR_GetInUserAction
2
{
3
[
Attribute
(
"0"
)]
4
protected
bool
m_bPilotOnly
;
5
6
[
Attribute
(
"0"
)]
7
protected
bool
m_bCargoOnly
;
8
9
//------------------------------------------------------------------------------------------------
10
override
bool
CanBePerformedScript
(
IEntity
user)
11
{
12
ChimeraCharacter
character =
ChimeraCharacter
.Cast(user);
13
if
(!character && !character.IsInVehicle())
14
return
false
;
15
16
CharacterControllerComponent characterController = character.GetCharacterController();
17
if
(!characterController)
18
return
false
;
19
20
CompartmentAccessComponent compartmentAccess = character.GetCompartmentAccessComponent();
21
if
(!compartmentAccess)
22
return
false
;
23
24
if
(compartmentAccess.IsSwitchingSeatsAnim())
25
return
false
;
26
27
BaseCompartmentSlot
characterCompartment = compartmentAccess.GetCompartment();
28
if
(!characterCompartment)
29
return
false
;
30
31
BaseCompartmentSlot
compartment = GetCompartmentSlot();
32
if
(!compartment)
33
return
false
;
34
35
if
(characterCompartment == compartment)
36
return
false
;
37
38
// Restrict switching to this compartment in case the section does not match
39
if
(characterCompartment.
GetCompartmentSection
() != compartment.
GetCompartmentSection
())
40
return
false
;
41
42
auto
commandHandler = character.GetAnimationComponent().GetCommandHandler();
43
if
(commandHandler && commandHandler.IsVehicleSwitchingSeats())
44
return
false
;
45
46
// Prevents switching seats within different vehicles,
47
if
(characterCompartment.GetOwner().GetRootParent() !=
GetOwner
().GetRootParent())
48
return
false
;
49
50
// Check if the position isn't locked
51
if
(
m_pLockComp
&&
m_pLockComp
.IsLocked(user, compartment))
52
{
53
SetCannotPerformReason
(
m_pLockComp
.GetCannotPerformReason(user));
54
return
false
;
55
}
56
57
return
true
;
58
}
59
60
//------------------------------------------------------------------------------------------------
61
override
bool
CanBeShownScript
(
IEntity
user)
62
{
63
if
(!user)
64
return
false
;
65
66
BaseCompartmentSlot
compartment = GetCompartmentSlot();
67
if
(!compartment)
68
return
false
;
69
70
if
(compartment.GetOccupant())
71
return
false
;
72
73
ChimeraCharacter
character =
ChimeraCharacter
.Cast(user);
74
if
(!character && !character.IsInVehicle())
75
return
false
;
76
77
CompartmentAccessComponent compartmentAccess = character.GetCompartmentAccessComponent();
78
if
(!compartmentAccess)
79
return
false
;
80
81
if
(compartmentAccess.IsGettingIn() || compartmentAccess.IsGettingOut())
82
return
false
;
83
84
BaseCompartmentSlot
characterCompartment = compartmentAccess.GetCompartment();
85
if
(!characterCompartment)
86
return
false
;
87
88
if
(characterCompartment == compartment)
89
return
false
;
90
91
// Restrict switching to this compartment in case the section does not match
92
if
(characterCompartment.
GetCompartmentSection
() != compartment.
GetCompartmentSection
())
93
return
false
;
94
95
auto
commandHandler = character.GetAnimationComponent().GetCommandHandler();
96
if
(commandHandler && commandHandler.IsVehicleSwitchingSeats())
97
return
false
;
98
99
// Prevents switching seats within different vehicles,
100
if
(characterCompartment.GetOwner().GetRootParent() !=
GetOwner
().GetRootParent())
101
return
false
;
102
104
auto
vehicleController = VehicleControllerComponent.Cast(characterCompartment.GetController());
105
if
(vehicleController && !vehicleController.CanSwitchSeat())
106
return
false
;
107
108
if
(
m_bPilotOnly
)
109
{
110
// Check if the Compartment the player is in, is part of the Vehicle and not a sub compartment
111
if
(characterCompartment.GetOwner() != characterCompartment.GetOwner().GetRootParent())
112
return
false
;
113
}
114
115
if
(
m_bCargoOnly
)
116
{
117
// Check if the Compartment the player is in, is not the main Compartment of the Vehicle but a sub compartment
118
if
(characterCompartment.GetOwner() == characterCompartment.GetOwner().GetRootParent())
119
return
false
;
120
}
121
122
return
true
;
123
}
124
}
BaseCompartmentSlot
Definition
BaseCompartmentSlot.c:2
BaseCompartmentSlot::GetCompartmentSection
int GetCompartmentSection()
Switching seats is allowed only between compartments with matching area.
Definition
BaseCompartmentSlot.c:65
BaseUserAction::SetCannotPerformReason
void SetCannotPerformReason(string reason)
Definition
BaseUserAction.c:21
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
SCR_GetInUserAction
Definition
SCR_GetInUserAction.c:2
SCR_GetInUserAction::m_pLockComp
SCR_BaseLockComponent m_pLockComp
Definition
SCR_GetInUserAction.c:5
SCR_SwitchSeatAction
Definition
SCR_SwitchSeatUserAction.c:2
SCR_SwitchSeatAction::m_bPilotOnly
bool m_bPilotOnly
Definition
SCR_SwitchSeatUserAction.c:4
SCR_SwitchSeatAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_SwitchSeatUserAction.c:61
SCR_SwitchSeatAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_SwitchSeatUserAction.c:10
SCR_SwitchSeatAction::m_bCargoOnly
bool m_bCargoOnly
Definition
SCR_SwitchSeatUserAction.c:7
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UserActions
SCR_SwitchSeatUserAction.c
Generated by
1.17.0