Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionCommanderEstablishCommandMenuHandler.c
Go to the documentation of this file.
3{
6
7 protected const string ESTABLISH_BASE_LIMIT_REACHED = "#AR-Notification_GROUP_TASK_ESTABLISH_BASE_TOO_MANY_BASES";
8
9 //------------------------------------------------------------------------------------------------
10 override bool CanQuickEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
11 {
12 if (!super.CanQuickEntryBeShown(commanderFaction, playerId, position, hoveredEntity))
13 return false;
14
15 SCR_EstablishBaseTaskEntity task = SCR_EstablishBaseTaskEntity.Cast(hoveredEntity);
16 if (!task)
17 return false;
18
19 return true;
20 }
21
22 //------------------------------------------------------------------------------------------------
23 override bool CanEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText = "")
24 {
26 if (gameModeCampaign && !gameModeCampaign.GetBaseManager().CanFactionBuildNewBase(commanderFaction))
27 {
28 disabledText = ESTABLISH_BASE_LIMIT_REACHED;
29 return false;
30 }
31
32 return true;
33 }
34
35 //------------------------------------------------------------------------------------------------
36 override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText = "")
37 {
38 SCR_Task task = SCR_EstablishBaseTaskEntity.Cast(hoveredEntity);
39 if (!task)
40 {
41 SCR_GroupTaskManagerComponent groupTaskManager = SCR_GroupTaskManagerComponent.GetInstance();
42 if (groupTaskManager && groupTaskManager.CanCreateNewTaskWithTypename(GetTaskPrefabClassTypename(), commanderFaction))
43 return true;
44
45 return false;
46 }
47
48 SCR_TaskExecutorGroup groupExecutor = SCR_TaskExecutorGroup.Cast(SCR_TaskExecutorGroup.FromGroup(group.GetGroupID()));
49 bool canBeAssigned = SCR_TaskSystem.GetInstance().CanTaskBeAssignedTo(task, groupExecutor);
50 return canBeAssigned && !task.IsTaskAssignedTo(groupExecutor);
51 }
52
53 //------------------------------------------------------------------------------------------------
54 override void OnCommandIssued(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group)
55 {
56 SCR_FactionCommanderPlayerComponent factionCommanderPlayerComponent = GetLocalCommanderComponent();
57 if (!factionCommanderPlayerComponent)
58 return;
59
60 SCR_EstablishBaseTaskEntity task = SCR_EstablishBaseTaskEntity.Cast(hoveredEntity);
61
62 if (!task)
63 {
65 m_MapCommandCursor.ShowCursor(position);
66 m_MapCommandCursor.SetData(commanderFaction, playerId, hoveredEntity);
67 m_MapCommandCursor.GetOnCommandExecuted().Insert(OnCommandExecuted);
68 m_Group = group;
69 }
70 else if (group)
71 factionCommanderPlayerComponent.AssignGroupToTask(group.GetGroupID(), task.GetTaskID());
72 }
73
74 //------------------------------------------------------------------------------------------------
76 {
77 SCR_FactionCommanderPlayerComponent factionCommanderPlayerComponent = GetLocalCommanderComponent();
78 if (!factionCommanderPlayerComponent || !m_MapCommandCursor)
79 return;
80
81 factionCommanderPlayerComponent.CreateTask(GetTaskPrefab(), position, m_Group, m_MapCommandCursor.GetPlayerId());
82 }
83
84 //------------------------------------------------------------------------------------------------
85 override bool CanEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
86 {
88 if (gameModeCampaign && !gameModeCampaign.GetEstablishingBasesEnabled())
89 return false;
90
91 return super.CanEntryBeShown(commanderFaction, playerId, position, hoveredEntity);
92 }
93}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_BaseGameMode GetGameMode()
vector position
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
void SCR_GroupTaskManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void SCR_Task(IEntitySource src, IEntity parent)
Definition SCR_Task.c:1938
int GetGroupID()
SCR_FactionCommanderPlayerComponent GetLocalCommanderComponent()
override bool CanEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText="")
override void OnCommandIssued(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group)
override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText="")
override bool CanQuickEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
override bool CanEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)