Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ResourceStoredContainerStoragePartialHelper.c
Go to the documentation of this file.
2 {
3  protected SCR_ResourceContainer m_ContainerFrom;
4  protected SCR_ResourceContainer m_ContainerToCached;
5  protected bool m_bHasDetectedContainers;
6  protected float m_fMaxStoredResourceValue;
7 
8  //------------------------------------------------------------------------------------------------
9  float GetMaxStoredResourceValue()
10  {
11  if (m_bHasDetectedContainers)
12  return Math.Min(m_fMaxStoredResourceValue, m_ContainerFrom.GetResourceValue());
13 
14  return -1.0;
15  }
16 
17  //------------------------------------------------------------------------------------------------
18  protected bool IsSourceValid(notnull IEntity entity)
19  {
20  if (entity == m_ContainerFrom.GetOwner())
21  return false;
22 
23  SCR_ResourceComponent component = SCR_ResourceComponent.Cast(entity.FindComponent(SCR_ResourceComponent));
24 
25  if (!component)
26  return false;
27  // TODO MARIO: Fix the whole method for the container query.
28  //m_ContainerToCached = component.GetContainer();
29 
30  if (!m_ContainerToCached)
31  return false;
32 
33  if (!m_bHasDetectedContainers && m_ContainerToCached.IsAllowedToStoreResource())
34  m_bHasDetectedContainers = true;
35 
36  return m_ContainerToCached.CanStoreResource();
37  }
38 
39  //------------------------------------------------------------------------------------------------
40  protected bool ProcessStorage(notnull IEntity entity)
41  {
42  m_bHasDetectedContainers = true;
43  m_fMaxStoredResourceValue += m_ContainerToCached.ComputeResourceDifference();
44 
45  return m_fMaxStoredResourceValue < m_ContainerFrom.GetResourceValue();
46  }
47 
48  //------------------------------------------------------------------------------------------------
50  {
51  m_ContainerFrom = container;
52  }
53 };
SCR_ResourceContainer
Definition: SCR_ResourceContainer.c:34
SCR_ResourceStoredContainerStoragePartialHelper
Definition: SCR_ResourceStoredContainerStoragePartialHelper.c:1