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_EditorLinkComponent.c
Go to the documentation of this file.
1
[
ComponentEditorProps
(
category
:
"GameScripted/Editor"
, description:
""
)]
2
class
SCR_EditorLinkComponentClass
:
ScriptComponentClass
3
{
4
[
Attribute
(
desc
:
"If true it will allow variant randomization of editable entities. The 'Update editable entity' tool will automatically set this value if any of the direct children have variants."
)]
5
bool
m_bRandomizeVariants;
6
7
[
Attribute
()]
8
ref array<ref SCR_EditorLinkEntry> m_aEntries;
9
}
10
13
17
class
SCR_EditorLinkComponent :
ScriptComponent
18
{
19
protected
static
bool
s_bIgnoreSpawning
;
20
21
protected
ref array<IEntity>
m_aLinkedChildren
;
22
23
protected
ref
ScriptInvoker
m_OnLinkedEntitiesSpawned
;
24
28
ScriptInvoker
GetOnLinkedEntitiesSpawned
()
29
{
30
if
(!
m_OnLinkedEntitiesSpawned
)
31
m_OnLinkedEntitiesSpawned
=
new
ScriptInvoker
();
32
33
return
m_OnLinkedEntitiesSpawned
;
34
}
35
39
static
bool
IsSpawningIgnored()
40
{
41
return
s_bIgnoreSpawning
;
42
}
43
50
static
void
IgnoreSpawning(
bool
ignore)
51
{
52
s_bIgnoreSpawning
= ignore;
53
}
54
60
static
bool
IsSpawned
(SCR_EditableEntityComponent entity)
61
{
62
SCR_EditorLinkComponent linkComponent = SCR_EditorLinkComponent.Cast(entity.GetOwner().FindComponent(SCR_EditorLinkComponent));
63
return
linkComponent && linkComponent.IsSpawned();
64
}
65
69
bool
IsSpawned
()
70
{
71
return
m_aLinkedChildren
!= null;
72
}
73
74
override
void
EOnInit
(
IEntity
owner)
75
{
76
if
(
s_bIgnoreSpawning
)
77
{
78
SCR_EditableEntityComponent
editable =
SCR_EditableEntityComponent
.Cast(owner.
FindComponent
(
SCR_EditableEntityComponent
));
79
if
(editable)
80
editable.
SetEntityFlag
(
EEditableEntityFlag
.SPAWN_UNFINISHED,
true
);
81
s_bIgnoreSpawning
=
false
;
82
return
;
83
}
84
85
SpawnComposition
();
86
}
87
88
override
void
OnPostInit
(
IEntity
owner)
89
{
90
if
((
Replication
.IsClient() && !
Replication
.Loadtime()) ||
SCR_Global
.
IsEditMode
(owner))
91
return
;
92
93
SCR_EditableEntityComponent
parent =
SCR_EditableEntityComponent
.
GetEditableEntity
(owner);
94
if
(!parent)
95
return
;
96
97
SetEventMask(owner,
EntityEvent
.INIT);
98
}
99
100
void
SpawnComposition
()
101
{
102
if
((
Replication
.IsClient() && !
Replication
.Loadtime()) ||
SCR_Global
.
IsEditMode
(
GetOwner
()))
103
return
;
104
105
SCR_EditorLinkComponentClass
prefabData =
SCR_EditorLinkComponentClass
.Cast(
GetComponentData
(
GetOwner
()));
106
if
(!prefabData)
107
return
;
108
109
ArmaReforgerScripted
game
=
GetGame
();
110
BaseWorld
world =
GetOwner
().
GetWorld
();
111
112
EntitySpawnParams
spawnParams =
new
EntitySpawnParams
();
113
spawnParams.TransformMode = ETransformMode.LOCAL;
114
spawnParams.Parent =
GetOwner
();
115
116
m_aLinkedChildren
= {};
117
foreach
(
SCR_EditorLinkEntry
entry : prefabData.m_aEntries)
118
{
119
entry.SetSpawnParams(spawnParams);
120
const
IEntity
entity =
game
.SpawnEntityPrefabEx(entry.m_Prefab, prefabData.m_bRandomizeVariants, world, spawnParams);
121
if
(!entity)
122
Print
(
string
.Format(
"Unable to spawn linked entity @\"%1\"!"
, entry.m_Prefab.GetPath()),
LogLevel
.WARNING);
123
124
m_aLinkedChildren
.Insert(entity);
125
}
126
127
if
(
m_OnLinkedEntitiesSpawned
)
128
m_OnLinkedEntitiesSpawned
.Invoke(
this
);
129
}
130
131
array<IEntity>
GetLinkedChildren
()
132
{
133
return
m_aLinkedChildren
;
134
}
135
136
bool
HasChild
(
IEntity
entity)
137
{
138
if
(!
m_aLinkedChildren
)
139
return
false
;
140
141
return
m_aLinkedChildren
.Contains(entity);
142
}
143
}
144
145
[
BaseContainerProps
(),
SCR_BaseContainerCustomTitleResourceName
(
"m_Prefab"
,
true
)]
146
class
SCR_EditorLinkEntry
147
{
148
[
Attribute
(uiwidget:
UIWidgets
.ResourcePickerThumbnail,
params
:
"et"
)]
149
ResourceName
m_Prefab;
150
151
[
Attribute
(
params
:
"inf inf purpose=coords space=entity anglesVar=m_vAngles"
)]
152
vector
m_vPosition;
153
154
[
Attribute
(
params
:
"inf inf purpose=angles space=entity coordsVar=m_vPosition"
)]
155
vector
m_vAngles;
156
157
[
Attribute
(defvalue:
"1"
)]
158
float
m_fScale;
159
160
void
SetSpawnParams(out
EntitySpawnParams
spawnParams)
161
{
162
Math3D
.AnglesToMatrix(
Vector
(m_vAngles[1], m_vAngles[0], m_vAngles[2]), spawnParams.Transform);
163
spawnParams.Scale = m_fScale;
164
spawnParams.Transform[3] = m_vPosition;
165
}
166
167
void
SCR_EditorLinkEntry(
ResourceName
prefab,
vector
position
,
vector
angles
,
float
scale
)
168
{
169
if
(!prefab.IsEmpty())
170
{
171
m_Prefab = prefab;
172
m_vPosition =
position
;
173
m_vAngles =
angles
;
174
m_fScale =
scale
;
175
}
176
}
177
}
scale
vector scale
Definition
BlenderEndpoints.c:50
game
ref DSGameConfig game
Definition
DSConfig.c:81
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
angles
ref array< string > angles
Definition
PrefabImporter.c:22
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
SpawnComposition
void SpawnComposition()
Spawn the composition belonging to this layout.
Definition
SCR_CampaignBuildingLayoutComponent.c:216
SCR_BaseContainerCustomTitleResourceName
SCR_CampaignMilitaryBaseComponent SCR_MilitaryBaseComponent SCR_BaseContainerCustomTitleResourceName("m_sBaseName", true)
Definition
SCR_CampaignMilitaryBaseComponent.c:2910
GetComponentData
SCR_CharacterSoundComponentClass GetComponentData()
Definition
SCR_CharacterSoundComponent.c:132
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
m_aLinkedChildren
ref array< IEntity > m_aLinkedChildren
Definition
SCR_EditorLinkComponent.c:21
IsSpawned
bool IsSpawned()
Definition
SCR_EditorLinkComponent.c:69
GetOnLinkedEntitiesSpawned
ScriptInvoker GetOnLinkedEntitiesSpawned()
Definition
SCR_EditorLinkComponent.c:28
GetLinkedChildren
array< IEntity > GetLinkedChildren()
Definition
SCR_EditorLinkComponent.c:131
m_OnLinkedEntitiesSpawned
ref ScriptInvoker m_OnLinkedEntitiesSpawned
Definition
SCR_EditorLinkComponent.c:23
HasChild
bool HasChild(IEntity entity)
Definition
SCR_EditorLinkComponent.c:136
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
BaseWorld
Definition
BaseWorld.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetWorld
proto external BaseWorld GetWorld()
Math3D
Definition
Math3D.c:13
Replication
Main replication API.
Definition
Replication.c:14
ResourceName
Definition
ResourceName.c:13
SCR_EditableEntityComponent
Definition
SCR_EditableEntityComponent.c:14
SCR_EditableEntityComponent::GetEditableEntity
static SCR_EditableEntityComponent GetEditableEntity(IEntity owner)
Definition
SCR_EditableEntityComponent.c:919
SCR_EditableEntityComponent::SetEntityFlag
void SetEntityFlag(EEditableEntityFlag flag, bool toSet)
Definition
SCR_EditableEntityComponent.c:1680
SCR_EditorLinkComponentClass
Definition
SCR_EditorLinkComponent.c:3
SCR_EditorLinkEntry
Definition
SCR_EditorLinkComponent.c:147
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
UIWidgets
Definition
attributes.c:40
vector
Definition
vector.c:13
EntitySpawnParams
void EntitySpawnParams()
Definition
gameLib.c:130
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
EOnInit
override void EOnInit(IEntity owner)
Definition
SCR_AIConfigComponent.c:87
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
s_bIgnoreSpawning
SCR_EditorLinkComponentClass s_bIgnoreSpawning
EEditableEntityFlag
EEditableEntityFlag
Unique flags of the entity.
Definition
EEditableEntityFlag.c:6
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
Vector
proto native vector Vector(float x, float y, float z)
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
Editor
Components
Misc
SCR_EditorLinkComponent.c
Generated by
1.17.0