Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SetRallyPointCommand.c
Go to the documentation of this file.
3{
4 [Attribute("Assign Rally Point", desc: "Text displayed for set rally point command.")]
6
7 [Attribute("Unassign Rally Point", desc: "Text displayed for remove really point command.")]
9
10 [Attribute("No Base Selected", desc: "Text display for disabled command due to no base selected.")]
11 protected string m_sNoBaseSelectedString;
12
16 protected SCR_PlayerControllerGroupComponent m_PlayerControllerGroupComponent;
18
19 protected bool m_bAssign;
20
21 //------------------------------------------------------------------------------------------------
22 override bool CanRoleShow()
23 {
24 m_PlayerControllerGroupComponent = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
26 return false;
27
28 return m_PlayerControllerGroupComponent.IsPlayerLeaderOwnGroup();
29 }
30
31 //------------------------------------------------------------------------------------------------
32 override bool CanBeShown()
33 {
34 return false;
35 }
36
37 //------------------------------------------------------------------------------------------------
38 override bool CanShowOnMap()
39 {
40 if (m_MapConfig.MapEntityMode != EMapEntityMode.FULLSCREEN)
41 return false;
42
43 if (!SCR_GameModeCampaign.GetInstance())
44 return false;
45
46 m_PlayerControllerGroupComponent = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
48 return false;
49
50 if (!m_PlayerControllerGroupComponent.IsPlayerLeaderOwnGroup())
51 return false;
52
53 return true;
54 }
55
56 //------------------------------------------------------------------------------------------------
58 {
59 m_MapConfig = config;
60 if (m_MapConfig.MapEntityMode != EMapEntityMode.FULLSCREEN)
61 return;
62
64 if (mapRadialUI)
65 mapRadialUI.GetOnMenuInitInvoker().Insert(OnRadialMenuInit);
66
68 if (mapCampaignUI)
69 mapCampaignUI.GetOnBaseHovered().Insert(OnBaseHovered);
70 }
71
72 //------------------------------------------------------------------------------------------------
74 {
75 m_MapConfig = null;
76 if (config.MapEntityMode != EMapEntityMode.FULLSCREEN)
77 return;
78
80 if (mapCampaignUI)
81 mapCampaignUI.GetOnBaseHovered().Remove(OnBaseHovered);
82
84 if (mapRadialUI)
85 {
86 mapRadialUI.GetOnMenuInitInvoker().Remove(OnRadialMenuInit);
87
88 SCR_RadialMenu mapRadialMenu = mapRadialUI.GetRadialController().GetRadialMenu();
89 if (mapRadialMenu)
90 {
91 mapRadialMenu.GetOnOpen().Remove(OnMapRadialMenuOpen);
92 mapRadialMenu.GetOnAddEntry().Remove(OnRadialMenuEntryAdded);
93 }
94 }
95 }
96
97 //------------------------------------------------------------------------------------------------
99 {
101 if (mapRadialUI)
102 {
103 SCR_RadialMenu mapRadialMenu = mapRadialUI.GetRadialController().GetRadialMenu();
104 if (mapRadialMenu)
105 {
106 mapRadialMenu.GetOnOpen().Insert(OnMapRadialMenuOpen);
107 mapRadialMenu.GetOnAddEntry().Insert(OnRadialMenuEntryAdded);
108 }
109 }
110 }
111
112 //------------------------------------------------------------------------------------------------
114 {
115 SCR_RadialMenu radialMenu = SCR_RadialMenu.Cast(menu);
116 if (!radialMenu)
117 return;
118
121 return;
122
125 }
126
127 //------------------------------------------------------------------------------------------------
129 {
131
133 return;
134
136 }
137
138 //------------------------------------------------------------------------------------------------
143
144 //------------------------------------------------------------------------------------------------
146 {
147 SCR_SelectionMenuEntry foundEntry;
148 SCR_SelectionMenuCategoryEntry categoryEntry;
149 string commandName;
150 SCR_CommandingManagerComponent commandingManager = SCR_CommandingManagerComponent.GetInstance();
152
153 foreach (SCR_SelectionMenuEntry entry : mapRadialMenu.GetEntries())
154 {
155 categoryEntry = SCR_SelectionMenuCategoryEntry.Cast(entry);
156 if (categoryEntry)
157 foundEntry = FindCommandEntryInCategory(categoryEntry);
158
159 if (foundEntry)
160 return foundEntry;
161
162 commandName = entry.GetId();
163 command = SCR_SetRallyPointCommand.Cast(commandingManager.FindCommand(commandName));
164 if (!command)
165 continue;
166
167 foundEntry = entry;
168 break;
169 }
170
171 return foundEntry;
172 }
173
174 //------------------------------------------------------------------------------------------------
176 {
177 SCR_SelectionMenuEntry foundEntry;
178 SCR_SelectionMenuCategoryEntry categoryEntry;
179 string commandName;
180 SCR_CommandingManagerComponent commandingManager = SCR_CommandingManagerComponent.GetInstance();
182
183 foreach (SCR_SelectionMenuEntry element : category.GetEntries())
184 {
185 categoryEntry = SCR_SelectionMenuCategoryEntry.Cast(element);
186 if (categoryEntry)
187 foundEntry = FindCommandEntryInCategory(categoryEntry);
188
189 if (foundEntry)
190 return foundEntry;
191
192 SCR_MapMenuCommandingEntry commandingEntry = SCR_MapMenuCommandingEntry.Cast(element);
193 if (!commandingEntry)
194 continue;
195
196 commandName = commandingEntry.GetEntryIdentifier();
197 command = SCR_SetRallyPointCommand.Cast(commandingManager.FindCommand(commandName));
198 if (!command)
199 continue;
200
201 foundEntry = element;
202 break;
203 }
204
205 return foundEntry;
206 }
207
208 //------------------------------------------------------------------------------------------------
210 {
212 return false;
213
214 Faction playerFaction = SCR_FactionManager.SGetPlayerFaction(m_PlayerControllerGroupComponent.GetPlayerID());
215 if (!playerFaction)
216 return false;
217
218 if (!m_HoveredBase)
219 {
221 return false;
222 }
223
224 if (m_HoveredBase.GetType() != SCR_ECampaignBaseType.BASE || m_HoveredBase.GetFaction() != playerFaction)
225 {
227 return false;
228 }
229
230 SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
231 if (!groupsManager)
232 return false;
233
234 SCR_AIGroup group = groupsManager.FindGroup(m_PlayerControllerGroupComponent.GetGroupID());
235 if (!group)
236 return false;
237
239 if (!campaign)
240 return false;
241
242 SCR_CampaignMilitaryBaseManager baseManager = campaign.GetBaseManager();
243 if (!baseManager)
244 return false;
245
246 int groupRallyPointId = group.GetRallyPointId();
247 SCR_CampaignMilitaryBaseComponent groupRallyPoint = baseManager.FindBaseByCallsign(groupRallyPointId);
248 if (!groupRallyPoint)
249 {
251 m_bAssign = true;
252
253 return true;
254 }
255
256 if (groupRallyPoint == m_HoveredBase)
257 {
259 m_bAssign = false;
260 }
261 else
262 {
264 m_bAssign = true;
265 }
266
267 return true;
268 }
269
270 //------------------------------------------------------------------------------------------------
271 override bool CanBePerformed(notnull SCR_ChimeraCharacter user)
272 {
274 return false;
275
276 return super.CanBePerformed(user);
277 }
278
279 //------------------------------------------------------------------------------------------------
280 override bool Execute(IEntity cursorTarget, IEntity target, vector targetPosition, int playerID, bool isClient)
281 {
282 if (!m_HoveredBase)
283 return false;
284
285 SCR_PlayerControllerGroupComponent groupController = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
286 if (!groupController)
287 return false;
288
289 SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
290 if (!groupsManager)
291 return false;
292
293 SCR_AIGroup group = groupsManager.GetPlayerGroup(playerID);
294 if (!group || !group.IsPlayerLeader(playerID))
295 return false;
296
297 if (m_bAssign)
298 groupController.SetRallyPoint(m_HoveredBase, true);
299 else
300 groupController.RemoveRallyPoint();
301
302 return true;
303 }
304
305 //------------------------------------------------------------------------------------------------
312
313 //------------------------------------------------------------------------------------------------
320}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_BaseGameMode GetGameMode()
void SCR_CommandingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
EMapEntityMode
Mode of the map.
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
bool IsPlayerLeader(int playerID)
int GetRallyPointId()
void SetRallyPoint(notnull SCR_MilitaryBaseComponent base, bool force=false)
SCR_CampaignMilitaryBaseComponent FindBaseByCallsign(int callsign)
BaseHoveredInvoker GetOnBaseHovered()
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapClose()
Get on map close invoker.
SCR_MapUIBaseComponent GetMapUIComponent(typename componentType)
static ScriptInvokerBase< MapConfigurationInvoker > GetOnMapOpen()
Get on map open invoker.
static SCR_MapEntity GetMapInstance()
Get map entity instance.
2D map radial menu UI
ScriptInvokerVoid GetOnMenuInitInvoker()
static SCR_MapRadialUI GetInstance()
SCR_RadialMenuController GetRadialController()
ScriptInvoker GetOnAddEntry()
void OnBaseHovered(SCR_CampaignMilitaryBaseComponent base)
override bool CanBePerformed(notnull SCR_ChimeraCharacter user)
SCR_SelectionMenuEntry FindCommandEntry(SCR_RadialMenu mapRadialMenu)
override bool Execute(IEntity cursorTarget, IEntity target, vector targetPosition, int playerID, bool isClient)
void OnRadialMenuEntryAdded(SCR_SelectionMenu menu, SCR_SelectionMenuEntry entry)
SCR_SelectionMenuEntry FindCommandEntryInCategory(SCR_SelectionMenuCategoryEntry category)
void OnMapClose(MapConfiguration config)
void OnMapOpen(MapConfiguration config)
SCR_PlayerControllerGroupComponent m_PlayerControllerGroupComponent
SCR_CampaignMilitaryBaseComponent m_HoveredBase
ref SCR_SelectionMenuEntry m_RadialMenuEntry
SCR_CampaignMilitaryBaseComponent m_CurrentHoveredBase
SCR_FieldOfViewSettings Attribute