Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
CharacterCameraBinoculars.c
Go to the documentation of this file.
2{
3 // ! This is just a prototype functionality for binocs, should be moved to sightscomponent when possible
4
5 protected float m_fBinocFOV;
6
7 protected SCR_BinocularsComponent m_binoculars;
9 protected IEntity m_ePlayer;
10
11 //-----------------------------------------------------------------------------
12 // constructor
14 {
15 }
16
17 //-----------------------------------------------------------------------------
18 override void OnActivate(ScriptedCameraItem pPrevCamera, ScriptedCameraItemResult pPrevCameraResult)
19 {
20 super.OnActivate(pPrevCamera, pPrevCameraResult);
21
23 if (!m_ePlayer)
24 return;
25
27
28 if (!m_Optics)
29 {
30 Print("Optics wasn't found in binoculars!", LogLevel.WARNING);
31 return;
32 }
33
34 // Getting optics variables
35 m_fBinocFOV = m_Optics.GetFovZoomed();
36 }
37
38 //------------------------------------------------------------------------------------------------
43 {
44 // Finding gadget manager
46 if (!gadgetManager)
47 return null;
48
49 // Getting binoculars componenet
50 SCR_BinocularsComponent binoculars = SCR_BinocularsComponent.Cast(gadgetManager.GetHeldGadgetComponent());
51 if (!binoculars)
52 return null;
53
54 IEntity entityBinocular = binoculars.GetOwner();
55 if (!entityBinocular)
56 return null;
57
58 // Getting optics component
60
61 return optic;
62 }
63
64 //-----------------------------------------------------------------------------
65 override void OnUpdate(float pDt, out ScriptedCameraItemResult pOutResult)
66 {
67 super.OnUpdate(pDt, pOutResult);
68
69 pOutResult.m_fFOV = m_fBinocFOV;
70 pOutResult.m_bBlendFOV = false;
71
72 if (m_pCompartmentAccess.IsInCompartment())
73 pOutResult.m_fUseHeading = 0;
74
75 // Near plane
76 if (m_Optics)
77 pOutResult.m_fNearPlane = m_Optics.GetNearPlane();
78 else
79 {
80 pOutResult.m_fNearPlane = 0.05;
81 }
82 }
83}
override void OnUpdate(float pDt, out ScriptedCameraItemResult pOutResult)
SCR_BinocularsComponent m_binoculars
override void OnActivate(ScriptedCameraItem pPrevCamera, ScriptedCameraItemResult pPrevCameraResult)
SCR_2DOpticsComponent FindOpticsComponent(IEntity owner)
void CharacterCameraBinoculars(CameraHandlerComponent pCameraHandler)
proto external Managed FindComponent(typename typeName)
SCR_GadgetComponent GetHeldGadgetComponent()
static IEntity GetLocalControlledEntity()
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14