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_DelegateFactionManagerComponent.c
Go to the documentation of this file.
1
[
ComponentEditorProps
(
category
:
"GameScripted/FactionManager/Components"
, description:
""
)]
2
class
SCR_DelegateFactionManagerComponentClass
:
SCR_BaseFactionManagerComponentClass
3
{
4
};
5
//Here track tasks and spawn points
6
//Find faction deletegate on changed send that to the correct faction then have an rpl function to send the task
7
10
15
class
SCR_DelegateFactionManagerComponent
:
SCR_BaseFactionManagerComponent
16
{
17
[
Attribute
(
params
:
"et"
)]
18
protected
ResourceName
m_FactionDelegatePrefab
;
19
20
protected
ref
map<Faction, SCR_EditableFactionComponent>
m_FactionDelegates
=
new
map<Faction, SCR_EditableFactionComponent>
;
21
22
27
static
SCR_DelegateFactionManagerComponent
GetInstance
()
28
{
29
FactionManager factionManager =
GetGame
().GetFactionManager();
30
if
(factionManager)
31
return
SCR_DelegateFactionManagerComponent
.Cast(factionManager.FindComponent(
SCR_DelegateFactionManagerComponent
));
32
else
33
return
null;
34
}
35
40
int
GetFactionDelegates
(notnull out
map<Faction, SCR_EditableFactionComponent>
outDelegates)
41
{
42
int
count =
m_FactionDelegates
.Count();
43
for
(
int
i = 0; i < count; i++)
44
{
45
outDelegates.Insert(
m_FactionDelegates
.GetKey(i),
m_FactionDelegates
.GetElement(i));
46
}
47
return
count;
48
}
49
54
int
GetSortedFactionDelegates
(notnull out SCR_SortedArray<SCR_EditableFactionComponent> outDelegates)
55
{
56
int
count =
m_FactionDelegates
.Count();
57
SCR_Faction
faction;
58
SCR_EditableFactionComponent factionDelegate;
59
for
(
int
i = 0; i < count; i++)
60
{
61
factionDelegate =
m_FactionDelegates
.GetElement(i);
62
int
order = 0;
63
faction =
SCR_Faction
.Cast(factionDelegate.GetFaction());
64
if
(faction)
65
order = faction.
GetOrder
();
66
67
outDelegates.Insert(order, factionDelegate);
68
}
69
return
count;
70
}
71
75
int
GetFactionDelegateCount
()
76
{
77
return
m_FactionDelegates
.Count();
78
}
79
83
int
GetPlayableFactionDelegates
(notnull out
map<Faction, SCR_EditableFactionComponent>
outDelegates)
84
{
85
foreach
(
Faction
faction, SCR_EditableFactionComponent delegate:
m_FactionDelegates
)
86
{
87
SCR_Faction
scrFaction =
SCR_Faction
.Cast(faction);
88
if
(scrFaction && scrFaction.
IsPlayable
())
89
{
90
outDelegates.Insert(scrFaction, delegate);
91
}
92
}
93
94
return
outDelegates.Count();
95
}
96
100
int
GetPlayableFactionDelegateCount
()
101
{
102
int
count = 0;
103
104
foreach
(
Faction
faction, SCR_EditableFactionComponent delegate:
m_FactionDelegates
)
105
{
106
SCR_Faction
scrFaction =
SCR_Faction
.Cast(faction);
107
if
(scrFaction && scrFaction.
IsPlayable
())
108
count++;
109
}
110
111
return
count;
112
}
113
118
SCR_EditableFactionComponent
GetFactionDelegate
(
Faction
faction)
119
{
120
return
m_FactionDelegates
.Get(faction);
121
}
122
127
void
SetFactionDelegate
(
Faction
faction, SCR_EditableFactionComponent delegate)
128
{
129
m_FactionDelegates
.Set(faction, delegate);
130
}
131
132
override
void
OnFactionsInit
(array<Faction> factions)
133
{
134
if
(
SCR_Global
.
IsEditMode
(
GetOwner
()) || factions.IsEmpty() || (
Replication
.IsClient() &&
Replication
.Runtime()))
135
return
;
136
137
Resource
entityResource =
Resource
.Load(
m_FactionDelegatePrefab
);
138
IEntityComponentSource
componentSource =
SCR_EditableFactionComponentClass
.GetEditableEntitySource(entityResource);
139
if
(!componentSource)
140
{
141
Print
(
string
.Format(
"SCR_EditableFactionComponent missing in '%1'!"
,
m_FactionDelegatePrefab
.GetPath()),
LogLevel
.WARNING);
142
return
;
143
}
144
145
SCR_EditableFactionComponent editableEntity;
146
foreach
(
int
i,
Faction
faction: factions)
147
{
148
IEntity
delegateEntity =
GetGame
().SpawnEntityPrefab(entityResource);
149
editableEntity = SCR_EditableFactionComponent.Cast(SCR_EditableFactionComponent.GetEditableEntity(delegateEntity));
150
editableEntity.SetFactionIndex(i);
151
}
152
}
153
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
SCR_BaseFactionManagerComponent
void SCR_BaseFactionManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_BaseFactionManagerComponent.c:20
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
Faction
Definition
Faction.c:13
IEntityComponentSource
Definition
IEntityComponentSource.c:13
IEntity
Definition
IEntity.c:13
Replication
Main replication API.
Definition
Replication.c:14
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
ResourceName
Definition
ResourceName.c:13
SCR_BaseFactionManagerComponentClass
Definition
SCR_BaseFactionManagerComponent.c:3
SCR_DelegateFactionManagerComponentClass
Definition
SCR_DelegateFactionManagerComponent.c:3
SCR_DelegateFactionManagerComponent
Definition
SCR_DelegateFactionManagerComponent.c:16
SCR_DelegateFactionManagerComponent::m_FactionDelegatePrefab
ResourceName m_FactionDelegatePrefab
Definition
SCR_DelegateFactionManagerComponent.c:18
SCR_DelegateFactionManagerComponent::GetFactionDelegates
int GetFactionDelegates(notnull out map< Faction, SCR_EditableFactionComponent > outDelegates)
Definition
SCR_DelegateFactionManagerComponent.c:40
SCR_DelegateFactionManagerComponent::GetFactionDelegate
SCR_EditableFactionComponent GetFactionDelegate(Faction faction)
Definition
SCR_DelegateFactionManagerComponent.c:118
SCR_DelegateFactionManagerComponent::OnFactionsInit
override void OnFactionsInit(array< Faction > factions)
Definition
SCR_DelegateFactionManagerComponent.c:132
SCR_DelegateFactionManagerComponent::SetFactionDelegate
void SetFactionDelegate(Faction faction, SCR_EditableFactionComponent delegate)
Definition
SCR_DelegateFactionManagerComponent.c:127
SCR_DelegateFactionManagerComponent::GetPlayableFactionDelegates
int GetPlayableFactionDelegates(notnull out map< Faction, SCR_EditableFactionComponent > outDelegates)
Definition
SCR_DelegateFactionManagerComponent.c:83
SCR_DelegateFactionManagerComponent::GetFactionDelegateCount
int GetFactionDelegateCount()
Definition
SCR_DelegateFactionManagerComponent.c:75
SCR_DelegateFactionManagerComponent::GetInstance
static SCR_DelegateFactionManagerComponent GetInstance()
Definition
SCR_DelegateFactionManagerComponent.c:27
SCR_DelegateFactionManagerComponent::m_FactionDelegates
ref map< Faction, SCR_EditableFactionComponent > m_FactionDelegates
Definition
SCR_DelegateFactionManagerComponent.c:20
SCR_DelegateFactionManagerComponent::GetPlayableFactionDelegateCount
int GetPlayableFactionDelegateCount()
Definition
SCR_DelegateFactionManagerComponent.c:100
SCR_DelegateFactionManagerComponent::GetSortedFactionDelegates
int GetSortedFactionDelegates(notnull out SCR_SortedArray< SCR_EditableFactionComponent > outDelegates)
Definition
SCR_DelegateFactionManagerComponent.c:54
SCR_EditableFactionComponentClass
Definition
SCR_EditableFactionComponent.c:3
SCR_Faction
Definition
SCR_Faction.c:6
SCR_Faction::GetOrder
int GetOrder()
Definition
SCR_Faction.c:136
SCR_Faction::IsPlayable
bool IsPlayable()
Definition
SCR_Faction.c:335
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
map
Definition
Types.c:486
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Editor
Components
SCR_DelegateFactionManagerComponent.c
Generated by
1.17.0