DayZ 1.24
Loading...
Searching...
No Matches
ActionViewBinoculars.c
Go to the documentation of this file.
2{
4
5 override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
6 {
7 Rangefinder rangefinder = Rangefinder.Cast(item);
8 if (rangefinder)
9 m_Text = "#use_range_finder";
10 else
11 m_Text = "#Look_Through";
12 }
13
14 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
15 {
17 if (Class.CastTo(optic, item) && !optic.IsInOptics() && !player.IsNVGLowered())
18 return true;
19 return false;
20 }
21
23 {
24 player.SetIronsights(false);
25 player.SetHandheldOpticsInUse(true);
26 player.SetOptics(true);
27 optic.EnterOptics();
28 optic.HideSelection("hide");
29 if (NVGoggles.Cast(optic) && optic.ConfigIsExisting("simpleHiddenSelections"))
30 optic.SetSimpleHiddenSelectionState(0, false);
31
32 if (optic.HasEnergyManager())
33 {
35 if (!rf)
36 return;
37
38 rf.SetPlayer(player);
39 if (GetGame().IsServer())
40 rf.GetCompEM().SwitchOn();
41 }
42 }
43
45 {
46 optic.ShowSelection("hide");
47 if (NVGoggles.Cast(optic) && optic.ConfigIsExisting("simpleHiddenSelections"))
48 optic.SetSimpleHiddenSelectionState(0, true);
49 player.SetHandheldOpticsInUse(false);
50 player.ExitSights();
51 if (optic.HasEnergyManager())
52 {
54 if (!rf)
55 return;
56
57 rf.SetPlayer(null);
58 if (GetGame().IsServer())
59 rf.GetCompEM().SwitchOff();
60 }
61 }
62}
string m_Text
Definition ActionBase.c:49
override void EnterOptics(ItemOptics optic, PlayerBase player)
override void OnActionInfoUpdate(PlayerBase player, ActionTarget target, ItemBase item)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void ExitOptics(ItemOptics optic, PlayerBase player)
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.