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,
"");
210 return type.IsUsingOptics2DModel();
225 if (!
g_Game.IsDedicatedServer())
233 if (!
g_Game.IsDedicatedServer())
241 if (GetCompEM() && GetCompEM().CanWork())
252 else if (!
IsWorking() && m_reddot_displayed)
260 super.OnWasAttached(parent, slot_id);
265 if (
Class.CastTo(wep,parent))
267 SetZeroingClampDist(wep.GetZeroingClamp(wep.GetCurrentMuzzle()));
273 super.OnWasDetached(parent, slot_id);
276 if (
PlayerBase.CastTo(player, GetHierarchyRootPlayer()))
278 player.SetReturnToOptics(
false);
284 if (
Class.CastTo(wep,parent))
286 SetZeroingClampDist(0.0);
292 super.OnInventoryExit(player);
297 playerPB.SetReturnToOptics(
false);
305 super.OnStoreSave(ctx);
307 ctx.Write(m_CurrentOpticMode);
312 if ( !super.OnStoreLoad(ctx,version) )
318 if ( version >= 126 )
320 if ( !ctx.Read(m_CurrentOpticMode) )
336 super.OnVariablesSynchronized();
338 if (m_CurrentOpticModeLocal != m_CurrentOpticMode)
341 m_CurrentOpticModeLocal = m_CurrentOpticMode;
352 path =
"cfgVehicles " +
GetType() +
" OpticsModelInfo";
365 m_reddot_index = GetHiddenSelectionIndex(
"reddot");
367 if (
g_Game.ConfigIsExisting(
path +
" opticSightTexture"))
369 g_Game.ConfigGetText(
path +
" opticSightTexture", temp);
370 m_optic_sight_texture = temp;
373 if (
g_Game.ConfigIsExisting(
path +
" opticSightMaterial"))
375 g_Game.ConfigGetText(
path +
" opticSightMaterial", temp);
376 m_optic_sight_material = temp;
385 if (
g_Game.IsDedicatedServer())
397 if (m_reddot_index == -1)
407 if (m_optic_sight_texture !=
"")
408 SetObjectTexture(m_reddot_index, m_optic_sight_texture);
409 if (m_optic_sight_material !=
"")
410 SetObjectMaterial(m_reddot_index, m_optic_sight_material);
414 SetObjectTexture(m_reddot_index,
"");
415 SetObjectMaterial(m_reddot_index,
"");
418 m_reddot_displayed = state;
426 m_isNVOptic = ConfigGetBool(
"NVOptic");
433 string path =
"cfgVehicles " +
GetType() +
" OpticsInfo";
440 fov_max =
g_Game.ConfigGetFloat(
path +
" opticsZoomMax");
451 string path =
"cfgVehicles " +
GetType() +
" OpticsInfo";
452 g_Game.ConfigGetFloatArray(
path +
" PPMaskProperties", mask_array);
453 g_Game.ConfigGetFloatArray(
path +
" PPLensProperties", lens_array);
454 blur_float =
g_Game.ConfigGetFloat(
path +
" PPBlurProperties");
459 string path =
"cfgVehicles " +
GetType() +
" OpticsInfo";
460 if (
g_Game.ConfigIsExisting(
path +
" nearPlaneDistanceOverride") )
473 if (
g_Game.ConfigIsExisting(
"cfgVehicles " +
GetType() +
" OpticsInfo PPDOFProperties"))
475 g_Game.ConfigGetFloatArray(
"cfgVehicles " +
GetType() +
" OpticsInfo PPDOFProperties", temp_array);
478 else if (
g_Game.ConfigIsExisting(
"cfgVehicles " +
GetType() +
" OpticsInfoWeaponOverride PPDOFProperties"))
480 g_Game.ConfigGetFloatArray(
"cfgVehicles " +
GetType() +
" OpticsInfoWeaponOverride PPDOFProperties", temp_array);
522 m_CurrentOpticMode = mode;
528 return m_CurrentOpticMode;
537 HideSelection(
"hide");
544 ShowSelection(
"hide");
550 return m_OpticsDOFProperties;
567 return m_nearplane_override;
572 string path =
"cfgVehicles " +
GetType() +
" OpticsInfo preloadOpticType";
578 m_2D_preload_type = type_2d;
598 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)
script counterpart to engine's class Weapon
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void DayZPlayerCameraOptics(DayZPlayer pPlayer, HumanInputController pInput)
Serializer ParamsReadContext
Serializer ParamsWriteContext
override void SetTakeable(bool pState)
StarlightOptic ItemOptics