DayZ 1.24
Loading...
Searching...
No Matches
ItemOptics Class Reference
Inheritance diagram for ItemOptics:
[legend]
Collaboration diagram for ItemOptics:
[legend]

Protected Member Functions

void SetPlayer (PlayerBase player)
 
PlayerBase GetPlayer ()
 

Protected Attributes

PlayerBase m_Player
 

Private Member Functions

void ItemOptics ()
 
proto native bool EnterOptics ()
 switches to optics mode if possible
 
proto native bool IsInOptics ()
 is weapon in optics mode or not
 
proto native bool ExitOptics ()
 switches out of optics mode (if possible)
 
proto native bool HasWeaponIronsightsOverride ()
 is weapon in optics mode or not
 
proto native bool UseWeaponIronsightsOverride (bool state)
 switches into ironsights override settings
 
proto native bool IsUsingWeaponIronsightsOverride ()
 is optics using ironsights override settings or not
 
proto native int GetStepFOVCount ()
 returns number of configured steps
 
proto native int GetStepFOVIndex ()
 returns index of currently used value in 'discretefov' config array
 
proto native bool SetStepFOVIndex (int step)
 sets zoom to fov value defined at given in 'discretefov' config array
 
proto native bool StepFOVUp ()
 sets zoom to next defined (respective to current) value in zoom fov config array
 
proto native bool StepFOVDown ()
 sets zoom to previous (respective to current) defined value in zoom fov config array
 
proto native float GetCurrentStepFOV ()
 returns fov value at current index, or 'OpticsInfo.opticsZoomInit' config value (non-zooming optics)
 
proto native int GetStepZeroing ()
 returns position of currently used value in zeroing config array
 
proto native bool SetStepZeroing (int step)
 
proto native bool StepZeroingUp ()
 sets zeroing to next defined (respective to current) value in zeroing config array
 
proto native bool StepZeroingDown ()
 sets zeroing to previous (respective to current) defined value in zeroing config array
 
proto native void GetCameraPoint (out vector pos, out vector dir)
 gets camera position & direction in model space of optics entity
 
proto native float GetZoomInit ()
 gets FOV value, when entering optics
 
proto native float GetZoomMin ()
 gets FOV minimum
 
proto native float GetZoomMax ()
 gets FOV maximum
 
proto native float GetZeroingDistanceZoomMin ()
 Gets Zeroing distance at opticsZoomMin.
 
proto native float GetZeroingDistanceZoomMax ()
 Gets Zeroing distance at opticsZoomMax.
 
proto native void SetZeroingClampDist (float dist)
 Sets zeroing clamp for the optics and updates the clamp if dist > 0. Used when attached to weapon.
 
override void OnWorkStart ()
 
override void OnWorkStop ()
 
bool IsWorking ()
 
void UpdateOpticsReddotVisibility ()
 
override void OnWasAttached (EntityAI parent, int slot_id)
 
override void OnWasDetached (EntityAI parent, int slot_id)
 
override void OnInventoryExit (Man player)
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override void OnVariablesSynchronized ()
 
void InitReddotData ()
 
void ShowReddot (bool state)
 
void InitOpticsPPInfo ()
 
bool InitDOFAvailability ()
 optics with more than 1x zoom do not allow DOF changes
 
void InitOpticsPP (out array< float > mask_array, out array< float > lens_array, out float blur_float)
 initializes values for optics' post-processes
 
void InitCameraOverrideProperties ()
 
bool InitOpticsDOFProperties (out array< float > temp_array)
 Initializes DOF properties for optic's alternate ironsights (ACOG etc.)
 
bool AllowsDOF ()
 returns 'true' for non-magnifying optics
 
bool IsNVOptic ()
 
int GetCurrentNVType ()
 
void SetCurrentOpticMode (int mode)
 
int GetCurrentOpticMode ()
 
void OnOpticModeChange ()
 optic-specific behaviour to be defined here (override)
 
void OnOpticEnter ()
 
void OnOpticExit ()
 
ref array< floatGetOpticsDOF ()
 
ref array< floatGetOpticsPPMask ()
 
ref array< floatGetOpticsPPLens ()
 
float GetOpticsPPBlur ()
 
float GetNearPlaneValue ()
 
void Init2DPreloadType ()
 
void InitOpticMode ()
 
void UpdateSelectionVisibility ()
 
override void SetActions ()
 
override void OnDebugSpawn ()
 
override bool CanPutAsAttachment (EntityAI parent)
 
override bool CanPutAsAttachment (EntityAI parent)
 
void HuntingOptic ()
 
override void OnWasAttached (EntityAI parent, int slot_id)
 
override void OnWasDetached (EntityAI parent, int slot_id)
 
override void HideSelection (string selection_name)
 
override void ShowSelection (string selection_name)
 
bool ParentUsesWinchesterTypeMount ()
 
override bool CanPutAsAttachment (EntityAI parent)
 

Private Attributes

bool m_data_set
 
bool m_allowsDOF
 
bool m_reddot_displayed bool m_isNVOptic = false
 
int m_CurrentOpticMode
 
int m_CurrentOpticModeLocal
 
int m_reddot_index
 
float m_blur_float
 
float m_nearplane_override
 
string m_optic_sight_texture
 
string m_optic_sight_material
 
string m_2D_preload_type
 
ref array< floatm_mask_array
 
ref array< floatm_lens_array
 
ref array< floatm_OpticsDOFProperties
 
EntityAI m_Parent
 

Detailed Description

Definition at line 1 of file ItemOptics.c.

Constructor & Destructor Documentation

◆ ItemOptics()

void ItemOptics::ItemOptics ( )
inlineprivate

Definition at line 19 of file ItemOptics.c.

20 {
24
31
33 RegisterNetSyncVariableInt("m_CurrentOpticMode", 0, 63);
34 }
int m_CurrentOpticModeLocal
Definition ItemOptics.c:8
void InitOpticMode()
Definition ItemOptics.c:485
void InitReddotData()
Definition ItemOptics.c:280
ref array< float > m_mask_array
Definition ItemOptics.c:15
void InitOpticsPPInfo()
Definition ItemOptics.c:334
ref array< float > m_OpticsDOFProperties
Definition ItemOptics.c:17
bool InitOpticsDOFProperties(out array< float > temp_array)
Initializes DOF properties for optic's alternate ironsights (ACOG etc.)
Definition ItemOptics.c:378
void Init2DPreloadType()
Definition ItemOptics.c:473
void InitCameraOverrideProperties()
Definition ItemOptics.c:368
ref array< float > m_lens_array
Definition ItemOptics.c:16

References Init2DPreloadType(), InitCameraOverrideProperties(), InitOpticMode(), InitOpticsDOFProperties(), InitOpticsPPInfo(), InitReddotData(), m_CurrentOpticModeLocal, m_lens_array, m_mask_array, and m_OpticsDOFProperties.

Member Function Documentation

◆ AllowsDOF()

bool ItemOptics::AllowsDOF ( )
inlineprivate

returns 'true' for non-magnifying optics

Definition at line 394 of file ItemOptics.c.

395 {
396 return m_allowsDOF;
397 }
bool m_allowsDOF
Definition ItemOptics.c:4

References m_allowsDOF.

Referenced by SetCameraPP().

◆ CanPutAsAttachment() [1/3]

override bool ItemOptics::CanPutAsAttachment ( EntityAI parent)
inlineprivate

Definition at line 31 of file M79.c.

32 {
33 return true;
34 }

◆ CanPutAsAttachment() [2/3]

override bool ItemOptics::CanPutAsAttachment ( EntityAI parent)
inlineprivate

Definition at line 3 of file BUISOptic.c.

4 {
5 if (!super.CanPutAsAttachment(parent)) return false;
6 if (parent.IsKindOf("M4A1_Base"))
7 return true;
8
9 return false;
10 //return true;
11 }

◆ CanPutAsAttachment() [3/3]

override bool ItemOptics::CanPutAsAttachment ( EntityAI parent)
inlineprivate

Definition at line 3 of file M4_CarryHandleOptic.c.

4 {
5 if (!super.CanPutAsAttachment(parent)) return false;
6 if (parent.IsKindOf("M4A1_Base"))
7 return true;
8
9 return false;
10 }

◆ EnterOptics()

ItemOptics::EnterOptics ( )
private

switches to optics mode if possible

Returns
true if success, false otherwise

◆ ExitOptics()

ItemOptics::ExitOptics ( )
private

switches out of optics mode (if possible)

Returns
true if success, false otherwise

◆ GetCameraPoint()

ItemOptics::GetCameraPoint ( out vector pos,
out vector dir )
private

gets camera position & direction in model space of optics entity

Referenced by DayZPlayerCameraBase::GetCurrentSightInfo(), and GetCurrentSightInfo().

◆ GetCurrentNVType()

int ItemOptics::GetCurrentNVType ( )
inlineprivate

Definition at line 404 of file ItemOptics.c.

405 {
406 /*
407 //TODO - implement this into NV optics and modify (KazuarOptic example below)
408 if (IsWorking())
409 {
410 switch (m_CurrentOpticMode)
411 {
412 case GameConstants.OPTICS_STATE_DAY:
413 return NVTypes.NV_OPTICS_KAZUAR_DAY;
414
415 case GameConstants.OPTICS_STATE_NIGHTVISION:
416 return NVTypes.NV_OPTICS_KAZUAR_NIGHT;
417 }
418 }
419 else
420 {
421 return NVTypes.NV_OPTICS_OFF;
422 }
423 */
424 return NVTypes.NONE;
425 }

Referenced by SetCameraPP().

◆ GetCurrentOpticMode()

int ItemOptics::GetCurrentOpticMode ( )
inlineprivate

Definition at line 433 of file ItemOptics.c.

434 {
435 return m_CurrentOpticMode;
436 }
int m_CurrentOpticMode
Definition ItemOptics.c:7

References m_CurrentOpticMode.

Referenced by KazuarOptic::UpdateSelectionVisibility(), and StarlightOptic::UpdateSelectionVisibility().

◆ GetCurrentStepFOV()

ItemOptics::GetCurrentStepFOV ( )
private

returns fov value at current index, or 'OpticsInfo.opticsZoomInit' config value (non-zooming optics)

◆ GetNearPlaneValue()

float ItemOptics::GetNearPlaneValue ( )
inlineprivate

Definition at line 468 of file ItemOptics.c.

469 {
471 }
float m_nearplane_override
Definition ItemOptics.c:11

References m_nearplane_override.

Referenced by AdjustCameraParameters().

◆ GetOpticsDOF()

ref array< float > ItemOptics::GetOpticsDOF ( )
inlineprivate

Definition at line 451 of file ItemOptics.c.

452 {
454 }

References m_OpticsDOFProperties.

Referenced by DayZPlayerCameraBase::SetCameraPP(), and SetCameraPP().

◆ GetOpticsPPBlur()

float ItemOptics::GetOpticsPPBlur ( )
inlineprivate

Definition at line 463 of file ItemOptics.c.

464 {
465 return m_blur_float;
466 }
float m_blur_float
Definition ItemOptics.c:10

References m_blur_float.

Referenced by SetCameraPP().

◆ GetOpticsPPLens()

ref array< float > ItemOptics::GetOpticsPPLens ( )
inlineprivate

Definition at line 459 of file ItemOptics.c.

460 {
461 return m_lens_array;
462 }

References m_lens_array.

Referenced by SetCameraPP().

◆ GetOpticsPPMask()

ref array< float > ItemOptics::GetOpticsPPMask ( )
inlineprivate

Definition at line 455 of file ItemOptics.c.

456 {
457 return m_mask_array;
458 }

References m_mask_array.

Referenced by SetCameraPP().

◆ GetPlayer()

PlayerBase ItemOptics::GetPlayer ( )
inlineprotected

Definition at line 10 of file PoweredOptic_Base.c.

11 {
12 return m_Player;
13 }
PlayerBase m_Player

References m_Player.

◆ GetStepFOVCount()

ItemOptics::GetStepFOVCount ( )
private

returns number of configured steps

◆ GetStepFOVIndex()

ItemOptics::GetStepFOVIndex ( )
private

returns index of currently used value in 'discretefov' config array

Returns
index of currently used value in 'discretefov' config array

◆ GetStepZeroing()

ItemOptics::GetStepZeroing ( )
private

returns position of currently used value in zeroing config array

Returns
position of currently used value in zeroing config array

◆ GetZeroingDistanceZoomMax()

ItemOptics::GetZeroingDistanceZoomMax ( )
private

Gets Zeroing distance at opticsZoomMax.

◆ GetZeroingDistanceZoomMin()

ItemOptics::GetZeroingDistanceZoomMin ( )
private

Gets Zeroing distance at opticsZoomMin.

◆ GetZoomInit()

ItemOptics::GetZoomInit ( )
private

gets FOV value, when entering optics

◆ GetZoomMax()

ItemOptics::GetZoomMax ( )
private

gets FOV maximum

◆ GetZoomMin()

ItemOptics::GetZoomMin ( )
private

gets FOV minimum

◆ HasWeaponIronsightsOverride()

ItemOptics::HasWeaponIronsightsOverride ( )
private

is weapon in optics mode or not

Returns
true if optics has defined override optics info for weapon

Referenced by DayZPlayerCameraBase::SetupSightEntities().

◆ HideSelection()

override void ItemOptics::HideSelection ( string selection_name)
inlineprivate

Definition at line 34 of file HuntingOptic.c.

35 {
36 super.HideSelection(selection_name);
37 if (selection_name == "hide") //hides pilotview selections in order not to obstruct view
38 {
39 HideSelection("rings_ris_pilot");
40 HideSelection("rings_winchester_pilot");
41 }
42 }
override void HideSelection(string selection_name)

References HideSelection().

Referenced by HideSelection(), HuntingOptic(), OnOpticEnter(), KazuarOptic::OnOpticEnter(), StarlightOptic::OnOpticEnter(), OnWasAttached(), OnWasDetached(), ShowSelection(), KazuarOptic::UpdateSelectionVisibility(), and StarlightOptic::UpdateSelectionVisibility().

◆ HuntingOptic()

void ItemOptics::HuntingOptic ( )
inlineprivate

Definition at line 5 of file HuntingOptic.c.

6 {
7 HideSelection("rings_ris");
8 HideSelection("rings_ris_pilot");
9 }

References HideSelection().

◆ Init2DPreloadType()

void ItemOptics::Init2DPreloadType ( )
inlineprivate

Definition at line 473 of file ItemOptics.c.

474 {
475 string path = "cfgVehicles " + GetType() + " OpticsInfo preloadOpticType";
476 string type_2d;
477
478 if (GetGame().ConfigIsExisting(path))
479 {
480 GetGame().ConfigGetText(path, type_2d);
482 }
483 }
eBleedingSourceType GetType()
string m_2D_preload_type
Definition ItemOptics.c:14
proto native CGame GetGame()

References GetGame(), GetType(), m_2D_preload_type, and path.

Referenced by ItemOptics().

◆ InitCameraOverrideProperties()

void ItemOptics::InitCameraOverrideProperties ( )
inlineprivate

Definition at line 368 of file ItemOptics.c.

369 {
370 string path = "cfgVehicles " + GetType() + " OpticsInfo";
371 if (GetGame().ConfigIsExisting(path + " nearPlaneDistanceOverride"))
372 m_nearplane_override = Math.Max(GetGame().ConfigGetFloat(path + " nearPlaneDistanceOverride"), DayZPlayerCameraBase.CONST_NEARPLANE_OPTICS_MIN);
373 else
374 m_nearplane_override = DayZPlayerCameraOptics.CONST_NEARPLANE_OPTICS;
375 }
void DayZPlayerCameraOptics(DayZPlayer pPlayer, HumanInputController pInput)
this is main camera class
Definition EnMath.c:7
static proto float Max(float x, float y)
Returns bigger of two given values.

References DayZPlayerCameraOptics(), GetGame(), GetType(), m_nearplane_override, Math::Max(), and path.

Referenced by ItemOptics().

◆ InitDOFAvailability()

bool ItemOptics::InitDOFAvailability ( )
inlineprivate

optics with more than 1x zoom do not allow DOF changes

Definition at line 343 of file ItemOptics.c.

344 {
345 float fov_max;
346 string path = "cfgVehicles " + GetType() + " OpticsInfo";
347
348 /*
349 Weapon_Base weapon = Weapon_Base.Cast(GetHierarchyParent());
350 if (!weapon)
351 return false; // no DOF for handheld optics
352 */
353 fov_max = GetGame().ConfigGetFloat(path + " opticsZoomMax");
355 return true;
356 return false;
357 }
const float DZPLAYER_CAMERA_FOV_IRONSIGHTS
Definition constants.c:836

References GameConstants::DZPLAYER_CAMERA_FOV_IRONSIGHTS, GetGame(), GetType(), and path.

Referenced by InitOpticsPPInfo().

◆ InitOpticMode()

void ItemOptics::InitOpticMode ( )
inlineprivate

Definition at line 485 of file ItemOptics.c.

486 {
488 }
void SetCurrentOpticMode(int mode)
Definition ItemOptics.c:427
const int OPTICS_STATE_DAY
Definition constants.c:800

References GameConstants::OPTICS_STATE_DAY, and SetCurrentOpticMode().

Referenced by ItemOptics().

◆ InitOpticsDOFProperties()

bool ItemOptics::InitOpticsDOFProperties ( out array< float > temp_array)
inlineprivate

Initializes DOF properties for optic's alternate ironsights (ACOG etc.)

Definition at line 378 of file ItemOptics.c.

379 {
380 if (GetGame().ConfigIsExisting("cfgVehicles " + GetType() + " OpticsInfo PPDOFProperties"))
381 {
382 GetGame().ConfigGetFloatArray("cfgVehicles " + GetType() + " OpticsInfo PPDOFProperties", temp_array);
383 return true;
384 }
385 else if (GetGame().ConfigIsExisting("cfgVehicles " + GetType() + " OpticsInfoWeaponOverride PPDOFProperties"))
386 {
387 GetGame().ConfigGetFloatArray("cfgVehicles " + GetType() + " OpticsInfoWeaponOverride PPDOFProperties", temp_array);
388 return true;
389 }
390 return false;
391 }

References GetGame(), and GetType().

Referenced by ItemOptics().

◆ InitOpticsPP()

void ItemOptics::InitOpticsPP ( out array< float > mask_array,
out array< float > lens_array,
out float blur_float )
inlineprivate

initializes values for optics' post-processes

Definition at line 360 of file ItemOptics.c.

361 {
362 string path = "cfgVehicles " + GetType() + " OpticsInfo";
363 GetGame().ConfigGetFloatArray(path + " PPMaskProperties", mask_array);
364 GetGame().ConfigGetFloatArray(path + " PPLensProperties", lens_array);
365 blur_float = GetGame().ConfigGetFloat(path + " PPBlurProperties");
366 }

References GetGame(), GetType(), and path.

Referenced by InitOpticsPPInfo().

◆ InitOpticsPPInfo()

void ItemOptics::InitOpticsPPInfo ( )
inlineprivate

Definition at line 334 of file ItemOptics.c.

335 {
338
339 m_isNVOptic = ConfigGetBool("NVOptic");
340 }
void InitOpticsPP(out array< float > mask_array, out array< float > lens_array, out float blur_float)
initializes values for optics' post-processes
Definition ItemOptics.c:360
bool m_reddot_displayed bool m_isNVOptic
Definition ItemOptics.c:6
bool InitDOFAvailability()
optics with more than 1x zoom do not allow DOF changes
Definition ItemOptics.c:343

References InitDOFAvailability(), InitOpticsPP(), m_allowsDOF, m_blur_float, m_isNVOptic, m_lens_array, and m_mask_array.

Referenced by ItemOptics().

◆ InitReddotData()

void ItemOptics::InitReddotData ( )
inlineprivate

Definition at line 280 of file ItemOptics.c.

281 {
282 string path = "cfgVehicles " + GetType() + " OpticsInfo";
283 string temp;
284
285 if (GetGame().ConfigIsExisting(path))
286 {
287 m_reddot_index = GetHiddenSelectionIndex("reddot");
288 if (GetGame().ConfigIsExisting(path + " opticSightTexture"))
289 {
290 GetGame().ConfigGetText(path + " opticSightTexture", temp);
292 temp = "";
293 }
294 if (GetGame().ConfigIsExisting(path + " opticSightMaterial"))
295 {
296 GetGame().ConfigGetText(path + " opticSightMaterial", temp);
298 temp = "";
299 }
300 }
301 m_data_set = true;
302 }
int m_reddot_index
Definition ItemOptics.c:9
bool m_data_set
Definition ItemOptics.c:3
string m_optic_sight_material
Definition ItemOptics.c:13
string m_optic_sight_texture
Definition ItemOptics.c:12

References GetGame(), GetType(), m_data_set, m_optic_sight_material, m_optic_sight_texture, m_reddot_index, and path.

Referenced by ItemOptics(), and ShowReddot().

◆ IsInOptics()

ItemOptics::IsInOptics ( )
private

is weapon in optics mode or not

Returns
true if in optics mode, false otherwise

Referenced by KazuarOptic::UpdateSelectionVisibility(), and StarlightOptic::UpdateSelectionVisibility().

◆ IsNVOptic()

bool ItemOptics::IsNVOptic ( )
inlineprivate

Definition at line 399 of file ItemOptics.c.

400 {
401 return m_isNVOptic;
402 }

References m_isNVOptic.

Referenced by Init(), and SetCameraPP().

◆ IsUsingWeaponIronsightsOverride()

ItemOptics::IsUsingWeaponIronsightsOverride ( )
private

is optics using ironsights override settings or not

Returns
true if optics is using ironsights override settings

◆ IsWorking()

bool ItemOptics::IsWorking ( )
inlineprivate

Definition at line 188 of file ItemOptics.c.

189 {
190 if (GetCompEM() && GetCompEM().CanWork())
191 return true;
192 return false;
193 }

Referenced by KazuarOptic::GetCurrentNVType(), StarlightOptic::GetCurrentNVType(), Init(), and UpdateOpticsReddotVisibility().

◆ OnDebugSpawn()

override void ItemOptics::OnDebugSpawn ( )
inlineprivate

Definition at line 499 of file ItemOptics.c.

500 {
501 GetInventory().CreateAttachment("Battery9V");
502 }

◆ OnInventoryExit()

override void ItemOptics::OnInventoryExit ( Man player)
inlineprivate

Definition at line 229 of file ItemOptics.c.

230 {
231 super.OnInventoryExit(player);
232
234 if (PlayerBase.CastTo(playerPB, player))
235 playerPB.SetReturnToOptics(false);
236
237 SetTakeable(true);
238 }
override void SetTakeable(bool pState)
Definition ItemBase.c:8905

References SetTakeable().

◆ OnOpticEnter()

void ItemOptics::OnOpticEnter ( )
inlineprivate

Definition at line 440 of file ItemOptics.c.

441 {
442 if (GetGame() && !GetGame().IsDedicatedServer())
443 HideSelection("hide");
444 }

References GetGame(), and HideSelection().

◆ OnOpticExit()

void ItemOptics::OnOpticExit ( )
inlineprivate

Definition at line 445 of file ItemOptics.c.

446 {
447 if (GetGame() && !GetGame().IsDedicatedServer())
448 ShowSelection("hide");
449 }
override void ShowSelection(string selection_name)

References GetGame(), and ShowSelection().

◆ OnOpticModeChange()

void ItemOptics::OnOpticModeChange ( )
inlineprivate

optic-specific behaviour to be defined here (override)

Definition at line 439 of file ItemOptics.c.

439{}

Referenced by OnStoreLoad(), OnVariablesSynchronized(), and SetCurrentOpticMode().

◆ OnStoreLoad()

override bool ItemOptics::OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprivate

Definition at line 247 of file ItemOptics.c.

248 {
249 if (!super.OnStoreLoad(ctx, version))
250 return false;
251 m_IsStoreLoad = true;
252
253 if (version >= 126)
254 {
255 if (!ctx.Read(m_CurrentOpticMode))
256 {
257 m_IsStoreLoad = false;
258 return false;
259 }
260 }
261
263 SetSynchDirty();
264
265 m_IsStoreLoad = false;
266 return true;
267 }
bool m_IsStoreLoad
Definition ItemBase.c:4743
void OnOpticModeChange()
optic-specific behaviour to be defined here (override)
Definition ItemOptics.c:439

References m_CurrentOpticMode, m_IsStoreLoad, and OnOpticModeChange().

◆ OnStoreSave()

override void ItemOptics::OnStoreSave ( ParamsWriteContext ctx)
inlineprivate

Definition at line 240 of file ItemOptics.c.

241 {
242 super.OnStoreSave(ctx);
243
244 ctx.Write(m_CurrentOpticMode);
245 }

References m_CurrentOpticMode.

◆ OnVariablesSynchronized()

override void ItemOptics::OnVariablesSynchronized ( )
inlineprivate

Definition at line 269 of file ItemOptics.c.

270 {
271 super.OnVariablesSynchronized();
272
274 {
277 }
278 }

References m_CurrentOpticMode, m_CurrentOpticModeLocal, and OnOpticModeChange().

◆ OnWasAttached() [1/2]

override void ItemOptics::OnWasAttached ( EntityAI parent,
int slot_id )
inlineprivate

Definition at line 203 of file ItemOptics.c.

204 {
205 super.OnWasAttached(parent, slot_id);
206
207 SetTakeable(false);
208
209 Weapon wep;
210 if (Class.CastTo(wep, parent))
211 SetZeroingClampDist(wep.GetZeroingClamp(wep.GetCurrentMuzzle()));
212 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native void SetZeroingClampDist(float dist)
Sets zeroing clamp for the optics and updates the clamp if dist > 0. Used when attached to weapon.
script counterpart to engine's class Weapon
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), SetTakeable(), and SetZeroingClampDist().

◆ OnWasAttached() [2/2]

override void ItemOptics::OnWasAttached ( EntityAI parent,
int slot_id )
inlineprivate

Definition at line 11 of file HuntingOptic.c.

12 {
13 super.OnWasAttached(parent, slot_id);
14 m_Parent = parent;
16 {
17 HideSelection("rings_winchester");
18 HideSelection("rings_winchester_pilot");
19 ShowSelection("rings_ris");
20 ShowSelection("rings_ris_pilot");
21 }
22 }
EntityAI m_Parent
Definition HuntingOptic.c:3
bool ParentUsesWinchesterTypeMount()

References HideSelection(), m_Parent, ParentUsesWinchesterTypeMount(), and ShowSelection().

◆ OnWasDetached() [1/2]

override void ItemOptics::OnWasDetached ( EntityAI parent,
int slot_id )
inlineprivate

Definition at line 214 of file ItemOptics.c.

215 {
216 super.OnWasDetached(parent, slot_id);
217
219 if (PlayerBase.CastTo(player, GetHierarchyRootPlayer()))
220 player.SetReturnToOptics(false);
221
222 SetTakeable(true);
223
224 Weapon wep;
225 if (Class.CastTo(wep, parent))
227 }

References Class::CastTo(), SetTakeable(), and SetZeroingClampDist().

◆ OnWasDetached() [2/2]

override void ItemOptics::OnWasDetached ( EntityAI parent,
int slot_id )
inlineprivate

Definition at line 24 of file HuntingOptic.c.

25 {
26 super.OnWasDetached(parent, slot_id);
27 m_Parent = null;
28 HideSelection("rings_ris");
29 HideSelection("rings_ris_pilot");
30 ShowSelection("rings_winchester");
31 ShowSelection("rings_winchester_pilot");
32 }

References HideSelection(), m_Parent, and ShowSelection().

◆ OnWorkStart()

override void ItemOptics::OnWorkStart ( )
inlineprivate

Definition at line 176 of file ItemOptics.c.

177 {
178 if (!GetGame().IsDedicatedServer())
179 ShowReddot(true);
180 }
void ShowReddot(bool state)
Definition ItemOptics.c:304

References GetGame(), and ShowReddot().

◆ OnWorkStop()

override void ItemOptics::OnWorkStop ( )
inlineprivate

Definition at line 182 of file ItemOptics.c.

183 {
184 if (!GetGame().IsDedicatedServer())
185 ShowReddot(false);
186 }

References GetGame(), and ShowReddot().

◆ ParentUsesWinchesterTypeMount()

bool ItemOptics::ParentUsesWinchesterTypeMount ( )
inlineprivate

Definition at line 66 of file HuntingOptic.c.

67 {
68 if (m_Parent && m_Parent.ConfigIsExisting("winchesterTypeOpticsMount"))
69 return m_Parent.ConfigGetBool("winchesterTypeOpticsMount");
70
71 return false;
72 }

References m_Parent.

Referenced by OnWasAttached(), and ShowSelection().

◆ SetActions()

override void ItemOptics::SetActions ( )
inlineprivate

Definition at line 492 of file ItemOptics.c.

493 {
494 super.SetActions();
495
497 }
void AddAction(typename actionName)

References AddAction().

◆ SetCurrentOpticMode()

void ItemOptics::SetCurrentOpticMode ( int mode)
inlineprivate

◆ SetPlayer()

void ItemOptics::SetPlayer ( PlayerBase player)
inlineprotected

Definition at line 5 of file PoweredOptic_Base.c.

6 {
8 }

References m_Player.

◆ SetStepFOVIndex()

ItemOptics::SetStepFOVIndex ( int step)
private

sets zoom to fov value defined at given in 'discretefov' config array

Parameters
[in]indexof configured step, range [0..cfg_max]
Returns
true if zoom set

◆ SetStepZeroing()

proto native bool ItemOptics::SetStepZeroing ( int step)
private

◆ SetZeroingClampDist()

ItemOptics::SetZeroingClampDist ( float dist)
private

Sets zeroing clamp for the optics and updates the clamp if dist > 0. Used when attached to weapon.

Referenced by OnWasAttached(), and OnWasDetached().

◆ ShowReddot()

void ItemOptics::ShowReddot ( bool state)
inlineprivate

Definition at line 304 of file ItemOptics.c.

305 {
306 if (GetGame().IsDedicatedServer())
307 {
308 ErrorEx("should not be called on the server!", ErrorExSeverity.INFO);
309 return;
310 }
311
312 if (!m_data_set)
314
315 // does not have reddot
316 if (m_reddot_index == -1)
317 return;
318
319 if (state)
320 {
321 if (m_optic_sight_texture != "")
322 SetObjectTexture(m_reddot_index, m_optic_sight_texture);
323 if (m_optic_sight_material != "")
324 SetObjectMaterial(m_reddot_index, m_optic_sight_material);
325 }
326 else
327 {
328 SetObjectTexture(m_reddot_index, "");
329 SetObjectMaterial(m_reddot_index, "");
330 }
332 }
ErrorExSeverity
Definition EnDebug.c:62
enum ShapeType ErrorEx

References ErrorEx, GetGame(), InitReddotData(), m_data_set, m_optic_sight_material, m_optic_sight_texture, and m_reddot_index.

Referenced by OnWorkStart(), OnWorkStop(), and UpdateOpticsReddotVisibility().

◆ ShowSelection()

override void ItemOptics::ShowSelection ( string selection_name)
inlineprivate

Definition at line 44 of file HuntingOptic.c.

45 {
46 super.ShowSelection(selection_name);
47 if (selection_name == "hide")
48 {
50 {
51 HideSelection("rings_winchester");
52 HideSelection("rings_winchester_pilot");
53 ShowSelection("rings_ris");
54 ShowSelection("rings_ris_pilot");
55 }
56 else
57 {
58 HideSelection("rings_ris");
59 HideSelection("rings_ris_pilot");
60 ShowSelection("rings_winchester");
61 ShowSelection("rings_winchester_pilot");
62 }
63 }
64 }

References HideSelection(), ParentUsesWinchesterTypeMount(), and ShowSelection().

Referenced by OnOpticExit(), OnWasAttached(), OnWasDetached(), ShowSelection(), KazuarOptic::UpdateSelectionVisibility(), and StarlightOptic::UpdateSelectionVisibility().

◆ StepFOVDown()

ItemOptics::StepFOVDown ( )
private

sets zoom to previous (respective to current) defined value in zoom fov config array

Returns
true if zoom set

◆ StepFOVUp()

ItemOptics::StepFOVUp ( )
private

sets zoom to next defined (respective to current) value in zoom fov config array

Returns
true if zoom set

◆ StepZeroingDown()

ItemOptics::StepZeroingDown ( )
private

sets zeroing to previous (respective to current) defined value in zeroing config array

Returns
true if zeroing set

◆ StepZeroingUp()

ItemOptics::StepZeroingUp ( )
private

sets zeroing to next defined (respective to current) value in zeroing config array

Returns
true if zeroing set

◆ UpdateOpticsReddotVisibility()

void ItemOptics::UpdateOpticsReddotVisibility ( )
inlineprivate

Definition at line 195 of file ItemOptics.c.

196 {
198 ShowReddot(true);
199 else if (!IsWorking() && m_reddot_displayed)
200 ShowReddot(false);
201 }
bool IsWorking()
Definition ItemOptics.c:188

References IsWorking(), and ShowReddot().

◆ UpdateSelectionVisibility()

void ItemOptics::UpdateSelectionVisibility ( )
inlineprivate

Definition at line 490 of file ItemOptics.c.

490{}

◆ UseWeaponIronsightsOverride()

ItemOptics::UseWeaponIronsightsOverride ( bool state)
private

switches into ironsights override settings

Returns
true if switching was successful

Referenced by DayZPlayerCameraBase::GetCurrentSightInfo(), and GetCurrentSightInfo().

Member Data Documentation

◆ m_2D_preload_type

string ItemOptics::m_2D_preload_type
private

Definition at line 14 of file ItemOptics.c.

Referenced by Init2DPreloadType().

◆ m_allowsDOF

bool ItemOptics::m_allowsDOF
private

Definition at line 4 of file ItemOptics.c.

Referenced by AllowsDOF(), and InitOpticsPPInfo().

◆ m_blur_float

float ItemOptics::m_blur_float
private

Definition at line 10 of file ItemOptics.c.

Referenced by GetOpticsPPBlur(), and InitOpticsPPInfo().

◆ m_CurrentOpticMode

◆ m_CurrentOpticModeLocal

int ItemOptics::m_CurrentOpticModeLocal
private

Definition at line 8 of file ItemOptics.c.

Referenced by ItemOptics(), and OnVariablesSynchronized().

◆ m_data_set

bool ItemOptics::m_data_set
private

Definition at line 3 of file ItemOptics.c.

Referenced by InitReddotData(), and ShowReddot().

◆ m_isNVOptic

bool m_reddot_displayed bool ItemOptics::m_isNVOptic = false
private

Definition at line 6 of file ItemOptics.c.

Referenced by InitOpticsPPInfo(), and IsNVOptic().

◆ m_lens_array

ref array<float> ItemOptics::m_lens_array
private

Definition at line 16 of file ItemOptics.c.

Referenced by GetOpticsPPLens(), InitOpticsPPInfo(), and ItemOptics().

◆ m_mask_array

ref array<float> ItemOptics::m_mask_array
private

Definition at line 15 of file ItemOptics.c.

Referenced by GetOpticsPPMask(), InitOpticsPPInfo(), and ItemOptics().

◆ m_nearplane_override

float ItemOptics::m_nearplane_override
private

Definition at line 11 of file ItemOptics.c.

Referenced by GetNearPlaneValue(), and InitCameraOverrideProperties().

◆ m_optic_sight_material

string ItemOptics::m_optic_sight_material
private

Definition at line 13 of file ItemOptics.c.

Referenced by InitReddotData(), and ShowReddot().

◆ m_optic_sight_texture

string ItemOptics::m_optic_sight_texture
private

Definition at line 12 of file ItemOptics.c.

Referenced by InitReddotData(), and ShowReddot().

◆ m_OpticsDOFProperties

ref array<float> ItemOptics::m_OpticsDOFProperties
private

Definition at line 17 of file ItemOptics.c.

Referenced by GetOpticsDOF(), and ItemOptics().

◆ m_Parent

EntityAI ItemOptics::m_Parent
private

Definition at line 3 of file HuntingOptic.c.

◆ m_Player

PlayerBase ItemOptics::m_Player
protected

Definition at line 3 of file PoweredOptic_Base.c.

◆ m_reddot_index

int ItemOptics::m_reddot_index
private

Definition at line 9 of file ItemOptics.c.

Referenced by InitReddotData(), and ShowReddot().


The documentation for this class was generated from the following files: