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_WeaponAction.c
Go to the documentation of this file.
1
enum
EWeaponActionType
2
{
3
Bipod
4
};
5
6
class
SCR_WeaponAction
:
ScriptedUserAction
7
{
9
[
Attribute
( uiwidget:
UIWidgets
.CheckBox, defvalue:
"1"
,
desc
:
"Should action behave as a toggle"
)]
10
protected
bool
m_bIsToggle
;
11
13
[
Attribute
( uiwidget:
UIWidgets
.CheckBox, defvalue:
"1"
,
desc
:
"Target state of the action, ignored if toggle"
)]
14
protected
bool
m_bTargetState
;
15
17
[
Attribute
( uiwidget:
UIWidgets
.Auto, defvalue:
"#AR-UserAction_State_On"
,
desc
:
"Description of action to toggle on"
)]
18
protected
string
m_sActionStateOn
;
19
21
[
Attribute
( uiwidget:
UIWidgets
.Auto, defvalue:
"#AR-UserAction_State_Off"
,
desc
:
"Description of action to toggle off"
)]
22
protected
string
m_sActionStateOff
;
23
24
[
Attribute
(
"1"
,
UIWidgets
.ComboBox,
""
,
""
, ParamEnumArray.FromEnum(
EWeaponActionType
) )]
25
protected
EWeaponActionType
m_WeaponActionType
;
26
27
protected
BaseWeaponComponent
m_Weapon
;
28
29
override
void
Init
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
30
{
31
m_Weapon
=
WeaponComponent
.Cast(pOwnerEntity.
FindComponent
(
WeaponComponent
));
32
}
33
34
//------------------------------------------------------------------------------------------------
35
override
bool
CanBeShownScript
(
IEntity
user)
36
{
37
if
(!
m_Weapon
)
38
return
false
;
39
40
ChimeraCharacter
character =
ChimeraCharacter
.Cast(user);
41
if
(!character)
42
return
false
;
43
44
CharacterControllerComponent controller = character.GetCharacterController();
45
if
(!controller)
46
return
false
;
47
48
if
(!controller.GetInspect())
49
return
false
;
50
51
if
(
m_WeaponActionType
==
EWeaponActionType
.Bipod)
52
return
m_Weapon
&&
m_Weapon
.HasBipod();
53
54
return
true
;
55
}
56
57
//------------------------------------------------------------------------------------------------
58
override
bool
CanBePerformedScript
(
IEntity
user)
59
{
60
return
m_bIsToggle
|| (
GetState
() !=
m_bTargetState
);
61
}
62
63
//------------------------------------------------------------------------------------------------
65
bool
GetState
()
66
{
67
if
(!
m_Weapon
)
68
return
false
;
69
70
if
(
m_WeaponActionType
==
EWeaponActionType
.Bipod)
71
return
m_Weapon
.GetBipod();
72
73
return
false
;
74
}
75
76
//------------------------------------------------------------------------------------------------
78
void
SetState
(
bool
enable)
79
{
80
if
(!
m_Weapon
)
81
return
;
82
83
if
(
m_WeaponActionType
==
EWeaponActionType
.Bipod)
84
m_Weapon
.SetBipod(enable);
85
}
86
87
//------------------------------------------------------------------------------------------------
89
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
90
{
91
if
(
m_bIsToggle
)
92
SetState
(!
GetState
());
93
else
94
SetState
(
m_bTargetState
);
95
}
96
97
//------------------------------------------------------------------------------------------------
98
override
bool
GetActionNameScript
(out
string
outName)
99
{
100
if
(
m_WeaponActionType
==
EWeaponActionType
.Bipod)
101
{
102
if
(
GetState
())
103
outName =
"#AR-Keybind_BipodRetract"
;
104
else
105
outName =
"#AR-Keybind_Bipod"
;
106
107
return
true
;
108
}
109
110
UIInfo
uiInfo =
GetUIInfo
();
111
string
prefix;
112
if
(uiInfo)
113
prefix = uiInfo.GetName();
114
115
if
(!prefix.IsEmpty() &&
m_bIsToggle
)
116
{
117
prefix +=
" "
;
118
if
(
GetState
())
119
outName = prefix +
m_sActionStateOff
;
120
else
121
outName = prefix +
m_sActionStateOn
;
122
}
123
else
124
outName = prefix;
125
return
true
;
126
}
127
128
//------------------------------------------------------------------------------------------------
129
override
bool
HasLocalEffectOnlyScript
()
130
{
131
return
true
;
132
}
133
};
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
EWeaponActionType
EWeaponActionType
Definition
SCR_WeaponAction.c:2
Bipod
@ Bipod
Definition
SCR_WeaponAction.c:3
BaseUserAction::GetUIInfo
proto external UIInfo GetUIInfo()
Returns the UIInfo set for this user action or null if none.
BaseWeaponComponent
Definition
BaseWeaponComponent.c:13
ChimeraCharacter
Definition
ChimeraCharacter.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_WeaponAction
Definition
SCR_WeaponAction.c:7
SCR_WeaponAction::GetState
bool GetState()
Current state of the feature.
Definition
SCR_WeaponAction.c:65
SCR_WeaponAction::m_WeaponActionType
EWeaponActionType m_WeaponActionType
Definition
SCR_WeaponAction.c:25
SCR_WeaponAction::SetState
void SetState(bool enable)
Script to change state of the feature.
Definition
SCR_WeaponAction.c:78
SCR_WeaponAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_WeaponAction.c:35
SCR_WeaponAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
By default toggle the current state of the interaction.
Definition
SCR_WeaponAction.c:89
SCR_WeaponAction::m_bTargetState
bool m_bTargetState
Target state of the action, ignored if toggle.
Definition
SCR_WeaponAction.c:14
SCR_WeaponAction::m_bIsToggle
bool m_bIsToggle
Should action behave as a toggle.
Definition
SCR_WeaponAction.c:10
SCR_WeaponAction::m_sActionStateOn
string m_sActionStateOn
Description of action to toggle on.
Definition
SCR_WeaponAction.c:18
SCR_WeaponAction::m_sActionStateOff
string m_sActionStateOff
Description of action to toggle off.
Definition
SCR_WeaponAction.c:22
SCR_WeaponAction::GetActionNameScript
override bool GetActionNameScript(out string outName)
Definition
SCR_WeaponAction.c:98
SCR_WeaponAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_WeaponAction.c:58
SCR_WeaponAction::m_Weapon
BaseWeaponComponent m_Weapon
Definition
SCR_WeaponAction.c:27
SCR_WeaponAction::HasLocalEffectOnlyScript
override bool HasLocalEffectOnlyScript()
Definition
SCR_WeaponAction.c:129
SCR_WeaponAction::Init
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Definition
SCR_WeaponAction.c:29
ScriptedUserAction
Definition
ScriptedUserAction.c:13
UIInfo
UIInfo - allows to define UI elements.
Definition
UIInfo.c:14
UIWidgets
Definition
attributes.c:40
WeaponComponent
Definition
WeaponComponent.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UserActions
SCR_WeaponAction.c
Generated by
1.17.0