Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_NotificationSenderComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/GameMode/Components", description: "Base for gamemode scripted component.")]
5
6class SCR_NotificationSenderComponent : SCR_BaseGameModeComponent
7{
8 [Attribute("1", desc: "Show player left notification if player left.")]
9 protected bool m_bShowPlayerLeftNotification;
10
11 [Attribute(EKillFeedType.UNKNOWN_KILLER.ToString(), desc: "Is killfeed enabled and what info will be displayed (Full killfeed is always displayed in open unlimited Editor)", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EKillFeedType))]
12 protected EKillFeedType m_iKillFeedType;
13
14 [Attribute(EKillFeedReceiveType.GROUP_ONLY.ToString(), desc: "If killfeed is enabled, what is the relationship between the player that died and the local player. (Full killfeed is always displayed in open unlimited Editor)", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EKillFeedReceiveType))]
15 protected EKillFeedReceiveType m_iReceiveKillFeedType;
16
17 [Attribute(SCR_EFriendlyFireKillFeedType.SHOW_FRIENDLY_KILLS_TO_TEAM.ToString(), desc: "If on Friendly fire the players in volved or the entire team will be informed who killed whom. If set to default it will use the default killfeed notification", uiwidget : UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(SCR_EFriendlyFireKillFeedType))]
18 protected SCR_EFriendlyFireKillFeedType m_eFriendlyFireKillFeedType;
19
20 [Attribute("0", desc: "Array of Killfeed names")]
21 protected ref array<ref SCR_NotificationKillfeedTypeName> m_aKillfeedTypeNames;
22
23 [Attribute("0", desc: "Array of Killfeed receive names")]
24 protected ref array<ref SCR_NotificationKillfeedreceiveTypeName> m_aKillfeedReceiveTypeNames;
25
26 [Attribute(desc: "Array of friendly fire Killfeed names")]
27 protected ref array<ref SCR_NotificationFriendlyFireKillfeedTypeName> m_aFriendlyFireKillfeedTypeNames;
28
29 [Attribute("{D3BFEE28E7D5B6A1}Configs/ServerBrowser/KickDialogs.conf", desc: "If disconnect reason has a preset set to it then it will send a kick/ban notification", params: "conf")]
30 protected ref SCR_ConfigurableDialogUiPresets m_PlayerKickReasonsConfig;
31
33
35
36 //States
38
39 //------------------------------------------------------------------------------------------------
40 override void OnControllableDestroyed(notnull SCR_InstigatorContextData instigatorContextData)
41 {
42 IEntity entity = instigatorContextData.GetVictimEntity();
43
44 //~ No entity destroyed or entity not a character
45 if (!entity || !ChimeraCharacter.Cast(entity))
46 return;
47
48 bool isUnlimitedEditor = false;
49
50 //~ Check if player has unlimited editor and if the editor is open
51 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
52 if (editorManager)
53 isUnlimitedEditor = !editorManager.IsLimited();
54
55 //~ Killfeed is disabled and unlimited editor is not open
56 if (!isUnlimitedEditor && m_iKillFeedType == EKillFeedType.DISABLED)
57 return;
58
59 IEntity killerEntity = instigatorContextData.GetKillerEntity();
60
61 int victimPlayerId = SCR_PossessingManagerComponent.GetPlayerIdFromControlledEntity(entity);
62
63 //~ Entity is not a player so do not show notification
64 if (victimPlayerId <= 0)
65 return;
66
67 int localPlayerID = SCR_PlayerController.GetLocalPlayerId();
68 Faction localPlayerFaction = m_FactionManager.GetLocalPlayerFaction();
69
70 //~ No local faction and player is not GM so don't show killfeed
71 if (!localPlayerFaction && !isUnlimitedEditor)
72 return;
73
74 bool forceFullKillfeed;
75
76 //~ Check if the player can show the notification of a player dying
77 if (localPlayerFaction && !isUnlimitedEditor && m_iReceiveKillFeedType != EKillFeedReceiveType.ALL)
78 {
79 //~ No faction manager so don't show killfeed?
81 return;
82
83 //~ Get victim faction
84 Faction victimFaction;
85 if (victimPlayerId > 0)
86 {
87 victimFaction = m_FactionManager.GetPlayerFaction(victimPlayerId);
88 }
89 else if (entity)
90 {
92 if (FactionAffiliation)
93 victimFaction = FactionAffiliation.GetAffiliatedFaction();
94 }
95
96 //~ Is victim faction friendly to local faction
97 SCR_Faction scrLocalPlayerFaction = SCR_Faction.Cast(localPlayerFaction);
98 bool victimIsFriendly = (scrLocalPlayerFaction && scrLocalPlayerFaction.DoCheckIfFactionFriendly(scrLocalPlayerFaction)) || (!scrLocalPlayerFaction && localPlayerFaction.IsFactionFriendly(victimFaction));
99
100 //~ Victim was killed by friendly fire is friendly to local player and not suicide and the friendly fire killfeed is not Default
101 if (!isUnlimitedEditor && victimIsFriendly && m_eFriendlyFireKillFeedType != SCR_EFriendlyFireKillFeedType.DEFAULT_SETTINGS && instigatorContextData.HasAnyVictimKillerRelation(SCR_ECharacterDeathStatusRelations.KILLED_BY_FRIENDLY_PLAYER))
102 {
103 //~ Show full killfeed if friendly fire involved the a friendly faction
104 if (m_eFriendlyFireKillFeedType == SCR_EFriendlyFireKillFeedType.SHOW_FRIENDLY_KILLS_TO_TEAM)
105 forceFullKillfeed = true;
106 //~ Show full killfeed if friendly fire involved the local player (Either as Victim or Killer)
107 else if (m_eFriendlyFireKillFeedType == SCR_EFriendlyFireKillFeedType.SHOW_FRIENDLY_KILLS_TO_PLAYERS_INVOLVED)
108 forceFullKillfeed = (localPlayerID == instigatorContextData.GetKillerPlayerID() || localPlayerID == victimPlayerId);
109 }
110
111 if (!forceFullKillfeed)
112 {
113 switch (m_iReceiveKillFeedType)
114 {
115 //~ check if in group
116 case EKillFeedReceiveType.GROUP_ONLY :
117 {
118 //~ Check if local player is not the same as killed otherwise they are always in the same group
119 if (localPlayerID != victimPlayerId)
120 {
121 //~ Factions not friendly so don't show killfeed
122 if (!victimIsFriendly)
123 return;
124
125 //~ No group manager so don't send
126 SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
127 if (!groupManager)
128 return;
129
130 SCR_AIGroup localPlayerGroup = groupManager.GetPlayerGroup(localPlayerID);
131
132 //~ If not in a group or not in the same group do not send
133 if (!localPlayerGroup || !localPlayerGroup.IsPlayerInGroup(victimPlayerId))
134 return;
135 }
136
137 break;
138 }
139
140 //~ Check if the same faction
141 case EKillFeedReceiveType.SAME_FACTION_ONLY :
142 {
143 //~ Check if local player is not the same as killed otherwise they are always the same faction
144 if (localPlayerID != victimPlayerId)
145 {
146 //~ If no local faction or if not the same faction do not show killfeed
147 if (!localPlayerFaction || localPlayerFaction != victimFaction)
148 return;
149
150 //~ If Faction is hostile towards itself still do not show killfeed (Deathmatch)
151 if (!victimIsFriendly)
152 return;
153 }
154
155 break;
156 }
157
158 //~ Check if allies
159 case EKillFeedReceiveType.ALLIES_ONLY :
160 {
161 //~ Check if local player is not the same as killed otherwise they are always allied
162 if (localPlayerID != victimPlayerId)
163 {
164 //~ Factions not friendly so don't show killfeed
165 if (!victimIsFriendly)
166 return;
167 }
168
169 break;
170 }
171
172 //~ Check if enemies
173 case EKillFeedReceiveType.ENEMIES_ONLY :
174 {
175 //~ If local player killed it is never an enemy
176 if (localPlayerID == victimPlayerId)
177 return;
178
179 //~ Factions friendly so don't show killfeed
180 if (victimIsFriendly)
181 return;
182
183 break;
184 }
185 }
186 }
187 }
188
189 SCR_ECharacterControlType victimControlType = instigatorContextData.GetVictimCharacterControlType();
190 SCR_ECharacterControlType killerControlType = instigatorContextData.GetKillerCharacterControlType();
191
192 int killerPlayerID = instigatorContextData.GetKillerPlayerID();
193
194 //~ Killed by GM so send GM notification
195 if (instigatorContextData.HasAnyVictimKillerRelation(SCR_ECharacterDeathStatusRelations.KILLED_BY_UNLIMITED_EDITOR))
196 {
197 if (victimControlType != SCR_ECharacterControlType.POSSESSED_AI)
198 {
199 //~ Player killed by GM but GM not known
200 if (killerPlayerID <= 0)
201 {
202 //SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_KILLED_BY_EDITOR, victimPlayerId);
203 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_DIED, victimPlayerId);
204 }
205 //~ Player killed by GM and GM is known
206 else
207 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_KILLED_BY_EDITOR_PLAYER, victimPlayerId, killerPlayerID);
208 }
209 else
210 {
211 //~ Possessed AI killed by GM but GM not known
212 if (killerPlayerID <= 0)
213 {
214 //SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.POSSESSED_AI_KILLED_BY_EDITOR, victimPlayerId);
215 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_DIED, victimPlayerId);
216 }
217 //~ Possessed AI killed by GM and GM is known
218 else
219 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.POSSESSED_AI_KILLED_BY_EDITOR_PLAYER, victimPlayerId, killerPlayerID);
220 }
221
222 return;
223 }
224
225 //~ Never show killer so simply show player died if limited editor unless forceFullKillFeed is true
226 if (!isUnlimitedEditor && m_iKillFeedType == EKillFeedType.UNKNOWN_KILLER && !forceFullKillfeed)
227 {
228 //Player died
229 if (victimControlType != SCR_ECharacterControlType.POSSESSED_AI)
230 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_DIED, victimPlayerId);
231 //Possessed AI died
232 else
233 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.POSSESSED_AI_DIED, victimPlayerId);
234
235 return;
236 }
237
238 //~ Death notification
239 //~ Suicide
240 if (instigatorContextData.HasAnyVictimKillerRelation(SCR_ECharacterDeathStatusRelations.SUICIDE))
241 {
242 //Player Suicide
243 if (victimControlType != SCR_ECharacterControlType.POSSESSED_AI)
244 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_DIED, victimPlayerId);
245 //Possessed Suicide
246 else
247 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.POSSESSED_AI_DIED, victimPlayerId);
248
249 return;
250 }
251 //If killed by other player or player that is has an unlimited editor or the full killfeed is forced
252 if (killerControlType == SCR_ECharacterControlType.PLAYER || killerControlType == SCR_ECharacterControlType.UNLIMITED_EDITOR)
253 {
254 if (victimControlType != SCR_ECharacterControlType.POSSESSED_AI)
255 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_KILLED_PLAYER, killerPlayerID, victimPlayerId);
256 else
257 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.PLAYER_KILLED_POSSESSED_AI, killerPlayerID, victimPlayerId);
258
259 return;
260 }
261
262 //~ Get RPL component if AI or possessed AI
263 RplId killerRplId;
264 if ((killerControlType == SCR_ECharacterControlType.AI || killerControlType == SCR_ECharacterControlType.POSSESSED_AI) && killerEntity)
265 {
266 SCR_EditableCharacterComponent editableCharacterComponent = SCR_EditableCharacterComponent.Cast(killerEntity.FindComponent(SCR_EditableCharacterComponent));
267 if (editableCharacterComponent)
268 killerRplId = Replication.FindItemId(editableCharacterComponent);
269
270 //~ Invalid killer so show that player simply died
271 if (!killerRplId.IsValid())
272 {
273 //Player died
274 if (victimControlType != SCR_ECharacterControlType.POSSESSED_AI)
275 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_DIED, victimPlayerId);
276 //Possessed AI died
277 else
278 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.POSSESSED_AI_DIED, victimPlayerId);
279
280 return;
281 }
282 }
283
284 //~ Killed by possessed AI
285 if (killerControlType == SCR_ECharacterControlType.POSSESSED_AI)
286 {
287 if (victimControlType != SCR_ECharacterControlType.POSSESSED_AI)
288 {
289 SCR_NotificationsComponent.SendLocalLimitedEditor(ENotification.AI_KILLED_PLAYER, killerRplId, victimPlayerId);
290 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.POSSESSED_AI_KILLED_PLAYER, killerPlayerID, victimPlayerId);
291 }
292 else
293 {
294 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.POSSESSED_AI_KILLED_POSSESSED_AI, killerPlayerID, victimPlayerId);
295 }
296
297 return;
298 }
299 //~ Killed by AI
300 if (killerControlType == SCR_ECharacterControlType.AI)
301 {
302 if (victimControlType != SCR_ECharacterControlType.POSSESSED_AI)
303 SCR_NotificationsComponent.SendLocal(ENotification.AI_KILLED_PLAYER, killerRplId, victimPlayerId);
304 else
305 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.AI_KILLED_POSSESSED_AI, killerRplId, victimPlayerId);
306
307 return;
308 }
309
310 //~ Unknown killer (Fallback)
311 if (victimControlType != SCR_ECharacterControlType.POSSESSED_AI)
312 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_DIED, victimPlayerId);
313 else
314 SCR_NotificationsComponent.SendLocalUnlimitedEditor(ENotification.POSSESSED_AI_DIED, victimPlayerId);
315 }
316
317 //------------------------------------------------------------------------------------------------
318 protected void OnEditorLimitedChanged(bool isLimited)
319 {
320 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
321 if (!editorManager)
322 return;
323
324 int playerID = editorManager.GetPlayerID();
325
326 //Became Player
327 if (isLimited)
328 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_PLAYER_NO_LONGER_GM, playerID);
329 //Became GM
330 else
331 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_PLAYER_BECAME_GM, playerID);
332 }
333
334 //------------------------------------------------------------------------------------------------
335 override void OnPlayerRegistered(int playerId)
336 {
337 //Join notification
338 SCR_NotificationsComponent.SendLocal(ENotification.PLAYER_JOINED, playerId);
339 }
340
341 //------------------------------------------------------------------------------------------------
342 override void OnPlayerDisconnected(int playerId, KickCauseCode cause, int timeout)
343 {
344 //~ Should never be called for clients but just in case
345 if (!GetGameMode().IsMaster())
346 return;
347
348 SCR_EditorManagerEntity editorManager;
349
350 //~ Get editorManager if has any
352 if (core)
353 editorManager = core.GetEditorManager(playerId);
354
355 bool hasUnlimitedEditor = editorManager && !editorManager.IsLimited();
356
357 //~ Is GM, Always show GM left notification even if kicked/banned to notify players that the GM has left
358 if (hasUnlimitedEditor)
359 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_GM_LEFT, playerId);
360
361 bool isKickedOrBanned = false;
362
363 //~ Check if disconnect cause has message attached to it. If true: show kick/ban reason. If false: only show gm/player left
364 if (m_PlayerKickReasonsConfig)
365 {
366 string groupId, reasonId;
367 KickCauseGroup2 groupInt;
368 int reasonInt;
369
370 //~ Get disconnect message preset
371 GetGame().GetFullKickReason(cause, groupInt, reasonInt, groupId, reasonId);
372 SCR_ConfigurableDialogUiPreset preset = m_PlayerKickReasonsConfig.FindPreset(groupId + "_" + reasonId);
373
374 //~ If has kick/Ban message it will send out a notification
375 isKickedOrBanned = preset != null && !preset.m_sMessage.IsEmpty();
376 }
377 //~ No config
378 else
379 {
380 Print("'SCR_NotificationSenderComponent' has no 'm_PlayerKickReasonsConfig'! Make sure it is added else it will never know if a player was kicked!", LogLevel.ERROR);
381 }
382
383 //~ Is kicked/banned. Will also send ban notification if for some reason there is a timeout attached even if there is no specific kick message
384 if (isKickedOrBanned || timeout != 0)
385 {
386 SCR_DataCollectorComponent dataCollector = GetGame().GetDataCollector();
387 if (dataCollector)
388 {
389 SCR_PlayerData playerData = dataCollector.GetPlayerData(playerId);
390
391 if (playerData)
392 {
393 float banTimeOut = playerData.GetTimeOut();
394
395 //~ If playerData has ban timeout which is greater then timeout use that instead. This is because Heavy ban kicks the player and bans it via backend. So the timeout is set somewhere else
396 if (banTimeOut > 0 && banTimeOut > timeout)
397 timeout = banTimeOut;
398 }
399 }
400
401 //~ Player kicked
402 if (timeout == 0)
403 SCR_NotificationsComponent.SendToEveryone(ENotification.PLAYER_KICKED, playerId, KickCauseCodeAPI.GetGroup(cause), KickCauseCodeAPI.GetReason(cause), timeout);
404 //~ Player perminent ban
405 else if (timeout < 0)
406 SCR_NotificationsComponent.SendToEveryone(ENotification.PLAYER_BANNED_NO_DURATION, playerId, KickCauseCodeAPI.GetGroup(cause), KickCauseCodeAPI.GetReason(cause), timeout);
407 //~ Player temp ban
408 else
409 SCR_NotificationsComponent.SendToEveryone(ENotification.PLAYER_BANNED, playerId, KickCauseCodeAPI.GetGroup(cause), KickCauseCodeAPI.GetReason(cause), timeout);
410 }
411 //~ Is Not kicked/banned, is player and should send on leave notification.
412 else if (m_bShowPlayerLeftNotification && !hasUnlimitedEditor)
413 {
414 SCR_NotificationsComponent.SendToEveryone(ENotification.PLAYER_LEFT, playerId);
415 }
416 }
417
418 //------------------------------------------------------------------------------------------------
419 override void OnPlayerSpawnFinalize_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
420 {
421 //Check if faction changed and send notification if diffrent
423 {
424 int playerId = requestComponent.GetPlayerId();
425 //Get factions using ID
426 Faction playerFaction = m_FactionManager.GetPlayerFaction(playerId);
427 SCR_Faction scrPlayerFaction = SCR_Faction.Cast(playerFaction);
428
429 //Faction is different
430 if (m_FactionOnSpawn != playerFaction)
431 {
432 //Send player joined faction notification
433 if (!scrPlayerFaction || (m_FactionOnSpawn && !scrPlayerFaction.IsRelatedFaction(m_FactionOnSpawn)))
434 SCR_NotificationsComponent.SendToUnlimitedEditorPlayers(ENotification.PLAYER_JOINED_FACTION, playerId);
435
436 m_FactionOnSpawn = playerFaction;
437 }
438 }
439 }
440
441 //======================================== WEATHER SET TO LOOPING ========================================\\
442
443 //------------------------------------------------------------------------------------------------
448 {
449 if (Replication.IsClient())
450 return;
451
453 {
455 GetGame().GetCallqueue().CallLater(OnWeatherChangedNotificationDelay, 0 , false, playerID);
456 }
457 }
458
459 //------------------------------------------------------------------------------------------------
460 protected void OnWeatherChangedNotificationDelay(int playerID)
461 {
463
464 ChimeraWorld world = ChimeraWorld.CastFrom(GetGame().GetWorld());
465 if (!world)
466 return;
467
468 TimeAndWeatherManagerEntity weatherManager = world.GetTimeAndWeatherManager();
469 if (!weatherManager)
470 return;
471
472 WeatherState currentState = weatherManager.GetCurrentWeatherState();
473
474 if (!currentState)
475 return;
476
477 SCR_NotificationsComponent.SendToUnlimitedEditorPlayers(ENotification.EDITOR_ATTRIBUTES_WEATHER_CHANGED, playerID, currentState.GetStateID());
478 }
479
480 //======================================== KILLFEED ========================================\\
481
482 //------------------------------------------------------------------------------------------------
486 int GetKillFeedTypeNames(notnull array<ref SCR_NotificationKillfeedTypeName> killFeedTypeNames)
487 {
488 killFeedTypeNames.Clear();
489 foreach (SCR_NotificationKillfeedTypeName killfeedTypeName: m_aKillfeedTypeNames)
490 {
491 killFeedTypeNames.Insert(killfeedTypeName);
492 }
493
494 return killFeedTypeNames.Count();
495 }
496
497 //------------------------------------------------------------------------------------------------
501 int GetKillFeedReceiveTypeNames(notnull array<ref SCR_NotificationKillfeedreceiveTypeName> killFeedReceiveTypeNames)
502 {
503 killFeedReceiveTypeNames.Clear();
504 foreach (SCR_NotificationKillfeedreceiveTypeName killfeedReceiveTypeName: m_aKillfeedReceiveTypeNames)
505 {
506 killFeedReceiveTypeNames.Insert(killfeedReceiveTypeName);
507 }
508
509 return killFeedReceiveTypeNames.Count();
510 }
511
512 //------------------------------------------------------------------------------------------------
515 {
516 return m_iKillFeedType;
517 }
518
519 //------------------------------------------------------------------------------------------------
523 void SetKillFeedType(EKillFeedType killFeedType, int playerNotificationId = -1)
524 {
525 if (!GetGameMode().IsMaster() || killFeedType == m_iKillFeedType)
526 return;
527
528 SetKillFeedTypeBroadcast(killFeedType);
529 Rpc(SetKillFeedTypeBroadcast, killFeedType);
530
531 if (playerNotificationId > 0)
532 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_CHANGED_KILLFEED_TYPE, playerNotificationId, killFeedType);
533 }
534
535 //------------------------------------------------------------------------------------------------
536 [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
537 protected void SetKillFeedTypeBroadcast(EKillFeedType killFeedType)
538 {
539 m_iKillFeedType = killFeedType;
540 }
541
542 //------------------------------------------------------------------------------------------------
544 EKillFeedReceiveType GetReceiveKillFeedType()
545 {
546 return m_iReceiveKillFeedType;
547 }
548
549 //------------------------------------------------------------------------------------------------
553 void SetReceiveKillFeedType(EKillFeedReceiveType receiveKillFeedType, int playerNotificationId = -1)
554 {
555 if (receiveKillFeedType == m_iReceiveKillFeedType || !GetGameMode().IsMaster())
556 return;
557
558 SetReceiveKillFeedTypeBroadcast(receiveKillFeedType);
559 Rpc(SetReceiveKillFeedTypeBroadcast, receiveKillFeedType);
560
561 if (playerNotificationId > 0)
562 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_CHANGED_KILLFEED_RECEIVE_TYPE, playerNotificationId, receiveKillFeedType);
563 }
564
565 //------------------------------------------------------------------------------------------------
566 [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
567 protected void SetReceiveKillFeedTypeBroadcast(EKillFeedReceiveType receiveKillFeedType)
568 {
569 m_iReceiveKillFeedType = receiveKillFeedType;
570 }
571
572 //------------------------------------------------------------------------------------------------
574 SCR_EFriendlyFireKillFeedType GetFriendlyFireKillFeedType()
575 {
576 return m_eFriendlyFireKillFeedType;
577 }
578
579 //------------------------------------------------------------------------------------------------
583 void SetFriendlyFireKillFeedType(SCR_EFriendlyFireKillFeedType friendlyFireKillFeedType, int playerNotificationId = -1)
584 {
585 if (friendlyFireKillFeedType == m_eFriendlyFireKillFeedType || !GetGameMode().IsMaster())
586 return;
587
588 SetFriendlyFireKillFeedTypeBroadcast(friendlyFireKillFeedType);
589 Rpc(SetFriendlyFireKillFeedTypeBroadcast, friendlyFireKillFeedType);
590
591 if (playerNotificationId > 0)
592 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_CHANGED_FRIENDLY_FIRE_KILLFEED_TYPE, playerNotificationId, friendlyFireKillFeedType);
593 }
594
595 //------------------------------------------------------------------------------------------------
596 [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
597 protected void SetFriendlyFireKillFeedTypeBroadcast(SCR_EFriendlyFireKillFeedType friendlyFireKillFeedType)
598 {
599 m_eFriendlyFireKillFeedType = friendlyFireKillFeedType;
600 }
601
602 //------------------------------------------------------------------------------------------------
606 int GetFriendlyFireKillFeedTypeNames(notnull out array<ref SCR_NotificationFriendlyFireKillfeedTypeName> friendlyFireKillFeedTypeNames)
607 {
608 friendlyFireKillFeedTypeNames.Clear();
609 foreach (SCR_NotificationFriendlyFireKillfeedTypeName friendlyFireKillfeedTypeName : m_aFriendlyFireKillfeedTypeNames)
610 {
611 friendlyFireKillFeedTypeNames.Insert(friendlyFireKillfeedTypeName);
612 }
613
614 return friendlyFireKillFeedTypeNames.Count();
615 }
616
617 //======================================== RPL ========================================\\
618
619 //------------------------------------------------------------------------------------------------
620 override bool RplSave(ScriptBitWriter writer)
621 {
622 writer.WriteInt(m_iKillFeedType);
623 writer.WriteInt(m_iReceiveKillFeedType);
624
625 return true;
626 }
627
628 //------------------------------------------------------------------------------------------------
629 override bool RplLoad(ScriptBitReader reader)
630 {
631 EKillFeedType killFeedType;
632 EKillFeedReceiveType receiveKillFeedType;
633
634 reader.ReadInt(killFeedType);
635 reader.ReadInt(receiveKillFeedType);
636
637 SetKillFeedTypeBroadcast(killFeedType);
638 SetReceiveKillFeedTypeBroadcast(receiveKillFeedType);
639
640 return true;
641 }
642
643 //======================================== INIT ========================================\\
644
645 //------------------------------------------------------------------------------------------------
646 override void EOnInit(IEntity owner)
647 {
648 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
649 if (editorManager)
650 editorManager.GetOnLimitedChange().Insert(OnEditorLimitedChanged);
651
652 m_FactionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
653
654 super.EOnInit(owner);
655 }
656
657 //------------------------------------------------------------------------------------------------
658 override void OnPostInit(IEntity owner)
659 {
660 SetEventMask(owner, EntityEvent.INIT);
661
662 super.OnPostInit(owner);
663 }
664
665 //======================================== DELETE ========================================\\
666
667 //------------------------------------------------------------------------------------------------
668 protected override void OnDelete(IEntity owner)
669 {
670 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.GetInstance();
671 if (editorManager)
672 editorManager.GetOnLimitedChange().Remove(OnEditorLimitedChanged);
673
674 super.OnDelete(owner);
675 }
676}
677
681{
682 //~ If changes are made in this enum make sure to change m_aKillfeedTypeNames
683 DISABLED = 0,
684 UNKNOWN_KILLER = 10,
685 FULL = 20,
686}
687
690enum EKillFeedReceiveType
691{
692 //~ If changes are made in this enum make sure to change m_aKillfeedReceiveTypeNames
693 ALL = 0,
698}
699
700enum SCR_EFriendlyFireKillFeedType
701{
705}
706
709class SCR_NotificationKillfeedTypeName
710{
711 [Attribute(desc: "Killfeed type", uiwidget : UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EKillFeedType))]
712 protected EKillFeedType m_iKillfeedType;
713
714 [Attribute(desc: "Name displayed in Notification", uiwidget: UIWidgets.LocaleEditBox)]
715 protected LocalizedString m_sKillfeedTypeName;
716
717 //------------------------------------------------------------------------------------------------
719 EKillFeedType GetKillfeedType()
720 {
721 return m_iKillfeedType;
722 }
723
724 //------------------------------------------------------------------------------------------------
726 string GetName()
727 {
728 return m_sKillfeedTypeName;
729 }
730}
731
733[BaseContainerProps(), SCR_BaseContainerCustomTitleEnum(EKillFeedReceiveType, "m_iKillfeedreceiveType")]
735{
736 [Attribute(desc: "Killfeed receive type", uiwidget : UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EKillFeedReceiveType))]
737 protected EKillFeedReceiveType m_iKillfeedreceiveType;
738
739 [Attribute(desc: "Name displayed in Notification", uiwidget: UIWidgets.LocaleEditBox)]
741
742 //------------------------------------------------------------------------------------------------
748
749 //------------------------------------------------------------------------------------------------
751 string GetName()
752 {
754 }
755}
756
758[BaseContainerProps(), SCR_BaseContainerCustomTitleEnum(SCR_EFriendlyFireKillFeedType, "m_eFriendlyFireKillfeedType")]
759class SCR_NotificationFriendlyFireKillfeedTypeName
760{
761 [Attribute(desc: "Friendly fire Killfeed type", uiwidget : UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(SCR_EFriendlyFireKillFeedType))]
762 protected SCR_EFriendlyFireKillFeedType m_eFriendlyFireKillfeedType;
763
764 [Attribute(desc: "Name displayed in Notification", uiwidget: UIWidgets.LocaleEditBox)]
765 protected LocalizedString m_sFriendlyFireKillfeedTypeName;
766
767 //------------------------------------------------------------------------------------------------
769 SCR_EFriendlyFireKillFeedType GetFriendlyFireKillfeedType()
770 {
771 return m_eFriendlyFireKillfeedType;
772 }
773
774 //------------------------------------------------------------------------------------------------
776 string GetName()
777 {
778 return m_sFriendlyFireKillfeedTypeName;
779 }
780}
ENotification
ArmaReforgerScripted GetGame()
Definition game.c:1398
override bool RplLoad(ScriptBitReader reader)
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseGameMode GetGameMode()
void SCR_BaseGameModeComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
override bool RplSave(ScriptBitWriter writer)
SCR_ECharacterControlType
What kind of controller the character or (in some cases vehicle) has, eg: AI, Player,...
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
Get all prefabs that have the spawner data
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void OnControllableDestroyed(IEntity entity, IEntity killerEntity, Instigator instigator, notnull SCR_InstigatorContextData instigatorContextData)
void OnEditorLimitedChanged(bool isLimited)
void SetKillFeedType(EKillFeedType killFeedType, int playerNotificationId=-1)
void SetKillFeedTypeBroadcast(EKillFeedType killFeedType)
enum EKillFeedType GROUP_ONLY
Will see killfeed from group members only.
enum EKillFeedType SCR_BaseContainerCustomTitleEnum(EKillFeedType, "m_iKillfeedType")
UNKNOWN_KILLER
Will see killfeed messages but will never know who the killer is.
enum EKillFeedType ALLIES_ONLY
Will see killfeed from allies only.
EKillFeedType GetKillFeedType()
void SetFriendlyFireKillFeedType(SCR_EFriendlyFireKillFeedType friendlyFireKillFeedType, int playerNotificationId=-1)
EKillFeedReceiveType GetReceiveKillFeedType()
enum EKillFeedType SAME_FACTION_ONLY
Will see killfeed from same faction only.
void OnWeatherChangedNotificationDelay(int playerID)
void SetFriendlyFireKillFeedTypeBroadcast(SCR_EFriendlyFireKillFeedType friendlyFireKillFeedType)
SCR_EFriendlyFireKillFeedType GetFriendlyFireKillFeedType()
bool m_bListeningToWeatherChanged
Configs ServerBrowser KickDialogs desc
SCR_FactionManager m_FactionManager
enum EKillFeedType BaseContainerProps()
Class to get Killfeed type name.
enum EKillFeedType ENEMIES_ONLY
Will see killfeed from enemies only.
int GetKillFeedReceiveTypeNames(notnull array< ref SCR_NotificationKillfeedreceiveTypeName > killFeedReceiveTypeNames)
void SetReceiveKillFeedType(EKillFeedReceiveType receiveKillFeedType, int playerNotificationId=-1)
int GetFriendlyFireKillFeedTypeNames(notnull out array< ref SCR_NotificationFriendlyFireKillfeedTypeName > friendlyFireKillFeedTypeNames)
void SetReceiveKillFeedTypeBroadcast(EKillFeedReceiveType receiveKillFeedType)
enum EKillFeedType SHOW_FRIENDLY_KILLS_TO_TEAM
When a player is killed by a friendly faction the both teams will see the full notification of the te...
void OnWeatherChangedNotification(int playerID)
int GetKillFeedTypeNames(notnull array< ref SCR_NotificationKillfeedTypeName > killFeedTypeNames)
Faction m_FactionOnSpawn
FULL
Will see every player (except possessed pawns) killed messages. Including killer.
enum EKillFeedType SHOW_FRIENDLY_KILLS_TO_PLAYERS_INVOLVED
When a player is killed by a friendly faction both they and the killer will see the full notification...
enum EKillFeedType DEFAULT_SETTINGS
Kill feed will be default depending on EKillFeedType and EKillFeedFriendlyKillsType.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
override void OnPlayerSpawnFinalize_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
proto external Managed FindComponent(typename typeName)
Main replication API.
Definition Replication.c:14
Replication item identifier.
Definition RplId.c:14
bool IsPlayerInGroup(int playerID)
Class for a .conf file with multiple presets.
Core component to manage SCR_EditorManagerEntity.
SCR_EditorManagerEntity GetEditorManager()
override bool DoCheckIfFactionFriendly(Faction faction)
bool IsRelatedFaction(notnull Faction otherFaction)
Class to get Killfeed receive type name.
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
static SCR_PlayerData GetPlayerData(int playerID)
override void EOnInit(IEntity owner)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14
@ ALL
Everything except general switch.
Definition EntityEvent.c:37
@ DISABLED
General event switch.
Definition EntityEvent.c:35
override void OnPlayerRegistered(int playerId)
override void OnPlayerDisconnected(int playerId, KickCauseCode cause, int timeout)
KickCauseGroup2
Extends KickCauseGroup by adding game-specific groups.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
Definition EnNetwork.c:95
RplRcver
Definition RplRcver.c:59
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
Definition RplChannel.c:14