Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CampaignBuildingCompositionOutlineRegistry.c
Go to the documentation of this file.
1 // Here is define which layout prefab belongs to given editable entity and how long it takes to build up the composition.
2 // The Value is kind of abstract as it's not a cost of the composition or the time needed.
3 // It depends on other setup like how much of this value is added by one usage of building tool or how many players at the same time are using their tool to build the composition.
4 
7 {
8  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Composition layout fits to a small (flat) slot size.", "et")]
9  protected ResourceName m_sSlotFlatSmallLayout;
10 
11  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Composition layout fits to a medium (flat) slot size.", "et")]
12  protected ResourceName m_sSlotFlatMediumLayout;
13 
14  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Composition layout fits to a large (flat) slot size.", "et")]
15  protected ResourceName m_sSlotFlatLargeLayout;
16 
17  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Composition layout fits to a small (road) slot size.", "et")]
18  protected ResourceName m_sSlotRoadSmallLayout;
19 
20  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Composition layout fits to a medium (road) slot size.", "et")]
21  protected ResourceName m_sSlotRoadMediumLayout;
22 
23  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Composition layout fits to a large (road) slot size.", "et")]
24  protected ResourceName m_sSlotRoadLargeLayout;
25 
26  [Attribute()]
27  protected ref array<ref SCR_CampaignBuildingCompositionOutline> m_aCompositionLayouts;
28 
29  static const int DEFAULT_BUILDING_VALUE = 50;
30 
31  //------------------------------------------------------------------------------------------------
33  ResourceName GetCompositionOutline(notnull SCR_EditableEntityComponent entity)
34  {
35  IEntity composition = entity.GetOwner();
36  if (!composition)
37  return ResourceName.Empty;
38 
39  ResourceName compositionResourceName = composition.GetPrefabData().GetPrefabName();
40  if (compositionResourceName.IsEmpty())
41  return ResourceName.Empty;
42 
43  foreach (SCR_CampaignBuildingCompositionOutline compositionLayout : m_aCompositionLayouts)
44  {
45  if (compositionLayout.GetEditableEntity() == compositionResourceName)
46  return compositionLayout.GetCompositionLayout();
47  }
48 
49  // If there wasn't found a specific layout for a given composition, load the one set for a specific slot.
50  SCR_EditableEntityUIInfo editableEntityUIInfo = SCR_EditableEntityUIInfo.Cast(entity.GetInfo());
51  if (!editableEntityUIInfo)
52  return ResourceName.Empty;
53 
54  if (editableEntityUIInfo.HasEntityLabel(EEditableEntityLabel.SLOT_FLAT_SMALL))
55  return m_sSlotFlatSmallLayout;
56  else if (editableEntityUIInfo.HasEntityLabel(EEditableEntityLabel.SLOT_FLAT_MEDIUM))
57  return m_sSlotFlatMediumLayout;
58  else if (editableEntityUIInfo.HasEntityLabel(EEditableEntityLabel.SLOT_FLAT_LARGE))
59  return m_sSlotFlatLargeLayout;
60  else if (editableEntityUIInfo.HasEntityLabel(EEditableEntityLabel.SLOT_ROAD_SMALL))
61  return m_sSlotRoadSmallLayout;
62  else if (editableEntityUIInfo.HasEntityLabel(EEditableEntityLabel.SLOT_ROAD_MEDIUM))
63  return m_sSlotRoadMediumLayout;
64  else if (editableEntityUIInfo.HasEntityLabel(EEditableEntityLabel.SLOT_ROAD_LARGE))
65  return m_sSlotRoadLargeLayout;
66  // if the slot size wasn't set, use fail safe.
67  return m_sSlotFlatSmallLayout;
68  }
69 
70  //------------------------------------------------------------------------------------------------
72  int GetCompositionBuildingValue(ResourceName originalComposition)
73  {
74  foreach (SCR_CampaignBuildingCompositionOutline compositionLayout : m_aCompositionLayouts)
75  {
76  if (compositionLayout.GetEditableEntity() == originalComposition)
77  return compositionLayout.GetBuildingValue();
78  }
79 
80  return DEFAULT_BUILDING_VALUE;
81  }
82 };
83 
86 {
87  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Editable entity prefab", "et")]
88  protected ResourceName m_sEditableEntity;
89 
90  [Attribute("", UIWidgets.ResourcePickerThumbnail, "Layout prefab", "et")]
91  protected ResourceName m_sCompositionLayout;
92 
93  [Attribute("50", "Defines how long it takes to build up the composition.", "")]
94  protected int m_iBuildingValue;
95 
96  //------------------------------------------------------------------------------------------------
97  ResourceName GetEditableEntity()
98  {
99  return m_sEditableEntity;
100  }
101 
102  //------------------------------------------------------------------------------------------------
103  ResourceName GetCompositionLayout()
104  {
105  return m_sCompositionLayout;
106  }
107 
108  //------------------------------------------------------------------------------------------------
109  int GetBuildingValue()
110  {
111  return m_iBuildingValue;
112  }
113 }
EEditableEntityLabel
EEditableEntityLabel
Definition: EEditableEntityLabel.c:1
SCR_BaseContainerCustomTitleResourceName
SCR_CampaignMilitaryBaseComponent SCR_MilitaryBaseComponent SCR_BaseContainerCustomTitleResourceName("m_sBaseName", true)
Definition: SCR_CampaignMilitaryBaseComponent.c:2522
SCR_CampaignBuildingCompositionOutline
Definition: SCR_CampaignBuildingCompositionOutlineRegistry.c:85
SCR_EditableEntityUIInfo
Definition: SCR_EditableEntityUIInfo.c:2
Attribute
class SCR_CampaignBuildingCompositionOutlineManager Attribute
Post-process effect of scripted camera.
SCR_CampaignBuildingCompositionOutlineManager
Definition: SCR_CampaignBuildingCompositionOutlineRegistry.c:6
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
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