Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionCommanderConflictBaseMenuHandler.c
Go to the documentation of this file.
3{
4 [Attribute("1", desc:"If checked, player commander can create objective")]
6
7 protected const string BASE_NOT_SELECTED_TEXT = "#AR-FactionCommander_NoBaseSelected";
8
9 //------------------------------------------------------------------------------------------------
10 bool CanCreateObjectiveEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
11 {
13 }
14
15 //------------------------------------------------------------------------------------------------
16 bool CanCreateObjectiveEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText = "")
17 {
18 SCR_GroupTaskManagerComponent groupTaskManager = SCR_GroupTaskManagerComponent.GetInstance();
19 if (!groupTaskManager)
20 return false;
21
22 return groupTaskManager.CanCreateNewTaskWithTypename(GetTaskPrefabClassTypename(), commanderFaction);
23 }
24
25 //------------------------------------------------------------------------------------------------
26 override bool CanEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
27 {
28 return true;
29 }
30
31 //------------------------------------------------------------------------------------------------
32 override bool CanEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText = "")
33 {
34 if (!GetHoveredBase())
35 return false;
36
37 return true;
38 }
39
40 //------------------------------------------------------------------------------------------------
41 override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText = "")
42 {
43 return true;
44 }
45
46 //------------------------------------------------------------------------------------------------
47 protected SCR_CampaignFactionCommanderPlayerComponent GetLocalCampaignCommanderComponent()
48 {
49 return SCR_CampaignFactionCommanderPlayerComponent.Cast(GetLocalCommanderComponent());
50 }
51
52 //------------------------------------------------------------------------------------------------
54 {
55 SCR_CampaignFactionCommanderPlayerComponent factionCommanderPlayerComponent = GetLocalCampaignCommanderComponent();
56
57 if (!factionCommanderPlayerComponent)
58 return null;
59
60 return factionCommanderPlayerComponent.GetHoveredBase();
61 }
62
63 //------------------------------------------------------------------------------------------------
64 protected SCR_Task GetTaskOnBase(SCR_CampaignMilitaryBaseComponent targetBase, Faction targetFaction, typename taskClass)
65 {
66 if (!targetBase)
67 return null;
68
69 array<SCR_Task> tasks = {};
70 SCR_TaskSystem.GetInstance().GetTasksByState(tasks, SCR_ETaskState.CREATED | SCR_ETaskState.ASSIGNED, targetFaction.GetFactionKey());
73
74 foreach (SCR_Task task : tasks)
75 {
76 SCR_CampaignMilitaryBaseTaskEntity campaignMilitaryBaseTask = SCR_CampaignMilitaryBaseTaskEntity.Cast(task);
77 if (!campaignMilitaryBaseTask)
78 continue;
79
80 data = SCR_CampaignMilitaryBaseTaskData.Cast(task.GetTaskData());
81 if (!data)
82 continue;
83
84 if (data.m_aOwnerFactionKeys.IsEmpty())
85 continue;
86
87 base = campaignMilitaryBaseTask.GetMilitaryBase();
88 if (!base)
89 continue;
90
91 if (task.Type() == taskClass && base == targetBase && data.m_aOwnerFactionKeys.Contains(targetFaction.GetFactionKey()))
92 return task;
93 }
94
95 return null;
96 }
97
98 //------------------------------------------------------------------------------------------------
99 protected SCR_Task GetTask(IEntity hoveredEntity, notnull Faction faction, typename taskClass)
100 {
101 SCR_Task task = SCR_Task.Cast(hoveredEntity);
102 if (!task || task && task.Type() != taskClass)
103 task = GetTaskOnHoveredBase(faction, taskClass);
104
105 return task;
106 }
107
108 //------------------------------------------------------------------------------------------------
109 protected SCR_Task GetTaskOnHoveredBase(notnull Faction faction, typename taskClass)
110 {
111 return GetTaskOnBase(GetHoveredBase(), faction, taskClass);
112 }
113
114 //------------------------------------------------------------------------------------------------
115 protected bool CanCampaignGroupEntryBeSelected(notnull Faction faction, IEntity hoveredEntity, notnull SCR_AIGroup group, typename taskClass)
116 {
117 SCR_Task task = GetTask(hoveredEntity, faction, taskClass);
118 if (!task)
119 {
120 SCR_GroupTaskManagerComponent groupTaskManager = SCR_GroupTaskManagerComponent.GetInstance();
121 if (groupTaskManager && groupTaskManager.CanCreateNewTaskWithTypename(taskClass, faction))
122 return true;
123
124 return false;
125 }
126
127 SCR_TaskExecutorGroup groupExecutor = SCR_TaskExecutorGroup.Cast(SCR_TaskExecutorGroup.FromGroup(group.GetGroupID()));
128 bool canBeAssigned = SCR_TaskSystem.GetInstance().CanTaskBeAssignedTo(task, groupExecutor);
129 return canBeAssigned && !task.IsTaskAssignedTo(groupExecutor);
130 }
131}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
vector position
Get all prefabs that have the spawner data
void SCR_GroupTaskManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_ScenarioFrameworkTask GetTask()
void SCR_Task(IEntitySource src, IEntity parent)
Definition SCR_Task.c:1938
SCR_ETaskState
Definition SCR_Task.c:3
SCR_FactionCommanderPlayerComponent GetLocalCommanderComponent()
SCR_Task GetTaskOnBase(SCR_CampaignMilitaryBaseComponent targetBase, Faction targetFaction, typename taskClass)
override bool CanEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText="")
override bool CanEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText="")
bool CanCreateObjectiveEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
bool CanCampaignGroupEntryBeSelected(notnull Faction faction, IEntity hoveredEntity, notnull SCR_AIGroup group, typename taskClass)
SCR_Task GetTask(IEntity hoveredEntity, notnull Faction faction, typename taskClass)
SCR_Task GetTaskOnHoveredBase(notnull Faction faction, typename taskClass)
SCR_CampaignFactionCommanderPlayerComponent GetLocalCampaignCommanderComponent()
bool CanCreateObjectiveEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText="")
SCR_FieldOfViewSettings Attribute