Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_BaseFactionEditableAttribute.c
Go to the documentation of this file.
1
4
[
BaseContainerProps
(),
SCR_BaseEditorAttributeCustomTitle
()]
5
class
SCR_BaseFactionEditableAttribute
:
SCR_BasePresetsEditorAttribute
6
{
7
override
SCR_BaseEditorAttributeVar
ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
8
{
9
SCR_EditableEntityComponent
editableEntity =
SCR_EditableEntityComponent
.Cast(item);
10
if
(!editableEntity)
11
return
null;
12
13
if
(!
ValidEntity
(editableEntity.GetOwner()))
14
return
null;
15
16
FactionManager factionManager =
GetGame
().GetFactionManager();
17
if
(!factionManager)
18
return
null;
19
20
Faction
faction =
GetFaction
(editableEntity.GetOwner());
21
if
(!faction)
22
return
null;
23
24
SCR_DelegateFactionManagerComponent
delegateFactionManager =
SCR_DelegateFactionManagerComponent
.
GetInstance
();
25
if
(!delegateFactionManager)
26
return
null;
27
28
SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new
SCR_SortedArray<SCR_EditableFactionComponent>;
29
int
count = delegateFactionManager.
GetSortedFactionDelegates
(factionDelegates);
30
31
if
(factionDelegates.IsEmpty())
32
return
null;
33
34
int
factionIndex = factionManager.GetFactionIndex(faction);
35
36
for
(
int
i = 0; i < count; i++)
37
{
38
if
(factionDelegates.GetValue(i).GetFactionIndex() == factionIndex)
39
return
SCR_BaseEditorAttributeVar
.
CreateInt
(i);
40
}
41
42
return
null;
43
}
44
45
//~ Check if entity is valid to set faction
46
protected
bool
ValidEntity
(
GenericEntity
entity)
47
{
48
return
false
;
49
}
50
51
//~ Get the entity faction
52
protected
Faction
GetFaction
(
GenericEntity
entity)
53
{
54
return
null;
55
}
56
57
//~ Set the entity faction
58
protected
void
SetFaction
(
GenericEntity
entity,
Faction
faction)
59
{
60
61
}
62
63
//~ Creates the buttons to select faction
64
protected
override
void
CreatePresets
()
65
{
66
SCR_DelegateFactionManagerComponent
delegateFactionManager =
SCR_DelegateFactionManagerComponent
.
GetInstance
();
67
if
(!delegateFactionManager)
68
return
;
69
70
FactionManager factionManager =
GetGame
().GetFactionManager();
71
if
(!factionManager)
72
return
;
73
74
m_aValues
.Clear();
75
76
SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new
SCR_SortedArray<SCR_EditableFactionComponent>;
77
int
count = delegateFactionManager.
GetSortedFactionDelegates
(factionDelegates);
78
79
SCR_Faction
scrFaction;
80
81
for
(
int
i = 0; i < count; ++i)
82
{
83
scrFaction =
SCR_Faction
.Cast(factionDelegates.Get(i).GetFaction());
84
85
if
(!scrFaction || scrFaction.
GetParent
() != null)
86
continue
;
87
88
SCR_EditorAttributeFloatStringValueHolder
value =
new
SCR_EditorAttributeFloatStringValueHolder
();
89
value.
SetWithUIInfo
(scrFaction.GetUIInfo(), factionDelegates.GetValue(i).GetFactionIndex());
90
m_aValues
.Insert(value);
91
}
92
}
93
94
override
void
WriteVariable
(Managed item,
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
int
playerID)
95
{
96
if
(!var)
97
return
;
98
99
FactionManager factionManager =
GetGame
().GetFactionManager();
100
if
(!factionManager)
101
return
;
102
103
SCR_EditableEntityComponent
editableEntity =
SCR_EditableEntityComponent
.Cast(item);
104
if
(!editableEntity)
105
return
;
106
107
SCR_DelegateFactionManagerComponent
delegateFactionManager =
SCR_DelegateFactionManagerComponent
.
GetInstance
();
108
if
(!delegateFactionManager)
109
return
;
110
111
SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new
SCR_SortedArray<SCR_EditableFactionComponent>;
112
delegateFactionManager.
GetSortedFactionDelegates
(factionDelegates);
113
114
if
(factionDelegates.IsEmpty())
115
return
;
116
117
//Faction faction = factionManager.GetFactionByIndex(var.GetInt());
118
Faction
faction = factionManager.GetFactionByIndex(factionDelegates.GetValue(var.
GetInt
()).GetFactionIndex());
119
if
(!faction)
120
return
;
121
122
SetFaction
(editableEntity.GetOwner(), faction);
123
}
124
};
125
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
GetFaction
SCR_CampaignFaction GetFaction()
Definition
SCR_CampaignMobileAssemblyStandaloneComponent.c:164
Faction
Definition
Faction.c:13
GenericEntity
Definition
GenericEntity.c:16
SCR_BaseEditorAttributeCustomTitle
Definition
SCR_BaseEditorAttribute.c:876
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::CreateInt
static SCR_BaseEditorAttributeVar CreateInt(int value)
Definition
SCR_BaseEditorAttributeVar.c:107
SCR_BaseEditorAttributeVar::GetInt
int GetInt()
Definition
SCR_BaseEditorAttributeVar.c:20
SCR_BaseFactionEditableAttribute
Definition
SCR_BaseFactionEditableAttribute.c:6
SCR_BaseFactionEditableAttribute::SetFaction
void SetFaction(GenericEntity entity, Faction faction)
Definition
SCR_BaseFactionEditableAttribute.c:58
SCR_BaseFactionEditableAttribute::ValidEntity
bool ValidEntity(GenericEntity entity)
Definition
SCR_BaseFactionEditableAttribute.c:46
SCR_BaseFactionEditableAttribute::GetFaction
Faction GetFaction(GenericEntity entity)
Definition
SCR_BaseFactionEditableAttribute.c:52
SCR_BaseFactionEditableAttribute::WriteVariable
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
Definition
SCR_BaseFactionEditableAttribute.c:94
SCR_BaseFactionEditableAttribute::CreatePresets
override void CreatePresets()
Definition
SCR_BaseFactionEditableAttribute.c:64
SCR_BaseFloatValueHolderEditorAttribute::m_aValues
ref array< ref SCR_EditorAttributeFloatStringValueHolder > m_aValues
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:6
SCR_BasePresetsEditorAttribute
Definition
SCR_BasePresetsEditorAttribute.c:6
SCR_DelegateFactionManagerComponent
Definition
SCR_DelegateFactionManagerComponent.c:16
SCR_DelegateFactionManagerComponent::GetInstance
static SCR_DelegateFactionManagerComponent GetInstance()
Definition
SCR_DelegateFactionManagerComponent.c:27
SCR_DelegateFactionManagerComponent::GetSortedFactionDelegates
int GetSortedFactionDelegates(notnull out SCR_SortedArray< SCR_EditableFactionComponent > outDelegates)
Definition
SCR_DelegateFactionManagerComponent.c:54
SCR_EditableEntityComponent
Definition
SCR_EditableEntityComponent.c:14
SCR_EditorAttributeFloatStringValueHolder
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:61
SCR_EditorAttributeFloatStringValueHolder::SetWithUIInfo
void SetWithUIInfo(SCR_UIInfo info, float value)
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:141
SCR_Faction
Definition
SCR_Faction.c:6
SCR_Faction::GetParent
Faction GetParent()
Definition
SCR_Faction.c:546
scripts
Game
Editor
Containers
Attributes
SCR_BaseFactionEditableAttribute.c
Generated by
1.17.0