Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_BIKIMagazineHelper.c
Go to the documentation of this file.
1
class
SCR_BIKIMagazineHelper
2
{
3
//------------------------------------------------------------------------------------------------
6
static
ResourceName
GetFirstBullet(notnull
BaseContainer
magazineContainer)
7
{
8
IEntityComponentSource
magazineComponentSource =
SCR_BaseContainerTools
.FindComponentSource(magazineContainer,
MagazineComponent
);
9
if
(!magazineComponentSource)
10
return
ResourceName
.Empty;
11
12
ResourceName
config;
13
if
(!magazineComponentSource.Get(
"AmmoConfig"
, config) || !config)
14
return
ResourceName
.Empty;
15
16
Resource
resource =
Resource
.Load(config);
17
if
(!resource.IsValid())
18
return
ResourceName
.Empty;
19
20
array<int> indices;
21
if
(!magazineComponentSource.Get(
"AmmoMapping"
, indices) || indices.IsEmpty())
22
return
ResourceName
.Empty;
23
24
BaseContainer
configContainer = resource.GetResource().ToBaseContainer();
25
array<ResourceName> ammoResourceNames;
26
if
(!configContainer.Get(
"AmmoResourceArray"
, ammoResourceNames))
27
return
ResourceName
.Empty;
28
29
int
index
= indices[0];
30
if
(!ammoResourceNames.IsIndexValid(
index
))
31
return
ResourceName
.Empty;
32
33
return
ammoResourceNames[
index
];
34
}
35
36
//------------------------------------------------------------------------------------------------
39
static
map<typename, ref array<ResourceName>
> GetMagazineWells(notnull array<ResourceName> magazines)
40
{
41
if
(magazines.IsEmpty())
42
return
new
map<typename, ref array<ResourceName>
>();
43
44
map<typename, ref array<ResourceName>
> result =
new
map<typename, ref array<ResourceName>
>();
45
46
Resource
resource;
47
BaseContainer
baseContainer;
48
IEntityComponentSource
magazineComponentSource;
49
foreach
(
ResourceName
magazine : magazines)
50
{
51
resource =
Resource
.Load(magazine);
52
if
(!resource.IsValid())
53
continue
;
54
55
//baseContainer = resource.GetResource().ToBaseContainer();
56
magazineComponentSource =
SCR_BaseContainerTools
.FindComponentSource(resource,
MagazineComponent
);
57
if
(!magazineComponentSource)
58
continue
;
59
60
baseContainer = magazineComponentSource.GetObject(
"MagazineWell"
);
61
if
(!baseContainer)
62
continue
;
63
64
typename
typeName = baseContainer.GetClassName().ToType();
65
if
(!typeName)
66
continue
;
67
68
if
(result.Contains(typeName))
69
result.Get(typeName).Insert(magazine);
70
else
71
result.Insert(typeName, { magazine });
72
}
73
74
return
result;
75
}
76
}
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
BaseContainer
Definition
BaseContainer.c:13
IEntityComponentSource
Definition
IEntityComponentSource.c:13
MagazineComponent
Definition
MagazineComponent.c:13
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
ResourceName
Definition
ResourceName.c:13
SCR_BIKIMagazineHelper
Definition
SCR_BIKIMagazineHelper.c:2
SCR_BaseContainerTools
Definition
SCR_BaseContainerTools.c:4
map
Definition
Types.c:486
scripts
WorkbenchGame
ResourceManager
BIKI
Helpers
SCR_BIKIMagazineHelper.c
Generated by
1.17.0