Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ArsenalBaseEditorAttribute.c
Go to the documentation of this file.
3 {
4  //~ Checks if the arsenal has the given arsenal group flag enabled. Else will not show this Arsenal Attribute
5  [Attribute("2", UIWidgets.ComboBox, "Editable Arsenal Group", "", ParamEnumArray.FromEnum(SCR_EArsenalAttributeGroup) )]
6  protected SCR_EArsenalAttributeGroup m_eEditableAttributeGroups;
7 
8  [Attribute("0", desc: "Dictates if attribute can be shown for box, displays or both. All other settings are still checked so if an arsenal display cannot display outfits then it will still not show.", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EArsenalType))]
9  protected EArsenalType m_iArsenalType;
10 
11  //------------------------------------------------------------------------------------------------
12  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
13  {
14  SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item);
15  if (!editableEntity)
16  return null;
17 
18  SCR_ArsenalComponent arsenalComponent = SCR_ArsenalComponent.FindArsenalComponent(editableEntity.GetOwner());
19  if (!arsenalComponent)
20  return null;
21 
22  //~ Check if box or display
23  if (m_iArsenalType != EArsenalType.ANY)
24  {
25  SCR_ArsenalDisplayComponent displayComp = SCR_ArsenalDisplayComponent.Cast(arsenalComponent);
26 
27  if ((m_iArsenalType == EArsenalType.BOX_ONLY && displayComp != null) || (m_iArsenalType == EArsenalType.DISPLAY_ONLY && displayComp == null))
28  return null;
29  }
30 
31  SCR_EArsenalAttributeGroup arsenalGroups = arsenalComponent.GetEditableAttributeGroups();
32  if (!(arsenalGroups & m_eEditableAttributeGroups))
33  return null;
34 
35  return SCR_BaseEditorAttributeVar.CreateInt(arsenalComponent.GetSupportedArsenalItemTypes());
36  }
37 
38  //------------------------------------------------------------------------------------------------
39  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
40  {
41  if (!var)
42  return;
43 
44  SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item);
45  if (!editableEntity)
46  return;
47 
48  SCR_ArsenalComponent arsenalComponent = SCR_ArsenalComponent.FindArsenalComponent(editableEntity.GetOwner());
49  if (!arsenalComponent)
50  return;
51 
52  //~ Check if box or display
53  if (m_iArsenalType != EArsenalType.ANY)
54  {
55  SCR_ArsenalDisplayComponent displayComp = SCR_ArsenalDisplayComponent.Cast(arsenalComponent);
56 
57  if ((m_iArsenalType == EArsenalType.BOX_ONLY && displayComp != null) || (m_iArsenalType == EArsenalType.DISPLAY_ONLY && displayComp == null))
58  return;
59  }
60 
61  //~ Make sure Values are created if it didn't yet exist
62  if (m_aValues.IsEmpty())
63  CreatePresets();
64 
65  //Get the current and add/remove flags as all arsenal attributes edit the same enum and would otherwise override itself
66  SCR_EArsenalItemType arsenalFlags = arsenalComponent.GetSupportedArsenalItemTypes();
67  int newArsenalflags = var.GetInt();
68 
70  {
71  //Check if flag is true or not
72  if (newArsenalflags & (int)value.GetFloatValue())
73  arsenalFlags |= (int)value.GetFloatValue();
74  else
75  arsenalFlags &= ~(int)value.GetFloatValue();
76  }
77 
78  //Update the arsenal
79  arsenalComponent.SetSupportedArsenalItemTypes(arsenalFlags);
80  }
81 }
82 
83 enum EArsenalType
84 {
85  ANY,
86  BOX_ONLY,
88 }
SCR_EArsenalAttributeGroup
SCR_EArsenalAttributeGroup
Definition: SCR_EArsenalAttributeGroup.c:1
m_aValues
SCR_BaseEditorAttributeEntryTimeSlider m_aValues
SCR_LoadoutBaseEditorAttribute
Definition: SCR_LoadoutBaseEditorAttribute.c:3
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
SCR_ArsenalBaseEditorAttribute
Definition: SCR_ArsenalBaseEditorAttribute.c:2
SCR_EArsenalItemType
SCR_EArsenalItemType
Definition: SCR_EArsenalItemType.c:2
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
ANY
SCR_ArsenalBaseEditorAttribute ANY
Definition: SCR_QRFWaypointConfig.c:4
DISPLAY_ONLY
SCR_ArsenalBaseEditorAttribute DISPLAY_ONLY
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
SCR_EditorAttributeFloatStringValueHolder
Definition: SCR_BaseFloatValueHolderEditorAttribute.c:17
BOX_ONLY
SCR_ArsenalBaseEditorAttribute BOX_ONLY
SCR_ArsenalComponent
Definition: SCR_ArsenalComponent.c:9
int
SCR_PossessingManagerComponentClass int
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