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_PrefabStructureFillingPlugin_Car.c
Go to the documentation of this file.
1
class
SCR_PrefabStructureFillingPlugin_Car
: SCR_PrefabStructureFillingPlugin_TypeBase
2
{
3
[
Attribute
(defvalue:
"0"
,
desc
:
"Number Of Lights Wanted"
,
params
:
"0 inf"
)]
4
int
m_iDesiredTotalNumberOfLights;
5
6
//------------------------------------------------------------------------------------------------
7
override
bool
Process(notnull
IEntitySource
prefab)
8
{
9
if
(!super.Process(prefab))
10
return
false
;
11
12
if
(!
CreateLights
(prefab, m_iDesiredTotalNumberOfLights))
13
return
false
;
14
15
return
true
;
16
}
17
18
//------------------------------------------------------------------------------------------------
23
protected
bool
CreateLights
(notnull
IEntitySource
prefab,
int
desiredTotalNumberOfLights)
24
{
25
if
(desiredTotalNumberOfLights < 1)
26
{
27
Print
(
"No lights requested"
,
LogLevel
.NORMAL);
28
return
true
;
29
}
30
31
int
componentIndex =
SCR_BaseContainerTools
.FindComponentIndex(prefab,
BaseLightManagerComponent
);
32
if
(componentIndex < 0)
33
{
34
Print
(
"No "
+
BaseLightManagerComponent
+
" on Prefab"
,
LogLevel
.WARNING);
35
return
false
;
36
}
37
38
IEntityComponentSource
componentSource = prefab.GetComponent(componentIndex);
39
if
(!componentSource)
40
{
41
Print
(
"[SCR_PrefabStructureFillingPlugin_Car.CreateLights] wat ("
+ __FILE__ +
" L"
+ __LINE__ +
")"
,
LogLevel
.FATAL);
42
return
false
;
43
}
44
45
BaseContainerList
lightSlots = componentSource.GetObjectArray(
"LightSlots"
);
46
if
(!lightSlots)
47
{
48
Print
(
"[SCR_PrefabStructureFillingPlugin_Car.CreateLights] wat ("
+ __FILE__ +
" L"
+ __LINE__ +
")"
,
LogLevel
.FATAL);
49
return
false
;
50
}
51
52
int
lightSlotsCount = lightSlots.Count();
53
if
(desiredTotalNumberOfLights <= lightSlotsCount)
54
{
55
PrintFormat
(
"Requested %1 lights, %2 existing"
, desiredTotalNumberOfLights, lightSlotsCount, level:
LogLevel
.NORMAL);
56
return
true
;
57
}
58
59
array<ref ContainerIdPathEntry>
path
= {
new
ContainerIdPathEntry
(
"components"
, componentIndex) };
60
bool
isEditing = m_WorldEditorAPI.IsDoingEditAction();
61
if
(!isEditing)
62
m_WorldEditorAPI.BeginEntityAction();
63
64
for
(
int
i = lightSlotsCount; i < desiredTotalNumberOfLights; ++i)
65
{
66
if
(!m_WorldEditorAPI.CreateObjectArrayVariableMember(prefab,
path
,
"LightSlots"
,
"SCR_LightSlot"
, i))
67
{
68
Print
(
"Error creating SCR_LightSlot"
,
LogLevel
.ERROR);
69
return
false
;
70
}
71
}
72
73
if
(!isEditing)
74
m_WorldEditorAPI.EndEntityAction();
75
76
Print
(
"Successfully created "
+ (desiredTotalNumberOfLights - lightSlotsCount) +
" lights"
,
LogLevel
.NORMAL);
77
return
true
;
78
}
79
}
path
string path
Definition
AddonBuildInfoTool.c:249
ContainerIdPathEntry
void ContainerIdPathEntry(string propertyName, int index=-1)
Definition
worldEditor.c:30
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
BaseContainerList
Definition
BaseContainerList.c:13
BaseLightManagerComponent
Definition
BaseLightManagerComponent.c:13
IEntityComponentSource
Definition
IEntityComponentSource.c:13
IEntitySource
Definition
IEntitySource.c:13
SCR_BaseContainerTools
Definition
SCR_BaseContainerTools.c:4
SCR_PrefabStructureFillingPlugin_Car
Definition
SCR_PrefabStructureFillingPlugin_Car.c:2
SCR_PrefabStructureFillingPlugin_Car::CreateLights
bool CreateLights(notnull IEntitySource prefab, int desiredTotalNumberOfLights)
Definition
SCR_PrefabStructureFillingPlugin_Car.c:23
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
PrintFormat
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
WorkbenchGame
WorldEditor
PrefabStructureFilling
SCR_PrefabStructureFillingPlugin_Car.c
Generated by
1.17.0