Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ResourceSystemSubscriptionHandleBase.c
Go to the documentation of this file.
2 {
3  protected RplId m_OwnerRplId;
4  protected RplId m_ResourceComponentRplId;
5  protected typename m_InteractorType;
6  protected EResourceType m_eResourceType;
7  protected EResourceGeneratorID m_eResourceIdentifier;
8  protected SCR_ResourceSystemSubscriptionManager m_SubscriptionManager;
9  protected WorldTimestamp m_fLastPokedAt;
10 
11  //------------------------------------------------------------------------------------------------
12  static SCR_ResourceSystemSubscriptionHandleBase CreateHandle(notnull SCR_ResourceSystemSubscriptionManager manager, RplId ownerRplId, RplId resourceComponentRplId, typename interactorType, EResourceType resourceType, EResourceGeneratorID resourceIdentifier)
13  {
14  Managed owner = Replication.FindItem(ownerRplId);
15 
16  if (!owner)
17  return null;
18 
19  SCR_ResourceSystemSubscriptionHandleBase handle = manager.GetHandle(resourceComponentRplId, interactorType, resourceType, resourceIdentifier);
20 
21  if (handle)
22  return handle;
23 
24  string stringType = string.Format("SCR_ResourceSystemSubscriptionHandle<%1>", owner.Type());
25  typename type = stringType.ToType();
26  handle = SCR_ResourceSystemSubscriptionHandleBase.Cast(type.Spawn());
27 
28  if (!handle)
29  return null;
30 
31  handle.OnInit(manager, ownerRplId, resourceComponentRplId, interactorType, resourceType, resourceIdentifier);
32 
33  return handle;
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  WorldTimestamp GetLastPokedAt()
38  {
39  return m_fLastPokedAt;
40  }
41 
42  //------------------------------------------------------------------------------------------------
43  RplId GetOwnerRplId()
44  {
45  return m_OwnerRplId;
46  }
47 
48  //------------------------------------------------------------------------------------------------
49  RplId GetResourceComponentRplId()
50  {
51  return m_ResourceComponentRplId;
52  }
53 
54  //------------------------------------------------------------------------------------------------
55  typename GetInteractorType()
56  {
57  return m_InteractorType;
58  }
59 
60  //------------------------------------------------------------------------------------------------
61  EResourceType GetResourceIdentifier()
62  {
63  return m_eResourceIdentifier;
64  }
65 
66  //------------------------------------------------------------------------------------------------
67  EResourceGeneratorID GetResourceType()
68  {
69  return m_eResourceType;
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  void Poke()
74  {
75  m_fLastPokedAt = GetGame().GetWorld().GetTimestamp();
76  }
77 
78  //------------------------------------------------------------------------------------------------
79  protected void OnDelete()
80  {
81  if (m_SubscriptionManager)
82  m_SubscriptionManager.OnSubscriptionListenerHandleDeleted(this);
83  }
84 
85  //------------------------------------------------------------------------------------------------
86  protected void OnInit(notnull SCR_ResourceSystemSubscriptionManager manager, RplId ownerRplId, RplId resourceComponentRplId, typename interactorType, EResourceType resourceType, EResourceGeneratorID resourceIdentifier)
87  {
88  m_SubscriptionManager = manager;
89  m_OwnerRplId = ownerRplId;
90  m_ResourceComponentRplId = resourceComponentRplId;
91  m_InteractorType = interactorType;
92  m_eResourceType = resourceType;
93  m_eResourceIdentifier = resourceIdentifier;
94  }
95 
96  //------------------------------------------------------------------------------------------------
97  sealed void SCR_ResourceSystemSubscriptionHandleBase(SCR_ResourceSystemSubscriptionManager manager, RplId ownerRplId, RplId resourceComponentRplId, typename interactorType, EResourceType resourceType, EResourceGeneratorID resourceIdentifier)
98  {
99  if (manager)
100  OnInit(manager, ownerRplId, resourceComponentRplId, interactorType, resourceType, resourceIdentifier);
101  }
102 
103  //------------------------------------------------------------------------------------------------
105  {
106  OnDelete();
107  }
108 }
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_ResourceSystemSubscriptionManager
Definition: SCR_ResourceSystemSubscriptionManager.c:1
EResourceType
EResourceType
Definition: SCR_ResourceContainer.c:1
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
SCR_ResourceSystemSubscriptionHandleBase
Definition: SCR_ResourceSystemSubscriptionHandleBase.c:1
EResourceGeneratorID
EResourceGeneratorID
Definition: SCR_ResourceGenerator.c:1