Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ResourceSystemSubscriptionListing.c
Go to the documentation of this file.
2 {
3  protected ref set<RplId> m_aListeners = new set<RplId>();
4  protected SCR_ResourceInteractor m_Interactor;
5 
6  //------------------------------------------------------------------------------------------------
7  SCR_ResourceInteractor GetInteractor()
8  {
9  return m_Interactor;
10  }
11 
12  //------------------------------------------------------------------------------------------------
13  bool IsEmpty()
14  {
15  return m_aListeners.IsEmpty();
16  }
17 
18  //------------------------------------------------------------------------------------------------
19  void SubscribeListener(RplId listener)
20  {
21  m_aListeners.Insert(listener);
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  void UnsubscribeListener(RplId listener)
26  {
27  m_aListeners.RemoveItem(listener);
28  }
29 
30  //------------------------------------------------------------------------------------------------
31  void Replicate()
32  {
33  if (m_Interactor)
34  m_Interactor.ReplicateEx();
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  void SCR_ResourceSystemSubscriptionListing(notnull SCR_ResourceInteractor interactor)
39  {
40  m_Interactor = interactor;
41 
42  ChimeraWorld world = ChimeraWorld.CastFrom(GetGame().GetWorld());
43 
44  if (!world)
45  return;
46 
47  SCR_ResourceSystem updateSystem = SCR_ResourceSystem.Cast(world.FindSystem(SCR_ResourceSystem));
48 
49  if (!updateSystem)
50  return;
51 
52  updateSystem.RegisterSubscribedInteractor(m_Interactor);
53  }
54 
56  {
57  ArmaReforgerScripted game = GetGame();
58  if (!game)
59  return;
60 
61  ChimeraWorld world = ChimeraWorld.CastFrom(game.GetWorld());
62 
63  if (!world)
64  return;
65 
66  SCR_ResourceSystem updateSystem = SCR_ResourceSystem.Cast(world.FindSystem(SCR_ResourceSystem));
67 
68  if (!updateSystem)
69  return;
70 
71  updateSystem.UnregisterSubscribedInteractor(m_Interactor);
72  }
73 }
ChimeraWorld
Definition: ChimeraWorld.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_ResourceSystem
Definition: SCR_ResourceSystem.c:1
SCR_ResourceSystemSubscriptionListing
Definition: SCR_ResourceSystemSubscriptionListing.c:1