Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
optics.c
Go to the documentation of this file.
9
11{
12 override bool IsSightOnly()
13 {
14 return true;
15 }
16}
17
18class M4_T3NRDSOptic : ItemOptics
19{
20 override bool IsSightOnly()
21 {
22 return true;
23 }
24}
25
27{
28 override bool IsSightOnly()
29 {
30 return true;
31 }
32}
33
34class ReflexOptic : ItemOptics
35{
36 override bool IsSightOnly()
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.)
53 {
54 super.InitOpticMode();
55
56 SetCurrentOpticMode(GameConstants.OPTICS_STATE_NIGHTVISION);
57 }
58
59 override int GetCurrentNVType()
60 {
61 if (IsWorking())
62 {
63 switch (m_CurrentOpticMode)
64 {
65 case GameConstants.OPTICS_STATE_DAY:
66 return NVTypes.NV_OPTICS_KAZUAR_DAY;
67
68 case GameConstants.OPTICS_STATE_NIGHTVISION:
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 {
100 case GameConstants.OPTICS_STATE_NIGHTVISION:
101 HideSelection("hide_cover");
102 HideSelection("hide_cover_pilot");
103 break;
104
105 case GameConstants.OPTICS_STATE_DAY:
106 ShowSelection("hide_cover");
107 if ( !GetGame().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
129 SetCurrentOpticMode(GameConstants.OPTICS_STATE_NIGHTVISION);
130 }
131
132 override int GetCurrentNVType()
133 {
134 if (IsWorking())
135 {
136 switch (m_CurrentOpticMode)
137 {
138 case GameConstants.OPTICS_STATE_DAY:
139 return NVTypes.NV_OPTICS_STARLIGHT_DAY;
140
141 case GameConstants.OPTICS_STATE_NIGHTVISION:
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
157 UpdateSelectionVisibility();
158 }
159
160 override void OnOpticEnter()
161 {
162 super.OnOpticEnter();
163
164 HideSelection("hide_cover_pilot");
165 }
166
167 override void UpdateSelectionVisibility()
168 {
169 super.UpdateSelectionVisibility();
170
171 switch (GetCurrentOpticMode())
172 {
173 case GameConstants.OPTICS_STATE_NIGHTVISION:
174 HideSelection("hide_cover");
175 HideSelection("hide_cover_pilot");
176 break;
177
178 case GameConstants.OPTICS_STATE_DAY:
179 ShowSelection("hide_cover");
180 if ( !GetGame().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)
void OnOpticModeChange()
optic-specific behaviour to be defined here (override)
Definition itemoptics.c:527
void InitOpticMode()
Definition itemoptics.c:577
int GetCurrentOpticMode()
Definition itemoptics.c:521
bool IsWorking()
Definition itemoptics.c:234
int GetCurrentNVType()
Definition itemoptics.c:492
void OnOpticEnter()
Definition itemoptics.c:528
void UpdateSelectionVisibility()
Definition itemoptics.c:582
bool IsSightOnly()
Definition itemoptics.c:213
override void SetActions()
Definition itemoptics.c:584
void SetCurrentOpticMode(int mode)
Definition itemoptics.c:515
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition endebug.c:90