Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MoveToRootContextAction.c
Go to the documentation of this file.
3 {
4  bool ParentInSelection(SCR_EditableEntityComponent entity, notnull set<SCR_EditableEntityComponent> selectedEntities)
5  {
6  SCR_EditableEntityComponent parent = entity.GetParentEntity();
7  while (parent)
8  {
9  if (selectedEntities.Find(parent) != -1)
10  {
11  return true;
12  }
13  parent = parent.GetParentEntity();
14  }
15  return false;
16  }
17 
18 
19  override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
20  {
22  if (!layersManager || !layersManager.IsEditingLayersEnabled())
23  return false;
24 
26  if (!core)
27  return false;
28 
29  foreach (SCR_EditableEntityComponent entity : selectedEntities)
30  {
31  if (entity.CanSetParent(null) && entity.GetEntityType() != EEditableEntityType.CHARACTER)
32  return true;
33  }
34 
35  return false;
36  }
37 
38  override bool CanBePerformed(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
39  {
41  if (!layersManager || !layersManager.IsEditingLayersEnabled())
42  return false;
43 
44  foreach (SCR_EditableEntityComponent entity : selectedEntities)
45  {
46  if (ParentInSelection(entity, selectedEntities))
47  continue;
48 
49  if (entity.GetParentEntity())
50  {
51  return true;
52  }
53  }
54 
55  return false;
56  }
57 
58  override void Perform(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition,int flags, int param = -1)
59  {
61  if (!core)
62  return;
63 
64  set<SCR_EditableEntityComponent> entitiesToMove = new set<SCR_EditableEntityComponent>();
65 
66  foreach (SCR_EditableEntityComponent entity: selectedEntities)
67  {
68  if (!entity.CanSetParent(null) && entity.GetEntityType() != EEditableEntityType.CHARACTER)
69  continue;
70 
71  entitiesToMove.Insert(entity);
72  }
73 
75  if (layersManager)
76  {
77  layersManager.MoveToLayerAndSelect(entitiesToMove, null);
78  }
79  }
80 
81 };
SCR_EditableEntityCore
Definition: SCR_EditableEntityCore.c:10
SCR_BaseEditorComponent
Definition: SCR_BaseEditorComponent.c:119
SCR_BaseContextAction
Definition: SCR_BaseContextAction.c:7
EEditableEntityType
EEditableEntityType
Defines type of SCR_EditableEntityComponent. Assigned automatically based on IEntity inheritance.
Definition: EEditableEntityType.c:5
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
SCR_LayersEditorComponent
Definition: SCR_LayersEditorManager.c:11
SCR_MoveToRootContextAction
Definition: SCR_MoveToRootContextAction.c:2
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