Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ChooseAndSpawnOccupantsContextAction.c
Go to the documentation of this file.
3 {
4  [Attribute(desc: "Compartments Types to fill when chosing entities.", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(ECompartmentType))]
5  protected ref array<ECompartmentType> m_aCompartmentsTypes;
6 
7  [Attribute(desc: "Opens content browser and shows single characters only")]
8  protected ref SCR_EditorContentBrowserDisplayConfig m_SingleCharacterDisplayConfig;
9 
10  [Attribute(desc: "Opens content browser and shows single characters and small groups")]
11  protected ref SCR_EditorContentBrowserDisplayConfig m_SmallGroupsDisplayConfig;
12 
13  [Attribute(desc: "Opens content browser and shows single characters, small groups and medium groups")]
14  protected ref SCR_EditorContentBrowserDisplayConfig m_MediumGroupsDisplayConfig;
15 
16  [Attribute(desc: "Opens content browser and shows single characters, small groups medium groups and large groups")]
17  protected ref SCR_EditorContentBrowserDisplayConfig m_LargeGroupsDisplayConfig;
18 
19  [Attribute("5", desc: "This free compartment amount or higher need to be availible or more in order for 'large' filter label to be set in the content browser. Allowing those groups sizes (and lower) to be placed", params: "1 inf 1")]
20  protected int m_LargeGroupSize;
21 
22  [Attribute("3", desc: "This free compartment amount or higher need to be availible or more in order for 'medium' filter label to be set in the content browser. Allowing those groups sizes (and lower) to be placed", params: "1 inf 1")]
23  protected int m_MediumGroupSize;
24 
25  [Attribute("2", desc: "This free compartment amount or higher need to be availible or more in order for 'small' filter label to be set in the content browser. Allowing those groups sizes (and lower) to be placed. (Anything lower will be a single character)", params: "1 inf 1")]
26  protected int m_SmallGroupSize;
27 
28 
29  override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
30  {
31  if (!hoveredEntity)
32  return false;
33 
34  SCR_BaseCompartmentManagerComponent compartmentManager = SCR_BaseCompartmentManagerComponent.Cast(hoveredEntity.GetOwner().FindComponent(SCR_BaseCompartmentManagerComponent));
35  if (!compartmentManager)
36  return false;
37 
39  return contentBrowserManager != null;
40  }
41 
42  override bool CanBePerformed(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
43  {
44  SCR_BaseCompartmentManagerComponent compartmentManager = SCR_BaseCompartmentManagerComponent.Cast(hoveredEntity.GetOwner().FindComponent(SCR_BaseCompartmentManagerComponent));
45 
46  return compartmentManager && compartmentManager.CanOccupy(m_aCompartmentsTypes, false, string.Empty, false, true);
47  }
48 
49  override void Perform(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition,int flags, int param = -1)
50  {
51  SCR_BaseCompartmentManagerComponent compartmentManager = SCR_BaseCompartmentManagerComponent.Cast(hoveredEntity.GetOwner().FindComponent(SCR_BaseCompartmentManagerComponent));
52 
53  array<BaseCompartmentSlot> freeCompartments = {};
54 
55  foreach(ECompartmentType compartmentType: m_aCompartmentsTypes)
56  {
57  compartmentManager.GetFreeCompartmentsOfType(freeCompartments, compartmentType);
58  }
59 
60  if (freeCompartments.IsEmpty())
61  return;
62 
63  int count = freeCompartments.Count();
64 
66 
67  if (count >= m_LargeGroupSize)
68  contentBrowserManager.OpenBrowserExtended(hoveredEntity, m_LargeGroupsDisplayConfig);
69  else if (count >= m_MediumGroupSize)
70  contentBrowserManager.OpenBrowserExtended(hoveredEntity, m_MediumGroupsDisplayConfig);
71  else if (count >= m_SmallGroupSize)
72  contentBrowserManager.OpenBrowserExtended(hoveredEntity, m_SmallGroupsDisplayConfig);
73  else
74  contentBrowserManager.OpenBrowserExtended(hoveredEntity, m_SingleCharacterDisplayConfig);
75  }
76 };
SCR_ChooseAndSpawnOccupantsContextAction
Definition: SCR_ChooseAndSpawnOccupantsContextAction.c:2
SCR_EditorContentBrowserDisplayConfig
Definition: SCR_EditorContentBrowserDisplayConfig.c:5
ECompartmentType
ECompartmentType
Definition: ECompartmentType.c:7
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_ContentBrowserEditorComponent
Definition: SCR_ContentBrowserEditorComponent.c:16
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
SCR_SelectedEntitiesContextAction
Definition: SCR_SelectedEntitiesContextAction.c:10
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
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