Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseRoleCallsign.c
Go to the documentation of this file.
3{
4 [Attribute("1")]
5 protected bool m_bEnabled;
6
7 [Attribute()]
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.")]
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
41 {
42 //~ Player only role and given character is not AI
44 return false;
45 //~ AI Only role and given character is not AI
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 //------------------------------------------------------------------------------------------------
92 {
93 return -1;
94 }
95};
96
97//------------------------------------------------------------------------------------------------
104
105
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_ERoleAvailableForCharacterType
@ ANY_CHARACTER
class SCR_HitZoneGroupNameHolder BaseContainerCustomStringTitleField("USE INHERITED VERSION ONLY!")
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_AIGroup GetMaster()
bool IsSlave()
SCR_ERoleAvailableForCharacterType m_eRoleAvailableForCharacterType
LocalizedString m_sRoleName
bool IsValidRole(IEntity character, int playerID, SCR_AIGroup group, inout int roleCallsignIndex, out bool isUnique)
SCR_FieldOfViewSettings Attribute