DayZ 1.24
Loading...
Searching...
No Matches
ActionViewOptics.c
Go to the documentation of this file.
2{
4 {
6 m_CommandUID = DayZPlayerConstants.CMD_GESTUREFB_LOOKOPTICS;
7 m_CommandUIDProne = DayZPlayerConstants.CMD_GESTUREFB_LOOKOPTICS;
8 m_Text = "#Look_Through";
9 }
10
16
18 {
19 return true;
20 }
21
22 override bool HasProgress()
23 {
24 return false;
25 }
26
27 override bool HasTarget()
28 {
29 return false;
30 }
31
32 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
33 {
35 if (Class.CastTo(optic, item) && !optic.IsInOptics() && !player.IsNVGLowered())
36 return true;
37 return false;
38 }
39
41 {
42 return true;
43 }
44
46 {
47 super.OnStartClient(action_data);
48
49 GetGame().GetMission().AddActiveInputExcludes({"actonViewOpticExcl"});
50 }
51
53 {
54 super.OnStartServer(action_data);
55
56 if (!GetGame().IsMultiplayer())
57 GetGame().GetMission().AddActiveInputExcludes({"actonViewOpticExcl"});
58 }
59
61 {
63 if (Class.CastTo(optic, action_data.m_MainItem))
64 {
65 if (!optic.IsInOptics())
66 EnterOptics(optic, action_data.m_Player);
67 }
68 }
69
71 {
73 if (Class.CastTo(optic, action_data.m_MainItem))
74 {
75 if (!optic.IsInOptics())
76 EnterOptics(optic, action_data.m_Player);
77 }
78 }
79
81 {
83 if (Class.CastTo(optic, action_data.m_MainItem) && optic.IsInOptics())
84 ExitOptics(optic, action_data.m_Player);
85 GetGame().GetMission().RemoveActiveInputExcludes({"actonViewOpticExcl"});
86 }
87
89 {
91 if (Class.CastTo(optic, action_data.m_MainItem) && optic.IsInOptics())
92 ExitOptics(optic, action_data.m_Player);
93
94 if (!GetGame().IsMultiplayer())
95 GetGame().GetMission().RemoveActiveInputExcludes({"actonViewOpticExcl"});
96 }
97
99 {
101 if (Class.CastTo(optic, action_data.m_MainItem))
102 ExitOptics(optic, action_data.m_Player);
103 }
104
106 {
108 if (Class.CastTo(optic, action_data.m_MainItem))
109 ExitOptics(optic, action_data.m_Player);
110 }
111
113 {
114 if (!item.HasEnergyManager())
115 return true;
116 else if (item.GetCompEM() && item.GetCompEM().CanWork())
117 return true;
118
119 return false;
120 }
121
123 {
124 player.SetIronsights(false);
125 player.SetHandheldOpticsInUse(true);
126 player.SetOptics(true);
127 optic.EnterOptics();
128 optic.HideSelection("hide");
129 if (optic.HasEnergyManager())
130 optic.GetCompEM().SwitchOn();
131 player.GetAimingModel().SetAimNoiseAllowed(false);
132 }
133
135 {
136 optic.ShowSelection("hide");
137 player.ExitSights();
138 player.SetHandheldOpticsInUse(false);
139 if (optic.HasEnergyManager())
140 optic.GetCompEM().SwitchOff();
141 player.GetAimingModel().SetAimNoiseAllowed(true);
142 }
143}
string m_Text
Definition ActionBase.c:49
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
override bool IsFullBody(PlayerBase player)
void ExitOptics(ItemOptics optic, PlayerBase player)
override bool ActionConditionContinue(ActionData action_data)
override void OnStartServer(ActionData action_data)
bool CanWork(ItemBase item)
override void OnStartAnimationLoopServer(ActionData action_data)
override void OnEndClient(ActionData action_data)
override bool HasTarget()
override void OnEndAnimationLoopServer(ActionData action_data)
void EnterOptics(ItemOptics optic, PlayerBase player)
override bool HasProgress()
override void CreateConditionComponents()
override void OnStartClient(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnStartAnimationLoopClient(ActionData action_data)
override void OnEndAnimationLoopClient(ActionData action_data)
override void OnEndServer(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.