Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BaseRoleCallsign.c
Go to the documentation of this file.
3 {
4  [Attribute("1")]
5  protected bool m_bEnabled;
6 
7  [Attribute()]
8  protected LocalizedString m_sRoleName;
9 
10  [Attribute(SCR_ERoleAvailableForCharacterType.AI_ONLY.ToString(), uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(SCR_ERoleAvailableForCharacterType), desc: "If the role is availible for Player and AI or only AI or Player. Take into account that Player roles are set and will only change if the player leaves the group not when they die.")]
11  protected SCR_ERoleAvailableForCharacterType m_eRoleAvailableForCharacterType;
12 
13  [Attribute("1", "Unique roles can only be present once in a group (Including any attached Master and Slave groups)")]
14  protected bool m_bIsUnique;
15 
16  //------------------------------------------------------------------------------------------------
28  bool IsValidRole(IEntity character, int playerID, SCR_AIGroup group, inout int roleCallsignIndex, out bool isUnique)
29  {
30  if (!m_bEnabled)
31  return false;
32 
33  isUnique = m_bIsUnique;
34 
35  //~ If looking for specific role and this is not that role
36  if (roleCallsignIndex >= 0 && roleCallsignIndex != GetRoleIndex())
37  return false;
38 
39  //~ Check if role can be assigned to player or AI
40  if (m_eRoleAvailableForCharacterType != SCR_ERoleAvailableForCharacterType.ANY_CHARACTER)
41  {
42  //~ Player only role and given character is not AI
43  if (m_eRoleAvailableForCharacterType == SCR_ERoleAvailableForCharacterType.PLAYER_ONLY && playerID <= 0)
44  return false;
45  //~ AI Only role and given character is not AI
46  else if (m_eRoleAvailableForCharacterType == SCR_ERoleAvailableForCharacterType.AI_ONLY && playerID > 0)
47  return false;
48  }
49 
50  //~ Checks if role is availible in group. If not in group than it is always availible
51  if (!group)
52  return true;
53 
54  //~ Get master group if group is slave
55  SCR_AIGroup masterGroup;
56  if (group.IsSlave())
57  masterGroup = group.GetMaster();
58 
59  if (masterGroup)
60  group = masterGroup;
61 
62  //~ If unique role check if it is already in use
63  if (m_bIsUnique)
64  {
65  SCR_CallsignGroupComponent groupCallsignComponent = SCR_CallsignGroupComponent.Cast(group.FindComponent(SCR_CallsignGroupComponent));
66 
67  //~ Check if role is already in use by AI or player
68  if (groupCallsignComponent && groupCallsignComponent.IsUniqueRoleInUse(GetRoleIndex()))
69  return false;
70  }
71 
72  //~ All base checks pass
73  return true;
74  }
75 
76  //------------------------------------------------------------------------------------------------
81  string GetRoleName()
82  {
83  return m_sRoleName;
84  }
85 
86  //------------------------------------------------------------------------------------------------
91  int GetRoleIndex()
92  {
93  return -1;
94  }
95 };
96 
97 //------------------------------------------------------------------------------------------------
99 {
103 };
104 
105 
SCR_BaseRoleCallsign
Definition: SCR_BaseRoleCallsign.c:2
PLAYER_ONLY
@ PLAYER_ONLY
Definition: SCR_BaseRoleCallsign.c:102
BaseContainerCustomStringTitleField
class SCR_HitZoneGroupNameHolder BaseContainerCustomStringTitleField("USE INHERENT VERSION ONLY!")
Definition: SCR_HitZoneGroupNameHolder.c:27
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_ERoleAvailableForCharacterType
SCR_ERoleAvailableForCharacterType
Definition: SCR_BaseRoleCallsign.c:98
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_AIGroup
Definition: SCR_AIGroup.c:68
AI_ONLY
@ AI_ONLY
Definition: SCR_BaseRoleCallsign.c:101
m_bEnabled
private bool m_bEnabled
Definition: SCR_BaseManualCameraComponent.c:3
LocalizedString
Definition: LocalizedString.c:21
ANY_CHARACTER
@ ANY_CHARACTER
Definition: SCR_BaseRoleCallsign.c:100
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468