Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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)")]
2 class SCR_EntityLabelPointComponentClass : ScriptComponentClass
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  {
13  if (m_aEntityLabels)
14  {
15  labels.Clear();
16  labels.Copy(m_aEntityLabels);
17  }
18 
19  return m_aEntityLabels != null;
20  }
21 }
22 
23 class SCR_EntityLabelPointComponent : ScriptComponent
24 {
25  //invokes with labelComponent and owner origin
26  protected ref ScriptInvoker m_OnOwnerUpdated;
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  //------------------------------------------------------------------------------------------------
44  ScriptInvoker GetOnOwnerUpdated()
45  {
46  if (!m_OnOwnerUpdated)
47  m_OnOwnerUpdated = new ScriptInvoker();
48 
49  return m_OnOwnerUpdated;
50  }
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
EEditableEntityLabel
Definition: EEditableEntityLabel.c:1
SCR_EditableEntityCore
Definition: SCR_EditableEntityCore.c:10
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
GetOnOwnerUpdated
ScriptInvoker GetOnOwnerUpdated()
Definition: SCR_EntityLabelPointComponent.c:44
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
~SCR_EntityLabelPointComponent
void ~SCR_EntityLabelPointComponent()
Definition: SCR_EntityLabelPointComponent.c:78
Attribute
typedef Attribute
Post-process effect of scripted camera.
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
EOnInit
protected override void EOnInit(IEntity owner)
Definition: SCR_EntityLabelPointComponent.c:65
HasLabel
bool HasLabel(EEditableEntityLabel label)
Definition: SCR_EntityLabelPointComponent.c:30
m_OnOwnerUpdated
SCR_EntityLabelPointComponentClass m_OnOwnerUpdated
OnEntityUpdated
protected void OnEntityUpdated(notnull SCR_EditableEntityComponent editableComponent)
Definition: SCR_EntityLabelPointComponent.c:53
SCR_EntityLabelPointComponentClass
Definition: SCR_EntityLabelPointComponent.c:2
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180