5 bool m_reddot_displayed
6 bool m_isNVOptic =
false;
7 int m_CurrentOpticMode;
8 int m_CurrentOpticModeLocal;
11 float m_nearplane_override;
12 string m_optic_sight_texture;
13 string m_optic_sight_material;
14 string m_2D_preload_type;
32 m_CurrentOpticModeLocal = -1;
33 RegisterNetSyncVariableInt(
"m_CurrentOpticMode", 0, 63 );
40 proto native
bool EnterOptics ();
46 proto native
bool IsInOptics ();
52 proto native
bool ExitOptics ();
58 proto native
bool HasWeaponIronsightsOverride ();
64 proto native
bool UseWeaponIronsightsOverride(
bool state);
70 proto native
bool IsUsingWeaponIronsightsOverride();
75 proto native
int GetStepFOVCount ();
81 proto native
int GetStepFOVIndex ();
88 proto native
bool SetStepFOVIndex (
int step);
94 proto native
bool StepFOVUp ();
100 proto native
bool StepFOVDown ();
105 proto native
float GetCurrentStepFOV ();
111 proto native
int GetStepZeroing ();
118 proto native
bool SetStepZeroing (
int step);
125 proto native
bool StepZeroingUp ();
132 proto native
bool StepZeroingDown ();
138 proto native
void GetCameraPoint (out
vector pos, out
vector dir);
144 proto native
float GetZoomInit();
150 proto native
float GetZoomMin();
156 proto native
float GetZoomMax();
162 proto native
float GetZeroingDistanceZoomMin();
168 proto native
float GetZeroingDistanceZoomMax();
174 proto native
void SetZeroingClampDist(
float dist);
182 if (m_reddot_index == -1)
186 if (m_reddot_displayed)
188 if (m_optic_sight_texture !=
"")
189 opticsType.SetOptics2DTexture(m_reddot_index, m_optic_sight_texture);
190 if (m_optic_sight_material !=
"")
191 opticsType.SetOptics2DMaterial(m_reddot_index, m_optic_sight_material);
195 opticsType.SetOptics2DTexture(m_reddot_index,
"");
196 opticsType.SetOptics2DMaterial(m_reddot_index,
"");
203 return ItemOpticsType.Cast(GetInventoryItemType());
210 return type.IsUsingOptics2DModel();
220 if (!
GetGame().IsDedicatedServer())
228 if (!
GetGame().IsDedicatedServer())
236 if (GetCompEM() && GetCompEM().CanWork())
247 else if (!
IsWorking() && m_reddot_displayed)
255 super.OnWasAttached(parent, slot_id);
260 if (
Class.CastTo(wep,parent))
262 SetZeroingClampDist(wep.GetZeroingClamp(wep.GetCurrentMuzzle()));
268 super.OnWasDetached(parent, slot_id);
271 if (
PlayerBase.CastTo(player, GetHierarchyRootPlayer()))
273 player.SetReturnToOptics(
false);
279 if (
Class.CastTo(wep,parent))
281 SetZeroingClampDist(0.0);
287 super.OnInventoryExit(player);
292 playerPB.SetReturnToOptics(
false);
300 super.OnStoreSave(ctx);
302 ctx.Write(m_CurrentOpticMode);
307 if ( !super.OnStoreLoad(ctx,version) )
313 if ( version >= 126 )
315 if ( !ctx.Read(m_CurrentOpticMode) )
331 super.OnVariablesSynchronized();
333 if (m_CurrentOpticModeLocal != m_CurrentOpticMode)
336 m_CurrentOpticModeLocal = m_CurrentOpticMode;
347 path =
"cfgVehicles " +
GetType() +
" OpticsModelInfo";
360 m_reddot_index = GetHiddenSelectionIndex(
"reddot");
362 if (
GetGame().ConfigIsExisting(
path +
" opticSightTexture"))
364 GetGame().ConfigGetText(
path +
" opticSightTexture", temp);
365 m_optic_sight_texture = temp;
368 if (
GetGame().ConfigIsExisting(
path +
" opticSightMaterial"))
370 GetGame().ConfigGetText(
path +
" opticSightMaterial", temp);
371 m_optic_sight_material = temp;
380 if (
GetGame().IsDedicatedServer())
392 if (m_reddot_index == -1)
402 if (m_optic_sight_texture !=
"")
403 SetObjectTexture(m_reddot_index, m_optic_sight_texture);
404 if (m_optic_sight_material !=
"")
405 SetObjectMaterial(m_reddot_index, m_optic_sight_material);
409 SetObjectTexture(m_reddot_index,
"");
410 SetObjectMaterial(m_reddot_index,
"");
413 m_reddot_displayed = state;
421 m_isNVOptic = ConfigGetBool(
"NVOptic");
428 string path =
"cfgVehicles " +
GetType() +
" OpticsInfo";
435 fov_max =
GetGame().ConfigGetFloat(
path +
" opticsZoomMax");
446 string path =
"cfgVehicles " +
GetType() +
" OpticsInfo";
447 GetGame().ConfigGetFloatArray(
path +
" PPMaskProperties", mask_array);
448 GetGame().ConfigGetFloatArray(
path +
" PPLensProperties", lens_array);
449 blur_float =
GetGame().ConfigGetFloat(
path +
" PPBlurProperties");
454 string path =
"cfgVehicles " +
GetType() +
" OpticsInfo";
455 if (
GetGame().ConfigIsExisting(
path +
" nearPlaneDistanceOverride") )
468 if (
GetGame().ConfigIsExisting(
"cfgVehicles " +
GetType() +
" OpticsInfo PPDOFProperties"))
470 GetGame().ConfigGetFloatArray(
"cfgVehicles " +
GetType() +
" OpticsInfo PPDOFProperties", temp_array);
473 else if (
GetGame().ConfigIsExisting(
"cfgVehicles " +
GetType() +
" OpticsInfoWeaponOverride PPDOFProperties"))
475 GetGame().ConfigGetFloatArray(
"cfgVehicles " +
GetType() +
" OpticsInfoWeaponOverride PPDOFProperties", temp_array);
517 m_CurrentOpticMode = mode;
523 return m_CurrentOpticMode;
532 HideSelection(
"hide");
539 ShowSelection(
"hide");
545 return m_OpticsDOFProperties;
562 return m_nearplane_override;
567 string path =
"cfgVehicles " +
GetType() +
" OpticsInfo preloadOpticType";
573 m_2D_preload_type = type_2d;
593 GetInventory().CreateAttachment(
"Battery9V");
eBleedingSourceType GetType()
void AddAction(typename actionName)
Super root of all classes in Enforce script.
this is main camera class
void OnOpticModeChange()
optic-specific behaviour to be defined here (override)
void InitOpticsPP(out array< float > mask_array, out array< float > lens_array, out float blur_float)
initializes values for optics' post-processes
override void OnDebugSpawn()
bool IsUsingOptics2DModel()
Returns whether this ItemOptics uses the 2D optics model.
override void OnWorkStart()
int GetCurrentOpticMode()
ref array< float > GetOpticsPPLens()
override void OnStoreSave(ParamsWriteContext ctx)
bool AllowsDOF()
returns 'true' for non-magnifying optics
ref array< float > GetOpticsPPMask()
float GetNearPlaneValue()
void UpdateOpticsReddotVisibility()
void UpdateSelectionVisibility()
bool InitDOFAvailability()
optics with more than 1x zoom do not allow DOF changes
override void OnVariablesSynchronized()
override void SetActions()
bool InitOpticsDOFProperties(out array< float > temp_array)
Initializes DOF properties for optic's alternate ironsights (ACOG etc.)
ref array< float > GetOpticsDOF()
void SetCurrentOpticMode(int mode)
override void OnWasAttached(EntityAI parent, int slot_id)
override void OnInventoryExit(Man player)
void InitCameraOverrideProperties()
void ShowReddot(bool state)
ItemOpticsType GetItemOpticsType()
Returns the ItemOpticsType of this ItemOptics instance.
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWorkStop()
override void OnWasDetached(EntityAI parent, int slot_id)
Serialization general interface. Serializer API works with:
script counterpart to engine's class Weapon
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void DayZPlayerCameraOptics(DayZPlayer pPlayer, HumanInputController pInput)
proto native CGame GetGame()
override void SetTakeable(bool pState)