Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
optics.c
Go to the documentation of this file.
4 class GrozaOptic : ItemOptics {};
5 class ACOGOptic : ItemOptics {};
8 class M68Optic : ItemOptics {};
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 
20  SetCurrentOpticMode(GameConstants.OPTICS_STATE_NIGHTVISION);
21  }
22 
23  override int GetCurrentNVType()
24  {
25  if (IsWorking())
26  {
27  switch (m_CurrentOpticMode)
28  {
29  case GameConstants.OPTICS_STATE_DAY:
30  return NVTypes.NV_OPTICS_KAZUAR_DAY;
31 
32  case GameConstants.OPTICS_STATE_NIGHTVISION:
33  return NVTypes.NV_OPTICS_KAZUAR_NIGHT;
34  }
35  Error("Undefined optic mode of " + this);
36  return NVTypes.NONE;
37  }
38  else
39  {
40  return NVTypes.NV_OPTICS_OFF;
41  }
42  }
43 
44  override void OnOpticModeChange()
45  {
46  super.OnOpticModeChange();
47 
48  UpdateSelectionVisibility();
49  }
50 
51  override void OnOpticEnter()
52  {
53  super.OnOpticEnter();
54 
55  HideSelection("hide_cover_pilot");
56  }
57 
58  override void UpdateSelectionVisibility()
59  {
60  super.UpdateSelectionVisibility();
61 
62  switch (GetCurrentOpticMode())
63  {
64  case GameConstants.OPTICS_STATE_NIGHTVISION:
65  HideSelection("hide_cover");
66  HideSelection("hide_cover_pilot");
67  break;
68 
69  case GameConstants.OPTICS_STATE_DAY:
70  ShowSelection("hide_cover");
71  if ( !GetGame().IsDedicatedServer() && !IsInOptics() ) //quick sanity check, just in case
72  {
73  ShowSelection("hide_cover_pilot");
74  }
75  break;
76  }
77  }
78 
79  override void SetActions()
80  {
81  super.SetActions();
82 
84  }
85 };
86 
88 {
89  override void InitOpticMode() //TODO - decide whether to randomize on spawn and how to determine it (attachment etc.)
90  {
91  super.InitOpticMode();
92 
93  SetCurrentOpticMode(GameConstants.OPTICS_STATE_NIGHTVISION);
94  }
95 
96  override int GetCurrentNVType()
97  {
98  if (IsWorking())
99  {
100  switch (m_CurrentOpticMode)
101  {
102  case GameConstants.OPTICS_STATE_DAY:
103  return NVTypes.NV_OPTICS_STARLIGHT_DAY;
104 
105  case GameConstants.OPTICS_STATE_NIGHTVISION:
106  return NVTypes.NV_OPTICS_STARLIGHT_NIGHT;
107  }
108  Error("Undefined optic mode of " + this);
109  return NVTypes.NONE;
110  }
111  else
112  {
113  return NVTypes.NV_OPTICS_OFF;
114  }
115  }
116 
117  override void OnOpticModeChange()
118  {
119  super.OnOpticModeChange();
120 
121  UpdateSelectionVisibility();
122  }
123 
124  override void OnOpticEnter()
125  {
126  super.OnOpticEnter();
127 
128  HideSelection("hide_cover_pilot");
129  }
130 
131  override void UpdateSelectionVisibility()
132  {
133  super.UpdateSelectionVisibility();
134 
135  switch (GetCurrentOpticMode())
136  {
137  case GameConstants.OPTICS_STATE_NIGHTVISION:
138  HideSelection("hide_cover");
139  HideSelection("hide_cover_pilot");
140  break;
141 
142  case GameConstants.OPTICS_STATE_DAY:
143  ShowSelection("hide_cover");
144  if ( !GetGame().IsDedicatedServer() && !IsInOptics() ) //quick sanity check, just in case
145  {
146  ShowSelection("hide_cover_pilot");
147  }
148  break;
149  }
150  }
151 
152  override void SetActions()
153  {
154  super.SetActions();
155 
157  }
158 };
GetGame
proto native CGame GetGame()
Error
void Error(string err)
Messagebox with error message.
Definition: endebug.c:90
KashtanOptic
Definition: optics.c:7
FNP45_MRDSOptic
Definition: optics.c:10
ACOGOptic
Definition: optics.c:5
Crossbow_RedpointOptic
Definition: optics.c:1
M68Optic
Definition: optics.c:8
NVTypes
NVTypes
Definition: dayzplayercamera_base.c:54
PistolOptic
Definition: optics.c:3
AddAction
void AddAction(typename actionName)
Definition: advancedcommunication.c:86
StarlightOptic
Definition: optics.c:87
M4_T3NRDSOptic
Definition: optics.c:9
ReflexOptic
Definition: optics.c:11
GrozaOptic
Definition: optics.c:4
ACOGOptic_6x
Definition: optics.c:6
GameConstants
Definition: constants.c:612
ActionToggleNVMode
Definition: actiontogglenvmode.c:2
KazuarOptic
Definition: optics.c:14
LongrangeOptic
Definition: optics.c:2
ItemOptics
Definition: itemoptics.c:1
KobraOptic
Definition: optics.c:12