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_ToggleSafetyUserAction.c
Go to the documentation of this file.
1
class
SCR_ToggleSafetyUserAction
:
SCR_InspectionUserAction
2
{
3
[
Attribute
(
"0"
,
UIWidgets
.ComboBox,
""
,
""
, ParamEnumArray.FromEnum(
EMuzzleType
))]
4
protected
EMuzzleType
m_eMuzzleType
;
5
6
protected
WeaponAttachmentsStorageComponent
m_AttachmentStorage
;
7
8
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
9
{
10
CharacterControllerComponent charComp = CharacterControllerComponent.Cast(pUserEntity.
FindComponent
(CharacterControllerComponent));
11
charComp.SetSafety(!
IsSafetyOn
(),
false
);
12
}
13
14
override
bool
CanBeShownScript
(
IEntity
user)
15
{
16
if
(!
m_WeaponComponent
)
17
{
18
if
(
m_AttachmentStorage
)
19
{
20
InventoryStorageSlot
slot =
m_AttachmentStorage
.GetParentSlot();
21
if
(!slot)
22
return
false
;
23
24
IEntity
weapon =
m_AttachmentStorage
.GetParentSlot().GetOwner();
25
if
(weapon)
26
m_WeaponComponent
=
WeaponComponent
.Cast(weapon.
FindComponent
(
WeaponComponent
));
27
}
28
29
return
false
;
30
}
31
32
if
(
m_WeaponComponent
.GetCurrentMuzzle() ==
NULL
)
33
return
false
;
34
if
(
m_WeaponComponent
.GetCurrentMuzzle().GetMuzzleType() !=
m_eMuzzleType
)
35
return
false
;
36
37
CharacterControllerComponent charComp = CharacterControllerComponent.Cast(user.
FindComponent
(CharacterControllerComponent));
38
return
(charComp && charComp.GetInspect());
39
}
40
41
bool
IsSafetyOn
()
42
{
43
BaseMuzzleComponent
muzzle =
m_WeaponComponent
.GetCurrentMuzzle();
44
return
(muzzle.GetCurrentFireMode().GetFiremodeType() ==
EWeaponFiremodeType
.Safety);
45
}
46
47
override
bool
GetActionNameScript
(out
string
outName)
48
{
49
if
(
IsSafetyOn
())
50
{
51
outName =
WidgetManager
.Translate(
"#AR-Keybind_WeaponSafety (%1)"
,
"#AR-UserAction_State_On-UC"
);
52
}
53
else
54
{
55
outName =
WidgetManager
.Translate(
"#AR-Keybind_WeaponSafety (%1)"
,
"#AR-UserAction_State_Off-UC"
);
56
}
57
return
true
;
58
}
59
60
override
void
Init
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
61
{
62
if
(
m_eMuzzleType
==
EMuzzleType
.MT_BaseMuzzle)
63
{
64
m_WeaponComponent
=
WeaponComponent
.Cast(pOwnerEntity.
FindComponent
(
WeaponComponent
));
65
}
66
else
if
(
m_eMuzzleType
==
EMuzzleType
.MT_UGLMuzzle)
67
{
68
// not ideal, but we cannot get parent slot in init and have to retrieve it later
69
m_AttachmentStorage
= WeaponAttachmentsStorageComponent.Cast(pOwnerEntity.
FindComponent
(WeaponAttachmentsStorageComponent));
70
}
71
}
72
};
BaseMuzzleComponent
Definition
BaseMuzzleComponent.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
InventoryStorageSlot
Definition
InventoryStorageSlot.c:13
SCR_InspectionUserAction
Definition
SCR_InspectionUserAction.c:2
SCR_InspectionUserAction::m_WeaponComponent
BaseWeaponComponent m_WeaponComponent
Definition
SCR_InspectionUserAction.c:3
SCR_ToggleSafetyUserAction
Definition
SCR_ToggleSafetyUserAction.c:2
SCR_ToggleSafetyUserAction::m_AttachmentStorage
WeaponAttachmentsStorageComponent m_AttachmentStorage
Definition
SCR_ToggleSafetyUserAction.c:6
SCR_ToggleSafetyUserAction::GetActionNameScript
override bool GetActionNameScript(out string outName)
Definition
SCR_ToggleSafetyUserAction.c:47
SCR_ToggleSafetyUserAction::IsSafetyOn
bool IsSafetyOn()
Definition
SCR_ToggleSafetyUserAction.c:41
SCR_ToggleSafetyUserAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_ToggleSafetyUserAction.c:14
SCR_ToggleSafetyUserAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_ToggleSafetyUserAction.c:8
SCR_ToggleSafetyUserAction::Init
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Definition
SCR_ToggleSafetyUserAction.c:60
SCR_ToggleSafetyUserAction::m_eMuzzleType
EMuzzleType m_eMuzzleType
Definition
SCR_ToggleSafetyUserAction.c:4
UIWidgets
Definition
attributes.c:40
WeaponComponent
Definition
WeaponComponent.c:13
WidgetManager
Definition
WidgetManager.c:16
NULL
@ NULL
Unknown type.
Definition
DataVarType.c:21
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EWeaponFiremodeType
EWeaponFiremodeType
Definition
EWeaponFiremodeType.c:13
EMuzzleType
EMuzzleType
Definition
EMuzzleType.c:13
scripts
Game
UserActions
Inspection
SCR_ToggleSafetyUserAction.c
Generated by
1.17.0