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_FactionRelationshipEditorAttribute.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_BaseEditorAttributeCustomTitle
()]
2
class
SCR_FactionRelationshipEditorAttribute
:
SCR_BaseMultiSelectPresetsEditorAttribute
3
{
4
//------------------------------------------------------------------------------------------------
5
override
SCR_BaseEditorAttributeVar
ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
6
{
7
SCR_EditableFactionComponent editableFaction = SCR_EditableFactionComponent.Cast(item);
8
if
(!editableFaction)
9
return
null;
10
11
SCR_Faction
selectedFaction =
SCR_Faction
.Cast(editableFaction.GetFaction());
12
if
(!selectedFaction)
13
return
null;
14
15
SCR_DelegateFactionManagerComponent
delegateFactionManager =
SCR_DelegateFactionManagerComponent
.
GetInstance
();
16
if
(!delegateFactionManager)
17
return
null;
18
19
SCR_FactionManager
factionManager =
SCR_FactionManager
.Cast(
GetGame
().GetFactionManager());
20
if
(!factionManager)
21
return
null;
22
23
super.ReadVariable(item, manager);
24
25
// Get delegate faction manager
26
SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new
SCR_SortedArray<SCR_EditableFactionComponent>();
27
int
count = delegateFactionManager.
GetSortedFactionDelegates
(factionDelegates);
28
SCR_Faction
scrFaction;
29
30
// Loop through all factions
31
for
(
int
i = 0; i < count; ++i)
32
{
33
scrFaction =
SCR_Faction
.Cast(factionDelegates.Get(i).GetFaction());
34
if
(!scrFaction)
35
continue
;
36
37
// Set the state based on friendly (highlighted) or hostile(non-highlighted)
38
AddOrderedState
(scrFaction.
DoCheckIfFactionFriendly
(selectedFaction));
39
}
40
41
return
SCR_BaseEditorAttributeVar
.
CreateVector
(
GetFlagVector
());
42
}
43
44
//------------------------------------------------------------------------------------------------
45
override
void
WriteVariable(Managed item,
SCR_BaseEditorAttributeVar
var, SCR_AttributesManagerEditorComponent manager,
int
playerID)
46
{
47
SCR_EditableFactionComponent editableFaction = SCR_EditableFactionComponent.Cast(item);
48
if
(!editableFaction)
49
return
;
50
51
SCR_Faction
selectedFaction =
SCR_Faction
.Cast(editableFaction.GetFaction());
52
if
(!selectedFaction)
53
return
;
54
55
SCR_DelegateFactionManagerComponent
delegateFactionManager =
SCR_DelegateFactionManagerComponent
.
GetInstance
();
56
if
(!delegateFactionManager)
57
return
;
58
59
SCR_FactionManager
factionManager =
SCR_FactionManager
.Cast(
GetGame
().GetFactionManager());
60
if
(!factionManager)
61
return
;
62
63
super.WriteVariable(item, var, manager, playerID);
64
65
// Get delegate faction manager
66
SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new
SCR_SortedArray<SCR_EditableFactionComponent>();
67
int
count = delegateFactionManager.
GetSortedFactionDelegates
(factionDelegates);
68
SCR_Faction
scrFaction;
69
70
// Loop through all factions
71
for
(
int
i = 0; i < count; ++i)
72
{
73
scrFaction =
SCR_Faction
.Cast(factionDelegates.Get(i).GetFaction());
74
if
(!scrFaction)
75
continue
;
76
77
// Based on the state, set the faction to friendly (highlighted) or hostile(non-highlighted)
78
if
(
GetOrderedState
())
79
factionManager.SetFactionsFriendly(selectedFaction, scrFaction, playerID,
false
);
80
else
81
factionManager.SetFactionsHostile(selectedFaction, scrFaction, playerID,
false
);
82
}
83
84
//~ Update AIs
85
SCR_FactionManager
.RequestUpdateAllTargetsFactions();
86
}
87
88
//------------------------------------------------------------------------------------------------
89
override
protected
void
CreatePresets
()
90
{
91
SCR_DelegateFactionManagerComponent
delegateFactionManager =
SCR_DelegateFactionManagerComponent
.
GetInstance
();
92
if
(!delegateFactionManager)
93
return
;
94
95
FactionManager factionManager =
GetGame
().GetFactionManager();
96
if
(!factionManager)
97
return
;
98
99
m_aValues
.Clear();
100
101
SCR_SortedArray<SCR_EditableFactionComponent> factionDelegates =
new
SCR_SortedArray<SCR_EditableFactionComponent>();
102
int
count = delegateFactionManager.
GetSortedFactionDelegates
(factionDelegates);
103
104
SCR_Faction
scrFaction;
105
SCR_EditorAttributeFloatStringValueHolder
value;
106
107
for
(
int
i = 0; i < count; ++i)
108
{
109
scrFaction =
SCR_Faction
.Cast(factionDelegates.Get(i).GetFaction());
110
111
if
(!scrFaction || scrFaction.
GetParent
() != null)
112
continue
;
113
114
value =
new
SCR_EditorAttributeFloatStringValueHolder
();
115
116
value.
SetWithUIInfo
(scrFaction.GetUIInfo(), factionManager.GetFactionIndex(factionDelegates.Get(i).GetFaction()));
117
m_aValues
.Insert(value);
118
}
119
}
120
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition
SCR_FactionManager.c:498
SCR_BaseEditorAttributeCustomTitle
Definition
SCR_BaseEditorAttribute.c:876
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::CreateVector
static SCR_BaseEditorAttributeVar CreateVector(vector value)
Definition
SCR_BaseEditorAttributeVar.c:125
SCR_BaseFloatValueHolderEditorAttribute::m_aValues
ref array< ref SCR_EditorAttributeFloatStringValueHolder > m_aValues
Definition
SCR_BaseFloatValueHolderEditorAttribute.c:6
SCR_BaseMultiSelectPresetsEditorAttribute
Definition
SCR_BaseMultiSelectPresetsEditorAttribute.c:5
SCR_BaseMultiSelectPresetsEditorAttribute::GetOrderedState
bool GetOrderedState()
Definition
SCR_BaseMultiSelectPresetsEditorAttribute.c:50
SCR_BaseMultiSelectPresetsEditorAttribute::GetFlagVector
vector GetFlagVector()
Definition
SCR_BaseMultiSelectPresetsEditorAttribute.c:138
SCR_BaseMultiSelectPresetsEditorAttribute::AddOrderedState
void AddOrderedState(bool state)
Definition
SCR_BaseMultiSelectPresetsEditorAttribute.c:27
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_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
SCR_Faction::DoCheckIfFactionFriendly
override bool DoCheckIfFactionFriendly(Faction faction)
Definition
SCR_Faction.c:504
SCR_FactionRelationshipEditorAttribute
Definition
SCR_FactionRelationshipEditorAttribute.c:3
SCR_FactionRelationshipEditorAttribute::CreatePresets
void CreatePresets()
Definition
SCR_FactionRelationshipEditorAttribute.c:89
scripts
Game
Editor
Containers
Attributes
SCR_FactionRelationshipEditorAttribute.c
Generated by
1.17.0