Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
arrowmanagerbase.c
Go to the documentation of this file.
2 {
3  protected const int VERSION = 2;
4  protected ref array<EntityAI> m_Arrows;
5  protected EntityAI m_Owner;
6 
7  void ArrowManagerBase(EntityAI owner)
8  {
9  m_Owner = owner;
10  m_Arrows = new array<EntityAI>();
11  }
12 
13  void AddArrow(EntityAI arrow)
14  {
15  m_Arrows.Insert(arrow);
16  }
17 
18  void RemoveArrow(EntityAI arrow)
19  {
20  m_Arrows.RemoveItem(arrow);
21  }
22 
23  void ClearArrows()
24  {
25  foreach (EntityAI arrow : m_Arrows)
26  {
27  if (arrow)
28  arrow.DeleteSafe();
29  }
30 
31  m_Arrows.Clear();
32  }
33 
34  int GetArrowsCount()
35  {
36  return m_Arrows.Count();
37  }
38 
39  void DropArrow(int index)
40  {
41  if (m_Arrows.Count() > index)
42  {
43  EntityAI arrow = m_Arrows.Get(index);
44  vector pos = arrow.GetPosition();
45 
46  m_Owner.RemoveChild(arrow);
47 
48  vector m4[4];
49  Math3D.MatrixIdentity4(m4);
50  m4[3] = pos;
51 
52  arrow.PlaceOnSurfaceRotated(m4, pos);
53 
54  arrow.SetTransform(m4);
55  arrow.PlaceOnSurface();
56  }
57  }
58 
59  void DropFirstArrow()
60  {
61  DropArrow(0);
62  }
63 
64  void DropAllArrows()
65  {
66  for (int i = m_Arrows.Count() - 1; i >= 0 ; i--)
67  {
68  DropArrow(i);
69  }
70  }
71 
72  EntityAI GetArrow(int index)
73  {
74  if (m_Arrows.Count() > index)
75  {
76  return m_Arrows.Get(index);
77  }
78 
79  return null;
80  }
81 
82  EntityAI GetFirstArrow()
83  {
84  if (m_Arrows.Count())
85  {
86  return m_Arrows.Get(0);
87  }
88 
89  return null;
90  }
91 
92  EntityAI AcquireFirstArrow(bool keepTransform = false)
93  {
94  EntityAI entity = GetFirstArrow();
95  m_Owner.RemoveChild(entity, keepTransform);
96  return entity;
97  }
98 
99 }
vector
Definition: enconvert.c:105
m_Owner
enum ProcessDirectDamageFlags m_Owner
array< EntityAI >
ArrowManagerBase
Definition: arrowmanagerbase.c:1
EntityAI
Definition: building.c:5
Math3D
Definition: enmath3d.c:27