Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
optics.c
Go to the documentation of this file.
1//class Crossbow_RedpointOptic : ItemOptics {}; //! Unused?!
9
11{
12 override bool IsUsableWithNV()
13 {
14 return true;
15 }
16}
17
18class M4_T3NRDSOptic : ItemOptics
19{
20 override bool IsUsableWithNV()
21 {
22 return true;
23 }
24}
25
27{
28 override bool IsUsableWithNV()
29 {
30 return true;
31 }
32}
33
34class ReflexOptic : ItemOptics
35{
36 override bool IsUsableWithNV()
37 {
38 return true;
39 }
40}
41
43{
44 override bool IsSightOnly()
45 {
46 return true;
47 }
48}
49
50class KazuarOptic: ItemOptics
51{
52 override void InitOpticMode() //TODO - decide whether to randomize on spawn and how to determine it (attachment etc.)
57 }
58
59 override int GetCurrentNVType()
60 {
61 if (IsWorking())
62 {
63 switch (m_CurrentOpticMode)
64 {
66 return NVTypes.NV_OPTICS_KAZUAR_DAY;
67
69 return NVTypes.NV_OPTICS_KAZUAR_NIGHT;
70 }
71 Error("Undefined optic mode of " + this);
72 return NVTypes.NONE;
73 }
74 else
75 {
76 return NVTypes.NV_OPTICS_OFF;
77 }
78 }
79
80 override void OnOpticModeChange()
81 {
82 super.OnOpticModeChange();
83
85 }
86
87 override void OnOpticEnter()
88 {
89 super.OnOpticEnter();
90
91 HideSelection("hide_cover_pilot");
92 }
93
95 {
96 super.UpdateSelectionVisibility();
97
98 switch (GetCurrentOpticMode())
99 {
101 HideSelection("hide_cover");
102 HideSelection("hide_cover_pilot");
103 break;
104
106 ShowSelection("hide_cover");
107 if ( !g_Game.IsDedicatedServer() && !IsInOptics() ) //quick sanity check, just in case
108 {
109 ShowSelection("hide_cover_pilot");
110 }
111 break;
112 }
113 }
114
115 override void SetActions()
116 {
117 super.SetActions();
118
120 }
121};
122
124{
125 override void InitOpticMode() //TODO - decide whether to randomize on spawn and how to determine it (attachment etc.)
126 {
127 super.InitOpticMode();
128
130 }
131
132 override int GetCurrentNVType()
133 {
134 if (IsWorking())
135 {
136 switch (m_CurrentOpticMode)
137 {
139 return NVTypes.NV_OPTICS_STARLIGHT_DAY;
140
142 return NVTypes.NV_OPTICS_STARLIGHT_NIGHT;
143 }
144 Error("Undefined optic mode of " + this);
145 return NVTypes.NONE;
146 }
147 else
148 {
149 return NVTypes.NV_OPTICS_OFF;
150 }
151 }
152
153 override void OnOpticModeChange()
154 {
155 super.OnOpticModeChange();
156
158 }
159
160 override void OnOpticEnter()
161 {
162 super.OnOpticEnter();
163
164 HideSelection("hide_cover_pilot");
165 }
166
168 {
169 super.UpdateSelectionVisibility();
170
171 switch (GetCurrentOpticMode())
172 {
174 HideSelection("hide_cover");
175 HideSelection("hide_cover_pilot");
176 break;
177
179 ShowSelection("hide_cover");
180 if ( !g_Game.IsDedicatedServer() && !IsInOptics() ) //quick sanity check, just in case
181 {
182 ShowSelection("hide_cover_pilot");
183 }
184 break;
185 }
186 }
187
188 override void SetActions()
189 {
190 super.SetActions();
191
193 }
194}
195
196class MK4Optic_ColorBase : ItemOptics {};
197class MK4Optic_Tan : MK4Optic_ColorBase {};
198class MK4Optic_Black : MK4Optic_ColorBase {};
199class MK4Optic_Green : MK4Optic_ColorBase {};
void AddAction(typename actionName)
override bool IsUsableWithNV()
Definition optics.c:28
void UpdateSelectionVisibility()
Definition itemoptics.c:587
int GetCurrentNVType()
Definition itemoptics.c:497
void ItemOptics()
Definition itemoptics.c:19
void InitOpticMode()
Definition itemoptics.c:582
void OnOpticEnter()
Definition itemoptics.c:533
override void HideSelection(string selection_name)
bool IsWorking()
Definition itemoptics.c:239
bool IsUsableWithNV()
Definition itemoptics.c:218
int m_CurrentOpticMode
Definition itemoptics.c:7
override void ShowSelection(string selection_name)
proto native bool IsInOptics()
is weapon in optics mode or not
void SetCurrentOpticMode(int mode)
Definition itemoptics.c:520
int GetCurrentOpticMode()
Definition itemoptics.c:526
void OnOpticModeChange()
optic-specific behaviour to be defined here (override)
Definition itemoptics.c:532
override void SetActions()
Definition itemoptics.c:589
override bool IsSightOnly()
Definition optics.c:44
override bool IsUsableWithNV()
Definition optics.c:12
Not ready yet.
Definition optics.c:3
override void OnOpticModeChange()
Definition optics.c:153
override void OnOpticEnter()
Definition optics.c:160
override int GetCurrentNVType()
Definition optics.c:132
override void InitOpticMode()
Definition optics.c:125
override void SetActions()
Definition optics.c:188
override void UpdateSelectionVisibility()
Definition optics.c:167
DayZGame g_Game
Definition dayzgame.c:3942
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
const int OPTICS_STATE_NIGHTVISION
Definition constants.c:911
const int OPTICS_STATE_DAY
Definition constants.c:910