Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionCommanderDismantleCommandMenuHandler.c
Go to the documentation of this file.
3{
4 [Attribute("-10 0 -10", desc:"Task offset")]
6
7 protected const string HQ_CANNOT_BE_DISMANTLED = "#AR-FactionCommander_HQCannotBeDismantled";
8 protected const string BASE_CANNOT_BE_DISMANTLED = "#AR-FactionCommander_BaseCannotBeDismantled";
9
10 //------------------------------------------------------------------------------------------------
11 override bool CanCreateObjectiveEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
12 {
13 if (!super.CanCreateObjectiveEntryBeShown(commanderFaction, playerId, position, hoveredEntity))
14 return false;
15
16 SCR_Task task = GetTaskOnHoveredBase(commanderFaction, SCR_DismantleCampaignMilitaryBaseTaskEntity);
17 if (task)
18 return false;
19
20 return true;
21 }
22
23 //------------------------------------------------------------------------------------------------
24 override bool CanQuickEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
25 {
26 if (!super.CanQuickEntryBeShown(commanderFaction, playerId, position, hoveredEntity))
27 return false;
28
29 SCR_Task task = SCR_DismantleCampaignMilitaryBaseTaskEntity.Cast(hoveredEntity);
30 if (!task)
31 return false;
32
33 return true;
34 }
35
36 //------------------------------------------------------------------------------------------------
37 override bool CanEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, out string disabledText = "")
38 {
39 if (!super.CanEntryBeSelected(commanderFaction, playerId, position, hoveredEntity))
40 {
41 disabledText = BASE_NOT_SELECTED_TEXT;
42 return false;
43 }
44
45 SCR_CampaignFaction campaignFaction = SCR_CampaignFaction.Cast(commanderFaction);
46 if (!campaignFaction)
47 return false;
48
50 if (hoveredBase.GetFaction() != commanderFaction)
51 return false;
52
53 if (hoveredBase.IsHQ())
54 {
55 disabledText = HQ_CANNOT_BE_DISMANTLED;
56 return false;
57 }
58
59 if (hoveredBase.IsControlPoint() || hoveredBase.GetType() == SCR_ECampaignBaseType.RELAY || hoveredBase.GetType() == SCR_ECampaignBaseType.SOURCE_BASE)
60 {
61 disabledText = BASE_CANNOT_BE_DISMANTLED;
62 return false;
63 }
64
65 return true;
66 }
67
68 //------------------------------------------------------------------------------------------------
69 override bool CanGroupEntryBeSelected(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group, out string disabledText = "")
70 {
71 if (!super.CanGroupEntryBeSelected(commanderFaction, playerId, position, hoveredEntity, group))
72 return false;
73
74 return CanCampaignGroupEntryBeSelected(commanderFaction, hoveredEntity, group, SCR_DismantleCampaignMilitaryBaseTaskEntity);
75 }
76
77 //------------------------------------------------------------------------------------------------
78 override void OnCommandIssued(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity, SCR_AIGroup group)
79 {
80 SCR_CampaignFactionCommanderPlayerComponent factionCommanderPlayerComponent = GetLocalCampaignCommanderComponent();
81 if (!factionCommanderPlayerComponent)
82 return;
83
84 SCR_Task task = SCR_DismantleCampaignMilitaryBaseTaskEntity.Cast(hoveredEntity);
85 if (!task)
86 task = GetTaskOnHoveredBase(commanderFaction, SCR_DismantleCampaignMilitaryBaseTaskEntity);
87
88 if (!task)
89 factionCommanderPlayerComponent.CreateCampaignMilitaryBaseTask(GetTaskPrefab(), group, playerId, m_vPositionOffset);
90 else if (group)
91 factionCommanderPlayerComponent.AssignGroupToTask(group.GetGroupID(), task.GetTaskID());
92 }
93}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
vector position
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void SCR_Task(IEntitySource src, IEntity parent)
Definition SCR_Task.c:1938
int GetGroupID()
SCR_ECampaignBaseType GetType()
Returns type of this base.
bool CanCampaignGroupEntryBeSelected(notnull Faction faction, IEntity hoveredEntity, notnull SCR_AIGroup group, typename taskClass)
SCR_Task GetTaskOnHoveredBase(notnull Faction faction, typename taskClass)
SCR_CampaignFactionCommanderPlayerComponent GetLocalCampaignCommanderComponent()
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 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 CanCreateObjectiveEntryBeShown(notnull Faction commanderFaction, int playerId, vector position, IEntity hoveredEntity)
SCR_FieldOfViewSettings Attribute