DayZ 1.24
Loading...
Searching...
No Matches
Optics.c
Go to the documentation of this file.
13
15{
16 override void InitOpticMode() //TODO - decide whether to randomize on spawn and how to determine it (attachment etc.)
17 {
18 super.InitOpticMode();
19
21 }
22
23 override int GetCurrentNVType()
24 {
25 if (IsWorking())
26 {
27 switch (m_CurrentOpticMode)
28 {
30 return NVTypes.NV_OPTICS_KAZUAR_DAY;
31
33 return NVTypes.NV_OPTICS_KAZUAR_NIGHT;
34 }
35 Error("Undefined optic mode of " + this);
36 return NVTypes.NONE;
37 }
38 else
39 return NVTypes.NV_OPTICS_OFF;
40 }
41
42 override void OnOpticModeChange()
43 {
44 super.OnOpticModeChange();
45
47 }
48
49 override void OnOpticEnter()
50 {
51 super.OnOpticEnter();
52
53 HideSelection("hide_cover_pilot");
54 }
55
57 {
58 super.UpdateSelectionVisibility();
59
60 switch (GetCurrentOpticMode())
61 {
63 HideSelection("hide_cover");
64 HideSelection("hide_cover_pilot");
65 break;
66
68 ShowSelection("hide_cover");
69 if (!GetGame().IsDedicatedServer() && !IsInOptics()) //quick sanity check, just in case
70 ShowSelection("hide_cover_pilot");
71 break;
72 }
73 }
74
75 override void SetActions()
76 {
77 super.SetActions();
78
80 }
81};
82
84{
85 override void InitOpticMode() //TODO - decide whether to randomize on spawn and how to determine it (attachment etc.)
86 {
87 super.InitOpticMode();
88
90 }
91
92 override int GetCurrentNVType()
93 {
94 if (IsWorking())
95 {
96 switch (m_CurrentOpticMode)
97 {
99 return NVTypes.NV_OPTICS_STARLIGHT_DAY;
100
102 return NVTypes.NV_OPTICS_STARLIGHT_NIGHT;
103 }
104 Error("Undefined optic mode of " + this);
105 return NVTypes.NONE;
106 }
107 else
108 return NVTypes.NV_OPTICS_OFF;
109 }
110
111 override void OnOpticModeChange()
112 {
113 super.OnOpticModeChange();
114
116 }
117
118 override void OnOpticEnter()
119 {
120 super.OnOpticEnter();
121
122 HideSelection("hide_cover_pilot");
123 }
124
126 {
127 super.UpdateSelectionVisibility();
128
129 switch (GetCurrentOpticMode())
130 {
132 HideSelection("hide_cover");
133 HideSelection("hide_cover_pilot");
134 break;
135
137 ShowSelection("hide_cover");
138 if (!GetGame().IsDedicatedServer() && !IsInOptics()) //quick sanity check, just in case
139 ShowSelection("hide_cover_pilot");
140 break;
141 }
142 }
143
144 override void SetActions()
145 {
146 super.SetActions();
147
149 }
150};
void AddAction(typename actionName)
int GetCurrentOpticMode()
Definition ItemOptics.c:433
bool IsWorking()
Definition ItemOptics.c:188
proto native bool IsInOptics()
is weapon in optics mode or not
override void ShowSelection(string selection_name)
override void HideSelection(string selection_name)
int m_CurrentOpticMode
Definition ItemOptics.c:7
void SetCurrentOpticMode(int mode)
Definition ItemOptics.c:427
override void SetActions()
Definition Optics.c:75
override int GetCurrentNVType()
Definition Optics.c:23
override void UpdateSelectionVisibility()
Definition Optics.c:56
override void InitOpticMode()
Definition Optics.c:16
override void OnOpticEnter()
Definition Optics.c:49
override void OnOpticModeChange()
Definition Optics.c:42
override void InitOpticMode()
Definition Optics.c:85
override int GetCurrentNVType()
Definition Optics.c:92
override void OnOpticEnter()
Definition Optics.c:118
override void SetActions()
Definition Optics.c:144
override void UpdateSelectionVisibility()
Definition Optics.c:125
override void OnOpticModeChange()
Definition Optics.c:111
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
const int OPTICS_STATE_DAY
Definition constants.c:800
const int OPTICS_STATE_NIGHTVISION
Definition constants.c:801