PC Stable Documentation
 
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Loading...
Searching...
No Matches
ItemOptics Class Reference

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.
 
protected void OnDrawOptics2D ()
 
protected ItemOpticsType GetItemOpticsType ()
 Returns the ItemOpticsType of this ItemOptics instance.
 
bool IsUsingOptics2DModel ()
 Returns whether this ItemOptics uses the 2D optics model.
 
bool IsSightOnly ()
 
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)
 
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)
 
void SetPlayer (PlayerBase player)
 
PlayerBase GetPlayer ()
 
void StartWorkServer ()
 
void StopWorkServer ()
 

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
 
protected PlayerBase m_Player
 
protected bool m_IsActionActive
 

Constructor & Destructor Documentation

◆ ItemOptics()

Member Function Documentation

◆ AllowsDOF()

bool AllowsDOF ( )
inlineprivate

returns 'true' for non-magnifying optics

References m_allowsDOF.

Referenced by Weapon::HideWeaponBarrel(), and SetCameraPP().

◆ CanPutAsAttachment() [1/2]

override bool CanPutAsAttachment ( EntityAI  parent)
inlineprivate

◆ CanPutAsAttachment() [2/2]

override bool CanPutAsAttachment ( EntityAI  parent)
inlineprivate

◆ EnterOptics()

EnterOptics ( )
private

switches to optics mode if possible

Returns
true if success, false otherwise

Referenced by ActionViewBinoculars::EnterOptics(), ActionViewOptics::EnterOptics(), ActionZoomIn::OnEndServer(), and DayZPlayer::SwitchOptics().

◆ ExitOptics()

ExitOptics ( )
private

switches out of optics mode (if possible)

Returns
true if success, false otherwise

Referenced by ActionViewOptics::ExitOptics(), ActionZoomOut::OnEndServer(), and DayZPlayer::SwitchOptics().

◆ GetCameraPoint()

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 GetCurrentNVType ( )
inlineprivate

Referenced by SetCameraPP().

◆ GetCurrentOpticMode()

◆ GetCurrentStepFOV()

GetCurrentStepFOV ( )
private

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

Referenced by ManBase::HideClothing(), and HoldBreathFOVEffect().

◆ GetItemOpticsType()

protected ItemOpticsType GetItemOpticsType ( )
inlineprivate

Returns the ItemOpticsType of this ItemOptics instance.

Referenced by InitReddotData(), IsUsingOptics2DModel(), and OnDrawOptics2D().

◆ GetNearPlaneValue()

float GetNearPlaneValue ( )
inlineprivate

References m_nearplane_override.

Referenced by AdjustCameraParameters().

◆ GetOpticsDOF()

ref array< float > GetOpticsDOF ( )
inlineprivate

◆ GetOpticsPPBlur()

float GetOpticsPPBlur ( )
inlineprivate

References m_blur_float.

Referenced by SetCameraPP().

◆ GetOpticsPPLens()

ref array< float > GetOpticsPPLens ( )
inlineprivate

References m_lens_array.

Referenced by SetCameraPP().

◆ GetOpticsPPMask()

ref array< float > GetOpticsPPMask ( )
inlineprivate

References m_mask_array.

Referenced by SetCameraPP().

◆ GetPlayer()

PlayerBase GetPlayer ( )
inlineprivate

References m_Player.

◆ GetStepFOVCount()

GetStepFOVCount ( )
private

returns number of configured steps

◆ GetStepFOVIndex()

GetStepFOVIndex ( )
private

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

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

◆ GetStepZeroing()

GetStepZeroing ( )
private

returns position of currently used value in zeroing config array

Returns
position of currently used value in zeroing config array

◆ GetZeroingDistanceZoomMax()

GetZeroingDistanceZoomMax ( )
private

Gets Zeroing distance at opticsZoomMax.

◆ GetZeroingDistanceZoomMin()

GetZeroingDistanceZoomMin ( )
private

Gets Zeroing distance at opticsZoomMin.

◆ GetZoomInit()

GetZoomInit ( )
private

gets FOV value, when entering optics

◆ GetZoomMax()

GetZoomMax ( )
private

gets FOV maximum

◆ GetZoomMin()

GetZoomMin ( )
private

gets FOV minimum

◆ HasWeaponIronsightsOverride()

HasWeaponIronsightsOverride ( )
private

is weapon in optics mode or not

Returns
true if optics has defined override optics info for weapon

Referenced by Weapon::CanEnterIronsights(), and DayZPlayerCameraBase::SetupSightEntities().

◆ HideSelection()

◆ HuntingOptic()

void HuntingOptic ( )
inlineprivate

References HideSelection().

◆ Init2DPreloadType()

void Init2DPreloadType ( )
inlineprivate

◆ InitCameraOverrideProperties()

void InitCameraOverrideProperties ( )
inlineprivate

◆ InitDOFAvailability()

bool InitDOFAvailability ( )
inlineprivate

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

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

Referenced by InitOpticsPPInfo().

◆ InitOpticMode()

void InitOpticMode ( )
inlineprivate

◆ InitOpticsDOFProperties()

bool InitOpticsDOFProperties ( out array< float temp_array)
inlineprivate

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

References CGame::ConfigGetFloatArray(), GetGame(), and GetType().

Referenced by ItemOptics().

◆ InitOpticsPP()

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

initializes values for optics' post-processes

References CGame::ConfigGetFloat(), CGame::ConfigGetFloatArray(), GetGame(), GetType(), and path.

Referenced by InitOpticsPPInfo().

◆ InitOpticsPPInfo()

void InitOpticsPPInfo ( )
inlineprivate

◆ InitReddotData()

◆ IsInOptics()

◆ IsNVOptic()

bool IsNVOptic ( )
inlineprivate

◆ IsSightOnly()

bool IsSightOnly ( )
inlineprivate

◆ IsUsingOptics2DModel()

bool IsUsingOptics2DModel ( )
inlineprivate

Returns whether this ItemOptics uses the 2D optics model.

References GetItemOpticsType().

Referenced by InitReddotData(), DayZPlayer::OnDrawOptics2D(), and ShowReddot().

◆ IsUsingWeaponIronsightsOverride()

IsUsingWeaponIronsightsOverride ( )
private

is optics using ironsights override settings or not

Returns
true if optics is using ironsights override settings

Referenced by DayZPlayer::HandleWeapons().

◆ IsWorking()

◆ OnDebugSpawn()

override void OnDebugSpawn ( )
inlineprivate

◆ OnDrawOptics2D()

protected void OnDrawOptics2D ( )
inlineprivate

◆ OnInventoryExit()

override void OnInventoryExit ( Man  player)
inlineprivate

References SetTakeable().

◆ OnOpticEnter()

void OnOpticEnter ( )
inlineprivate

References GetGame(), and HideSelection().

Referenced by DayZPlayer::SwitchOptics().

◆ OnOpticExit()

void OnOpticExit ( )
inlineprivate

References GetGame(), and ShowSelection().

Referenced by DayZPlayer::SwitchOptics().

◆ OnOpticModeChange()

void OnOpticModeChange ( )
inlineprivate

optic-specific behaviour to be defined here (override)

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

◆ OnStoreLoad()

override bool OnStoreLoad ( ParamsReadContext  ctx,
int  version 
)
inlineprivate

◆ OnStoreSave()

override void OnStoreSave ( ParamsWriteContext  ctx)
inlineprivate

◆ OnVariablesSynchronized()

override void OnVariablesSynchronized ( )
inlineprivate

◆ OnWasAttached() [1/2]

override void OnWasAttached ( EntityAI  parent,
int  slot_id 
)
inlineprivate

◆ OnWasAttached() [2/2]

override void OnWasAttached ( EntityAI  parent,
int  slot_id 
)
inlineprivate

◆ OnWasDetached() [1/2]

override void OnWasDetached ( EntityAI  parent,
int  slot_id 
)
inlineprivate

◆ OnWasDetached() [2/2]

override void OnWasDetached ( EntityAI  parent,
int  slot_id 
)
inlineprivate

◆ OnWorkStart()

override void OnWorkStart ( )
inlineprivate

References GetGame(), and ShowReddot().

◆ OnWorkStop()

override void OnWorkStop ( )
inlineprivate

References GetGame(), and ShowReddot().

◆ ParentUsesWinchesterTypeMount()

bool ParentUsesWinchesterTypeMount ( )
inlineprivate

References m_Parent.

Referenced by OnWasAttached(), and ShowSelection().

◆ SetActions()

override void SetActions ( )
inlineprivate

References AddAction().

◆ SetCurrentOpticMode()

void SetCurrentOpticMode ( int  mode)
inlineprivate

◆ SetPlayer()

void SetPlayer ( PlayerBase  player)
inlineprivate

References m_Player.

◆ SetStepFOVIndex()

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 SetStepZeroing ( int  step)
private

◆ SetZeroingClampDist()

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()

◆ ShowSelection()

◆ StartWorkServer()

void StartWorkServer ( )
inlineprivate

◆ StepFOVDown()

StepFOVDown ( )
private

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

Returns
true if zoom set

◆ StepFOVUp()

StepFOVUp ( )
private

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

Returns
true if zoom set

◆ StepZeroingDown()

StepZeroingDown ( )
private

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

Returns
true if zeroing set

Referenced by DayZPlayer::HandleWeapons().

◆ StepZeroingUp()

StepZeroingUp ( )
private

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

Returns
true if zeroing set

Referenced by DayZPlayer::HandleWeapons().

◆ StopWorkServer()

void StopWorkServer ( )
inlineprivate

◆ UpdateOpticsReddotVisibility()

void UpdateOpticsReddotVisibility ( )
inlineprivate

◆ UpdateSelectionVisibility()

void UpdateSelectionVisibility ( )
inlineprivate

Referenced by OnOpticModeChange().

◆ UseWeaponIronsightsOverride()

UseWeaponIronsightsOverride ( bool  state)
private

switches into ironsights override settings

Returns
true if switching was successful

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

Field Documentation

◆ m_2D_preload_type

string m_2D_preload_type
private

Referenced by Init2DPreloadType().

◆ m_allowsDOF

bool m_allowsDOF
private

Referenced by AllowsDOF(), and InitOpticsPPInfo().

◆ m_blur_float

float m_blur_float
private

◆ m_CurrentOpticMode

◆ m_CurrentOpticModeLocal

int m_CurrentOpticModeLocal
private

◆ m_data_set

bool m_data_set
private

Referenced by InitReddotData(), and ShowReddot().

◆ m_IsActionActive

protected bool m_IsActionActive
private

◆ m_isNVOptic

bool m_reddot_displayed bool m_isNVOptic = false
private

Referenced by InitOpticsPPInfo(), and IsNVOptic().

◆ m_lens_array

ref array<float> m_lens_array
private

◆ m_mask_array

ref array<float> m_mask_array
private

◆ m_nearplane_override

float m_nearplane_override
private

◆ m_optic_sight_material

string m_optic_sight_material
private

◆ m_optic_sight_texture

string m_optic_sight_texture
private

◆ m_OpticsDOFProperties

ref array<float> m_OpticsDOFProperties
private

Referenced by GetOpticsDOF(), and ItemOptics().

◆ m_Parent

EntityAI m_Parent
private

◆ m_Player

◆ m_reddot_index

int m_reddot_index
private

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