Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlayerControllerGroupComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Groups", description: "This component should be attached to player controller and is used by groups to send requests to server.")]
2 class SCR_PlayerControllerGroupComponentClass : ScriptComponentClass
3 {
4 }
5 
6 class SCR_PlayerControllerGroupComponent : ScriptComponent
7 {
8  protected int m_iGroupID = -1;
9  // Map with playerID and list of groups the player was invited to
10  protected ref map<int, ref array<int>> m_mPlayerInvitesToGroups;
11  protected ref ScriptInvoker<int, int> m_OnInviteReceived;
12  protected ref ScriptInvoker<int> m_OnInviteAccepted;
13  protected ref ScriptInvoker<int> m_OnInviteCancelled;
14  protected ref ScriptInvoker<int> m_OnGroupChanged;
15 
16  protected int m_iUISelectedGroupID = -1;
17  protected int m_iGroupInviteID = -1;
18  protected int m_iGroupInviteFromPlayerID = -1;
19  protected string m_sGroupInviteFromPlayerName; //Player name is saved to get the name of the one who invited even if that player left the server
20 
21  protected const ref Color DEFAULT_COLOR = new Color(0, 0, 0, 0.4);
22 
23  //------------------------------------------------------------------------------------------------
26  static SCR_PlayerControllerGroupComponent GetPlayerControllerComponent(int playerID)
27  {
28  PlayerController playerController = GetGame().GetPlayerManager().GetPlayerController(playerID);
29  if (!playerController)
30  return null;
31 
32  return SCR_PlayerControllerGroupComponent.Cast(playerController.FindComponent(SCR_PlayerControllerGroupComponent));
33  }
34 
35  //------------------------------------------------------------------------------------------------
37  static SCR_PlayerControllerGroupComponent GetLocalPlayerControllerGroupComponent()
38  {
40  if (!playerController)
41  return null;
42 
43  return SCR_PlayerControllerGroupComponent.Cast(playerController.FindComponent(SCR_PlayerControllerGroupComponent));
44  }
45 
46  //------------------------------------------------------------------------------------------------
48  int GetGroupID()
49  {
50  return m_iGroupID;
51  }
52 
53  //------------------------------------------------------------------------------------------------
56  {
57  Rpc(RPC_AskCreateGroup);
58  }
59 
60  //------------------------------------------------------------------------------------------------
63  void RequestKickPlayer(int playerID)
64  {
65  Rpc(RPC_AskKickPlayer, playerID);
66  }
67 
68  //------------------------------------------------------------------------------------------------
71  void RequestPromoteLeader(int playerID)
72  {
73  Rpc(RPC_AskPromoteLeader, playerID);
74  }
75 
76  //------------------------------------------------------------------------------------------------
80  void RequestPrivateGroupChange(int playerID, bool isPrivate)
81  {
82  Rpc(RPC_ChangePrivateGroup, playerID, isPrivate);
83  }
84 
85  //------------------------------------------------------------------------------------------------
89  void PlayerRequestToJoinPrivateGroup(int playerID, RplId groupID)
90  {
91  Rpc(RPC_PlayerRequestToJoinPrivateGroup, playerID, groupID);
92  }
93 
94  //------------------------------------------------------------------------------------------------
97  void ClearAllRequesters(RplId groupID)
98  {
99  Rpc(RPC_ClearAllRequesters, groupID);
100  RPC_ClearAllRequesters(groupID);
101  }
102 
103  //------------------------------------------------------------------------------------------------
106  {
107  PlayerController playerController = PlayerController.Cast(GetOwner());
108  if (!playerController)
109  return -1;
110 
111  return playerController.GetPlayerId();
112  }
113 
114  //------------------------------------------------------------------------------------------------
119  bool CanPlayerJoinGroup(int playerID, notnull SCR_AIGroup group)
120  {
121  /*
122  Assumed issue:
123  SCR_FactionManager have cache mapping playerIds to factions.
124  This cache may not be in sysnc with the FactionAffiliation, because of different replication hieararchies and methods
125  Fix:
126  We do not use cache, but instead ask directly SCR_PlayerFactionAffiliationComponent.
127  This should work on client asking for its own PlayerId or server for any IDs.
128  */
129 
130  // Flipping comment for quick switch of implementation
131  //*
132  Faction groupFaction = group.GetFaction();
133  if (!groupFaction)
134  {
135  #ifdef DEPLOY_MENU_DEBUG
136  Print(string.Format("SCR_PlayerControllerGroupComponent.CanPlayerJoinGroup(%1, %2) - No group faction", playerID, group), LogLevel.ERROR);
137  #endif
138  return false;
139  }
140 
141  PlayerController pc = GetGame().GetPlayerManager().GetPlayerController(playerID);
142  if (!pc)
143  {
144  #ifdef DEPLOY_MENU_DEBUG
145  Print(string.Format("SCR_PlayerControllerGroupComponent.CanPlayerJoinGroup(%1, %2) - No player controller", playerID, group), LogLevel.ERROR);
146  #endif
147  return false;
148  }
149 
150  SCR_PlayerFactionAffiliationComponent playerAffiliation
152  if (!playerAffiliation)
153  {
154  // Happen only if PlayerController prefab is poorly configured
155  #ifdef DEPLOY_MENU_DEBUG
156  Print(string.Format("SCR_PlayerControllerGroupComponent.CanPlayerJoinGroup(%1, %2) - No SCR_PlayerFactionAffiliationComponent", playerID, group), LogLevel.ERROR);
157  #endif
158  return false;
159  }
160 
161  Faction playerFaction = playerAffiliation.GetAffiliatedFaction();
162  if (playerFaction != groupFaction)
163  {
164  #ifdef DEPLOY_MENU_DEBUG
165  Print(string.Format("SCR_PlayerControllerGroupComponent.CanPlayerJoinGroup(%1, %2) - Faction mis-match! See, below:", playerID, group), LogLevel.ERROR);
166  Print(playerFaction, LogLevel.NORMAL);
167  if (playerFaction)
168  Print(playerFaction.GetFactionKey(), LogLevel.NORMAL);
169 
170  Print(groupFaction, LogLevel.NORMAL);
171  if (groupFaction)
172  Print(groupFaction.GetFactionKey(), LogLevel.NORMAL);
173  #endif
174  return false;
175  }
176 
177  /*/
178  // First we check the player is in the faction of the group
179  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
180  if (factionManager)
181  {
182  // TODO (langepau): Remove temporary debug logging when respawn issue is fixed.
183  Faction playerFaction = factionManager.GetPlayerFaction(playerID);
184  Faction groupFaction = group.GetFaction();
185  if (playerFaction != groupFaction)
186  {
187  #ifdef DEPLOY_MENU_DEBUG
188  Print(string.Format("SCR_PlayerControllerGroupComponent.CanPlayerJoinGroup(%1, %2) - Faction mis-match! See, below:", playerID, group), LogLevel.ERROR);
189  Print(playerFaction, LogLevel.NORMAL);
190  if (playerFaction)
191  Print(playerFaction.GetFactionKey(), LogLevel.NORMAL);
192 
193  Print(groupFaction, LogLevel.NORMAL);
194  if (groupFaction)
195  Print(groupFaction.GetFactionKey(), LogLevel.NORMAL);
196  #endif
197 
198  return false;
199  }
200  }
201  else
202  {
203  #ifdef DEPLOY_MENU_DEBUG
204  Print(string.Format("SCR_PlayerControllerGroupComponent.CanPlayerJoinGroup(%1, %2) - No SCR_FactionManager!", playerID, group), LogLevel.ERROR);
205  #endif
206  }
207  //*/
208 
209  // Groups manager doesn't exist, no point in continuing, cannot join
210  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
211  if (!groupsManager)
212  {
213  #ifdef DEPLOY_MENU_DEBUG
214  Print(string.Format("SCR_PlayerControllerGroupComponent.CanPlayerJoinGroup(%1, %2) - No SCR_GroupsManagerComponent!", playerID, group), LogLevel.ERROR);
215  #endif
216  return false;
217  }
218 
219  // Cannot join a full group
220  if (group.IsFull())
221  return false;
222 
223  // Cannot join the group we are in already
224  if (groupsManager.GetPlayerGroup(playerID) == group)
225  {
226  #ifdef DEPLOY_MENU_DEBUG
227  Print(string.Format("SCR_PlayerControllerGroupComponent.CanPlayerJoinGroup(%1, %2) - Already in group!", playerID, group), LogLevel.ERROR);
228  #endif
229  return false;
230  }
231 
232  return true;
233  }
234 
235  //------------------------------------------------------------------------------------------------
240  bool IsPlayerLeader(int playerID, notnull SCR_AIGroup group)
241  {
242  return playerID == group.GetLeaderID();
243  }
244 
245  //------------------------------------------------------------------------------------------------
249  {
250  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
251  if (!groupManager)
252  return false;
253 
254  //get controller from owner, because if this is used on server we cannot get local players player controller :wesmart:
256  if (!controller)
257  return false;
258 
259  int playerID = controller.GetPlayerId();
260  SCR_AIGroup playerGroup = groupManager.GetPlayerGroup(playerID);
261  if (!playerGroup)
262  return false;
263 
264  return IsPlayerLeader(playerID, playerGroup);
265  }
266 
267  //------------------------------------------------------------------------------------------------
271  bool CanInvitePlayer(int playerID)
272  {
273  // Our group id is not valid -> cannot invite anyone
274  if (m_iGroupID < 0)
275  return false;
276 
277  // Groups manager doesn't exist, no point in continuing, cannot invite
278  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
279  if (!groupsManager)
280  return false;
281 
282  // We get our group
283  SCR_AIGroup group = groupsManager.GetPlayerGroup(GetPlayerID());
284  if (!group)
285  return false;
286 
287  // Check if the player can join us
288  if (!CanPlayerJoinGroup(playerID, group))
289  return false;
290 
291  // Already invited this player, cannot invite again
292  if (WasAlreadyInvited(playerID))
293  return false;
294 
295  return true;
296  }
297 
298  //------------------------------------------------------------------------------------------------
302  bool WasAlreadyInvited(int playerID)
303  {
304  // The map is not initialised -> didn't invite anyone yet
306  return false;
307 
308  // We didn't invite this player to any group yet
309  if (!m_mPlayerInvitesToGroups.Contains(playerID))
310  return false;
311 
312  // If our group is in the array of invites for this player, we return true (already invited)
313  // Otherwise we return false (wasn't invited yet)
314  return m_mPlayerInvitesToGroups.Get(playerID).Contains(m_iGroupID);
315  }
316 
317  //------------------------------------------------------------------------------------------------
321  void AcceptJoinPrivateGroup(int playerID, bool accept)
322  {
323  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
324 
325  SCR_AIGroup group = groupManager.FindGroup(GetGroupID());
326  if (!group)
327  return;
328 
329  group.GetOnJoinPrivateGroupConfirm().Invoke(DEFAULT_COLOR); // Saphyr TODO: temporary before definition from art dept.
330 
331  if (accept)
332  Rpc(RPC_ConfirmJoinPrivateGroup,playerID, group.GetGroupID());
333  else
334  Rpc(RPC_CancelJoinPrivateGroup, playerID, group.GetGroupID());
335  }
336 
337  //------------------------------------------------------------------------------------------------
340  void InvitePlayer(int playerID)
341  {
342  // When group id is not valid, return
343  if (m_iGroupID < 0)
344  return;
345 
346  // Init map if not initialised yet
348  m_mPlayerInvitesToGroups = new map<int, ref array<int>>();
349 
350  // Init array of groups the playerID was invited to if not initialised yet
351  if (!m_mPlayerInvitesToGroups.Contains(playerID))
352  m_mPlayerInvitesToGroups.Insert(playerID, {});
353 
354  // We already invited this player to our group, don't invite again
355  if (m_mPlayerInvitesToGroups.Get(playerID).Contains(m_iGroupID))
356  return;
357 
358  // We didn't invite this player to our group yet
359  // Get an array of all the groups the local player invited the other player to
360  array<int> invitedGroups = m_mPlayerInvitesToGroups.Get(playerID);
361 
362  // Invite the player and log the invitation
363  Rpc(RPC_AskInvitePlayer, playerID);
364  invitedGroups.Insert(m_iGroupID);
365  }
366 
367  //------------------------------------------------------------------------------------------------
371  void InviteThisPlayer(int groupID, int fromPlayerID)
372  {
373  Rpc(RPC_DoInvitePlayer, groupID, fromPlayerID)
374  }
375 
376  //------------------------------------------------------------------------------------------------
379  {
380  if (m_iGroupInviteID >= 0)
381  {
382  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
383  if (!groupManager)
384  return;
385 
386  SCR_AIGroup group = groupManager.FindGroup(m_iGroupInviteID);
387  if (!group)
388  return;
389 
390  group.RemoveRequester(GetPlayerID());
391 
393  m_iGroupInviteID = -1;
394  if (m_OnInviteAccepted)
395  m_OnInviteAccepted.Invoke();
396  }
397  }
398 
399  //------------------------------------------------------------------------------------------------
401  ScriptInvoker GetOnInviteReceived()
402  {
403  if (!m_OnInviteReceived)
404  m_OnInviteReceived = new ScriptInvoker<int, int>();
405 
406  return m_OnInviteReceived;
407  }
408 
409  //------------------------------------------------------------------------------------------------
412  {
413  if (!group)
414  return;
415 
416  //in case of the selected group being deleted, remove it from selected
417  if (group.GetGroupID() == GetSelectedGroupID())
418  SetSelectedGroupID(-1);
419  }
420 
421  //------------------------------------------------------------------------------------------------
425  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
426  void RPC_PlayerRequestToJoinPrivateGroup(int playerID, RplId groupID)
427  {
428  SCR_AIGroup group = SCR_AIGroup.Cast(Replication.FindItem(groupID));
429  if (!group)
430  return;
431 
432  group.AddRequester(playerID);
433  SCR_NotificationsComponent.SendToPlayer(group.GetLeaderID(), ENotification.GROUPS_REQUEST_JOIN_PRIVATE_GROUP, playerID);
434  }
435 
436  //------------------------------------------------------------------------------------------------
440  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
441  void RPC_ConfirmJoinPrivateGroup(int playerID, int groupID)
442  {
443  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
444  if (!groupManager)
445  return;
446 
447  SCR_AIGroup group = SCR_AIGroup.Cast(groupManager.FindGroup(groupID));
448  if (!group)
449  return;
450 
451  PlayerController playerController = GetGame().GetPlayerManager().GetPlayerController(playerID);
452  if (!playerController)
453  return;
454 
455  SCR_PlayerControllerGroupComponent playerComponent = SCR_PlayerControllerGroupComponent.Cast(playerController.FindComponent(SCR_PlayerControllerGroupComponent));
456 
457  playerComponent.RequestJoinGroup(group.GetGroupID());
458 
459  group.RemoveRequester(playerID);
460 
461  SCR_NotificationsComponent.SendToPlayer(playerID, ENotification.GROUPS_REQUEST_ACCEPTED);
462  }
463 
464  //------------------------------------------------------------------------------------------------
468  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
469  void RPC_CancelJoinPrivateGroup(int playerID, int groupID)
470  {
471  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
472  if (!groupManager)
473  return;
474 
475  SCR_AIGroup group = SCR_AIGroup.Cast(groupManager.FindGroup(groupID));
476  if (!group)
477  return;
478 
479  group.RemoveRequester(playerID);
480  group.AddDeniedRequester(playerID);
481 
482  SCR_NotificationsComponent.SendToPlayer(playerID, ENotification.GROUPS_REQUEST_DENIED);
483  }
484 
485  //------------------------------------------------------------------------------------------------
489  [RplRpc(RplChannel.Reliable, RplRcver.Owner)]
490  void RPC_DoInvitePlayer(int groupID, int fromPlayerID)
491  {
492  m_iGroupInviteID = groupID;
493  m_iGroupInviteFromPlayerID = fromPlayerID;
494 
495  //Save player name so it can be obtained even if the player left
496  PlayerManager playerManager = GetGame().GetPlayerManager();
497  if (playerManager)
498  m_sGroupInviteFromPlayerName = playerManager.GetPlayerName(fromPlayerID);
499 
500  if (m_OnInviteReceived)
501  m_OnInviteReceived.Invoke(groupID, fromPlayerID);
502  }
503 
504  //------------------------------------------------------------------------------------------------
507  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
508  void RPC_AskInvitePlayer(int playerID)
509  {
510  PlayerController invitedPlayer = GetGame().GetPlayerManager().GetPlayerController(playerID);
511  if (!invitedPlayer)
512  return;
513 
514  SCR_PlayerControllerGroupComponent invitedPlayerGroupComponent = SCR_PlayerControllerGroupComponent.Cast(invitedPlayer.FindComponent(SCR_PlayerControllerGroupComponent));
515  if (!invitedPlayerGroupComponent)
516  return;
517 
518  invitedPlayerGroupComponent.InviteThisPlayer(m_iGroupID, GetPlayerID());
519  }
520 
521  //------------------------------------------------------------------------------------------------
523  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
525  {
526  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
527  if (!groupsManager)
528  return;
529 
530  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
531  if (!factionManager)
532  return;
533 
534  Faction faction = factionManager.GetPlayerFaction(GetPlayerID());
535  if (!faction)
536  return;
537 
538  SCR_Faction scrFaction = SCR_Faction.Cast(faction);
539  if(!scrFaction)
540  return;
541 
542  // We check if there is any empty group already for our faction
543  if (groupsManager.TryFindEmptyGroup(faction))
544  return;
545 
546  // We check if other then predefined group can be created
547  if(scrFaction.GetCanCreateOnlyPredefinedGroups())
548  return;
549 
550  // No empty group found, we allow creation of new group
551  SCR_AIGroup newGroup = groupsManager.CreateNewPlayableGroup(faction);
552 
553  // No new group was created, return
554  if (!newGroup)
555  return;
556 
557  // New group sucessfully created
558  // The player should be automatically added/moved to it
559  RPC_AskJoinGroup(newGroup.GetGroupID());
560  }
561 
562  //------------------------------------------------------------------------------------------------
565  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
566  void RPC_AskKickPlayer(int playerID)
567  {
568  SCR_GroupsManagerComponent groupsManager;
569  SCR_PlayerControllerGroupComponent playerGroupController;
570  SCR_AIGroup group;
571  if (!InitiateComponents(playerID, groupsManager, playerGroupController, group))
572  return;
573 
574  //requesting player is not leader of the targets group, do nothing
575  if (!group.IsPlayerLeader(GetPlayerID()))
576  return;
577 
578  SCR_AIGroup newGroup = groupsManager.GetFirstNotFullForFaction(group.GetFaction(), group, true);
579  if (!newGroup)
580  newGroup = groupsManager.CreateNewPlayableGroup(group.GetFaction());
581 
582  if (!newGroup)
583  return;
584  playerGroupController.RequestJoinGroup(newGroup.GetGroupID());
585  }
586 
587  //------------------------------------------------------------------------------------------------
590  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
591  void RPC_AskPromoteLeader(int playerID)
592  {
593  SCR_GroupsManagerComponent groupsManager;
594  SCR_PlayerControllerGroupComponent playerGroupController;
595  SCR_AIGroup group;
596  if (!InitiateComponents(playerID, groupsManager, playerGroupController, group))
597  return;
598 
599  if (!group.IsPlayerLeader(GetPlayerID()))
600  return;
601 
602  groupsManager.SetGroupLeader(group.GetGroupID(), playerID);
603  }
604 
605  //------------------------------------------------------------------------------------------------
609  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
610  void RPC_ChangePrivateGroup(int playerID, bool isPrivate)
611  {
612  SCR_GroupsManagerComponent groupsManager;
613  SCR_PlayerControllerGroupComponent playerGroupController;
614  SCR_AIGroup group;
615  if (!InitiateComponents(playerID, groupsManager, playerGroupController, group))
616  return;
617 
618  groupsManager.SetPrivateGroup(group.GetGroupID(), isPrivate);
619  }
620 
621  //------------------------------------------------------------------------------------------------
624  void RequestJoinGroup(int groupID)
625  {
626  Rpc(RPC_AskJoinGroup, groupID);
627  }
628 
629  //------------------------------------------------------------------------------------------------
632  [RplRpc(RplChannel.Reliable, RplRcver.Owner)]
633  void RPC_DoChangeGroupID(int groupID)
634  {
635  m_iGroupID = groupID;
636  if (groupID == m_iGroupInviteID)
637  {
638  //reset the invite if player manually joined the group he is invited into
639  m_iGroupInviteID = -1;
641  m_OnInviteCancelled.Invoke();
642  }
643  if (m_OnGroupChanged)
644  GetGame().GetCallqueue().CallLater(OnGroupChangedDelayed, 0, false, groupID);
645  }
646 
647  //------------------------------------------------------------------------------------------------
648  protected void OnGroupChangedDelayed(int groupId)
649  {
650  m_OnGroupChanged.Invoke(groupId);
651  }
652 
653  //------------------------------------------------------------------------------------------------
656  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
657  void RPC_AskJoinGroup(int groupID)
658  {
659  // Trying to join the same group, reject.
660  if (groupID == m_iGroupID)
661  return;
662 
663  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
664  if (!groupsManager)
665  return;
666 
667  int groupIDAfter;
668  if (m_iGroupID != -1)
669  groupIDAfter = groupsManager.MovePlayerToGroup(GetPlayerID(), m_iGroupID, groupID);
670  else
671  groupIDAfter = groupsManager.AddPlayerToGroup(groupID, GetPlayerID());
672 
673  if (groupIDAfter != m_iGroupID)
674  {
675  m_iGroupID = groupIDAfter;
676  Rpc(RPC_DoChangeGroupID, groupIDAfter);
677  }
678  }
679 
680  //------------------------------------------------------------------------------------------------
687  bool InitiateComponents(int playerID, out SCR_GroupsManagerComponent groupsManager, out SCR_PlayerControllerGroupComponent playerGroupController , out SCR_AIGroup group)
688  {
689  groupsManager = SCR_GroupsManagerComponent.GetInstance();
690  if (!groupsManager)
691  return false;
692 
693  playerGroupController = SCR_PlayerControllerGroupComponent.GetPlayerControllerComponent(playerID);
694  if (!playerGroupController)
695  return false;
696 
697  group = groupsManager.GetPlayerGroup(playerID);
698  if (!group)
699  return false;
700  return true;
701  }
702 
703  //------------------------------------------------------------------------------------------------
706  {
707  return m_iUISelectedGroupID;
708  }
709 
710  //------------------------------------------------------------------------------------------------
712  ScriptInvoker GetOnInviteAccepted()
713  {
714  if (!m_OnInviteAccepted)
715  m_OnInviteAccepted = new ScriptInvoker<int>();
716 
717  return m_OnInviteAccepted;
718  }
719 
720  //------------------------------------------------------------------------------------------------
722  ScriptInvoker GetOnGroupChanged()
723  {
724  if (!m_OnGroupChanged)
725  m_OnGroupChanged = new ScriptInvoker<int>();
726 
727  return m_OnGroupChanged;
728  }
729 
730  //------------------------------------------------------------------------------------------------
732  ScriptInvoker GetOnInviteCancelled()
733  {
734  if (!m_OnInviteCancelled)
735  m_OnInviteCancelled = new ScriptInvoker<int>();
736 
737  return m_OnInviteCancelled;
738  }
739 
740  //------------------------------------------------------------------------------------------------
743  {
744  return m_iGroupInviteID;
745  }
746 
747  //------------------------------------------------------------------------------------------------
749  void SetGroupInviteID(int value)
750  {
751  m_iGroupInviteID = value;
752  }
753 
754  //------------------------------------------------------------------------------------------------
757  {
759  }
760 
761  //------------------------------------------------------------------------------------------------
764  {
766  }
767 
768  //------------------------------------------------------------------------------------------------
770  void SetSelectedGroupID(int groupID)
771  {
772  m_iUISelectedGroupID = groupID;
773  }
774 
775  //------------------------------------------------------------------------------------------------
779  void RequestSetCustomGroupDescription(int groupID, string desc)
780  {
781  Rpc(RPC_AskSetCustomDescription, groupID, desc, SCR_PlayerController.GetLocalPlayerId());
782  }
783 
784  //------------------------------------------------------------------------------------------------
789  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
790  void RPC_AskSetCustomDescription(int groupID, string desc, int authorID)
791  {
792  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
793  if (!groupsManager)
794  return;
795 
796  SCR_AIGroup group = groupsManager.FindGroup(groupID);
797  if (!group)
798  return;
799 
800  group.SetCustomDescription(desc, authorID);
801  }
802 
803  //------------------------------------------------------------------------------------------------
807  void RequestSetGroupMaxMembers(int groupID, int maxMembers)
808  {
809  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
810  if (!groupsManager)
811  return;
812 
813  SCR_AIGroup group = groupsManager.FindGroup(groupID);
814  if (!group)
815  return;
816 
817  if (group.GetMaxMembers() == maxMembers || maxMembers < 0)
818  return;
819 
820  Rpc(RPC_AskSetGroupMaxMembers, groupID, maxMembers);
821  }
822 
823  //------------------------------------------------------------------------------------------------
827  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
828  void RPC_AskSetGroupMaxMembers(int groupID, int maxMembers)
829  {
830  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
831  if (!groupsManager)
832  return;
833 
834  SCR_AIGroup group = groupsManager.FindGroup(groupID);
835  if (!group)
836  return;
837 
838  if (group.GetMaxMembers() == maxMembers || maxMembers < 0)
839  return;
840 
841  group.SetMaxMembers(maxMembers);
842  }
843 
844  //------------------------------------------------------------------------------------------------
850  void RequestSetCustomFrequency(int groupID, int frequency)
851  {
852  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
853  if (!groupsManager)
854  return;
855 
856  SCR_AIGroup group = groupsManager.FindGroup(groupID);
857  if (!group)
858  return;
859 
860  if (frequency < 0 || group.GetRadioFrequency() == frequency)
861  return;
862 
863  Rpc(RPC_AskSetFrequency, groupID, frequency);
864  }
865 
866  //------------------------------------------------------------------------------------------------
869  void RequestSetNewGroupsAllowed(bool isAllowed)
870  {
871  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
872  if (!groupsManager || isAllowed == groupsManager.GetNewGroupsAllowed())
873  return;
874 
875  Rpc(RPC_AskSetNewGroupsAllowed, isAllowed);
876  }
877 
878  //------------------------------------------------------------------------------------------------
882  {
883  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
884  if (!groupsManager || isAllowed == groupsManager.GetNewGroupsAllowed())
885  return;
886 
887  Rpc(RPC_AskSetCanPlayersChangeAttributes, isAllowed);
888  }
889 
890  //------------------------------------------------------------------------------------------------
894  void RequestSetCustomGroupName(int groupID, string name)
895  {
896  Rpc(RPC_AskSetCustomName, groupID, name, SCR_PlayerController.GetLocalPlayerId());
897  }
898 
899  //------------------------------------------------------------------------------------------------
904  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
905  void RPC_AskSetCustomName(int groupID, string name, int authorID)
906  {
907  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
908  if (!groupsManager)
909  return;
910 
911  SCR_AIGroup group = groupsManager.FindGroup(groupID);
912  if (!group)
913  return;
914 
915  group.SetCustomName(name, authorID);
916  }
917 
918  //------------------------------------------------------------------------------------------------
921  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
922  void RPC_AskSetNewGroupsAllowed(bool isAllowed)
923  {
924  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
925  if (!groupsManager || isAllowed == groupsManager.GetNewGroupsAllowed())
926  return;
927 
928  groupsManager.SetNewGroupsAllowed(isAllowed);
929  }
930 
931  //------------------------------------------------------------------------------------------------
934  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
936  {
937  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
938  if (!groupsManager || isAllowed == groupsManager.GetNewGroupsAllowed())
939  return;
940 
941  groupsManager.SetCanPlayersChangeAttributes(isAllowed);
942  }
943 
944  //------------------------------------------------------------------------------------------------
948  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
949  void RPC_AskSetFrequency(int groupID, int frequency)
950  {
951  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
952  if (!groupsManager)
953  return;
954 
955  SCR_AIGroup group = groupsManager.FindGroup(groupID);
956  if (!group)
957  return;
958 
959  if (frequency < 0 || group.GetRadioFrequency() == frequency)
960  return;
961 
962  SCR_Faction groupFaction = SCR_Faction.Cast(group.GetFaction());
963  if (!groupFaction)
964  return;
965 
966  int formerFrequency = group.GetRadioFrequency();
967  int foundGroupsWithFrequency = 0;
968 
969  //no null check here because the array will always at least contain the group that was passed as parameter into this method
970  array<SCR_AIGroup> existingGroups = groupsManager.GetPlayableGroupsByFaction(groupFaction);
971 
972  foreach (SCR_AIGroup checkedGroup: existingGroups)
973  {
974  if (checkedGroup.GetRadioFrequency() == formerFrequency)
975  foundGroupsWithFrequency++;
976  }
977 
978  //if there is only our group with this frequency or none, release it before changing our frequency
979  if (foundGroupsWithFrequency <= 1)
980  groupsManager.ReleaseFrequency(formerFrequency, groupFaction);
981 
982  //if the new frequency is unclaimed, claime it so newly created groups do not get it by default
983  if (!groupsManager.IsFrequencyClaimed(frequency, groupFaction))
984  groupsManager.ClaimFrequency(frequency, groupFaction);
985 
986  group.SetRadioFrequency(frequency);
987  }
988 
989  //------------------------------------------------------------------------------------------------
994  void RequestSetGroupFlag(int groupID, int flagIndex, bool isFromImageset)
995  {
996  Rpc(RPC_AskSetGroupFlag, groupID, flagIndex, isFromImageset);
997  }
998 
999  //------------------------------------------------------------------------------------------------
1004  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
1005  void RPC_AskSetGroupFlag(int groupID, int flagIndex, bool isFromImageset)
1006  {
1007  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1008  if (!groupsManager)
1009  return;
1010 
1011  SCR_AIGroup group = groupsManager.FindGroup(groupID);
1012  if (!group)
1013  return;
1014 
1015  group.SetGroupFlag(flagIndex, isFromImageset);
1016  }
1017 
1018  //------------------------------------------------------------------------------------------------
1021  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
1022  void RPC_ClearAllRequesters(RplId groupID)
1023  {
1024  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
1025  if (!groupManager)
1026  return;
1027 
1028  SCR_AIGroup group = SCR_AIGroup.Cast(Replication.FindItem(groupID));
1029  if (!group)
1030  return;
1031 
1032  group.ClearRequesters();
1033  group.ClearDeniedRequester();
1034  }
1035 
1036  //------------------------------------------------------------------------------------------------
1039  void RequestCreateSlaveGroup(RplId rplCompID)
1040  {
1041  Rpc(RPC_AskCreateSlaveGroup, rplCompID);
1042  }
1043 
1044  //------------------------------------------------------------------------------------------------
1047  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
1048  void RPC_AskCreateSlaveGroup(RplId rplCompID)
1049  {
1050  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
1051  if (!groupManager)
1052  return;
1053 
1054  SCR_CommandingManagerComponent commandingManager = SCR_CommandingManagerComponent.GetInstance();
1055  if (!commandingManager)
1056  return;
1057 
1058  IEntity groupEntity = GetGame().SpawnEntityPrefab(Resource.Load(commandingManager.GetGroupPrefab()));
1059  if (!groupEntity)
1060  return;
1061 
1062  SCR_AIGroup group = SCR_AIGroup.Cast(groupEntity);
1063  if (!group)
1064  return;
1065 
1066  RplComponent slaveRplComp = RplComponent.Cast(group.FindComponent(RplComponent));
1067  if (!slaveRplComp)
1068  return;
1069 
1070  groupManager.RequestSetGroupSlave(rplCompID, slaveRplComp.Id());
1071  }
1072 
1073  //------------------------------------------------------------------------------------------------
1078  bool IsAICharacterInAnyGroup(SCR_ChimeraCharacter character, SCR_Faction faction)
1079  {
1080  //TODO: kuceramar: come up with better solution that doesnt include going through all groups
1081  //possible JIP problems due ot using SCR_CHimeraCharacter
1082  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
1083  if (!groupManager)
1084  return false;
1085 
1086  array<SCR_AIGroup> groups = groupManager.GetPlayableGroupsByFaction(faction);
1087 
1088  foreach(SCR_AIGroup group : groups)
1089  {
1090  if (group.IsAIControlledCharacterMember(character))
1091  return true;
1092  }
1093 
1094  return false;
1095  }
1096 
1097  //------------------------------------------------------------------------------------------------
1101  void RequestAddAIAgent(SCR_ChimeraCharacter character, int playerID)
1102  {
1103  RplComponent rplComp = RplComponent.Cast(character.FindComponent(RplComponent));
1104  if (!rplComp)
1105  return;
1106 
1107  Rpc(RPC_AskAddAIAgent, rplComp.Id(), playerID);
1108  }
1109 
1110  //------------------------------------------------------------------------------------------------
1114  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
1115  void RPC_AskAddAIAgent(RplId characterID, int playerID)
1116  {
1117  SCR_GroupsManagerComponent groupsManager;
1118  SCR_PlayerControllerGroupComponent playerGroupController;
1119  SCR_AIGroup group;
1120  if (!InitiateComponents(playerID, groupsManager, playerGroupController, group))
1121  return;
1122 
1123  RplComponent rplComp = RplComponent.Cast(Replication.FindItem(characterID));
1124  if (!rplComp)
1125  return;
1126 
1127  SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(rplComp.GetEntity());
1128  if (!character)
1129  return;
1130 
1131  if (!group.IsPlayerLeader(playerID))
1132  return;
1133 
1134  AddAIToSlaveGroup(character, group);
1135  }
1136 
1137  //------------------------------------------------------------------------------------------------
1141  void AddAIToSlaveGroup(notnull IEntity controlledEntity, SCR_AIGroup group)
1142  {
1143  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
1144  if (!groupManager)
1145  return;
1146 
1147  SCR_AIGroup slaveGroup = group.GetSlave();
1148  if (!slaveGroup)
1149  return;
1150 
1151  if (!slaveGroup.IsAIActivated())
1152  slaveGroup.ActivateAI();
1153 
1154  slaveGroup.AddAgentFromControlledEntity(controlledEntity);
1155 
1156  RplId groupCompID, characterCompID;
1157  RplComponent rplComp = RplComponent.Cast(slaveGroup.FindComponent(RplComponent));
1158  if (!rplComp)
1159  return;
1160 
1161  groupCompID = rplComp.Id();
1162  rplComp = RplComponent.Cast(controlledEntity.FindComponent(RplComponent));
1163  characterCompID = rplComp.Id();
1164 
1165  groupManager.AskAddAiMemberToGroup(groupCompID, characterCompID);
1166  }
1167 
1168  //------------------------------------------------------------------------------------------------
1172  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
1173  void RPC_AskRemoveAIAgent(RplId characterID, int playerID)
1174  {
1175  SCR_GroupsManagerComponent groupsManager;
1176  SCR_PlayerControllerGroupComponent playerGroupController;
1177  SCR_AIGroup group;
1178  if (!InitiateComponents(playerID, groupsManager, playerGroupController, group))
1179  return;
1180 
1181  RplComponent rplComp = RplComponent.Cast(Replication.FindItem(characterID));
1182  if (!rplComp)
1183  return;
1184 
1185  SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(rplComp.GetEntity());
1186  if (!character)
1187  return;
1188 
1189  if (!group.IsPlayerLeader(playerID))
1190  return;
1191 
1192  RemoveAiFromSlaveGroup(character, group);
1193  }
1194 
1195  //------------------------------------------------------------------------------------------------
1199  void RemoveAiFromSlaveGroup(notnull IEntity controlledEntity, SCR_AIGroup group)
1200  {
1201  SCR_GroupsManagerComponent groupManager = SCR_GroupsManagerComponent.GetInstance();
1202  if (!groupManager)
1203  return;
1204 
1205  SCR_AIGroup slaveGroup = group.GetSlave();
1206  if (!slaveGroup)
1207  return;
1208 
1209  //deactivate the group since we are removing last AI member
1210  if (slaveGroup.GetAgentsCount() == 1)
1211  slaveGroup.Deactivate();
1212 
1213  slaveGroup.RemoveAgentFromControlledEntity(controlledEntity);
1214 
1215  RplId groupCompID, characterCompID;
1216  RplComponent rplComp = RplComponent.Cast(slaveGroup.FindComponent(RplComponent));
1217  groupCompID = rplComp.Id();
1218  rplComp = RplComponent.Cast(controlledEntity.FindComponent(RplComponent));
1219  if (!rplComp)
1220  return;
1221 
1222  characterCompID = rplComp.Id();
1223 
1224  groupManager.AskRemoveAiMemberFromGroup(groupCompID, characterCompID);
1225  }
1226 
1227  //------------------------------------------------------------------------------------------------
1231  void RequestRemoveAgent(SCR_ChimeraCharacter character, int playerID)
1232  {
1233  RplComponent rplComp = RplComponent.Cast(character.FindComponent(RplComponent));
1234  if (!rplComp)
1235  return;
1236 
1237  Rpc(RPC_AskRemoveAIAgent, rplComp.Id(), playerID);
1238  }
1239 
1240  //------------------------------------------------------------------------------------------------
1241  override void OnPostInit(IEntity owner)
1242  {
1243  super.OnPostInit(owner);
1244 
1245  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1246  if (!groupsManager)
1247  return;
1248 
1249 #ifdef ENABLE_DIAG
1250  DiagMenu.RegisterMenu(SCR_DebugMenuID.DEBUGUI_GROUPS, "Groups", "GameCode");
1251  DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_GROUPS_ENABLE_DIAG, "", "Enable groups diag", "Groups");
1252  ConnectToDiagSystem(owner);
1253 #endif
1254  groupsManager.GetOnPlayableGroupRemoved().Insert(OnGroupDeleted);
1255  }
1256 
1257  //------------------------------------------------------------------------------------------------
1258  override void OnDelete(IEntity owner)
1259  {
1260 #ifdef ENABLE_DIAG
1261  DisconnectFromDiagSystem(owner);
1262 #endif
1263 
1264  super.OnDelete(owner);
1265  }
1266 
1267  //------------------------------------------------------------------------------------------------
1270  {
1271  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1272  if (!groupsManager)
1273  return null;
1274 
1275  return groupsManager.FindGroup(m_iGroupID);
1276  }
1277 
1278  //------------------------------------------------------------------------------------------------
1281  {
1282  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1283  if (!groupsManager)
1284  return 0;
1285 
1286  SCR_AIGroup group = groupsManager.FindGroup(m_iGroupID);
1287  if (!group)
1288  return 0;
1289 
1290  return group.GetRadioFrequency();
1291  }
1292 
1293  //------------------------------------------------------------------------------------------------
1294  override void EOnDiag(IEntity owner, float timeSlice)
1295  {
1296  if (!DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_GROUPS_ENABLE_DIAG))
1297  return;
1298 
1299  DbgUI.Begin("Groups");
1300 
1301  int playerID = SCR_PlayerController.GetLocalPlayerId();
1302  Faction faction;
1303  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
1304  if (factionManager)
1305  faction = factionManager.GetPlayerFaction(playerID);
1306 
1307  if (!faction)
1308  {
1309  DbgUI.Text("Groups do not support factionless players now!!");
1310  DbgUI.End();
1311  return;
1312  }
1313 
1314  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1315 
1316  DbgUI.Text("Your Faction:" + faction.GetFactionKey());
1317  DbgUI.Spacer(2);
1318 
1319  DbgUI.Text("Playable groups of your faction:");
1320  ListGroupsFromFaction(faction);
1321  DbgUI.Spacer(6);
1322 
1323  DbgUI.Text("Your group:");
1324  SCR_AIGroup group = groupsManager.GetPlayerGroup(playerID);
1325  if (group)
1326  {
1327  DbgUI.Text("." + group.ToString());
1328  Print(group.ToString(), LogLevel.NORMAL);
1329  }
1330  DbgUI.Spacer(2);
1331 
1332  if (DbgUI.Button("Create and join group for my faction"))
1333  CreateAndJoinGroup(faction);
1334 
1335  DbgUI.Spacer(2);
1336  DbgUI.End();
1337  }
1338 
1339  //------------------------------------------------------------------------------------------------
1343  {
1344  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1345  array<SCR_AIGroup> groups = groupsManager.GetPlayableGroupsByFaction(faction);
1346  if (!groups)
1347  {
1348  DbgUI.Text("No groups for your faction!!");
1349  return;
1350  }
1351 
1352  foreach(SCR_AIGroup group : groups)
1353  {
1354  DbgUI.Text(group.ToString());
1355  }
1356  }
1357 
1358  //------------------------------------------------------------------------------------------------
1362  {
1363  SCR_PlayerControllerGroupComponent playerGroupController = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
1364  if (!playerGroupController)
1365  return;
1366 
1367  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
1368  if (!groupsManager || !groupsManager.IsPlayerInAnyGroup(SCR_PlayerController.GetLocalPlayerId()))
1369  return;
1370 
1371  SCR_AIGroup group = groupsManager.GetFirstNotFullForFaction(faction, null, true);
1372  if (group)
1373  playerGroupController.RequestJoinGroup(group.GetGroupID());
1374  else
1375  playerGroupController.RequestCreateGroup(); //requestCreateGroup automatically puts player to the newly created group
1376  }
1377 }
RequestKickPlayer
void RequestKickPlayer(int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:63
RPC_AskSetCustomDescription
void RPC_AskSetCustomDescription(int groupID, string desc, int authorID)
Definition: SCR_PlayerControllerGroupComponent.c:790
RequestAddAIAgent
void RequestAddAIAgent(SCR_ChimeraCharacter character, int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:1101
GetOnInviteReceived
ScriptInvoker GetOnInviteReceived()
Definition: SCR_PlayerControllerGroupComponent.c:401
RequestPrivateGroupChange
void RequestPrivateGroupChange(int playerID, bool isPrivate)
Definition: SCR_PlayerControllerGroupComponent.c:80
SCR_PlayerController
Definition: SCR_PlayerController.c:31
GetOnInviteAccepted
ScriptInvoker GetOnInviteAccepted()
Definition: SCR_PlayerControllerGroupComponent.c:712
m_OnGroupChanged
protected ref ScriptInvoker< int > m_OnGroupChanged
Definition: SCR_PlayerControllerGroupComponent.c:14
CanPlayerJoinGroup
bool CanPlayerJoinGroup(int playerID, notnull SCR_AIGroup group)
Definition: SCR_PlayerControllerGroupComponent.c:119
RPC_ChangePrivateGroup
void RPC_ChangePrivateGroup(int playerID, bool isPrivate)
Definition: SCR_PlayerControllerGroupComponent.c:610
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
GetGroupInviteFromPlayerName
string GetGroupInviteFromPlayerName()
Definition: SCR_PlayerControllerGroupComponent.c:763
RequestRemoveAgent
void RequestRemoveAgent(SCR_ChimeraCharacter character, int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:1231
RPC_AskRemoveAIAgent
void RPC_AskRemoveAIAgent(RplId characterID, int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:1173
InvitePlayer
void InvitePlayer(int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:340
ClearAllRequesters
void ClearAllRequesters(RplId groupID)
Definition: SCR_PlayerControllerGroupComponent.c:97
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
GetPlayersGroup
SCR_AIGroup GetPlayersGroup()
Definition: SCR_PlayerControllerGroupComponent.c:1269
GetGroupInviteID
int GetGroupInviteID()
Definition: SCR_PlayerControllerGroupComponent.c:742
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
RPC_AskSetCustomName
void RPC_AskSetCustomName(int groupID, string name, int authorID)
Definition: SCR_PlayerControllerGroupComponent.c:905
m_mPlayerInvitesToGroups
protected ref map< int, ref array< int > > m_mPlayerInvitesToGroups
Definition: SCR_PlayerControllerGroupComponent.c:10
OnDelete
override void OnDelete(IEntity owner)
Definition: SCR_PlayerControllerGroupComponent.c:1258
RPC_AskSetFrequency
void RPC_AskSetFrequency(int groupID, int frequency)
Definition: SCR_PlayerControllerGroupComponent.c:949
RPC_CancelJoinPrivateGroup
void RPC_CancelJoinPrivateGroup(int playerID, int groupID)
Definition: SCR_PlayerControllerGroupComponent.c:469
RequestSetGroupFlag
void RequestSetGroupFlag(int groupID, int flagIndex, bool isFromImageset)
Definition: SCR_PlayerControllerGroupComponent.c:994
GetGroupInviteFromPlayerID
int GetGroupInviteFromPlayerID()
Definition: SCR_PlayerControllerGroupComponent.c:756
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
OnGroupChangedDelayed
protected void OnGroupChangedDelayed(int groupId)
Definition: SCR_PlayerControllerGroupComponent.c:648
RemoveAiFromSlaveGroup
void RemoveAiFromSlaveGroup(notnull IEntity controlledEntity, SCR_AIGroup group)
Should be only called on the server.
Definition: SCR_PlayerControllerGroupComponent.c:1199
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
RPC_DoChangeGroupID
void RPC_DoChangeGroupID(int groupID)
Definition: SCR_PlayerControllerGroupComponent.c:633
AddAIToSlaveGroup
void AddAIToSlaveGroup(notnull IEntity controlledEntity, SCR_AIGroup group)
Should be only called on the server.
Definition: SCR_PlayerControllerGroupComponent.c:1141
RequestCreateSlaveGroup
void RequestCreateSlaveGroup(RplId rplCompID)
Definition: SCR_PlayerControllerGroupComponent.c:1039
RequestJoinGroup
void RequestJoinGroup(int groupID)
Definition: SCR_PlayerControllerGroupComponent.c:624
IsAICharacterInAnyGroup
bool IsAICharacterInAnyGroup(SCR_ChimeraCharacter character, SCR_Faction faction)
Definition: SCR_PlayerControllerGroupComponent.c:1078
RequestCreateGroup
void RequestCreateGroup()
Definition: SCR_PlayerControllerGroupComponent.c:55
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
RPC_AskKickPlayer
void RPC_AskKickPlayer(int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:566
IsPlayerLeaderOwnGroup
bool IsPlayerLeaderOwnGroup()
Definition: SCR_PlayerControllerGroupComponent.c:248
GetActualGroupFrequency
int GetActualGroupFrequency()
Definition: SCR_PlayerControllerGroupComponent.c:1280
CanInvitePlayer
bool CanInvitePlayer(int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:271
RPC_AskAddAIAgent
void RPC_AskAddAIAgent(RplId characterID, int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:1115
ENotification
ENotification
Definition: ENotification.c:4
m_OnInviteReceived
protected ref ScriptInvoker< int, int > m_OnInviteReceived
Definition: SCR_PlayerControllerGroupComponent.c:11
RequestSetGroupMaxMembers
void RequestSetGroupMaxMembers(int groupID, int maxMembers)
Definition: SCR_PlayerControllerGroupComponent.c:807
GetOnInviteCancelled
ScriptInvoker GetOnInviteCancelled()
Definition: SCR_PlayerControllerGroupComponent.c:732
InitiateComponents
bool InitiateComponents(int playerID, out SCR_GroupsManagerComponent groupsManager, out SCR_PlayerControllerGroupComponent playerGroupController, out SCR_AIGroup group)
Definition: SCR_PlayerControllerGroupComponent.c:687
SCR_PlayerControllerGroupComponentClass
Definition: SCR_PlayerControllerGroupComponent.c:2
InviteThisPlayer
void InviteThisPlayer(int groupID, int fromPlayerID)
Definition: SCR_PlayerControllerGroupComponent.c:371
GetGroupID
int GetGroupID()
Definition: SCR_PlayerControllerGroupComponent.c:48
WasAlreadyInvited
bool WasAlreadyInvited(int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:302
SetSelectedGroupID
void SetSelectedGroupID(int groupID)
Definition: SCR_PlayerControllerGroupComponent.c:770
m_OnInviteCancelled
protected ref ScriptInvoker< int > m_OnInviteCancelled
Definition: SCR_PlayerControllerGroupComponent.c:13
GetSelectedGroupID
int GetSelectedGroupID()
Definition: SCR_PlayerControllerGroupComponent.c:705
RPC_ConfirmJoinPrivateGroup
void RPC_ConfirmJoinPrivateGroup(int playerID, int groupID)
Definition: SCR_PlayerControllerGroupComponent.c:441
RPC_AskCreateSlaveGroup
void RPC_AskCreateSlaveGroup(RplId rplCompID)
Definition: SCR_PlayerControllerGroupComponent.c:1048
DEFAULT_COLOR
const protected ref Color DEFAULT_COLOR
Definition: SCR_PlayerControllerGroupComponent.c:21
OnPostInit
override void OnPostInit(IEntity owner)
Editable Mine.
Definition: SCR_PlayerControllerGroupComponent.c:1241
m_iUISelectedGroupID
protected int m_iUISelectedGroupID
Definition: SCR_PlayerControllerGroupComponent.c:16
RPC_AskJoinGroup
void RPC_AskJoinGroup(int groupID)
Definition: SCR_PlayerControllerGroupComponent.c:657
m_iGroupInviteID
protected int m_iGroupInviteID
Definition: SCR_PlayerControllerGroupComponent.c:17
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
EOnDiag
override void EOnDiag(IEntity owner, float timeSlice)
Definition: SCR_PlayerControllerGroupComponent.c:1294
m_iGroupInviteFromPlayerID
protected int m_iGroupInviteFromPlayerID
Definition: SCR_PlayerControllerGroupComponent.c:18
RPC_PlayerRequestToJoinPrivateGroup
void RPC_PlayerRequestToJoinPrivateGroup(int playerID, RplId groupID)
Definition: SCR_PlayerControllerGroupComponent.c:426
m_iGroupID
SCR_PlayerControllerGroupComponentClass m_iGroupID
RequestSetCustomFrequency
void RequestSetCustomFrequency(int groupID, int frequency)
Sets custom frequency (KHz) for a group. Can set frequency that is already claimed....
Definition: SCR_PlayerControllerGroupComponent.c:850
AcceptJoinPrivateGroup
void AcceptJoinPrivateGroup(int playerID, bool accept)
Definition: SCR_PlayerControllerGroupComponent.c:321
Faction
Definition: Faction.c:12
SCR_GroupsManagerComponent
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_GroupsManagerComponent.c:1320
SCR_PlayerFactionAffiliationComponent
Definition: SCR_PlayerFactionAffiliationComponent.c:16
CreateAndJoinGroup
void CreateAndJoinGroup(Faction faction)
Definition: SCR_PlayerControllerGroupComponent.c:1361
RequestSetCanPlayersChangeAttributes
void RequestSetCanPlayersChangeAttributes(bool isAllowed)
Definition: SCR_PlayerControllerGroupComponent.c:881
SetGroupInviteID
void SetGroupInviteID(int value)
Definition: SCR_PlayerControllerGroupComponent.c:749
SCR_AIGroup
Definition: SCR_AIGroup.c:68
GetPlayerID
int GetPlayerID()
Definition: SCR_PlayerControllerGroupComponent.c:105
RPC_AskInvitePlayer
void RPC_AskInvitePlayer(int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:508
RequestPromoteLeader
void RequestPromoteLeader(int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:71
RPC_AskSetCanPlayersChangeAttributes
void RPC_AskSetCanPlayersChangeAttributes(bool isAllowed)
Definition: SCR_PlayerControllerGroupComponent.c:935
RequestSetCustomGroupDescription
void RequestSetCustomGroupDescription(int groupID, string desc)
Definition: SCR_PlayerControllerGroupComponent.c:779
RPC_DoInvitePlayer
void RPC_DoInvitePlayer(int groupID, int fromPlayerID)
Definition: SCR_PlayerControllerGroupComponent.c:490
RPC_AskCreateGroup
void RPC_AskCreateGroup()
Definition: SCR_PlayerControllerGroupComponent.c:524
m_sGroupInviteFromPlayerName
protected string m_sGroupInviteFromPlayerName
Definition: SCR_PlayerControllerGroupComponent.c:19
RequestSetCustomGroupName
void RequestSetCustomGroupName(int groupID, string name)
Definition: SCR_PlayerControllerGroupComponent.c:894
IsPlayerLeader
bool IsPlayerLeader(int playerID, notnull SCR_AIGroup group)
Definition: SCR_PlayerControllerGroupComponent.c:240
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
PlayerRequestToJoinPrivateGroup
void PlayerRequestToJoinPrivateGroup(int playerID, RplId groupID)
Definition: SCR_PlayerControllerGroupComponent.c:89
RPC_ClearAllRequesters
void RPC_ClearAllRequesters(RplId groupID)
Definition: SCR_PlayerControllerGroupComponent.c:1022
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition: DebugMenuID.c:3
AcceptInvite
void AcceptInvite()
Definition: SCR_PlayerControllerGroupComponent.c:378
RequestSetNewGroupsAllowed
void RequestSetNewGroupsAllowed(bool isAllowed)
Definition: SCR_PlayerControllerGroupComponent.c:869
GetOnGroupChanged
ScriptInvoker GetOnGroupChanged()
Definition: SCR_PlayerControllerGroupComponent.c:722
SCR_CommandingManagerComponent
void SCR_CommandingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_CommandingManagerComponent.c:46
PlayerManager
Definition: PlayerManager.c:12
RPC_AskSetGroupFlag
void RPC_AskSetGroupFlag(int groupID, int flagIndex, bool isFromImageset)
Definition: SCR_PlayerControllerGroupComponent.c:1005
ListGroupsFromFaction
void ListGroupsFromFaction(Faction faction)
Definition: SCR_PlayerControllerGroupComponent.c:1342
OnGroupDeleted
void OnGroupDeleted(SCR_AIGroup group)
Definition: SCR_PlayerControllerGroupComponent.c:411
RPC_AskSetGroupMaxMembers
void RPC_AskSetGroupMaxMembers(int groupID, int maxMembers)
Definition: SCR_PlayerControllerGroupComponent.c:828
SCR_Faction
Definition: SCR_Faction.c:6
RPC_AskSetNewGroupsAllowed
void RPC_AskSetNewGroupsAllowed(bool isAllowed)
Definition: SCR_PlayerControllerGroupComponent.c:922
m_OnInviteAccepted
protected ref ScriptInvoker< int > m_OnInviteAccepted
Definition: SCR_PlayerControllerGroupComponent.c:12
RPC_AskPromoteLeader
void RPC_AskPromoteLeader(int playerID)
Definition: SCR_PlayerControllerGroupComponent.c:591
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180