Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ResourceEncapsulatorContainerQueue.c
Go to the documentation of this file.
2 class SCR_ResourceEncapsulatorContainerQueue : SCR_ResourceContainerQueue<SCR_ResourceEncapsulator>
3 {
4  //------------------------------------------------------------------------------------------------
8  override int RegisterContainer(notnull SCR_ResourceContainer container)
9  {
10  int position = SCR_ResourceContainerQueueBase.INVALID_CONTAINER_INDEX;
11  float resourceValue;
12  bool shouldIncrementOffset;
13  SCR_ResourceContainerStorageQueue<SCR_ResourceEncapsulator> storageQueue;
14 
15  EResourceContainerStorageType storageType = container.GetStorageType();
16 
17  foreach (SCR_ResourceStoragePolicyBase<SCR_ResourceEncapsulator> policy: m_StoragePolicies)
18  {
19  storageQueue = policy.GetStorageQueue();
20 
21  if (shouldIncrementOffset)
22  {
23  storageQueue.IncrementOffset(1);
24  continue;
25  }
26 
27  if (!policy.IsStorageTypeValid(storageType))
28  continue;
29 
30  array<ref SCR_ResourceEncapsulatorActionBase> actions = m_Interactor.GetActions();
31  SCR_ResourceContainer containerRepresentative = m_Interactor.GetContainerRepresentative();
32 
33  if (actions)
34  {
35  foreach (SCR_ResourceEncapsulatorActionBase action: actions)
36  {
37  if (action)
38  action.PerformAction(containerRepresentative, container);
39  }
40  }
41 
42  m_fAggregatedResourceValue += container.GetResourceValue();;
43  m_fAggregatedMaxResourceValue += container.GetMaxResourceValue();
44 
45  shouldIncrementOffset = true;
46  position = storageQueue.RegisterContainer(container, m_Interactor);
47  }
48 
49  return position;
50  }
51 
52  //------------------------------------------------------------------------------------------------
53  override void DebugDraw()
54  {
55  if (!m_Interactor)
56  return;
57 
58  int consumerIdx;
59  float heightDiff;
60  vector origin;
61  Color color1 = Color.FromInt(m_Interactor.GetDebugColor().PackToInt());
62  Color color2 = Color.FromInt(m_Interactor.GetDebugColor().PackToInt());
63 
64  color1.Scale(0.2);
65  color1.SetA(1.0);
66  color2.Lerp(Color.FromInt(Color.WHITE), 0.0);
67  color2.SetA(1.0);
68 
69  foreach (int idx, SCR_ResourceContainer container: m_aRegisteredContainers)
70  {
71  if (!container)
72  continue;
73 
74  string infoText = string.Format(" ENC Pos: %1 Distance: %2 m ", idx, vector.Distance(m_Interactor.GetOwnerOrigin(), container.GetOwnerOrigin()));
75  origin = container.GetOwnerOrigin();
76  consumerIdx = container.GetLinkedInteractorIndex(m_Interactor);
77 
78  if (container.IsResourceGainEnabled())
79  consumerIdx++;
80 
81  if (container.IsResourceDecayEnabled())
82  consumerIdx++;
83 
84  heightDiff = container.debugControlOffset * consumerIdx + container.debugControlOffset * 3;
85 
86  Shape.CreateArrow(origin + Vector(0.0, heightDiff, 0.0), origin, 0.0, 0xFFFFFFFF, ShapeFlags.ONCE | ShapeFlags.NOZBUFFER);
87 
88  Shape.CreateArrow(m_Interactor.GetOwnerOrigin(), (origin + Vector(0.0, heightDiff, 0.0)), 0.1, color1.PackToInt(), ShapeFlags.ONCE | ShapeFlags.NOZBUFFER |ShapeFlags.DEPTH_DITHER);
89 
90  DebugTextWorldSpace.Create(m_Interactor.GetOwner().GetWorld(), infoText, DebugTextFlags.CENTER | DebugTextFlags.FACE_CAMERA | DebugTextFlags.ONCE, origin[0], origin[1] + heightDiff, origin[2], 10, color1.PackToInt(), color2.PackToInt(), consumerIdx + 1);
91 
92  if (!container.GetComponent().IsDebugVisualizationEnabled())
93  container.DebugDraw(false);
94  }
95  }
96 }
EResourceContainerStorageType
EResourceContainerStorageType
Definition: SCR_ResourceContainer.c:17
SCR_ResourceContainerQueueBase
Definition: SCR_ResourceContainerQueue.c:2
SCR_ResourceContainer
Definition: SCR_ResourceContainer.c:34
SCR_ResourceEncapsulatorContainerQueue
Definition: SCR_ResourceEncapsulatorContainerQueue.c:2
position
vector position
Definition: SCR_DestructibleTreeV2.c:30
SCR_ResourceEncapsulatorActionBase
Definition: SCR_ResourceEncapsulatorActionBase.c:2
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468