Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_2DPIPSightsComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Weapon/Sights", description: "", color: "0 0 255 255")]
3 {
4 }
5 
7 enum SCR_EPIPZeroingType
8 {
9  EPZ_NONE = 0,
11  EPZ_CAMERA_TURN = 2
12 }
13 
14 //------------------------------------------------------------------------------------------------
15 class SCR_2DPIPSightsComponent : SCR_2DSightsComponent
16 {
17  // 2D -----------------------------
19  protected bool m_b2DIsEnabled;
20 
21  // PIP -----------------------------
22  [Attribute("{EF091399D840192D}UI/layouts/Sights/PictureInPictureSightsLayout.layout", UIWidgets.ResourcePickerThumbnail, "The layout used for the PIP component", params: "layout", category: "PiPSights")]
23  protected ResourceName m_sPIPLayoutResource;
24 
25  [Attribute("RTTexture0", UIWidgets.EditBox, "Name of RTTexture widget within provided layout\n", category: "PiPSights")]
26  protected string m_sRTTextureWidgetName;
27 
28  [Attribute("RenderTarget0", UIWidgets.EditBox, "Name of RenderTarget widget within provided layout\n", category: "PiPSights")]
29  protected string m_sRTargetWidgetName;
30 
31  [Attribute("8", UIWidgets.Slider, "Camera index used for this PIP component\n", params: "0 31 1", category: "PiPSights")]
32  protected int m_iCameraIndex;
33 
34  [Attribute("2", UIWidgets.Slider, "GUI widget index for this PIP component\n", category: "PiPSights")]
35  protected int m_iGuiIndex;
36 
37  [Attribute("21", UIWidgets.Slider, "Camera field of view used by this PIP component. Determines LOD used. Set to 0 to use Focus FOV.\n[°]", params: "0 89.99 0.01", category: "PiPSights")]
38  protected float m_fMainCameraFOV;
39 
40  [Attribute("0.2", UIWidgets.Slider, "Camera near clipping plane\n[m]", params: "0 1000 0.01", category: "PiPSights")]
41  protected float m_fNearPlane;
42 
43  [Attribute("0", UIWidgets.Slider, "Camera far clipping plane. Set to zero to match maximum view distance\n[m]", params: "0 10000 1", category: "PiPSights")]
44  protected float m_fFarPlane;
45 
46  // Point info?
47  [Attribute("1.0", UIWidgets.Slider, "Scale of resolution used by the PIP\n[x]", params: "0.1 1 0.1", category: "PiPSights")]
48  protected float m_fResolutionScale;
49 
50  [Attribute("{972DF18CB9BFCBD4}Common/Postprocess/HDR_ScopePiP.emat", UIWidgets.EditBox, "HDR material resource\n", params: "emat", category: "PiPSights")]
51  protected ResourceName m_rScopeHDRMatrial;
52 
53  // 0 = immediately when entering ADS camera, 1.0 = only after full blend
54  [Attribute("0.25", UIWidgets.Slider, "Percentage of camera transition at which sights activate\n[%]", params: "0.0 1.0 0.01", category: "PiPSights")]
55  protected float m_fADSActivationPercentagePIP;
56 
57  // 0 = immediately when leaving ADS camera, 1.0 = only after full blend
58  [Attribute("0.75", UIWidgets.Slider, "Percentage of camera transition at which sights deactivate\n[%]", params: "0.0 1.0 0.01", category: "PiPSights")]
59  protected float m_fADSDeactivationPercentagePIP;
60 
61  [Attribute("40", UIWidgets.Slider, "Vignette parallax angle scale, divided by objective FOV.\n[x]", params: "-100 100 0.1", category: "PiPSights-Parallax")]
62  protected float m_fVignetteParallaxScale;
63 
64  [Attribute("0.014", UIWidgets.Slider, "Optimal distance from scope, where no parallax distant effect is present\n[m]", params: "-0.2 0.2 0.001", category: "PiPSights-Parallax")]
65  protected float m_fCenterDistance;
66 
67  [Attribute("0.8", UIWidgets.Slider, "How the parallax is affected when the eye moves closer to scope\n[x]", params: "0 1 0.001", category: "PiPSights-Parallax")]
68  protected float m_fDistanceMoveNear;
69 
70  [Attribute("0.4", UIWidgets.Slider, "How the parallax is affected when the eye moves farther from scope\n[x]", params: "0 1 0.001", category: "PiPSights-Parallax")]
71  protected float m_fDistanceMoveFar;
72 
73  [Attribute("0.5", UIWidgets.Slider, "Basic value for simulating parallax effect\n", params: "0 2 0.001", category: "PiPSights-Parallax")]
74  protected float m_fBasicParallax;
75 
76  [Attribute("1.75", UIWidgets.Slider, "Max parallax value for simulating parallax effect\nShould be bigger than BasicParallax\n", params: "0 2 0.001", category: "PiPSights-Parallax")]
77  protected float m_fMaxParallax;
78 
79  [Attribute("0.0", UIWidgets.Slider, "Parallax axis offset in X\n[°]", params: "-90 90 0.001", category: "PiPSights-Parallax")]
80  protected float m_fCenterOffsetX;
81 
82  [Attribute("0.0", UIWidgets.Slider, "Parallax axis offset in Y\n[°]", params: "-90 90 0.001", category: "PiPSights-Parallax")]
83  protected float m_fCenterOffsetY;
84 
85  [Attribute("0.01", UIWidgets.Slider, "Radius of PIP scope ocular\n[m]", params: "0.001 1 0.0001", category: "PiPSights", precision: 5)]
86  protected float m_fScopeRadius;
87 
88  [Attribute("1.05", UIWidgets.Slider, "PIP reticle additional scale to compensate discrepancy between camera and reticle\n[x]", params: "0.01 10 0.00001", category: "PiPSights", precision: 5)]
89  protected float m_fReticlePIPScale;
90 
91  [Attribute("1.0", UIWidgets.Slider, "PIP objective inner edge. Should be lower than max\n[x]", params: "0.001 10 0.00001", category: "PiPSights-Parallax", precision: 5)]
92  protected float m_fObjectivePIPEdgeMin;
93 
94  [Attribute("1.05", UIWidgets.Slider, "PIP objective outer edge\[x]", params: "0.001 10 0.00001", category: "PiPSights-Parallax", precision: 5)]
95  protected float m_fObjectivePIPEdgeMax;
96 
97  [Attribute("{5366CEDE2A151631}Terrains/Common/Water/UnderWater/oceanUnderwater.emat", UIWidgets.ResourcePickerThumbnail, "Underwater postprocess material\n", params: "emat", category: "PiPSights")]
98  protected ResourceName m_sUnderwaterPPMaterial;
99 
100  protected int m_iLastProjectionFrame = -1;
101  protected vector m_vScreenScopeCenter;
102  protected float m_fScreenScopeRadiusSq;
103  protected float m_fReticleScale;
104  protected float m_fEdgeScale = 1;
105  protected float m_fParallaxX;
106  protected float m_fParallaxY;
107 
108  protected IEntity m_CurrentPlayable;
109 
111  protected ref Color m_cReticleColor = m_ReticleColor;
112 
118  bool IsScreenPositionInSights(vector screenPosition)
119  {
120  if (!m_PIPCamera || !IsSightADSActive()) // With no active camera or disabled sights, the point is never in PIP
121  return false;
122 
123  BaseWorld world = GetGame().GetWorld();
124  int index = world.GetFrameNumber();
125 
126  // Recalculate the projection data only once per frame, so we save some perf on huge queries
127  if (m_iLastProjectionFrame != index)
128  {
129  WorkspaceWidget workspaceWidget = GetGame().GetWorkspace();
130 
131  vector sightsRear = GetSightsRearPosition();
132  m_vScreenScopeCenter = workspaceWidget.ProjWorldToScreen(sightsRear, world);
133  m_vScreenScopeCenter[2] = 0.0;
134 
135  vector extent = workspaceWidget.ProjWorldToScreen(sightsRear + GetOwner().GetWorldTransformAxis(0) * m_fScopeRadius, world);
136  extent[2] = 0.0;
137 
138  const float invSqrt2 = 0.70710678118; // 1.0 / Math.Sqrt(2.0);
139  m_fScreenScopeRadiusSq = invSqrt2 * vector.DistanceSq(extent, m_vScreenScopeCenter);
140  m_iLastProjectionFrame = index;
141  }
142 
143  float screenDistanceSq = vector.DistanceSq(screenPosition, m_vScreenScopeCenter);
144  return screenDistanceSq < m_fScreenScopeRadiusSq;
145  }
146 
147  protected int m_iDisableVignetteFrames;
148 
150  protected ref Widget m_wPIPRoot;
151 
153  protected bool m_bPIPIsEnabled;
154  protected static int s_bIsPIPActive;
155 
157  protected RTTextureWidget m_wRenderTargetTextureWidget;
158 
160  protected RenderTargetWidget m_wRenderTargetWidget;
161 
163  protected SCR_PIPCamera m_PIPCamera;
164 
165  Material m_pMaterial;
166  int m_iVignetteCenterXIndex = -1;
167  int m_iVignetteCenterYIndex = -1;
168  int m_iVignettePowerIndex = -1;
169  int m_iLensDistortIndex = -1;
170  int m_iReticleOffsetXIndex = -1;
171  int m_iReticleOffsetYIndex = -1;
172  int m_iReticleColorIndex = -1;
173  int m_iReticleScaleIndex = -1;
174  int m_iEdgeMinIndex = -1;
175  int m_iEdgeMaxIndex = -1;
176  int m_iEdgeCenterXIndex = -1;
177  int m_iEdgeCenterYIndex = -1;
178 
179  //------------------------------------------------------------------------------------------------
183  SCR_PIPCamera GetPIPCamera()
184  {
185  return m_PIPCamera;
186  }
187 
188  //------------------------------------------------------------------------------------------------
192  int GetPIPCameraIndex()
193  {
194  return m_iCameraIndex;
195  }
196 
197  //------------------------------------------------------------------------------------------------
198  override float GetADSActivationPercentageScript()
199  {
200  if (SCR_Global.IsScope2DEnabled())
201  return super.GetADSActivationPercentageScript();
202 
203  return m_fADSActivationPercentagePIP;
204  }
205 
206  //------------------------------------------------------------------------------------------------
207  override float GetADSDeactivationPercentageScript()
208  {
209  if (SCR_Global.IsScope2DEnabled())
210  return super.GetADSDeactivationPercentageScript();
211 
212  return m_fADSDeactivationPercentagePIP;
213  }
214 
215  //------------------------------------------------------------------------------------------------
216  bool IsPIPEnabled()
217  {
218  return m_bPIPIsEnabled;
219  }
220 
221  //------------------------------------------------------------------------------------------------
225  static bool IsPIPActive()
226  {
227  return s_bIsPIPActive;
228  }
229 
230  //------------------------------------------------------------------------------------------------
231  float GetMainCameraFOV()
232  {
233  if (SCR_Global.IsScope2DEnabled())
234  return GetFOV();
235 
236  if (m_fMainCameraFOV > 0)
237  return m_fMainCameraFOV;
238 
239  m_fMainCameraFOV = CalculateZoomFOV(1);
240  return m_fMainCameraFOV;
241  }
242 
243  //------------------------------------------------------------------------------------------------
244  private bool IsLocalControlledEntity(IEntity pEntity, bool checkHierarchy = true)
245  {
246  if (!pEntity)
247  return false;
248 
249  // We make sure that we only perform any local items on our local controlled entity
250  auto pGame = GetGame();
251  if (!pGame)
252  return false;
253 
254  auto pPlayerController = pGame.GetPlayerController();
255  if (!pPlayerController)
256  return false;
257 
258  auto pControlledEntity = pPlayerController.GetControlledEntity();
259  if (!pControlledEntity)
260  return false;
261 
262  // Straight hit
263  if (pControlledEntity == pEntity)
264  return true;
265 
266  // No can do
267  if (!checkHierarchy)
268  return false;
269 
270  // Check up in hierarchy?
271  m_CurrentPlayable = pEntity.GetParent();
272 
273  while (m_CurrentPlayable)
274  {
275  if (pControlledEntity == m_CurrentPlayable)
276  return true;
277 
278  m_CurrentPlayable = m_CurrentPlayable.GetParent();
279  }
280 
281  return false;
282  }
283 
284  //------------------------------------------------------------------------------------------------
291  protected CameraBase CreateCamera(IEntity parent, vector position, vector angles, int cameraIndex, float fov, float nearPlane, float farPlane)
292  {
293  // Spawn camera
294  BaseWorld baseWorld = parent.GetWorld();
295 
296  // Spawn it close
297  EntitySpawnParams params = new EntitySpawnParams();
298  parent.GetWorldTransform(params.Transform);
299  SCR_PIPCamera pipCamera = SCR_PIPCamera.Cast(GetGame().SpawnEntity(SCR_PIPCamera, baseWorld, params));
300 
301  vector mat[4];
302  parent = GetCameraLocalTransform(mat);
303 
304  pipCamera.SetCameraIndex(m_iCameraIndex);
305  pipCamera.SetVerticalFOV(fov);
306  pipCamera.SetNearPlane(nearPlane);
307  pipCamera.SetFarPlane(farPlane);
308  pipCamera.ApplyProps(m_iCameraIndex);
309  baseWorld.SetCameraLensFlareSet(cameraIndex, CameraLensFlareSetType.FirstPerson, string.Empty);
310 
311  // Set camera to hierarchy
312  parent.AddChild(pipCamera, -1, EAddChildFlags.AUTO_TRANSFORM);
313  pipCamera.SetLocalTransform(mat);
314  pipCamera.UpdatePIPCamera(1.0);
315  return pipCamera;
316  }
317 
318  //------------------------------------------------------------------------------------------------
319  protected Widget CreateUI(string layout, string rtTextureName, string rtName, out RTTextureWidget RTTexture, out RenderTargetWidget RTWidget)
320  {
321  // Empty layout, cannot create any widget
322  if (layout == string.Empty)
323  return null;
324 
325  // Create layout
326  Widget root = GetGame().GetWorkspace().CreateWidgets(layout);
327 
328  // Layout was not created successfully
329  if (!root)
330  return null;
331 
332  // We dont have required RT widgets, delete layout and terminate
333  RTTexture = RTTextureWidget.Cast(root.FindAnyWidget(rtTextureName));
334  RTWidget = RenderTargetWidget.Cast(root.FindAnyWidget(rtName));
335  if (!RTTexture || !RTWidget)
336  {
337  root.RemoveFromHierarchy();
338  return null;
339  }
340 
341  return root;
342  }
343 
344  //------------------------------------------------------------------------------------------------
345  void SetPIPEnabled(bool enabled)
346  {
347  // disabled->enabled
348  // Create neccessary items
349  if (enabled && !m_bPIPIsEnabled)
350  {
351  m_iDisableVignetteFrames = 5;
352 
353  // Try to create UI for PIP,
354  // output params are either set to valid ones,
355  // or root itself is set to null and destroyed
356  if (!m_wPIPRoot || !m_wRenderTargetTextureWidget || !m_wRenderTargetWidget)
357  m_wPIPRoot = CreateUI(m_sPIPLayoutResource, m_sRTTextureWidgetName, m_sRTargetWidgetName, m_wRenderTargetTextureWidget, m_wRenderTargetWidget);
358 
359  if (!m_wPIPRoot)
360  {
361  Print("Could not create PIP layouts!", LogLevel.ERROR);
362  return;
363  }
364 
365  IEntity owner = GetOwner();
366 
367  // Create PIP camera
368  if (!m_PIPCamera)
369  {
370  // TODO: restart camera when view distance changes
371  float viewDistance = GetGame().GetViewDistance();
372  if (m_fFarPlane > 0)
373  viewDistance = Math.Min(viewDistance, m_fFarPlane);
374 
375  m_PIPCamera = SCR_PIPCamera.Cast(CreateCamera(owner, GetSightsFrontPosition(true) + m_vCameraOffset, m_vCameraAngles, m_iCameraIndex, GetFOV(), m_fNearPlane, viewDistance));
376  }
377 
378  if (!m_PIPCamera)
379  {
380  Print("Could not create PIP camera!", LogLevel.ERROR);
381  return;
382  }
383 
384  // Set camera index of render target widget
385  BaseWorld baseWorld = owner.GetWorld();
386  m_wRenderTargetWidget.SetWorld(baseWorld, m_iCameraIndex);
387 
388  // Set resolution scale
389  m_wRenderTargetWidget.SetResolutionScale(m_fResolutionScale, m_fResolutionScale);
390 
391  if (!owner.IsDeleted())
392  m_wRenderTargetTextureWidget.SetGUIWidget(owner, m_iGuiIndex);
393 
394  if (m_pMaterial)
395  {
396  GetGame().GetWorld().SetCameraPostProcessEffect(m_iCameraIndex, 10, PostProcessEffectType.HDR, m_rScopeHDRMatrial);
397  }
398 
399  if (m_sUnderwaterPPMaterial != string.Empty)
400  GetGame().GetWorld().SetCameraPostProcessEffect(m_iCameraIndex, 2, PostProcessEffectType.UnderWater, m_sUnderwaterPPMaterial);
401 
402  s_bIsPIPActive = true;
403  m_bPIPIsEnabled = true;
404  return;
405  }
406 
407  // enabled -> disabled
408  if (!enabled && m_bPIPIsEnabled)
409  {
410  Destroy();
411  s_bIsPIPActive = false;
412  m_bPIPIsEnabled = false;
413  return;
414  }
415  }
416 
417  //------------------------------------------------------------------------------------------------
418  protected void DestroyCamera(CameraBase camera)
419  {
420  if (camera)
421  {
422  IEntity cameraParent = camera.GetParent();
423  if (cameraParent)
424  cameraParent.RemoveChild(camera);
425 
426  camera.GetWorld().SetCameraPostProcessEffect(m_iCameraIndex, 10, PostProcessEffectType.HDR, string.Empty);
427  camera.GetWorld().SetCameraPostProcessEffect(m_iCameraIndex, 2, PostProcessEffectType.UnderWater, string.Empty);
428  camera.GetWorld().SetCameraLensFlareSet(m_iCameraIndex, CameraLensFlareSetType.None, string.Empty);
429 
430  delete camera;
431  }
432  }
433 
434  //------------------------------------------------------------------------------------------------
435  // Destroy everything this component created during its lifetime
436  protected void Destroy()
437  {
438  IEntity owner = GetOwner();
439  if (m_wRenderTargetTextureWidget && owner && !owner.IsDeleted())
440  m_wRenderTargetTextureWidget.SetGUIWidget(owner, -1);
441 
442  if (m_wPIPRoot)
443  {
444  m_wPIPRoot.RemoveFromHierarchy();
445  m_wPIPRoot = null;
446  }
447 
448  DestroyCamera(m_PIPCamera);
449  }
450 
451  //------------------------------------------------------------------------------------------------
453  protected override void EnableReticleIllumination(bool enable)
454  {
455  super.EnableReticleIllumination(enable);
456 
457  if (m_bHasIllumination && enable)
458  m_cReticleColor = GetReticleIlluminationColor();
459  else
460  m_cReticleColor = GetReticleColor();
461  }
462 
463  //------------------------------------------------------------------------------------------------
464  protected override void OnSightADSActivated()
465  {
466  // A component without an owner shouldnt exist
467  IEntity owner = GetOwner();
468  if (!owner)
469  return;
470 
471  // We make sure that we only perform any local items on our local controlled entity
472  if (!IsLocalControlledEntity(owner))
473  return;
474 
475  // Set fov TODO@AS: Copied from base?
476  if (!m_SightsFovInfo)
477  {
479  SetupFovInfo();
480  }
481 
482  // Initialize to current zero value
483  m_fCurrentReticleOffsetY = GetReticleOffsetYTarget();
484 
485  bool scope2d = SCR_Global.IsScope2DEnabled();
486  if (!scope2d)
487  {
488  m_iDisableVignetteFrames = 15;
489  SetPIPEnabled(true);
490 
491  if (m_pMaterial)
492  UpdateScopeMaterial();
493 
494  // Switching input
495  if (m_SightsFovInfo.GetStepsCount() > 1)
496  GetGame().GetInputManager().AddActionListener(ACTION_WHEEL, EActionTrigger.VALUE, SelectNextZoomLevel);
497 
498  // Setup illumination
499  if (m_bHasIllumination)
500  {
501  GetGame().GetInputManager().AddActionListener(ACTION_ILLUMINATION, EActionTrigger.DOWN, ToggleIllumination);
502  EnableReticleIllumination(m_bIsIlluminationOn);
503  }
504  }
505 
506  s_OnSightsADSChanged.Invoke(true, m_fMainCameraFOV);
507 
508  if (scope2d)
509  {
510  if (m_bPIPIsEnabled)
511  {
512  SetPIPEnabled(false);
513  }
514 
515  m_b2DIsEnabled = true;
516  super.OnSightADSActivated();
517  }
518  else if (!scope2d && m_b2DIsEnabled)
519  {
520  m_b2DIsEnabled = false;
521  super.OnSightADSDeactivated();
522  }
523  }
524 
525  //------------------------------------------------------------------------------------------------
526  protected override void OnSightADSDeactivated()
527  {
528  // A component without an owner shouldnt exist
529  IEntity owner = GetOwner();
530  if (!owner)
531  return;
532 
533  if (!m_CurrentPlayable)
534  {
535  if (IsPIPEnabled())
536  {
537  // Make sure to revert overlay camera to default
538  if (m_PIPCamera)
539  {
540  auto camMgr = GetGame().GetCameraManager();
541  if (camMgr && camMgr.GetOverlayCamera() == m_PIPCamera)
542  camMgr.SetOverlayCamera(null);
543  }
544 
545  SetPIPEnabled(false);
546  }
547 
548  return;
549  }
550 
551  s_OnSightsADSChanged.Invoke(false, 0);
552 
553  bool scope2d = SCR_Global.IsScope2DEnabled();
554  if (scope2d)
555  {
556  super.OnSightADSDeactivated();
557  m_b2DIsEnabled = false;
558  }
559  else
560  {
561  SetPIPEnabled(false);
562  GetGame().GetInputManager().RemoveActionListener(ACTION_ILLUMINATION, EActionTrigger.DOWN, ToggleIllumination);
563  }
564 
565  // Removing switching input
566  GetGame().GetInputManager().RemoveActionListener(ACTION_WHEEL, EActionTrigger.VALUE, SelectNextZoomLevel);
567  GetGame().GetInputManager().RemoveActionListener(ACTION_ILLUMINATION, EActionTrigger.DOWN, ToggleIllumination);
568  }
569 
570  //------------------------------------------------------------------------------------------------
571  void UpdateCamera(float timeSlice)
572  {
573  if (!m_PIPCamera)
574  return;
575 
576  if (m_fScopeRadius <= 0)
577  return;
578 
579  // Compute FOV scale based on radius of the scope
580  CameraManager cameraManager = GetGame().GetCameraManager();
581  if (!cameraManager)
582  return;
583 
584  CameraBase mainCamera = cameraManager.CurrentCamera();
585  if (!mainCamera)
586  return;
587 
588  vector cameraMat[4];
589  mainCamera.GetLocalTransform(cameraMat);
590  vector localCameraPosition = cameraMat[3]; // Camera's position in character's model space.
591 
592  vector parentToLocalMat[4];
593  GetParentToLocalTransform(parentToLocalMat, mainCamera.GetParent());
594  localCameraPosition = localCameraPosition.Multiply4(parentToLocalMat); // Camera's position in our local space.
595 
596  vector pipSurfaceCenter = GetSightsRearPosition(true);
597  float distance = vector.Distance(pipSurfaceCenter, localCameraPosition);
598  if (distance == 0)
599  return;
600 
601  // Get base FOV for camera, zoom levels can vary
602  float fov;
603  SightsFOVInfo fovInfo = GetFOVInfo();
604  if (fovInfo)
605  {
606  fov = fovInfo.GetFOV();
607  SCR_CharacterCameraHandlerComponent.SetOverlayCameraFOV(fov);
608  }
609  else
610  {
611  fov = mainCamera.GetVerticalFOV();
612  }
613 
614  // Account for distance of camera to scope and its diameter
615  float scopeSize = Math.Atan2(m_fScopeRadius * 2, distance) * Math.RAD2DEG;
616  float screenPortion = scopeSize / mainCamera.GetVerticalFOV();
617  float currentFOV = m_PIPCamera.GetVerticalFOV();
618  bool fovChanged = !float.AlmostEqual(fov * screenPortion, currentFOV, currentFOV * 0.005);
619 
620  // Smooth adjustment for variable FOV sights
621  SCR_BaseVariableSightsFOVInfo variableSights = SCR_BaseVariableSightsFOVInfo.Cast(fovInfo);
622  if (variableSights && !fovChanged)
623  fovChanged = variableSights.IsAdjusting();
624 
625  if (fovChanged)
626  {
627  m_PIPCamera.SetVerticalFOV(fov * screenPortion);
628 
629  // Adjust objective edge field of view
630  if (variableSights)
631  m_fEdgeScale = fov / variableSights.GetBaseFOV();
632  }
633 
634  if (fovChanged && m_fReticleAngularSize != 0)
635  {
636  // Compute reticle base FOV once to be scaled with screenPortion
637  if (m_fReticleBaseZoom > 0)
638  m_fReticleBaseZoom = -CalculateZoomFOV(m_fReticleBaseZoom);
639 
640  float fovReticle;
641  if (m_fReticleBaseZoom == 0)
642  fovReticle = fov;
643  else if (m_fReticleBaseZoom < 0)
644  fovReticle = -m_fReticleBaseZoom;
645 
646  if (fovReticle > 0)
647  m_fReticleScale = fovReticle * screenPortion * m_fReticlePortion / m_fReticleAngularSize;
648  }
649 
650  // Get local tm in relation to actual parent
651  vector mat[4];
652  GetCameraLocalTransform(mat);
653 
654  // Compute direction to center of ocular
655  // Based on eye position to avoid constant errors in case of inaccurate placement of rear sight and eye position
656  vector sightsTransform[4];
657  GetSightsTransform(sightsTransform, true);
658 
659  vector parallaxPoint = sightsTransform[3] + sightsTransform[2] * distance;
660  vector parallaxDirection = (parallaxPoint - localCameraPosition).Normalized();
661  vector angles = SCR_Math3D.FixEulerVector180(parallaxDirection.VectorToAngles());
662 
663  // Parallax offset
664  angles += Vector(m_fCenterOffsetX, m_fCenterOffsetY, 0);
665 
666  // Scale parallax angle with apparent FOV
667  angles *= fov / mainCamera.GetVerticalFOV();
668 
669  // modify camera, reticle and objective with the same angles
670  m_fParallaxX = -angles[0];
671  m_fParallaxY = angles[1];
672 
673  // Modify camera with same angles as reticle
674  vector parallax[4];
675  Math3D.AnglesToMatrix(angles, parallax);
676  Math3D.MatrixMultiply3(mat, parallax, mat);
677 
678  // Apply zero angles to default rot
679  m_PIPCamera.SetLocalTransform(mat);
680 
681  // Finally update camera props
682  m_PIPCamera.UpdatePIPCamera(timeSlice);
683  }
684 
685  //------------------------------------------------------------------------------------------------
686  void UpdateHDR()
687  {
688  int mainCameraIndex = 0;
689  CameraManager manager = GetGame().GetCameraManager();
690  if (manager)
691  {
692  CameraBase cam = manager.CurrentCamera();
693  if (cam)
694  mainCameraIndex = cam.GetCameraIndex();
695  }
696  //don't forget to disable preexposure on scope material !
697  BaseWorld world = GetOwner().GetWorld();
698  float hdrBrightness = world.GetCameraHDRBrightness(mainCameraIndex);
699  world.SetCameraHDRBrightness(m_iCameraIndex, hdrBrightness);
700  }
701 
702  //------------------------------------------------------------------------------------------------
703  void UpdateScopeMaterial()
704  {
705  if (m_iDisableVignetteFrames > 0)
706  {
707  m_pMaterial.SetParamByIndex(m_iVignetteCenterXIndex, 0);
708  m_pMaterial.SetParamByIndex(m_iVignetteCenterYIndex, 0);
709  m_pMaterial.SetParamByIndex(m_iVignettePowerIndex, 2);
710 
711  m_iDisableVignetteFrames--;
712  return;
713  }
714 
715  ChimeraCharacter character = ChimeraCharacter.Cast(GetGame().GetPlayerController().GetControlledEntity());
716  if (!character)
717  return;
718 
719  CharacterControllerComponent controller = character.GetCharacterController();
720  if (!controller)
721  return;
722 
723  BaseWeaponManagerComponent weaponManager = controller.GetWeaponManagerComponent();
724  if (!weaponManager)
725  return;
726 
727  CameraManager cameraManager = GetGame().GetCameraManager();
728  if (!cameraManager)
729  return;
730 
731  CameraBase mainCamera = cameraManager.CurrentCamera();
732  if (!mainCamera)
733  return;
734 
735  //main camera matrix in local coordinates
736  vector mainCam[4];
737  mainCamera.GetLocalTransform(mainCam);
738 
739  //sights matrix in local coordinates
740  vector sightsLSCam[4];
741  float fov;
742  weaponManager.GetCurrentSightsCameraTransform(sightsLSCam, fov);
743 
744  //position of scope in main camera space
745  vector scopePosCam = sightsLSCam[3] - mainCam[3];
746 
747  //vectors
748  vector scopeFwd = sightsLSCam[2];//m_pOwner.GetWorldTransformAxis(2);
749  vector camFwd = mainCam[2];//m_PIPCamera.GetWorldTransformAxis(2);
750 
751  //Print(scopeFwd);
752  //Print(camFwd);
753 
754  //project to reticle plane at scopePosCam, plane = n*P + d = 0 -> scopeFwd dot scopePosLS + d = 0
755  //ray = C + s*t = camPos + camFwd*t
756  // t = (n*P - n*C) / (n*s)
757  //camPos is zero in this case
758  float ns = vector.Dot(camFwd, scopeFwd);
759  float nP = vector.Dot(scopePosCam, scopeFwd);
760 
761  float t = nP/ns;
762  vector projP = camFwd*t;
763 
764  vector locPos = scopePosCam - projP;
765 
766  //final move of vignette
767  // float centerX = locPos[0]*m_fProjectionDifferenceScale + m_fCenterOffsetX;
768  // float centerY = locPos[1]*m_fProjectionDifferenceScale + m_fCenterOffsetY;
769 
770  //distance from center distance - base of the eye pos from the projection plane
771  //TODO: t is for ARTII weapon negative !
772  float distance = Math.AbsFloat(t) - m_fCenterDistance;
773 
774  //change some material setting based on parameters
775  float vignettePower = 0;
776  //float lensPower = 0;
777 
778  //bigger power = much faster change with distance
779  float distancePower;
780  if (distance > 0)
781  {
782  //when we are farther to scope
783  distancePower = m_fDistanceMoveFar;
784  }
785  else
786  {
787  //when we are closer to scope
788  distancePower = m_fDistanceMoveNear;
789  //lensPower = -5.5;
790  }
791 
792  //stronger at beginning then slower -> some power function, log2 as Math from some reason doesn't contain power function
793  float fc = 1 - 1 /(Math.Log2(distancePower*Math.AbsFloat(distance) + 2));
794 
795  //max vignette power is 2, let a little opened
796  vignettePower = Math.Clamp(fc* 100, m_fBasicParallax, m_fMaxParallax);
797 
798  //how is it with lens distortion? now at zero is the -5.5
799  //lensPower = lensPower*Math.Clamp(-distance/m_fCenterDistance, 0, 5);
800 
801 
802  //modify vignete power also by distance from scope center
803  //locPos[2] = 0;
804  //const float ProjectionCenterDistanceModif = 140.0;
805  //vignettePower += locPos.Length()*ProjectionCenterDistanceModif;
806 
807  //Print(centerX);
808  //Print(centerY);
809  //Print(vignettePower);
810 
811  //centerX = Math.Clamp(centerX, -4, 4);
812  //centerY = Math.Clamp(centerY, -4, 4);
813 
814  // All effects are relative to actual FOV of the PIP surface
815  float pipFOV = m_PIPCamera.GetVerticalFOV();
816 
817  // Vignette
818  float vignetteParallaxScale;
819  if (m_fObjectiveFov > 0)
820  vignetteParallaxScale = m_fVignetteParallaxScale / (m_fObjectiveFov * m_fObjectiveScale);
821 
822  m_pMaterial.SetParamByIndex(m_iVignetteCenterXIndex, -m_fParallaxX * vignetteParallaxScale / pipFOV);
823  m_pMaterial.SetParamByIndex(m_iVignetteCenterYIndex, -m_fParallaxY * vignetteParallaxScale / pipFOV);
824  m_pMaterial.SetParamByIndex(m_iVignettePowerIndex, vignettePower);
825 
826  // Objective edge
827  m_pMaterial.SetParamByIndex(m_iEdgeCenterXIndex, m_fParallaxX * m_fReticlePIPScale / pipFOV);
828  m_pMaterial.SetParamByIndex(m_iEdgeCenterYIndex, m_fParallaxY * m_fReticlePIPScale / pipFOV);
829  float edgeSize = m_fObjectiveFov * m_fObjectiveScale * m_fEdgeScale / pipFOV;
830  m_pMaterial.SetParamByIndex(m_iEdgeMinIndex, 0.5 * m_fReticlePIPScale * edgeSize * edgeSize * m_fObjectivePIPEdgeMin);
831  m_pMaterial.SetParamByIndex(m_iEdgeMaxIndex, 0.5 * m_fReticlePIPScale * edgeSize * edgeSize * m_fObjectivePIPEdgeMax);
832 
833  // Reticle
834  m_pMaterial.SetParamByIndex(m_iReticleScaleIndex, m_fReticleScale / m_fReticlePIPScale);
835  m_pMaterial.SetParamByIndex(m_iReticleOffsetXIndex, m_fReticleScale * (m_fParallaxX + m_fReticleOffsetX) / pipFOV);
836  m_pMaterial.SetParamByIndex(m_iReticleOffsetYIndex, m_fReticleScale * (m_fParallaxY + m_fCurrentReticleOffsetY) / pipFOV);
837 
838  // Reticle color
839  float reticleRGBA[4] = {m_cReticleColor.R(), m_cReticleColor.G(), m_cReticleColor.B(), m_cReticleColor.A()};
840  m_pMaterial.SetParamByIndex(m_iReticleColorIndex, reticleRGBA);
841 
842  //m_pMaterial.SetParamByIndex(m_iLensDistortIndex, lensPower); // disabled for now, set in material directly
843  }
844 
845 
846  //------------------------------------------------------------------------------------------------
847  protected override void OnSightADSPostFrame(IEntity owner, float timeSlice)
848  {
849  super.OnSightADSPostFrame(owner, timeSlice);
850 
851 
852  // Before any updates make sure that we are in target state
853  bool use2D = SCR_Global.IsScope2DEnabled();
854  if ((m_bPIPIsEnabled && use2D) || (!m_bPIPIsEnabled && !use2D))
855  {
856  // Reactivate on change
859  }
860 
861  if (m_bPIPIsEnabled)
862  {
863  UpdateCamera(timeSlice);
864  UpdateHDR();
865 
866  if (m_pMaterial && m_PIPCamera)
867  UpdateScopeMaterial();
868  }
869 
870  #ifdef ENABLE_DIAG
871  if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_WEAPONS_PIP_SIGHTS))
872  DrawDiagWindow();
873  #endif
874  }
875 
876  //------------------------------------------------------------------------------------------------
877  protected override void OnInit(IEntity owner)
878  {
879  super.OnInit(owner);
880 
881  if (m_rScopeHDRMatrial.IsEmpty())
882  Print("Scope HDR material is empty!", LogLevel.WARNING);
883 
884  ResourceName mat = m_rScopeHDRMatrial;
885  m_pMaterial = Material.GetOrLoadMaterial(mat, 0);
886 
887  if (m_pMaterial)
888  {
889  m_iVignetteCenterXIndex = m_pMaterial.GetParamIndex("VignetteCenterX");
890  m_iVignetteCenterYIndex = m_pMaterial.GetParamIndex("VignetteCenterY");
891  m_iVignettePowerIndex = m_pMaterial.GetParamIndex("Vignette");
892  m_iLensDistortIndex = m_pMaterial.GetParamIndex("LensDistort");
893  m_iReticleOffsetXIndex = m_pMaterial.GetParamIndex("ReticleOffsetX");
894  m_iReticleOffsetYIndex = m_pMaterial.GetParamIndex("ReticleOffsetY");
895  m_iReticleColorIndex = m_pMaterial.GetParamIndex("ReticleColor");
896  m_iReticleScaleIndex = m_pMaterial.GetParamIndex("ReticleScale");
897  m_iEdgeMinIndex = m_pMaterial.GetParamIndex("EdgeMin");
898  m_iEdgeMaxIndex = m_pMaterial.GetParamIndex("EdgeMax");
899  m_iEdgeCenterXIndex = m_pMaterial.GetParamIndex("EdgeCenterX");
900  m_iEdgeCenterYIndex = m_pMaterial.GetParamIndex("EdgeCenterY");
901  }
902  else
903  {
904  Print("Cannot initialize PiP HDR PP !", LogLevel.ERROR);
905  }
906  }
907 
908 
909  //------------------------------------------------------------------------------------------------
910  protected override void ApplyRecoilToCamera(inout vector pOutCameraTransform[4], vector aimModAngles)
911  {
912  if (m_bPIPIsEnabled)
913  return;
914 
915  vector weaponAnglesMat[3];
916  Math3D.AnglesToMatrix(aimModAngles, weaponAnglesMat);
917  Math3D.MatrixMultiply3(pOutCameraTransform, weaponAnglesMat, pOutCameraTransform);
918  }
919 
920  //------------------------------------------------------------------------------------------------
921  protected override bool CanFreelook()
922  {
923  if (m_bPIPIsEnabled)
924  return true;
925 
926  return super.CanFreelook();
927  }
928 
929  #ifdef WORKBENCH
930  //------------------------------------------------------------------------------------------------
931  protected override void _WB_AfterWorldUpdate(IEntity owner, float timeSlice)
932  {
933  const ShapeFlags shapeFlags = ShapeFlags.ONCE | ShapeFlags.NOZBUFFER | ShapeFlags.TRANSP | ShapeFlags.DOUBLESIDE | ShapeFlags.NOOUTLINE;
934  const float axisLength = 0.1;
935 
936  vector ownerTransform[4];
937  owner.GetWorldTransform(ownerTransform);
938 
939  vector objectiveTransform[4];
940  Math3D.AnglesToMatrix(m_vCameraAngles, objectiveTransform);
941  Math3D.MatrixMultiply3(objectiveTransform, ownerTransform, objectiveTransform);
942  objectiveTransform[3] = (GetSightsFrontPosition(true) + m_vCameraOffset).Multiply4(ownerTransform);
943 
944  vector objectiveSide = objectiveTransform[0];
945  vector objectiveUp = objectiveTransform[1];
946  vector objectiveForward = objectiveTransform[2];
947  vector objectiveCenter = objectiveTransform[3];
948 
949  Shape rightArrow = Shape.CreateArrow(objectiveCenter, objectiveCenter + objectiveSide * axisLength, 0.01, Color.DARK_RED, shapeFlags);
950  Shape upArrow = Shape.CreateArrow(objectiveCenter, objectiveCenter + objectiveUp * axisLength, 0.01, Color.DARK_GREEN, shapeFlags);
951  Shape fwdArrow = Shape.CreateArrow(objectiveCenter, objectiveCenter + objectiveForward * axisLength, 0.01, Color.DARK_BLUE, shapeFlags);
952 
953  // Flip the transform for objective circle drawing
954  objectiveTransform[1] = objectiveForward;
955  objectiveTransform[2] = objectiveUp;
956  objectiveTransform[3] = objectiveCenter;
957  SCR_Shape.DrawCircle(objectiveTransform, m_fScopeRadius, Color.DARK_RED, COLOR_YELLOW_A, shapeFlags);
958 
959  // Draw ocular circle
960  vector ocularTransform[4];
961  ocularTransform[0] = ownerTransform[0];
962  ocularTransform[1] = ownerTransform[2];
963  ocularTransform[2] = ownerTransform[1];
964  ocularTransform[3] = GetSightsRearPosition(true).Multiply4(ownerTransform);
965 
966  SCR_Shape.DrawCircle(ocularTransform, m_fScopeRadius, Color.DARK_RED, COLOR_YELLOW_A, shapeFlags);
967 
968  // Draw ocular cross
969  vector ocularHorizontal[2];
970  vector ocularSide = ownerTransform[0] * m_fScopeRadius;
971  ocularHorizontal[0] = ocularTransform[3] + ocularSide;
972  ocularHorizontal[1] = ocularTransform[3] - ocularSide;
973 
974  vector ocularVertical[2];
975  vector ocularUp = ownerTransform[1] * m_fScopeRadius;
976  ocularVertical[0] = ocularTransform[3] - ocularUp;
977  ocularVertical[1] = ocularTransform[3] + ocularUp;
978 
979  Shape.CreateLines(Color.DARK_RED, shapeFlags, ocularHorizontal, 2);
980  Shape.CreateLines(Color.DARK_RED, shapeFlags, ocularVertical, 2);
981 
982  // Draw eye position
983  vector eyeTransform[4]
984  GetSightsTransform(eyeTransform);
985  Shape.CreateArrow(eyeTransform[3], ocularTransform[3], m_fScopeRadius* 0.3, Color.DARK_CYAN, shapeFlags);
986  Shape.CreateSphere(Color.DARK_CYAN, shapeFlags, eyeTransform[3], 0.001);
987  }
988  #endif
989 
990  #ifdef ENABLE_DIAG
991  protected static bool s_PIPDiagRegistered;
992 
993  //------------------------------------------------------------------------------------------------
994  protected void InputFloatClamped(inout float value, string label, float min, float max, int pxWidth = 100)
995  {
996  DbgUI.InputFloat(label, value, pxWidth);
997  value = Math.Clamp(value, min, max);
998  }
999 
1000  //------------------------------------------------------------------------------------------------
1001  protected void DrawDiagWindow()
1002  {
1003  DbgUI.Begin("2DPIPSights");
1004  {
1005  InputFloatClamped(m_fCenterDistance, "m_fCenterDistance", -0.2, 0.2);
1006  InputFloatClamped(m_fDistanceMoveNear, "m_fDistanceMoveNear", 0.0, 1.0);
1007  InputFloatClamped(m_fDistanceMoveFar, "m_fDistanceMoveFar", 0.0, 1.0);
1008  InputFloatClamped(m_fBasicParallax, "m_fBasicParallax", 0.0, 2.0);
1009  InputFloatClamped(m_fMaxParallax, "m_fMaxParallax", 0.0, 2.0);
1010  InputFloatClamped(m_fCenterOffsetX, "m_fCenterOffsetX", -90.0, 90.0);
1011  InputFloatClamped(m_fCenterOffsetY, "m_fCenterOffsetY", -90.0, 90.0);
1012  InputFloatClamped(m_fCurrentCameraPitch, "m_fCurrentCameraPitch", -90.0, 90.0);
1013  InputFloatClamped(m_fScopeRadius, "m_fScopeRadius", -90.0, 90.0);
1014  InputFloatClamped(m_fReticlePIPScale, "m_fReticlePIPScale", 0.01, 100.0);
1015  InputFloatClamped(m_fObjectivePIPEdgeMin, "m_fObjectivePIPEdgeMin", 0.0, 10.0);
1016  InputFloatClamped(m_fObjectivePIPEdgeMax, "m_fObjectivePIPEdgeMax", 0.0, 10.0);
1017  InputFloatClamped(m_fVignetteParallaxScale, "m_fVignetteParallaxScale", -100.0, 100.0);
1018  }
1019  DbgUI.End();
1020  }
1021  #endif
1022 
1023  //------------------------------------------------------------------------------------------------
1025  void SCR_2DPIPSightsComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
1026  {
1027  #ifdef ENABLE_DIAG
1028  if (!s_PIPDiagRegistered)
1029  {
1030  DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_WEAPONS_PIP_SIGHTS,"","Show PIP settings diag","Weapons");
1031  s_PIPDiagRegistered = true;
1032  }
1033  #endif
1034  }
1035 
1036  //------------------------------------------------------------------------------------------------
1038  void ~SCR_2DPIPSightsComponent()
1039  {
1040  Destroy();
1041  if (m_pMaterial)
1042  {
1043  m_pMaterial.Release();
1044  m_pMaterial = null;
1045  }
1046 
1047  /*
1048  This should prevent some static leakness.
1049  */
1050  if (IsPIPEnabled())
1051  SetPIPEnabled(false);
1052  }
1053 }
GetReticleOffsetYTarget
protected override float GetReticleOffsetYTarget()
Definition: SCR_2DSightsComponent.c:353
EPZ_NONE
SCR_2DPIPSightsComponentClass EPZ_NONE
Defines different means of adjusting zeroing for PIP sights.
SpawnEntity
protected IEntity SpawnEntity(ResourceName entityResourceName, notnull IEntity slotOwner)
Definition: SCR_CatalogEntitySpawnerComponent.c:1008
OnSightADSPostFrame
event void OnSightADSPostFrame(IEntity owner, float timeSlice)
Definition: SCR_2DSightsComponent.c:192
ToggleIllumination
protected void ToggleIllumination(float value, EActionTrigger trigger)
Action for toggling illumination.
Definition: SCR_2DSightsComponent.c:320
SCR_2DPIPSightsComponentClass
Definition: SCR_2DPIPSightsComponent.c:2
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
OnSightADSActivated
event void OnSightADSActivated()
Called every time the sight is activated.
Definition: SCR_2DSightsComponent.c:40
SetupFovInfo
protected void SetupFovInfo()
Definition: SCR_2DSightsComponent.c:204
SelectNextZoomLevel
protected void SelectNextZoomLevel(float value)
Move zoom level up and down based on mouse wheel value.
Definition: SCR_2DSightsComponent.c:269
Destroy
override bool Destroy()
Definition: SCR_EditableGroupComponent.c:460
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetSightsFrontPosition
proto external vector GetSightsFrontPosition(bool localSpace=false)
GetSightsTransform
proto external bool GetSightsTransform(out vector transform[4], bool localSpace=false)
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
SCR_PIPCamera
enum EManualCameraFlag SCR_PIPCamera
SCR_Math3D
Contains various scripted 3D math functions.
Definition: SCR_Math3D.c:2
GetSightsRearPosition
proto external vector GetSightsRearPosition(bool localSpace=false)
IsSightADSActive
proto external bool IsSightADSActive()
SCR_SightsZoomFOVInfo
Definition: SCR_SightsZoomFOVInfo.c:6
Attribute
typedef Attribute
Post-process effect of scripted camera.
distance
float distance
Definition: SCR_DestructibleTreeV2.c:29
GetADSActivationPercentageScript
event float GetADSActivationPercentageScript()
Called to get the ADS percentage when the sights go active.
Definition: ScriptedSightsComponent.c:34
CanFreelook
override bool CanFreelook()
Definition: SCR_2DSightsComponent.c:148
GetFOV
proto external float GetFOV()
SightsFOVInfo
Definition: SightsFOVInfo.c:11
EPZ_RETICLE_OFFSET
SCR_2DPIPSightsComponentClass EPZ_RETICLE_OFFSET
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
SCR_Shape
Definition: SCR_Shape.c:1
SCR_BaseVariableSightsFOVInfo
Definition: SCR_BaseVariableSightsFOVInfo.c:1
GetControlledEntity
SCR_EditableEntityComponent GetControlledEntity()
Returns the controlled entity or null if none.
Definition: SCR_EditablePlayerDelegateComponent.c:86
layout
UI layouts HUD CampaignMP CampaignMainHUD layout
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:20
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_Global
Definition: Functions.c:6
m_SightsFovInfo
protected SCR_SightsZoomFOVInfo m_SightsFovInfo
Definition: SCR_2DSightsComponent.c:37
GetFOVInfo
proto external SightsFOVInfo GetFOVInfo()
ApplyRecoilToCamera
protected override void ApplyRecoilToCamera(inout vector pOutCameraTransform[4], vector aimModAngles)
Definition: SCR_2DSightsComponent.c:154
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
GetADSDeactivationPercentageScript
event float GetADSDeactivationPercentageScript()
Called to get the ADS percentage when the sights go inactive.
Definition: ScriptedSightsComponent.c:36
OnSightADSDeactivated
event void OnSightADSDeactivated()
Called every time the sight is deactivated.
Definition: SCR_2DSightsComponent.c:117
OnInit
override protected void OnInit(IEntity owner)
Definition: SCR_CharacterCommandHandler_Tests.c:523
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition: DebugMenuID.c:3
position
vector position
Definition: SCR_DestructibleTreeV2.c:30
SCR_2DSightsComponentClass
Definition: SCR_2DSightsComponent.c:2
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180