Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
huntingoptic.c
Go to the documentation of this file.
1 class HuntingOptic extends ItemOptics
2 {
4 
5  void HuntingOptic()
6  {
7  HideSelection("rings_ris");
8  HideSelection("rings_ris_pilot");
9  }
10 
11  override void OnWasAttached( EntityAI parent, int slot_id )
12  {
13  super.OnWasAttached(parent, slot_id);
14  m_Parent = parent;
15  if (!ParentUsesWinchesterTypeMount())
16  {
17  HideSelection("rings_winchester");
18  HideSelection("rings_winchester_pilot");
19  ShowSelection("rings_ris");
20  ShowSelection("rings_ris_pilot");
21  }
22  }
23 
24  override void OnWasDetached( EntityAI parent, int slot_id )
25  {
26  super.OnWasDetached(parent, slot_id);
27  m_Parent = null;
28  HideSelection("rings_ris");
29  HideSelection("rings_ris_pilot");
30  ShowSelection("rings_winchester");
31  ShowSelection("rings_winchester_pilot");
32  }
33 
34  override void HideSelection( string selection_name )
35  {
36  super.HideSelection( selection_name );
37  if (selection_name == "hide") //hides pilotview selections in order not to obstruct view
38  {
39  HideSelection("rings_ris_pilot");
40  HideSelection("rings_winchester_pilot");
41  }
42  }
43 
44  override void ShowSelection( string selection_name )
45  {
46  super.ShowSelection( selection_name );
47  if (selection_name == "hide")
48  {
49  if (!ParentUsesWinchesterTypeMount())
50  {
51  HideSelection("rings_winchester");
52  HideSelection("rings_winchester_pilot");
53  ShowSelection("rings_ris");
54  ShowSelection("rings_ris_pilot");
55  }
56  else
57  {
58  HideSelection("rings_ris");
59  HideSelection("rings_ris_pilot");
60  ShowSelection("rings_winchester");
61  ShowSelection("rings_winchester_pilot");
62  }
63  }
64  }
65 
66  bool ParentUsesWinchesterTypeMount()
67  {
68  if (m_Parent && m_Parent.ConfigIsExisting("winchesterTypeOpticsMount"))
69  return m_Parent.ConfigGetBool("winchesterTypeOpticsMount");
70 
71  return false;
72  }
73 }
OnWasAttached
override void OnWasAttached(EntityAI parent, int slot_id)
Definition: torch.c:945
m_Parent
protected Widget m_Parent
Definition: sizetochild.c:92
OnWasDetached
override void OnWasDetached(EntityAI parent, int slot_id)
Definition: remotedetonator.c:237
ItemOptics
Definition: itemoptics.c:1
EntityAI
Definition: building.c:5