Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
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) )]
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 {
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
36 }
37
38 //------------------------------------------------------------------------------------------------
39 override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
40 {
41 if (!var)
42 return;
43
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())
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
83enum EArsenalType
84{
88}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_ArsenalBaseEditorAttribute DISPLAY_ONLY
SCR_ArsenalBaseEditorAttribute BOX_ONLY
SCR_BaseEditorAttributeEntryTimeSlider m_aValues
SCR_EArsenalItemType
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_EArsenalAttributeGroup m_eEditableAttributeGroups
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
SCR_EArsenalAttributeGroup GetEditableAttributeGroups()
static SCR_ArsenalComponent FindArsenalComponent(notnull IEntity entity, bool getFromSlotted=true)
SCR_EArsenalItemType GetSupportedArsenalItemTypes()
void SetSupportedArsenalItemTypes(SCR_EArsenalItemType types)
static SCR_BaseEditorAttributeVar CreateInt(int value)
Definition int.c:13
SCR_FieldOfViewSettings Attribute
@ ANY
Will list all servers regardless platform compatibility.
Definition EnScript.c:8