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_GroupIdentityComponent.c
Go to the documentation of this file.
1
void
SCR_GroupIdentityComponent_OnChange
(
SCR_MilitarySymbol
symbol,
LocalizedString
name);
2
typedef
func
SCR_GroupIdentityComponent_OnChange
;
3
4
[
ComponentEditorProps
(
category
:
"GameScripted/Misc"
, description:
""
)]
5
class
SCR_GroupIdentityComponentClass
:
ScriptComponentClass
6
{
7
}
8
9
class
SCR_GroupIdentityComponent :
ScriptComponent
10
{
11
[
Attribute
()]
12
protected
ref
SCR_MilitarySymbol
m_MilitarySymbol;
13
14
[
Attribute
(
desc
:
"When enabled, the group will use the identity defined in 'Military Symbol' attribute and ignore automatic evaluation."
)]
15
protected
bool
m_bForced
;
16
17
protected
SCR_AIGroup
m_Group
;
18
protected
int
m_iNameID
= -1;
19
protected
LocalizedString
m_sName
;
20
protected
ref ScriptInvokerBase<SCR_GroupIdentityComponent_OnChange>
m_OnIdentityChange
=
new
ScriptInvokerBase<SCR_GroupIdentityComponent_OnChange>();
21
22
//------------------------------------------------------------------------------------------------
25
SCR_MilitarySymbol
GetMilitarySymbol
()
26
{
27
return
m_MilitarySymbol;
28
}
29
30
//------------------------------------------------------------------------------------------------
33
LocalizedString
GetGroupName
()
34
{
35
return
m_sName
;
36
}
37
38
//------------------------------------------------------------------------------------------------
40
ScriptInvokerBase<SCR_GroupIdentityComponent_OnChange>
GetOnIdentityChange
()
41
{
42
return
m_OnIdentityChange
;
43
}
44
45
//------------------------------------------------------------------------------------------------
47
void
UpdateIdentity
()
48
{
49
//--- Server only
50
if
(
Replication
.IsClient())
51
return
;
52
53
//--- Save the current symbol for later comparison
54
SCR_MilitarySymbol
original =
new
SCR_MilitarySymbol
();
55
original.
CopyFrom
(m_MilitarySymbol);
56
57
//--- Update military symbol
58
SCR_GroupIdentityCore
core =
SCR_GroupIdentityCore
.Cast(
SCR_GroupIdentityCore
.GetInstance(
SCR_GroupIdentityCore
));
59
SCR_MilitarySymbolRuleSet
ruleSet = core.
GetSymbolRuleSet
();
60
ruleSet.
UpdateSymbol
(m_MilitarySymbol,
m_Group
);
61
62
//--- Broadcast the symbol if it changed
63
if
(!m_MilitarySymbol.IsEqual(original) ||
m_iNameID
== -1)
64
{
65
//--- Get name based on the symbol
66
SCR_GroupNameConfig
nameManager = core.
GetNames
();
67
int
nameID = nameManager.
GetGroupNameID
(m_MilitarySymbol);
68
69
//--- Apply changes
70
UpdateIdentityBroadcast
(nameID, m_MilitarySymbol);
71
Rpc
(
UpdateIdentityBroadcast
, nameID, m_MilitarySymbol);
72
}
73
}
74
75
//------------------------------------------------------------------------------------------------
76
[
RplRpc
(
RplChannel
.Reliable,
RplRcver
.Broadcast)]
77
protected
void
UpdateIdentityBroadcast
(
int
nameID,
SCR_MilitarySymbol
symbol)
78
{
79
SCR_GroupIdentityCore
core =
SCR_GroupIdentityCore
.Cast(
SCR_GroupIdentityCore
.GetInstance(
SCR_GroupIdentityCore
));
80
SCR_GroupNameConfig
nameManager = core.
GetNames
();
81
82
m_MilitarySymbol = symbol;
83
m_iNameID
= nameID;
84
m_sName
= nameManager.
GetGroupName
(
m_iNameID
);
85
86
m_OnIdentityChange
.Invoke(m_MilitarySymbol,
m_sName
);
87
}
88
89
//------------------------------------------------------------------------------------------------
90
protected
void
OnGroupInit
(
SCR_AIGroup
aiGroup)
91
{
92
UpdateIdentity
();
93
m_Group
.GetOnAgentAdded().Insert(
OnAgentAdded
);
94
m_Group
.GetOnAgentRemoved().Insert(
OnAgentRemoved
);
95
m_Group
.GetOnAgentRemoved().Remove(
OnAgentRemoved
);
96
}
97
98
//------------------------------------------------------------------------------------------------
99
protected
void
OnAgentAdded
()
100
{
101
UpdateIdentity
();
102
}
103
104
//------------------------------------------------------------------------------------------------
105
protected
void
OnAgentRemoved
()
106
{
107
UpdateIdentity
();
108
}
109
110
//------------------------------------------------------------------------------------------------
111
override
bool
RplSave
(ScriptBitWriter writer)
112
{
113
m_MilitarySymbol.OnRplSave(writer);
114
writer.WriteInt(
m_iNameID
);
115
116
return
true
;
117
}
118
119
//------------------------------------------------------------------------------------------------
120
//--- JIP on client
121
override
bool
RplLoad
(
ScriptBitReader
reader)
122
{
123
m_MilitarySymbol.OnRplLoad(reader);
124
reader.ReadInt(
m_iNameID
);
125
126
UpdateIdentityBroadcast
(
m_iNameID
, m_MilitarySymbol);
127
128
return
true
;
129
}
130
131
//------------------------------------------------------------------------------------------------
132
override
void
OnPostInit
(
IEntity
owner)
133
{
134
if
(
SCR_Global
.
IsEditMode
(owner))
135
return
;
136
137
m_Group
=
SCR_AIGroup
.Cast(owner);
138
if
(!
m_Group
)
139
{
140
Print
(
"SCR_GroupIdentityComponent must be attached to SCR_AIGroup!"
,
LogLevel
.WARNING);
141
return
;
142
}
143
144
if
(!
m_bForced
)
145
m_Group
.GetOnInit().Insert(
OnGroupInit
);
146
//--- ToDo: When member gets in/out of vehicle
147
}
148
149
//------------------------------------------------------------------------------------------------
150
override
void
OnDelete
(
IEntity
owner)
151
{
152
if
(!
m_bForced
&&
m_Group
)
153
{
154
m_Group
.GetOnInit().Remove(
OnGroupInit
);
155
m_Group
.GetOnAgentAdded().Remove(
OnAgentAdded
);
156
m_Group
.GetOnAgentRemoved().Remove(
OnAgentRemoved
);
157
}
158
}
159
}
m_Group
SCR_AIGroupSettingsComponentClass m_Group
OnAgentRemoved
void OnAgentRemoved(AIGroup group, AIAgent agent)
Definition
SCR_AIGroupSettingsComponent.c:141
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
func
func
Definition
SCR_AIThreatSystem.c:6
OnAgentRemoved
void OnAgentRemoved()
Definition
SCR_AmbientPatrolSpawnPointComponent.c:451
SCR_GroupIdentityComponent_OnChange
func SCR_GroupIdentityComponent_OnChange
Definition
SCR_GroupIdentityComponent.c:2
GetOnIdentityChange
ScriptInvokerBase< SCR_GroupIdentityComponent_OnChange > GetOnIdentityChange()
Definition
SCR_GroupIdentityComponent.c:40
GetMilitarySymbol
SCR_MilitarySymbol GetMilitarySymbol()
Definition
SCR_GroupIdentityComponent.c:25
OnGroupInit
void OnGroupInit(SCR_AIGroup aiGroup)
Definition
SCR_GroupIdentityComponent.c:90
m_iNameID
int m_iNameID
Definition
SCR_GroupIdentityComponent.c:18
UpdateIdentityBroadcast
void UpdateIdentityBroadcast(int nameID, SCR_MilitarySymbol symbol)
Definition
SCR_GroupIdentityComponent.c:77
m_bForced
bool m_bForced
Definition
SCR_GroupIdentityComponent.c:15
m_sName
LocalizedString m_sName
Definition
SCR_GroupIdentityComponent.c:19
m_OnIdentityChange
ref ScriptInvokerBase< SCR_GroupIdentityComponent_OnChange > m_OnIdentityChange
Definition
SCR_GroupIdentityComponent.c:20
GetGroupName
LocalizedString GetGroupName()
Definition
SCR_GroupIdentityComponent.c:33
UpdateIdentity
void UpdateIdentity()
Update group identity based on its current state.
Definition
SCR_GroupIdentityComponent.c:47
OnAgentAdded
void OnAgentAdded()
Definition
SCR_GroupIdentityComponent.c:99
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
GenericComponent::Rpc
void Rpc(func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL)
IEntity
Definition
IEntity.c:13
LocalizedString
Definition
LocalizedString.c:22
Replication
Main replication API.
Definition
Replication.c:14
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_Global
Definition
Functions.c:7
SCR_Global::IsEditMode
static bool IsEditMode()
Definition
Functions.c:1566
SCR_GroupIdentityComponentClass
Definition
SCR_GroupIdentityComponent.c:6
SCR_GroupIdentityCore
Definition
SCR_GroupIdentityCore.c:3
SCR_GroupIdentityCore::GetSymbolRuleSet
SCR_MilitarySymbolRuleSet GetSymbolRuleSet()
Definition
SCR_GroupIdentityCore.c:21
SCR_GroupIdentityCore::GetNames
SCR_GroupNameConfig GetNames()
Definition
SCR_GroupIdentityCore.c:13
SCR_GroupNameConfig
Definition
SCR_GroupNameConfig.c:3
SCR_GroupNameConfig::GetGroupName
LocalizedString GetGroupName(SCR_MilitarySymbol symbol)
Definition
SCR_GroupNameConfig.c:12
SCR_GroupNameConfig::GetGroupNameID
int GetGroupNameID(SCR_MilitarySymbol symbol)
Definition
SCR_GroupNameConfig.c:38
SCR_MilitarySymbol
Definition
SCR_MilitarySymbol.c:3
SCR_MilitarySymbol::CopyFrom
void CopyFrom(SCR_MilitarySymbol from)
Definition
SCR_MilitarySymbol.c:108
SCR_MilitarySymbolRuleSet
Definition
SCR_MilitarySymbolRuleSet.c:3
SCR_MilitarySymbolRuleSet::UpdateSymbol
void UpdateSymbol(out notnull SCR_MilitarySymbol outSymbol, SCR_Faction faction)
Definition
SCR_MilitarySymbolRuleSet.c:26
ScriptBitReader
Definition
EnNetwork.c:199
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
ScriptComponent::RplLoad
bool RplLoad(ScriptBitReader reader)
ScriptComponent::RplSave
bool RplSave(ScriptBitWriter writer)
OnAgentAdded
void OnAgentAdded(AIAgent agent)
Definition
SCR_AIGroupSettingsComponent.c:119
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
RplRpc
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
Definition
EnNetwork.c:95
RplRcver
RplRcver
Definition
RplRcver.c:59
RplChannel
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
Definition
RplChannel.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
OnDelete
@ OnDelete
Definition
SndComponentCallbacks.c:16
scripts
Game
GroupIdentity
SCR_GroupIdentityComponent.c
Generated by
1.17.0