Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionCommanderEstablishBaseRequestMenuHandler.c
Go to the documentation of this file.
3{
4 protected int m_iRequesterGroup;
7
8 protected const string ESTABLISH_BASE_LIMIT_REACHED = "#AR-Notification_GROUP_TASK_ESTABLISH_BASE_TOO_MANY_BASES";
9
10 //------------------------------------------------------------------------------------------------
11 override bool CanQuickEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
12 {
13 if (!super.CanQuickEntryBeShown(commanderFaction, playerId, position, hoveredEntity))
14 return false;
15
16 SCR_EstablishBaseRequestedTaskEntity task = SCR_EstablishBaseRequestedTaskEntity.Cast(hoveredEntity);
17 if (!task)
18 return false;
19
20 return true;
21 }
22
23 //------------------------------------------------------------------------------------------------
24 override bool CanEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText = "")
25 {
27 if (gameModeCampaign && !gameModeCampaign.GetBaseManager().CanFactionBuildNewBase(commanderFaction))
28 {
29 disabledText = ESTABLISH_BASE_LIMIT_REACHED;
30 return false;
31 }
32
33 return true;
34 }
35
36 //------------------------------------------------------------------------------------------------
37 override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText = "")
38 {
39 return false;
40 }
41
42 //------------------------------------------------------------------------------------------------
43 override void OnCommandIssued(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group)
44 {
45 SCR_FactionCommanderPlayerComponent factionCommanderPlayerComponent = GetLocalCommanderComponent();
46 if (!factionCommanderPlayerComponent)
47 return;
48
50 if (!groupComp)
51 return;
52
53 SCR_AIGroup requesterGroup = groupComp.GetPlayerGroup(playerId);
54 if (!requesterGroup)
55 return;
56
57 SCR_EstablishBaseRequestedTaskEntity task = SCR_EstablishBaseRequestedTaskEntity.Cast(hoveredEntity);
58 if (!task)
59 {
61 m_MapCommandCursor.ShowCursor(position);
62 m_MapCommandCursor.SetData(commanderFaction, playerId, hoveredEntity);
63 m_MapCommandCursor.GetOnCommandExecuted().Insert(OnCommandExecuted);
64 m_Group = group;
65 m_iRequesterGroup = requesterGroup.GetGroupID();
66 }
67 }
68
69 //------------------------------------------------------------------------------------------------
71 {
73 return;
74
75 SCR_FactionCommanderPlayerComponent factionCommanderPlayerComponent = GetLocalCommanderComponent();
76 if (!factionCommanderPlayerComponent)
77 return;
78
79 factionCommanderPlayerComponent.CreateRequestedTask(GetTaskPrefab(), position, m_iRequesterGroup, m_Group, m_MapCommandCursor.GetPlayerId(), this);
80 }
81
82 //------------------------------------------------------------------------------------------------
83 override bool CanEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
84 {
86 if (gameModeCampaign && !gameModeCampaign.GetEstablishingBasesEnabled())
87 return false;
88
89 return super.CanEntryBeShown(commanderFaction, playerId, position, hoveredEntity);
90 }
91}
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_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
int GetGroupID()
SCR_FactionCommanderPlayerComponent GetLocalCommanderComponent()
override void OnCommandIssued(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group)
override bool CanQuickEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
override bool CanEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText="")
override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText="")
override bool CanEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)