4 [
Attribute(
"{7134157CA6B1FA8E}Configs/Notifications/Notifications.conf",
desc:
"Link to config that holds all notification data",
params:
"conf class=SCR_NotificationConfig")]
20 return notificationData;
22 Print(
"Notification data not found in 'SCR_NotificationsComponent' for key: '" +
typename.EnumToString(
ENotification, notificationID) +
"'.",
LogLevel.WARNING);
25 return notificationData;
56 Print(
"'SCR_NotificationsComponentClass' failed to load notifications config!",
LogLevel.ERROR);
61 array<ref SCR_NotificationDisplayData>
data = {};
65 for(
int i = 0; i < count; i++)
70 Print(
"Notification data in 'SCR_NotificationsLogDisplay' has duplicate notification info key: '" +
typename.EnumToString(
ENotification,
data[i].m_NotificationKey) +
"'. There should only be one of each key!",
LogLevel.WARNING);
78 protected ref array<ref SCR_NotificationData>
m_aHistory = {};
85 static const int NOTIFICATION_DELETE_TIME = 30;
88 static const int NOTIFICATION_HISTORY_LENGTH = 10;
110 outHistory.Insert(entry);
123 if (maxHistoryIndex > 0 && count > maxHistoryIndex)
124 count = maxHistoryIndex;
126 for (
int i = count -1; i >= 0; i--)
166 static SCR_NotificationsComponent GetInstance()
168 PlayerController playerController =
GetGame().GetPlayerController();
169 if (playerController)
170 return SCR_NotificationsComponent.Cast(playerController.FindComponent(SCR_NotificationsComponent));
204 if (!Replication.IsServer())
206 SCR_PlayerController playerController = SCR_PlayerController.Cast(
GetGame().GetPlayerManager().
GetPlayerController(SCR_PlayerController.GetLocalPlayerId()));
207 if (!playerController)
210 SCR_NotificationsComponent notificationsComponent = SCR_NotificationsComponent.Cast(playerController.FindComponent(SCR_NotificationsComponent));
211 if (!notificationsComponent)
214 array<int> paramArray = {};
217 notificationsComponent.Rpc(notificationsComponent.Rpc_SendToEveryone, notificationID,
position, paramArray);
221 SCR_NotificationData newNotificationData = SCR_NotificationData();
224 return SendToEveryoneData(notificationID, newNotificationData);
240 protected static bool SendToEveryoneData(
ENotification notificationID, SCR_NotificationData
data)
243 if (!Replication.IsServer())
246 array<int> players = {};
247 for (
int i = 0, count =
GetGame().GetPlayerManager().
GetPlayers(players); i < count; i++)
249 SendToPlayerData(players[i], notificationID,
data);
285 if (!Replication.IsServer())
287 SCR_PlayerController playerController = SCR_PlayerController.Cast(
GetGame().GetPlayerManager().
GetPlayerController(SCR_PlayerController.GetLocalPlayerId()));
288 if (!playerController)
291 SCR_NotificationsComponent notificationsComponent = SCR_NotificationsComponent.Cast(playerController.FindComponent(SCR_NotificationsComponent));
292 if (!notificationsComponent)
295 array<int> paramArray = {};
298 notificationsComponent.Rpc(notificationsComponent.Rpc_SendToPlayer, playerID, notificationID,
position, paramArray);
302 SCR_NotificationData newNotificationData = SCR_NotificationData();
305 return SendToPlayerData(playerID, notificationID, newNotificationData);
321 protected static bool SendToPlayerData(
int playerID,
ENotification notificationID, SCR_NotificationData
data)
324 if (!Replication.IsServer())
327 PlayerController playerController =
GetGame().GetPlayerManager().GetPlayerController(playerID);
328 if (!playerController)
331 SCR_NotificationsComponent notificationsComponent = SCR_NotificationsComponent.Cast(playerController.FindComponent(SCR_NotificationsComponent));
332 if (!notificationsComponent)
335 notificationsComponent.SendToOwner(notificationID,
data);
372 if (!Replication.IsServer())
374 SCR_PlayerController playerController = SCR_PlayerController.Cast(
GetGame().GetPlayerManager().
GetPlayerController(SCR_PlayerController.GetLocalPlayerId()));
375 if (!playerController)
378 SCR_NotificationsComponent notificationsComponent = SCR_NotificationsComponent.Cast(playerController.FindComponent(SCR_NotificationsComponent));
379 if (!notificationsComponent)
382 FactionManager factionManager =
GetGame().GetFactionManager();
386 array<int> paramArray = {};
389 notificationsComponent.Rpc(notificationsComponent.Rpc_SendToFaction, factionManager.GetFactionIndex(faction), includeFriendlyFactions, notificationID,
position, paramArray);
393 SCR_NotificationData newNotificationData = SCR_NotificationData();
396 return SendToFactionData(faction, includeFriendlyFactions, notificationID, newNotificationData);
404 FactionManager factionManager =
GetGame().GetFactionManager();
420 protected static bool SendToFactionData(notnull SCR_Faction faction,
bool includeFriendlyFactions,
ENotification notificationID, SCR_NotificationData
data)
423 if (!Replication.IsServer())
426 array<int> players = {};
427 faction.GetPlayersInFaction(players);
429 foreach(
int playerID : players)
431 SendToPlayerData(playerID, notificationID,
data);
434 if (!includeFriendlyFactions)
438 FactionManager factionManager =
GetGame().GetFactionManager();
442 array<Faction> allFactions = {};
443 SCR_Faction scrFaction;
444 factionManager.GetFactionsList(allFactions);
446 foreach(
Faction otherFaction : allFactions)
448 if (otherFaction == faction)
451 scrFaction = SCR_Faction.Cast(otherFaction);
455 if (!faction.IsFactionFriendly(scrFaction))
460 foreach(
int playerID : players)
462 SendToPlayerData(playerID, notificationID,
data);
499 if (!Replication.IsServer())
501 SCR_PlayerController playerController = SCR_PlayerController.Cast(
GetGame().GetPlayerManager().
GetPlayerController(SCR_PlayerController.GetLocalPlayerId()));
502 if (!playerController)
505 SCR_NotificationsComponent notificationsComponent = SCR_NotificationsComponent.Cast(playerController.FindComponent(SCR_NotificationsComponent));
506 if (!notificationsComponent)
509 array<int> paramArray = {};
512 notificationsComponent.Rpc(notificationsComponent.Rpc_SendToUnlimitedEditorPlayers, notificationID,
position, paramArray);
516 SCR_NotificationData newNotificationData = SCR_NotificationData();
519 return SendToUnlimitedEditorPlayersData(notificationID, newNotificationData);
535 protected static bool SendToUnlimitedEditorPlayersData(
ENotification notificationID, SCR_NotificationData
data,
int playerID = -1)
538 if (!Replication.IsServer())
541 array<int> players = {};
542 for (
int i = 0, count =
GetGame().GetPlayerManager().
GetPlayers(players); i < count; i++)
544 if (playerID == players[i])
546 SendToPlayerData(players[i], notificationID,
data);
550 SCR_EditorManagerCore core = SCR_EditorManagerCore.Cast(SCR_EditorManagerCore.GetInstance(SCR_EditorManagerCore));
558 if (!editorManager.IsLimited())
559 SendToPlayerData(players[i], notificationID,
data);
596 if (!Replication.IsServer())
598 SCR_PlayerController playerController = SCR_PlayerController.Cast(
GetGame().GetPlayerManager().
GetPlayerController(SCR_PlayerController.GetLocalPlayerId()));
599 if (!playerController)
602 SCR_NotificationsComponent notificationsComponent = SCR_NotificationsComponent.Cast(playerController.FindComponent(SCR_NotificationsComponent));
603 if (!notificationsComponent)
606 array<int> paramArray = {};
609 notificationsComponent.Rpc(notificationsComponent.Rpc_SendToUnlimitedEditorPlayersAndPlayer, playerID, notificationID,
position, paramArray);
613 SCR_NotificationData newNotificationData = SCR_NotificationData();
616 return SendToUnlimitedEditorPlayersData(notificationID, newNotificationData, playerID);
661 if (!Replication.IsServer())
663 SCR_PlayerController playerController = SCR_PlayerController.Cast(
GetGame().GetPlayerManager().
GetPlayerController(SCR_PlayerController.GetLocalPlayerId()));
664 if (!playerController)
667 SCR_NotificationsComponent notificationsComponent = SCR_NotificationsComponent.Cast(playerController.FindComponent(SCR_NotificationsComponent));
668 if (!notificationsComponent)
671 array<int> paramArray = {};
674 notificationsComponent.Rpc(notificationsComponent.Rpc_SendToGroup, groupID, notificationID,
position, paramArray);
678 SCR_NotificationData newNotificationData = SCR_NotificationData();
681 return SendToGroupData(notificationID, newNotificationData, groupID);
697 protected static bool SendToGroupData(
ENotification notificationID, SCR_NotificationData
data,
int groupID)
700 if (!Replication.IsServer())
707 SCR_AIGroup group = groupManager.FindGroup(groupID);
713 if (players.IsEmpty())
716 foreach (
int playerID: players)
718 SendToPlayerData(playerID, notificationID,
data);
752 SCR_NotificationData newNotificationData = SCR_NotificationData();
755 return SendLocalData(notificationID, newNotificationData);
787 if (!editorManager || editorManager.IsLimited())
790 SCR_NotificationData newNotificationData = SCR_NotificationData();
793 return SendLocalData(notificationID, newNotificationData);
825 if (!editorManager || !editorManager.IsLimited())
828 SCR_NotificationData newNotificationData = SCR_NotificationData();
831 return SendLocalData(notificationID, newNotificationData);
836 protected static bool SendLocalData(
ENotification notificationID, SCR_NotificationData
data)
838 SCR_NotificationsComponent notificationsComponent = GetInstance();
839 if (!notificationsComponent)
842 notificationsComponent.ReceiveSCR_NotificationData(notificationID,
data);
848 protected static void CreateParamArray(notnull out array<int> paramArray,
int param1 = 0,
int param2 = 0,
int param3 = 0,
int param4 = 0,
int param5 = 0,
int param6 = 0)
851 paramArray.Insert(
param1);
854 paramArray.Insert(
param2);
857 paramArray.Insert(
param3);
860 paramArray.Insert(
param4);
863 paramArray.Insert(
param5);
866 paramArray.Insert(param6);
871 protected static void GetParamsFromArray(notnull array<int> paramArray, out
int param1 = 0, out
int param2 = 0, out
int param3 = 0, out
int param4 = 0, out
int param5 = 0, out
int param6 = 0)
873 int count = paramArray.Count();
912 param6 = paramArray[5];
974 if (!notificationClass)
986 if (!notificationClass)
996 if (!notificationClass)
1010 string playerName =
string.Empty;
1048 if (!notificationsSystem)
1051 notificationsSystem.
Register(
this);
1059 if (!notificationsSystem)
1072 for(
int i = 0; i < count; i++)
1093 PlayerController playerController = PlayerController.Cast(owner);
1094 if (!playerController)
1108 array<int> players = {};
1110 GetGame().GetPlayerManager().GetPlayers(players);
1112 foreach (
int player : players)
1132 super.OnDelete(owner);
ArmaReforgerScripted GetGame()
void SCR_AIGroup(IEntitySource src, IEntity parent)
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseGameMode GetGameMode()
SCR_CharacterSoundComponentClass GetComponentData()
int GetPlayers(out notnull array< int > outPlayers)
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
Get all prefabs that have the spawner data
Get all prefabs that have the spawner the given labels and are valid in the editor mode param catalogType Type to catalog to get prefabs from param editorMode Editor mode to get valid entries from param faction Faction(Optional)
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
array< string > GetStickyNotifications()
bool GetLastNotificationLocation(out vector lastLocation)
int GetHistoryOldToNew(out notnull array< SCR_NotificationData > outHistory, int maxHistoryIndex=-1)
void Rpc_SendToFaction(int factionIndex, bool includeFriendlyFactions, ENotification notificationID, vector position, notnull array< int > paramArray)
void ReceiveNotification(ENotification id)
SCR_NotificationData m_LastNotificationWithLocation
void AddPlayerNameToHistory(int playerID)
void ReceiveSCR_NotificationData(ENotification id, SCR_NotificationData data)
int GetHistoryNewToOld(out notnull array< SCR_NotificationData > outHistory)
void Rpc_SendToUnlimitedEditorPlayersAndPlayer(int playerID, ENotification notificationID, vector position, notnull array< int > paramArray)
SCR_NotificationsComponentClass m_aHistory
Framework for sending notifications to players.
void ConnectToNotificationsSystem()
array< ref SCR_NotificationDisplayColor > GetNotificationDisplayColor()
SCR_NotificationDisplayData GetNotificationDisplayData(ENotification notificationID)
ScriptInvoker GetOnNotification()
void Rpc_SendToUnlimitedEditorPlayers(ENotification notificationID, vector position, notnull array< int > paramArray)
void UpdateNotificationData(bool updateNotificationData)
void Rpc_SendToEveryone(ENotification notificationID, vector position, notnull array< int > paramArray)
ref ScriptInvoker Event_OnNotification
string GetPlayerNameFromHistory(int playerID)
void Rpc_SendToGroup(int groupID, ENotification notificationID, vector position, notnull array< int > paramArray)
void Rpc_SendToPlayer(int playerID, ENotification notificationID, vector position, notnull array< int > paramArray)
bool GetHistoryEntry(int index, out SCR_NotificationData data=null)
bool m_bIsUpdatingNotificationData
ref map< int, string > m_mPlayerNameHistory
bool SendToOwner(ENotification id, SCR_NotificationData data=null)
void DisconnectFromNotificationsSystem()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external BaseWorld GetWorld()
TODO: When systems can be replicated, just move overything from SCR_NotificationsComponent.
void Register(SCR_NotificationsComponent component)
void Unregister(SCR_NotificationsComponent component)
array< int > GetPlayerIDs()
ScriptInvokerBase< SCR_BaseGameMode_PlayerId > GetOnPlayerRegistered()
SCR_EditorManagerEntity GetEditorManager()
int GetPlayersInFaction(notnull out array< int > players)
void SetPosition(vector position)
void SetMeta(int id, SCR_NotificationDisplayData displayData)
void SetParameters(ENotificationReceiver receiverType, int param1=0, int param2=0, int param3=0, int param4=0, int param5=0, int param6=0)
ref map< ENotification, ref SCR_NotificationDisplayData > m_mNotificationDisplayDataMap
array< string > GetStickyNotifications()
array< ref SCR_NotificationDisplayColor > GetNotificationDisplayColor()
ref SCR_NotificationConfig notificationConfig
SCR_NotificationDisplayData GetNotificationDisplayData(ENotification notificationID)
ResourceName m_sNotificationConfig
void SCR_NotificationsComponentClass(IEntityComponentSource componentSource, IEntitySource parentSource, IEntitySource prefabSource)
IEntity GetOwner()
Owner entity of the fuel tank.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
proto external PlayerController GetPlayerController()
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.