Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionviewoptics.c
Go to the documentation of this file.
1
class
ActionViewOptics
:
ActionContinuousBase
2
{
3
void
ActionViewOptics
()
4
{
5
m_CallbackClass
=
ActionRaiseAndViewCB
;
6
m_CommandUID
=
DayZPlayerConstants
.CMD_GESTUREFB_LOOKOPTICS;
7
m_CommandUIDProne
=
DayZPlayerConstants
.CMD_GESTUREFB_LOOKOPTICS;
8
9
m_Text
=
"#Look_Through"
;
10
}
11
12
override
void
CreateConditionComponents
()
13
{
14
m_ConditionItem
=
new
CCINone
();
15
m_ConditionTarget
=
new
CCTNone
();
16
}
17
18
override
bool
IsFullBody
(
PlayerBase
player)
19
{
20
return
true
;
21
}
22
23
override
bool
IsCameraLockOnPerform
()
24
{
25
return
false
;
26
}
27
28
override
bool
CanBeUsedLeaning
()
29
{
30
return
false
;
31
}
32
33
override
bool
HasProgress
()
34
{
35
return
false
;
36
}
37
38
override
bool
HasTarget
()
39
{
40
return
false
;
41
}
42
43
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item)
44
{
45
ItemOptics
optic;
46
if
(
Class
.
CastTo
(optic, item) && !optic.
IsInOptics
() && !player.IsNVGLowered())
47
{
48
return
true
;
49
}
50
return
false
;
51
}
52
53
override
bool
ActionConditionContinue
(
ActionData
action_data)
54
{
55
return
true
;
56
}
57
58
override
void
OnStartClient
(
ActionData
action_data)
59
{
60
super.OnStartClient(action_data);
61
62
g_Game
.GetMission().AddActiveInputExcludes({
"actonViewOpticExcl"
});
63
}
64
65
override
void
OnStartServer
(
ActionData
action_data)
66
{
67
super.OnStartServer(action_data);
68
69
if
(!
g_Game
.IsMultiplayer())
70
g_Game
.GetMission().AddActiveInputExcludes({
"actonViewOpticExcl"
});
71
}
72
73
override
void
OnStartAnimationLoopServer
(
ActionData
action_data)
74
{
75
ItemOptics
optic;
76
if
(
Class
.
CastTo
(optic, action_data.m_MainItem))
77
{
78
if
(!optic.
IsInOptics
())
79
{
80
EnterOptics
(optic, action_data.m_Player);
81
}
82
}
83
}
84
85
override
void
OnStartAnimationLoopClient
(
ActionData
action_data)
86
{
87
ItemOptics
optic;
88
if
(
Class
.
CastTo
(optic, action_data.m_MainItem))
89
{
90
if
(!optic.
IsInOptics
())
91
{
92
EnterOptics
(optic, action_data.m_Player);
93
}
94
}
95
}
96
97
override
void
OnEndClient
(
ActionData
action_data)
98
{
99
ItemOptics
optic;
100
if
(
Class
.
CastTo
(optic, action_data.m_MainItem) && optic.
IsInOptics
())
101
{
102
ExitOptics
(optic, action_data.m_Player);
103
}
104
g_Game
.GetMission().RemoveActiveInputExcludes({
"actonViewOpticExcl"
});
105
}
106
107
override
void
OnEndServer
(
ActionData
action_data)
108
{
109
super.OnEndServer(action_data);
110
111
ItemOptics
optic;
112
if
(
Class
.
CastTo
(optic, action_data.m_MainItem) && optic.
IsInOptics
())
113
{
114
ExitOptics
(optic, action_data.m_Player);
115
}
116
117
if
(!
g_Game
.IsMultiplayer())
118
g_Game
.GetMission().RemoveActiveInputExcludes({
"actonViewOpticExcl"
});
119
}
120
121
override
void
OnEndAnimationLoopClient
(
ActionData
action_data)
122
{
123
ItemOptics
optic;
124
if
(
Class
.
CastTo
(optic, action_data.m_MainItem))
125
{
126
ExitOptics
(optic, action_data.m_Player);
127
}
128
}
129
130
override
void
OnEndAnimationLoopServer
(
ActionData
action_data)
131
{
132
ItemOptics
optic;
133
if
(
Class
.
CastTo
(optic, action_data.m_MainItem))
134
{
135
ExitOptics
(optic, action_data.m_Player);
136
}
137
}
138
139
bool
CanWork
(
ItemBase
item)
140
{
141
if
(!item.HasEnergyManager())
142
{
143
return
true
;
144
}
145
else
if
(item.GetCompEM() && item.GetCompEM().CanWork())
146
{
147
return
true
;
148
}
149
150
return
false
;
151
}
152
153
void
EnterOptics
(
ItemOptics
optic,
PlayerBase
player)
154
{
155
player.SetIronsights(
false
);
156
player.SetHandheldOpticsInUse(
true
);
157
player.SetOptics(
true
);
158
159
optic.
EnterOptics
();
160
optic.
HideSelection
(
"hide"
);
161
162
if
(optic.HasEnergyManager())
163
optic.GetCompEM().SwitchOn();
164
165
player.GetAimingModel().SetAimNoiseAllowed(
false
);
166
}
167
168
void
ExitOptics
(
ItemOptics
optic,
PlayerBase
player)
169
{
170
player.ExitSights();
171
player.SetHandheldOpticsInUse(
false
);
172
173
optic.
ShowSelection
(
"hide"
);
174
optic.
ExitOptics
();
175
176
if
(optic.HasEnergyManager())
177
optic.GetCompEM().SwitchOff();
178
179
player.GetAimingModel().SetAimNoiseAllowed(
true
);
180
}
181
}
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionContinuousBase::ActionContinuousBase
void ActionContinuousBase()
Definition
actioncontinuousbase.c:124
ActionRaiseAndViewCB
Definition
actionviewcompass.c:2
ActionViewOptics::CanWork
bool CanWork(ItemBase item)
Definition
actionviewoptics.c:139
ActionViewOptics::OnEndAnimationLoopClient
override void OnEndAnimationLoopClient(ActionData action_data)
Definition
actionviewoptics.c:121
ActionViewOptics::CanBeUsedLeaning
override bool CanBeUsedLeaning()
Definition
actionviewoptics.c:28
ActionViewOptics::ActionConditionContinue
override bool ActionConditionContinue(ActionData action_data)
Definition
actionviewoptics.c:53
ActionViewOptics::OnEndServer
override void OnEndServer(ActionData action_data)
Definition
actionviewoptics.c:107
ActionViewOptics::ExitOptics
void ExitOptics(ItemOptics optic, PlayerBase player)
Definition
actionviewoptics.c:168
ActionViewOptics::ActionViewOptics
void ActionViewOptics()
Definition
actionviewoptics.c:3
ActionViewOptics::OnStartAnimationLoopServer
override void OnStartAnimationLoopServer(ActionData action_data)
Definition
actionviewoptics.c:73
ActionViewOptics::OnStartClient
override void OnStartClient(ActionData action_data)
Definition
actionviewoptics.c:58
ActionViewOptics::HasProgress
override bool HasProgress()
Definition
actionviewoptics.c:33
ActionViewOptics::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionviewoptics.c:12
ActionViewOptics::IsCameraLockOnPerform
override bool IsCameraLockOnPerform()
Definition
actionviewoptics.c:23
ActionViewOptics::EnterOptics
void EnterOptics(ItemOptics optic, PlayerBase player)
Definition
actionviewoptics.c:153
ActionViewOptics::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionviewoptics.c:43
ActionViewOptics::HasTarget
override bool HasTarget()
Definition
actionviewoptics.c:38
ActionViewOptics::OnEndAnimationLoopServer
override void OnEndAnimationLoopServer(ActionData action_data)
Definition
actionviewoptics.c:130
ActionViewOptics::OnEndClient
override void OnEndClient(ActionData action_data)
Definition
actionviewoptics.c:97
ActionViewOptics::IsFullBody
override bool IsFullBody(PlayerBase player)
Definition
actionviewoptics.c:18
ActionViewOptics::OnStartAnimationLoopClient
override void OnStartAnimationLoopClient(ActionData action_data)
Definition
actionviewoptics.c:85
ActionViewOptics::OnStartServer
override void OnStartServer(ActionData action_data)
Definition
actionviewoptics.c:65
AnimatedActionBase::m_CommandUIDProne
int m_CommandUIDProne
Definition
animatedactionbase.c:144
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
CCINone
Definition
ccinone.c:2
CCTNone
Definition
cctnone.c:2
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
ItemBase
Definition
inventoryitem.c:742
ItemOptics
Definition
itemoptics.c:2
ItemOptics::HideSelection
override void HideSelection(string selection_name)
Definition
huntingoptic.c:34
ItemOptics::EnterOptics
proto native bool EnterOptics()
switches to optics mode if possible
ItemOptics::ShowSelection
override void ShowSelection(string selection_name)
Definition
huntingoptic.c:44
ItemOptics::IsInOptics
proto native bool IsInOptics()
is weapon in optics mode or not
ItemOptics::ExitOptics
proto native bool ExitOptics()
switches out of optics mode (if possible)
PlayerBase
Definition
playerbaseclient.c:2
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actionviewoptics.c
Generated by
1.17.0