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_RadioCoverageMapDescriptorComponent.c
Go to the documentation of this file.
1
class
SCR_RadioCoverageMapDescriptorComponentClass
:
SCR_MapDescriptorComponentClass
2
{
3
[
Attribute
(
"{C35F29E48086221A}Configs/Campaign/CampaignGraphLinesConfig.conf"
,
category
:
"Lines"
)]
4
protected
ref
SCR_GraphLinesData
m_GraphLinesData
;
5
6
//------------------------------------------------------------------------------------------------
7
SCR_GraphLinesData
GetGraphLinesData
()
8
{
9
return
m_GraphLinesData
;
10
}
11
}
12
13
class
SCR_RadioCoverageMapDescriptorComponent : SCR_MapDescriptorComponent
14
{
15
SCR_CoverageRadioComponent
m_Radio
;
16
17
//------------------------------------------------------------------------------------------------
18
protected
SCR_GraphLinesData
GetGraphLinesData
()
19
{
20
IEntity
owner = Item().Entity();
21
22
if
(!owner)
23
return
null;
24
25
SCR_RadioCoverageMapDescriptorComponentClass
componentData =
SCR_RadioCoverageMapDescriptorComponentClass
.Cast(
GetComponentData
(owner));
26
27
if
(!componentData)
28
return
null;
29
30
return
componentData.
GetGraphLinesData
();
31
}
32
33
//------------------------------------------------------------------------------------------------
34
void
SetParentRadio
(SCR_CoverageRadioComponent radio)
35
{
36
m_Radio
= radio;
37
38
if
(
m_Radio
)
39
{
40
SCR_MapEntity
.
GetOnMapOpen
().Insert(
OnMapOpen
);
41
SCR_MapEntity
.
GetOnMapClose
().Insert(
OnMapClose
);
42
}
43
else
44
{
45
DeleteLinks
();
46
SCR_MapEntity
.
GetOnMapOpen
().Remove(
OnMapOpen
);
47
SCR_MapEntity
.
GetOnMapClose
().Remove(
OnMapClose
);
48
}
49
}
50
51
//------------------------------------------------------------------------------------------------
52
SCR_CoverageRadioComponent
GetParentRadio
()
53
{
54
return
m_Radio
;
55
}
56
57
//------------------------------------------------------------------------------------------------
58
protected
void
OnMapOpen
(
MapConfiguration
config)
59
{
60
CreateLinks
();
61
}
62
63
//------------------------------------------------------------------------------------------------
64
protected
void
OnMapClose
(
MapConfiguration
config)
65
{
66
DeleteLinks
();
67
}
68
69
//------------------------------------------------------------------------------------------------
70
protected
void
CreateLinks
()
71
{
72
MapItem
mapItem = Item();
73
74
if
(!mapItem)
75
return
;
76
77
SCR_Faction
playerFaction =
SCR_Faction
.Cast(
SCR_FactionManager
.SGetLocalPlayerFaction());
78
79
if
(!playerFaction)
80
return
;
81
82
string
playerFactionEncryption = playerFaction.GetFactionRadioEncryptionKey();
83
84
if
(playerFactionEncryption.IsEmpty())
85
return
;
86
87
string
radioEncryption =
m_Radio
.GetEncryptionKey();
88
SCR_ERadioCoverageStatus coverage =
m_Radio
.GetCoverageByEncryption(radioEncryption);
89
90
if
(radioEncryption != playerFactionEncryption || coverage == SCR_ERadioCoverageStatus.NONE || coverage == SCR_ERadioCoverageStatus.SEND)
91
return
;
92
93
array<SCR_CoverageRadioComponent> radios = {};
94
m_Radio
.GetRadiosInRange(radios);
95
96
SCR_RadioCoverageMapDescriptorComponent target;
97
MapItem
targetItem;
98
array<MapLink> targetLinks = {};
99
MapLink
link;
100
101
foreach
(SCR_CoverageRadioComponent radio : radios)
102
{
103
target = SCR_RadioCoverageMapDescriptorComponent.Cast(radio.GetOwner().FindComponent(SCR_RadioCoverageMapDescriptorComponent));
104
105
if
(!target)
106
continue
;
107
108
targetItem = target.Item();
109
110
if
(!targetItem || !targetItem.IsVisible())
111
continue
;
112
113
bool
linked;
114
targetLinks.Clear();
115
targetItem.GetLinks(targetLinks);
116
117
// Don't create two links between the same bases
118
foreach
(
MapLink
targetLink : targetLinks)
119
{
120
if
(targetLink.Target() == mapItem)
121
{
122
linked =
true
;
123
break
;
124
}
125
}
126
127
if
(linked)
128
continue
;
129
130
link = mapItem.LinkTo(targetItem);
131
ColorMapLink
(link,
false
);
132
}
133
}
134
135
//------------------------------------------------------------------------------------------------
136
protected
void
DeleteLinks
()
137
{
138
MapItem
mapItem = Item();
139
140
if
(!mapItem)
141
return
;
142
143
mapItem.ClearLinks();
144
}
145
146
//------------------------------------------------------------------------------------------------
147
void
UpdateLinks
()
148
{
149
DeleteLinks
();
150
CreateLinks
();
151
}
152
153
//------------------------------------------------------------------------------------------------
154
void
OnIconHovered
(
bool
hovering)
155
{
156
MapItem
mapItem = Item();
157
158
if
(!mapItem)
159
return
;
160
161
array<MapLink> links = {};
162
mapItem.GetLinks(links);
163
164
// Add links saved in neighboring components so we can potentially highlight them as well
165
array<SCR_CoverageRadioComponent> radiosInRange = {};
166
m_Radio
.GetRadiosInRange(radiosInRange);
167
168
SCR_RadioCoverageMapDescriptorComponent comp;
169
MapItem
otherMapItem;
170
array<MapLink> otherLinks = {};
171
172
foreach
(SCR_CoverageRadioComponent radioInRange : radiosInRange)
173
{
174
comp = SCR_RadioCoverageMapDescriptorComponent.Cast(radioInRange.GetOwner().FindComponent(SCR_RadioCoverageMapDescriptorComponent));
175
176
if
(!comp)
177
continue
;
178
179
otherMapItem = comp.Item();
180
181
otherLinks.Clear();
182
otherMapItem.GetLinks(otherLinks);
183
184
foreach
(
MapLink
otherLink : otherLinks)
185
{
186
if
(otherLink.Target() == mapItem)
187
links.Insert(otherLink);
188
}
189
}
190
191
foreach
(
MapLink
link : links)
192
{
193
if
(!link)
194
continue
;
195
196
ColorMapLink
(link, hovering);
197
}
198
}
199
200
//------------------------------------------------------------------------------------------------
201
protected
void
ColorMapLink
(notnull
MapLink
link,
bool
isHovering)
202
{
203
MapLinkProps
props = link.GetMapLinkProps();
204
205
if
(!props)
206
return
;
207
208
SCR_GraphLinesData
linesData =
GetGraphLinesData
();
209
210
if
(!linesData)
211
return
;
212
213
props.SetLineWidth(linesData.
GetLineWidth
());
214
215
Color
c =
Color
.FromInt(props.GetLineColor().PackToInt());
216
217
if
(!c)
218
return
;
219
220
if
(isHovering)
221
c.SetA(linesData.
GetHighlightedAlpha
());
222
else
223
c.SetA(linesData.
GetDefaultAlpha
());
224
225
props.SetLineColor(c);
226
}
227
}
OnMapClose
void OnMapClose(MapConfiguration config)
Definition
SCR_CampaignFeedbackComponent.c:459
OnMapOpen
void OnMapOpen(MapConfiguration config)
Definition
SCR_CampaignFeedbackComponent.c:350
GetComponentData
SCR_CharacterSoundComponentClass GetComponentData()
Definition
SCR_CharacterSoundComponent.c:132
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition
SCR_FactionManager.c:498
m_Radio
SCR_RadioCoverageMapDescriptorComponentClass m_Radio
DeleteLinks
void DeleteLinks()
Definition
SCR_RadioCoverageMapDescriptorComponent.c:136
OnIconHovered
void OnIconHovered(bool hovering)
Definition
SCR_RadioCoverageMapDescriptorComponent.c:154
GetGraphLinesData
SCR_GraphLinesData GetGraphLinesData()
Definition
SCR_RadioCoverageMapDescriptorComponent.c:18
ColorMapLink
void ColorMapLink(notnull MapLink link, bool isHovering)
Definition
SCR_RadioCoverageMapDescriptorComponent.c:201
UpdateLinks
void UpdateLinks()
Definition
SCR_RadioCoverageMapDescriptorComponent.c:147
SetParentRadio
void SetParentRadio(SCR_CoverageRadioComponent radio)
Definition
SCR_RadioCoverageMapDescriptorComponent.c:34
GetParentRadio
SCR_CoverageRadioComponent GetParentRadio()
Definition
SCR_RadioCoverageMapDescriptorComponent.c:52
CreateLinks
void CreateLinks()
Definition
SCR_RadioCoverageMapDescriptorComponent.c:70
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
Color
Definition
Color.c:13
IEntity
Definition
IEntity.c:13
MapConfiguration
Definition
MapConfiguration.c:3
MapItem
Definition
MapItem.c:13
MapLink
Definition
MapLink.c:13
MapLinkProps
Definition
MapLinkProps.c:13
SCR_Faction
Definition
SCR_Faction.c:6
SCR_GraphLinesData
Definition
SCR_GraphLinesData.c:4
SCR_GraphLinesData::GetLineWidth
float GetLineWidth()
Definition
SCR_GraphLinesData.c:27
SCR_GraphLinesData::GetHighlightedAlpha
float GetHighlightedAlpha()
Definition
SCR_GraphLinesData.c:21
SCR_GraphLinesData::GetDefaultAlpha
float GetDefaultAlpha()
Definition
SCR_GraphLinesData.c:15
SCR_MapDescriptorComponentClass
Definition
SCR_MapDescriptorComponent.c:2
SCR_MapEntity
Definition
SCR_MapEntity.c:18
SCR_MapEntity::GetOnMapClose
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapClose()
Get on map close invoker.
Definition
SCR_MapEntity.c:92
SCR_MapEntity::GetOnMapOpen
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapOpen()
Get on map open invoker.
Definition
SCR_MapEntity.c:88
SCR_RadioCoverageMapDescriptorComponentClass
Definition
SCR_RadioCoverageMapDescriptorComponent.c:2
SCR_RadioCoverageMapDescriptorComponentClass::GetGraphLinesData
SCR_GraphLinesData GetGraphLinesData()
Definition
SCR_RadioCoverageMapDescriptorComponent.c:7
SCR_RadioCoverageMapDescriptorComponentClass::m_GraphLinesData
ref SCR_GraphLinesData m_GraphLinesData
Definition
SCR_RadioCoverageMapDescriptorComponent.c:4
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Components
Locations
SCR_RadioCoverageMapDescriptorComponent.c
Generated by
1.17.0