Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AttachToEntityToolbarAction.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  /*
6  private IEntity m_AttachedEntity;
7  private SCR_AttachManualCameraComponent m_AttachCameraComponent;
8 
9  override bool GetToggled()
10  {
11  return m_AttachedEntity != null;
12  }
13 
14  override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
15  {
16  return true;
17  }
18 
19  override bool CanBePerformed(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
20  {
21  if (GetToggled())
22  {
23  return true;
24  }
25  else
26  {
27  return GetTargetEntity(hoveredEntity, selectedEntities) != null;
28  }
29  }
30 
31  override void Perform(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition,int flags, int param = -1)
32  {
33  IEntity targetEntity = GetTargetEntity(hoveredEntity, selectedEntities);
34 
35  SCR_AttachManualCameraComponent attachComponent;
36  if (GetAttachCameraComponent(attachComponent))
37  {
38  if (targetEntity && m_AttachedEntity != targetEntity)
39  {
40  if (!attachComponent.AttachTo(targetEntity))
41  {
42  targetEntity = null;
43  }
44  }
45  else
46  {
47  attachComponent.Detach();
48  }
49  m_AttachedEntity = targetEntity;
50  }
51  GetOnToggleChanged().Invoke(m_AttachedEntity != null);
52  }
53 
54  IEntity GetTargetEntity(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities)
55  {
56  if (hoveredEntity != null && hoveredEntity.GetOwner() != null)
57  {
58  return hoveredEntity.GetOwner();
59  }
60  else if (selectedEntities.Count() == 1 && selectedEntities[0].GetOwner() != null)
61  {
62  return selectedEntities[0].GetOwner();
63  }
64  return null;
65  }
66 
67  bool GetAttachCameraComponent(out SCR_AttachManualCameraComponent attachComponent)
68  {
69  if (m_AttachCameraComponent)
70  {
71  attachComponent = m_AttachCameraComponent;
72  }
73  else
74  {
75  SCR_CameraEditorComponent cameraManager = SCR_CameraEditorComponent.Cast(SCR_CameraEditorComponent.GetInstance(SCR_CameraEditorComponent));
76  if (!cameraManager) return false;
77 
78  SCR_ManualCamera camera = cameraManager.GetCamera();
79  if (!camera) return false;
80 
81  attachComponent = SCR_AttachManualCameraComponent.Cast(camera.FindCameraComponent(SCR_AttachManualCameraComponent));
82  m_AttachCameraComponent = attachComponent;
83  }
84  return attachComponent != null;
85  }
86  */
87 };
SCR_AttachToEntityToolbarAction
Definition: SCR_AttachToEntityToolbarAction.c:3
SCR_BaseToggleToolbarAction
Definition: SCR_BaseToggleToolbarAction.c:3
SCR_BaseContainerCustomTitleUIInfo
void SCR_BaseContainerCustomTitleUIInfo(string propertyName, string format="%1")
Definition: Attributes.c:788
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468