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_BinocularsComponent.c
Go to the documentation of this file.
1
[
EntityEditorProps
(
category
:
"GameScripted/Gadgets"
, description:
"Binoculars gadget"
, color:
"0 0 255 255"
)]
2
class
SCR_BinocularsComponentClass
:
SCR_GadgetComponentClass
3
{
4
}
5
6
class
SCR_BinocularsComponent : SCR_GadgetComponent
7
{
8
protected
static
ref
ScriptInvoker
s_OnBinocToggled
=
new
ScriptInvoker
();
9
10
protected
Widget
m_RootWidget
= null;
// binoculars layout
11
12
// Optics reference
13
protected
SCR_2DOpticsComponent
m_Optic
;
14
15
//------------------------------------------------------------------------------------------------
17
protected
void
SetZoomedViewPlayer
(
bool
value)
18
{
19
SCR_PlayerController
.s_pLocalPlayerController.SetIsBinocularsZoomed(value);
20
}
21
22
//------------------------------------------------------------------------------------------------
25
private
void
SetZoomedView(
bool
state)
26
{
27
// Check for optics
28
if
(!
m_Optic
)
29
m_Optic
= SCR_2DOpticsComponent.Cast(
GetOwner
().FindComponent(SCR_2DOpticsComponent));
30
31
if
(!
m_Optic
)
32
{
33
Print
(
"Optic component in binoculars was not found!"
,
LogLevel
.ERROR);
34
return
;
35
}
36
37
// Activate optics
38
if
(state)
39
m_Optic
.
OnSightADSActivated
();
40
else
41
m_Optic
.
OnSightADSDeactivated
();
42
43
SetZoomedViewPlayer
(state);
44
45
// Invoke use
46
if
(
GetOwner
().
GetParent
() == SCR_PlayerController.GetLocalControlledEntity())
47
s_OnBinocToggled
.Invoke(state);
48
}
49
50
//------------------------------------------------------------------------------------------------
51
override
void
ModeSwitch
(EGadgetMode mode,
IEntity
charOwner)
52
{
53
super.ModeSwitch(mode, charOwner);
54
}
55
56
//------------------------------------------------------------------------------------------------
57
override
void
ModeClear
(EGadgetMode mode)
58
{
59
// not current player
60
IEntity
controlledEnt = SCR_PlayerController.GetLocalControlledEntity();
61
if
( !controlledEnt || controlledEnt !=
m_CharacterOwner
)
62
{
63
super.ModeClear(mode);
64
return
;
65
}
66
67
if
(m_iMode == EGadgetMode.IN_HAND && SCR_PlayerController.s_pLocalPlayerController && SCR_PlayerController.s_pLocalPlayerController.GetIsBinocularsZoomed())
68
ToggleFocused(
false
);
69
70
super.ModeClear(mode);
71
}
72
73
//------------------------------------------------------------------------------------------------
74
override
void
ToggleFocused(
bool
enable)
75
{
76
super.ToggleFocused(enable);
77
78
SetZoomedView(enable);
79
}
80
81
//------------------------------------------------------------------------------------------------
82
override
EGadgetType
GetType
()
83
{
84
return
EGadgetType.BINOCULARS;
85
}
86
87
//------------------------------------------------------------------------------------------------
88
override
bool
CanBeRaised
()
89
{
90
return
true
;
91
}
92
93
//------------------------------------------------------------------------------------------------
94
override
bool
IsUsingADSControls
()
95
{
96
return
true
;
97
}
98
99
//------------------------------------------------------------------------------------------------
100
override
bool
IsVisibleEquipped
()
101
{
102
return
true
;
103
}
104
105
//------------------------------------------------------------------------------------------------
106
// destructor
107
void
~SCR_BinocularsComponent()
108
{
109
if
(
m_RootWidget
)
110
{
111
m_RootWidget
.SetVisible(
false
);
112
delete
m_RootWidget
;
113
}
114
}
115
}
m_CharacterOwner
SCR_RplTestComponentClass m_CharacterOwner
SetZoomedViewPlayer
void SetZoomedViewPlayer(bool value)
Set whether the local character is zoomed in with the binoculars.
Definition
SCR_BinocularsComponent.c:17
m_Optic
SCR_2DOpticsComponent m_Optic
Definition
SCR_BinocularsComponent.c:13
s_OnBinocToggled
SCR_BinocularsComponentClass s_OnBinocToggled
m_RootWidget
Widget m_RootWidget
Definition
SCR_BinocularsComponent.c:10
ModeClear
void ModeClear(EGadgetMode mode)
Definition
SCR_CampaignBuildingGadgetToolComponent.c:509
ModeSwitch
override void ModeSwitch(EGadgetMode mode, IEntity charOwner)
Definition
SCR_CampaignBuildingGadgetToolComponent.c:76
GetType
override EGadgetType GetType()
Definition
SCR_CampaignBuildingGadgetToolComponent.c:60
EntityEditorProps
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Definition
SCR_CompassComponent.c:10
IsVisibleEquipped
override bool IsVisibleEquipped()
Definition
SCR_ConsumableItemComponent.c:154
CanBeRaised
override bool CanBeRaised()
Definition
SCR_DetonatorGadgetComponent.c:449
GetParent
Faction GetParent()
Definition
SCR_Faction.c:539
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
IsUsingADSControls
override bool IsUsingADSControls()
Definition
SCR_WristwatchComponent.c:183
IEntity
enum EVehicleType IEntity
SCR_2DOpticsComponent
Definition
SCR_2DOpticsComponent.c:294
SCR_2DOpticsComponent::OnSightADSActivated
override void OnSightADSActivated()
Definition
SCR_2DOpticsComponent.c:549
SCR_2DOpticsComponent::OnSightADSDeactivated
override void OnSightADSDeactivated()
Definition
SCR_2DOpticsComponent.c:557
SCR_BinocularsComponentClass
Definition
SCR_BinocularsComponent.c:3
SCR_GadgetComponentClass
Definition
SCR_GadgetComponent.c:3
SCR_PlayerController
Definition
SCR_PlayerController.c:31
Widget
Definition
Widget.c:13
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
Components
Gadgets
SCR_BinocularsComponent.c
Generated by
1.17.0