Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SpawnPointSpinBox.c
Go to the documentation of this file.
2 {
3  protected ref array<RplId> m_aSpawnPointIds = {};
4  protected bool m_bFocused;
5 
6  override bool OnFocus(Widget w, int x, int y)
7  {
8  super.OnFocus(w, x, y);
9  m_bFocused = true;
10 
11  return false;
12  }
13 
14  override bool OnFocusLost(Widget w, int x, int y)
15  {
16  super.OnFocusLost(w, x, y);
17  m_bFocused = false;
18 
19  return false;
20  }
21 
22  int AddItem(string item, RplId id)
23  {
24  if (!id.IsValid() || m_aSpawnPointIds.Find(id) > -1)
25  return -1;
26  int i = AddItem(item);
27  m_aSpawnPointIds.Insert(id);
28  SetInitialState();
29 
30  return i;
31  }
32 
33  override void RemoveItem(int item, bool last = false)
34  {
35  super.RemoveItem(item, last);
36 
37  if (m_aSpawnPointIds.IsIndexValid(item))
38  m_aSpawnPointIds.Remove(item);
39  }
40 
41  override void ClearAll()
42  {
43  super.ClearAll();
44  m_aSpawnPointIds.Clear();
45  }
46 
47  RplId GetSpawnPointId(int itemId)
48  {
49  if (m_aSpawnPointIds.IsEmpty())
50  return RplId.Invalid();
51  return m_aSpawnPointIds.Get(itemId);
52  }
53 
54  int GetItemId(RplId id)
55  {
56  return m_aSpawnPointIds.Find(id);
57  }
58 
59  bool IsEmpty()
60  {
61  return m_aSpawnPointIds.IsEmpty();
62  }
63 
64  void SetItemName(int id, string name)
65  {
66  if (m_aElementNames.IsIndexValid(id))
67  {
68  m_aElementNames[id] = name;
69  SetInitialState(false);
70  }
71  }
72 
73  array<SCR_SpawnPoint> GetSpawnPointsInList()
74  {
75  array<SCR_SpawnPoint> result = {};
76  foreach (RplId id : m_aSpawnPointIds)
77  {
78  SCR_SpawnPoint sp = SCR_SpawnPoint.GetSpawnPointByRplId(id);
79  if (sp)
80  result.Insert(sp);
81  }
82 
83  return result;
84  }
85 
86  bool IsFocused()
87  {
88  return m_bFocused && GetGame().GetInputManager().IsUsingMouseAndKeyboard();
89  }
90 };
SCR_SpawnPointSpinBox
Definition: SCR_SpawnPointSpinBox.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SpawnPoint
Spawn point entity defines positions on which players can possibly spawn.
Definition: SCR_SpawnPoint.c:27
SCR_SpinBoxComponent
Definition: SCR_SpinBoxComponent.c:1
IsValid
override bool IsValid(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action, vector actionPosition, out ESupportStationReasonInvalid reasonInvalid, out int supplyCost)
Definition: SCR_BaseDamageHealSupportStationComponent.c:98