Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ResourceGeneratorActionStore.c
Go to the documentation of this file.
3{
4 //------------------------------------------------------------------------------------------------
5 override float ComputeGeneratedResources(notnull SCR_ResourceGenerator generator, float resourceValue)
6 {
7 return Math.Min(resourceValue, generator.GetAggregatedMaxResourceValue() - generator.GetAggregatedResourceValue());
8 }
9
10 //------------------------------------------------------------------------------------------------
11 override void PerformAction(notnull SCR_ResourceGenerator generator, inout float resourceValue)
12 {
13 SCR_ResourceContainer containerTo;
14 SCR_ResourceContainerQueueBase containerQueue = generator.GetContainerQueue();
15 int containerCount = containerQueue.GetContainerCount();
16
17 for (int i = 0; i < containerCount; i++)
18 {
19 if (resourceValue <= 0)
20 break;
21
22 containerTo = containerQueue.GetContainerAt(i);
23
24 if (!containerTo)
25 continue;
26
27 float usedResources = Math.Min(containerTo.ComputeResourceDifference(), resourceValue);
28 resourceValue -= usedResources;
29
30 containerTo.IncreaseResourceValue(usedResources);
31 }
32 }
33}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition Math.c:13
bool IncreaseResourceValue(float value, bool notifyChange=true)
SCR_ResourceContainer GetContainerAt(int index)
@ PerformAction