Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EntityLabelPointComponent.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/Components", description: "Component labeling entities and tracking their positions updates (if they are in editable composition)")]
3{
4 [Attribute(uiwidget: UIWidgets.SearchComboBox, category: "Entity Spawner", desc: "Entity labels.", enums: ParamEnumArray.FromEnum(EEditableEntityLabel))]
5 protected ref array<EEditableEntityLabel> m_aEntityLabels;
6
7 //------------------------------------------------------------------------------------------------
11 bool GetEntityLabels(out notnull array<EEditableEntityLabel> labels)
12 {
14 {
15 labels.Clear();
16 labels.Copy(m_aEntityLabels);
17 }
18
19 return m_aEntityLabels != null;
20 }
21}
22
23class SCR_EntityLabelPointComponent : ScriptComponent
24{
25 //invokes with labelComponent and owner origin
27
28 //------------------------------------------------------------------------------------------------
31 {
33 if (!prefabData)
34 return false;
35
36 array<EEditableEntityLabel> labels = {};
37 prefabData.GetEntityLabels(labels);
38
39 return labels.Contains(label);
40 }
41
42 //------------------------------------------------------------------------------------------------
51
52 //------------------------------------------------------------------------------------------------
53 protected void OnEntityUpdated(notnull SCR_EditableEntityComponent editableComponent)
54 {
55 IEntity owner = editableComponent.GetOwner();
56 if (!owner)
57 return;
58
59 SCR_EntityLabelPointComponent labelComponent = SCR_EntityLabelPointComponent.Cast(owner.FindComponent(SCR_EntityLabelPointComponent));
60 if (labelComponent && m_OnOwnerUpdated)
61 m_OnOwnerUpdated.Invoke(labelComponent, owner.GetOrigin());
62 }
63
64 //------------------------------------------------------------------------------------------------
65 protected override void EOnInit(IEntity owner)
66 {
67 super.EOnInit(owner);
68
70 if (core)
71 core.Event_OnEntityTransformChanged.Insert(OnEntityUpdated);
72 else
73 Print("SCR_EditableEntityCore not found! SCR_EntityLaberComponent won't be updated!", LogLevel.WARNING);
74 }
75
76 //------------------------------------------------------------------------------------------------
77 // destructor
79 {
81 if (core)
82 core.Event_OnEntityTransformChanged.Remove(OnEntityUpdated);
83 }
84}
EEditableEntityLabel
SCR_CharacterSoundComponentClass GetComponentData()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
bool HasLabel(EEditableEntityLabel label)
void ~SCR_EntityLabelPointComponent()
void OnEntityUpdated(notnull SCR_EditableEntityComponent editableComponent)
SCR_EntityLabelPointComponentClass m_OnOwnerUpdated
ScriptInvoker GetOnOwnerUpdated()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
bool GetEntityLabels(out notnull array< EEditableEntityLabel > labels)
ref array< EEditableEntityLabel > m_aEntityLabels
proto external GenericEntity GetOwner()
Get owner entity.
override void EOnInit(IEntity owner)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134