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_RequiredDeployablePart.c
Go to the documentation of this file.
1
class
SCR_RequiredDeployablePart
:
ScriptAndConfig
2
{
3
[
Attribute
(uiwidget:
UIWidgets
.ResourcePickerThumbnail,
desc
:
"Prefab which is going to be required in order to deploy the main entity"
,
params
:
"et"
)]
4
protected
ResourceName
m_sPrefab
;
5
6
[
Attribute
(defvalue:
"1"
,
desc
:
"How many required prefabs need to be found in order to meet this requirement"
,
params
:
"1 inf 1"
)]
7
protected
int
m_iNumberOfRequiredPrefabs
;
8
9
[
Attribute
(
desc
:
"Localized string used to tell the player which part he is missing when wont be found"
)]
10
protected
LocalizedString
m_sPartName
;
11
12
[
Attribute
(defvalue:
"1"
,
desc
:
"Dictates whether elements found for this requirement are meant to be deleted upon deployment"
)]
13
protected
bool
m_bDeletePartsOnDeployment
;
14
15
[
Attribute
(defvalue:
"0"
,
desc
:
"Should game detach the magazines from weapons that are used for this requirement"
)]
16
protected
bool
m_bDetachMagazinesWhenUsed
;
17
18
protected
ref array<IEntity>
m_aFoundEntities
;
19
20
//------------------------------------------------------------------------------------------------
22
ResourceName
GetPrefab
()
23
{
24
return
m_sPrefab
;
25
}
26
27
//------------------------------------------------------------------------------------------------
28
void
SetNumberOfRequiredPrefabs
(
int
newValue)
29
{
30
m_iNumberOfRequiredPrefabs
= newValue;
31
}
32
33
//------------------------------------------------------------------------------------------------
35
int
GetNumberOfRequiredPrefabs
()
36
{
37
return
m_iNumberOfRequiredPrefabs
;
38
}
39
40
//------------------------------------------------------------------------------------------------
42
LocalizedString
GetPartName
()
43
{
44
return
m_sPartName
;
45
}
46
47
//------------------------------------------------------------------------------------------------
49
LocalizedString
GetMissingPartName
()
50
{
51
return
m_sPartName
;
52
}
53
54
//------------------------------------------------------------------------------------------------
57
bool
IsRequirementMet
(out
int
difference)
58
{
59
difference =
m_iNumberOfRequiredPrefabs
;
60
if
(!
m_aFoundEntities
)
61
return
false
;
62
63
difference -=
m_aFoundEntities
.Count();
64
return
difference == 0;
65
}
66
67
//------------------------------------------------------------------------------------------------
69
int
GetNumberOfFoundEntities
()
70
{
71
if
(!
m_aFoundEntities
)
72
return
0;
73
74
return
m_aFoundEntities
.Count();
75
}
76
77
//------------------------------------------------------------------------------------------------
79
bool
ShouldDeleteFoundEntities
()
80
{
81
return
m_bDeletePartsOnDeployment
;
82
}
83
84
//------------------------------------------------------------------------------------------------
86
array<IEntity>
GetFoundEntities
()
87
{
88
return
m_aFoundEntities
;
89
}
90
91
//------------------------------------------------------------------------------------------------
99
bool
EvaluateFoundEntity
(
vector
origin,
float
distanceSqToFoundEntity, notnull
BaseContainer
foundPrefab, notnull
IEntity
foundEntity)
100
{
101
Resource
res =
Resource
.Load(
m_sPrefab
);
102
if
(!res.IsValid())
103
return
false
;
104
105
BaseResourceObject
resObject = res.GetResource();
106
if
(!resObject)
107
return
false
;
108
109
BaseContainer
requiredPrefab = resObject.ToBaseContainer();
110
if
(requiredPrefab != foundPrefab)
111
return
false
;
112
113
if
(!
m_aFoundEntities
||
m_aFoundEntities
.Count() <
m_iNumberOfRequiredPrefabs
)
114
{
115
AddFoundEntity
(foundEntity);
116
return
true
;
117
}
118
119
foreach
(
int
id
,
IEntity
foundElement :
m_aFoundEntities
)
120
{
121
if
(
vector
.DistanceSq(foundElement.GetOrigin(), origin) <= distanceSqToFoundEntity)
122
continue
;
123
124
ReplaceFoundEntity
(foundEntity,
id
);
125
return
true
;
126
}
127
128
return
false
;
129
}
130
131
//------------------------------------------------------------------------------------------------
136
bool
DeleteFoundEntity
(
int
id
, notnull
IEntity
user)
137
{
138
if
(!
m_aFoundEntities
|| !
m_aFoundEntities
.IsIndexValid(
id
))
139
return
false
;
140
141
IEntity
deletedEntity =
m_aFoundEntities
[
id
];
142
if
(!deletedEntity)
143
return
false
;
144
145
if
(
m_bDetachMagazinesWhenUsed
)
146
SCR_MultiPartDeployableItemComponent.TryRemoveMagazineFromWeapons(deletedEntity, user);
147
148
GetGame
().GetCallqueue().CallLater(
SCR_EntityHelper
.DeleteEntityAndChildren,
param1
: deletedEntity);
//to give the time for the RPC calls to be sent
149
m_aFoundEntities
.Remove(
id
);
150
return
true
;
151
}
152
153
//------------------------------------------------------------------------------------------------
156
void
AddFoundEntity
(notnull
IEntity
entity)
157
{
158
if
(!
m_aFoundEntities
)
159
m_aFoundEntities
= {entity};
160
else
if
(!
m_aFoundEntities
.Contains(entity))
161
m_aFoundEntities
.Insert(entity);
162
}
163
164
//------------------------------------------------------------------------------------------------
168
void
ReplaceFoundEntity
(notnull
IEntity
entity,
int
id
)
169
{
170
if
(!
m_aFoundEntities
||
m_aFoundEntities
.IsEmpty())
171
return
;
172
173
if
(!
m_aFoundEntities
.IsIndexValid(
id
) ||
m_aFoundEntities
.Contains(entity))
174
return
;
175
176
m_aFoundEntities
[
id
] = entity;
177
}
178
179
//------------------------------------------------------------------------------------------------
182
SCR_RequiredDeployablePart
DeepClone
()
183
{
184
return
SCR_RequiredDeployablePart
.Cast(
Clone
());
185
}
186
}
id
AddonBuildInfoTool id
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
BaseContainer
Definition
BaseContainer.c:13
BaseResourceObject
Definition
BaseResourceObject.c:13
IEntity
Definition
IEntity.c:13
LocalizedString
Definition
LocalizedString.c:22
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
ResourceName
Definition
ResourceName.c:13
SCR_EntityHelper
Definition
SCR_EntityHelper.c:2
SCR_RequiredDeployablePart
Definition
SCR_RequiredDeployablePart.c:2
SCR_RequiredDeployablePart::GetMissingPartName
LocalizedString GetMissingPartName()
Definition
SCR_RequiredDeployablePart.c:49
SCR_RequiredDeployablePart::m_aFoundEntities
ref array< IEntity > m_aFoundEntities
Definition
SCR_RequiredDeployablePart.c:18
SCR_RequiredDeployablePart::m_sPrefab
ResourceName m_sPrefab
Definition
SCR_RequiredDeployablePart.c:4
SCR_RequiredDeployablePart::IsRequirementMet
bool IsRequirementMet(out int difference)
Definition
SCR_RequiredDeployablePart.c:57
SCR_RequiredDeployablePart::DeleteFoundEntity
bool DeleteFoundEntity(int id, notnull IEntity user)
Definition
SCR_RequiredDeployablePart.c:136
SCR_RequiredDeployablePart::SetNumberOfRequiredPrefabs
void SetNumberOfRequiredPrefabs(int newValue)
Definition
SCR_RequiredDeployablePart.c:28
SCR_RequiredDeployablePart::ShouldDeleteFoundEntities
bool ShouldDeleteFoundEntities()
Definition
SCR_RequiredDeployablePart.c:79
SCR_RequiredDeployablePart::DeepClone
SCR_RequiredDeployablePart DeepClone()
Definition
SCR_RequiredDeployablePart.c:182
SCR_RequiredDeployablePart::AddFoundEntity
void AddFoundEntity(notnull IEntity entity)
Definition
SCR_RequiredDeployablePart.c:156
SCR_RequiredDeployablePart::GetPrefab
ResourceName GetPrefab()
Definition
SCR_RequiredDeployablePart.c:22
SCR_RequiredDeployablePart::EvaluateFoundEntity
bool EvaluateFoundEntity(vector origin, float distanceSqToFoundEntity, notnull BaseContainer foundPrefab, notnull IEntity foundEntity)
Definition
SCR_RequiredDeployablePart.c:99
SCR_RequiredDeployablePart::m_sPartName
LocalizedString m_sPartName
Definition
SCR_RequiredDeployablePart.c:10
SCR_RequiredDeployablePart::m_iNumberOfRequiredPrefabs
int m_iNumberOfRequiredPrefabs
Definition
SCR_RequiredDeployablePart.c:7
SCR_RequiredDeployablePart::GetFoundEntities
array< IEntity > GetFoundEntities()
Definition
SCR_RequiredDeployablePart.c:86
SCR_RequiredDeployablePart::GetPartName
LocalizedString GetPartName()
Definition
SCR_RequiredDeployablePart.c:42
SCR_RequiredDeployablePart::m_bDeletePartsOnDeployment
bool m_bDeletePartsOnDeployment
Definition
SCR_RequiredDeployablePart.c:13
SCR_RequiredDeployablePart::GetNumberOfRequiredPrefabs
int GetNumberOfRequiredPrefabs()
Definition
SCR_RequiredDeployablePart.c:35
SCR_RequiredDeployablePart::m_bDetachMagazinesWhenUsed
bool m_bDetachMagazinesWhenUsed
Definition
SCR_RequiredDeployablePart.c:16
SCR_RequiredDeployablePart::GetNumberOfFoundEntities
int GetNumberOfFoundEntities()
Definition
SCR_RequiredDeployablePart.c:69
SCR_RequiredDeployablePart::ReplaceFoundEntity
void ReplaceFoundEntity(notnull IEntity entity, int id)
Definition
SCR_RequiredDeployablePart.c:168
ScriptAndConfig
Definition
Types.c:124
UIWidgets
Definition
attributes.c:40
vector
Definition
vector.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
param1
Tuple param1
Clone
class Class Clone()
Return shallow copy of object, or null if it is not allowed (not public constructor).
scripts
Game
Components
SCR_RequiredDeployablePart.c
Generated by
1.17.0