Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CampaignFeedbackComponent.c
Go to the documentation of this file.
1 class SCR_CampaignFeedbackComponentClass : ScriptComponentClass
2 {
3 }
4 
5 class SCR_CampaignFeedbackComponent : ScriptComponent
6 {
7  [Attribute("{3EE26F4747B6E99D}Configs/Hints/Conflict/ConflictHints.conf", params: "conf class=SCR_CampaignHintStorage")]
8  protected ResourceName m_sHintsConfig;
9 
10  protected SCR_GameModeCampaign m_Campaign;
11 
13 
14  protected SCR_CampaignMilitaryBaseComponent m_BaseWithPlayer;
15 
16  protected AudioHandle m_PlayedRadio = AudioHandle.Invalid;
17 
18  protected vector m_vFirstSpawnPosition;
19 
20  protected SCR_MapCampaignUI m_MapCampaignUI;
21 
22  protected ref TimeContainer m_SpawnTime;
23 
24  protected ref SCR_CampaignHintStorage m_HintsConfig;
25 
26  protected ref array<int> m_aShownHints = {};
27  protected ref array<int> m_aHintQueue = {};
28 
29  protected bool m_bIsPlayerInRadioRange = true;
30  protected bool m_bCanShowSpawnPosition;
31  protected bool m_bWasMapOpened;
32  protected bool m_bIsConscious;
33 
34  protected float m_fNextAllowedHintTimestamp;
35 
36  protected WorldTimestamp m_fBaseWithPlayerCaptureStart;
37  protected WorldTimestamp m_fBaseWithPlayerCaptureEnd;
38 
39  static const float ICON_FLASH_DURATION = 20;
40  static const float ICON_FLASH_PERIOD = 0.5;
41 
42  protected static const int AFTER_RESPAWN_HINT_DELAY_MS = 16500;
43  protected static const int DELAY_BETWEEN_HINTS_MS = 1000;
44  protected static const int FEATURE_HINT_DELAY = 120000;
45 
46  //------------------------------------------------------------------------------------------------
48  static SCR_CampaignFeedbackComponent GetInstance()
49  {
50  PlayerController pc = GetGame().GetPlayerController();
51 
52  if (!pc)
53  return null;
54 
55  return SCR_CampaignFeedbackComponent.Cast(pc.FindComponent(SCR_CampaignFeedbackComponent));
56  }
57 
58  //------------------------------------------------------------------------------------------------
61  void EnablePlayerSpawnHint(bool enable)
62  {
63  IEntity player = SCR_PlayerController.GetLocalControlledEntity();
64 
65  if (!player && enable)
66  return;
67 
68  m_bCanShowSpawnPosition = enable;
69 
70  if (enable)
71  {
72  m_vFirstSpawnPosition = player.GetOrigin();
73  SetSpawnTime();
74  }
75  else
76  {
77  m_vFirstSpawnPosition = vector.Zero;
78  SetMapOpened(false);
79 
80  if (m_MapCampaignUI)
81  m_MapCampaignUI.RemoveSpawnPositionHint();
82  }
83 
84  GetGame().GetCallqueue().Remove(EnablePlayerSpawnHint);
85  }
86 
87  //------------------------------------------------------------------------------------------------
90  {
91  m_MapCampaignUI = mapUi;
92  }
93 
94  //------------------------------------------------------------------------------------------------
95  void SetSpawnTime()
96  {
97  ChimeraWorld world = m_PlayerController.GetWorld();
98  TimeAndWeatherManagerEntity manager = world.GetTimeAndWeatherManager();
99 
100  if (manager)
101  m_SpawnTime = manager.GetTime();
102  else
103  Print("Time And Weather manager not found", LogLevel.WARNING);
104  }
105 
106  //------------------------------------------------------------------------------------------------
108  TimeContainer GetSpawnTime()
109  {
110  return m_SpawnTime;
111  }
112 
113  //------------------------------------------------------------------------------------------------
117  {
119  }
120 
121  //------------------------------------------------------------------------------------------------
124  {
125  return m_vFirstSpawnPosition;
126  }
127 
128  //------------------------------------------------------------------------------------------------
131  {
132  return m_bWasMapOpened;
133  }
134 
135  //------------------------------------------------------------------------------------------------
138  void SetMapOpened(bool wasOpened)
139  {
140  m_bWasMapOpened = wasOpened;
141  }
142 
143  //------------------------------------------------------------------------------------------------
146  {
147  return m_BaseWithPlayer;
148  }
149 
150  //------------------------------------------------------------------------------------------------
152  {
153  SCR_CampaignFactionManager fManager = SCR_CampaignFactionManager.Cast(GetGame().GetFactionManager());
154 
155  if (!fManager)
156  return;
157 
158  IEntity player = SCR_PlayerController.GetLocalControlledEntity();
159 
160  if (!player)
161  return;
162 
163  SCR_CampaignFaction faction = SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
164 
165  if (!faction)
166  return;
167 
168  bool isInRangeNow = m_Campaign.GetBaseManager().IsEntityInFactionRadioSignal(player, faction);
169 
170  if (isInRangeNow != m_bIsPlayerInRadioRange)
171  {
172  m_bIsPlayerInRadioRange = isInRangeNow;
173 
174  if (isInRangeNow)
175  {
176  SCR_PopUpNotification.GetInstance().PopupMsg("#AR-Campaign_RadioRangeEntered-UC", duration: 3);
177  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_RADIO_SIGNAL_GAIN);
178  }
179  else
180  {
181  SCR_PopUpNotification.GetInstance().PopupMsg("#AR-Campaign_RadioRangeLeft-UC", duration: 3);
182  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_RADIO_SIGNAL_LOST);
183  }
184  }
185  }
186 
187  //------------------------------------------------------------------------------------------------
188  protected void RegisterTasksShown()
189  {
190  SCR_PopUpNotification.GetInstance().HideCurrentMsg();
191  GetGame().GetInputManager().RemoveActionListener("TasksOpen", EActionTrigger.DOWN, RegisterTasksShown);
192  }
193 
194  //------------------------------------------------------------------------------------------------
196  void SetIsPlayerInRadioRange(bool status)
197  {
198  m_bIsPlayerInRadioRange = status;
199  }
200 
201  //------------------------------------------------------------------------------------------------
202  protected void GroupLeaderHint()
203  {
204  SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
205 
206  if (!groupsManager)
207  return;
208 
209  SCR_AIGroup group = groupsManager.GetPlayerGroup(m_PlayerController.GetPlayerId());
210 
211  if (!group)
212  return;
213 
214  IEntity leader = GetGame().GetPlayerManager().GetPlayerControlledEntity(group.GetLeaderID());
215 
216  if (leader != m_PlayerController.GetControlledEntity())
217  return;
218 
219  GetGame().GetCallqueue().Remove(GroupLeaderHint);
220  ShowHint(EHint.GAMEPLAY_GROUPS);
221  }
222 
223  //------------------------------------------------------------------------------------------------
224  protected void LoneDriverHint()
225  {
226  SCR_ChimeraCharacter player = SCR_ChimeraCharacter.Cast(GetGame().GetPlayerController().GetControlledEntity());
227 
228  if (!player)
229  return;
230 
231  if (!player.IsInVehicle())
232  return;
233 
234  Vehicle vehicle = Vehicle.Cast(SCR_EntityHelper.GetMainParent(player));
235 
236  if (!vehicle)
237  return;
238 
239  SCR_EditableVehicleComponent comp = SCR_EditableVehicleComponent.Cast(vehicle.FindComponent(SCR_EditableVehicleComponent));
240 
241  if (!comp)
242  return;
243 
244  array<CompartmentAccessComponent> compartments = {};
245 
246  if (comp.GetCrew(compartments, false) > 1)
247  return;
248 
249  GetGame().GetCallqueue().Remove(LoneDriverHint);
250 
251  ShowHint(EHint.CONFLICT_DRIVER);
252  }
253 
254  //------------------------------------------------------------------------------------------------
255  protected void TransportRequestHint()
256  {
257  if (m_BaseWithPlayer)
258  return;
259 
260  SCR_ChimeraCharacter player = SCR_ChimeraCharacter.Cast(m_PlayerController.GetControlledEntity());
261 
262  if (!player || player.IsInVehicle())
263  return;
264 
265  SCR_MilitaryBaseSystem baseManager = SCR_MilitaryBaseSystem.GetInstance();
266 
267  if (!baseManager)
268  return;
269 
270  array<SCR_MilitaryBaseComponent> bases = {};
271  baseManager.GetBases(bases);
272  int minDistanceSq = 500 * 500;
273  vector playerPos = player.GetOrigin();
275 
276  // Show this hint only if player is far enough from any base
277  foreach (SCR_MilitaryBaseComponent base : bases)
278  {
279  campaignBase = SCR_CampaignMilitaryBaseComponent.Cast(base);
280 
281  if (!campaignBase)
282  continue;
283 
284  if (vector.DistanceSqXZ(playerPos, campaignBase.GetOwner().GetOrigin()) < minDistanceSq)
285  return;
286  }
287 
288  minDistanceSq = 300 * 300;
289  array<int> playerIds = {};
290  int localPlayerId = m_PlayerController.GetPlayerId();
291  GetGame().GetPlayerManager().GetPlayers(playerIds);
292 
293  // Show this hint only if player is far enough from any other living player
294  foreach (int playerId : playerIds)
295  {
296  if (playerId == localPlayerId)
297  continue;
298 
299  SCR_ChimeraCharacter otherPlayer = SCR_ChimeraCharacter.Cast(GetGame().GetPlayerManager().GetPlayerControlledEntity(playerId));
300 
301  if (!otherPlayer)
302  continue;
303 
304  CharacterControllerComponent charControl = otherPlayer.GetCharacterController();
305 
306  if (!charControl || charControl.IsDead())
307  continue;
308 
309  if (vector.DistanceSqXZ(playerPos, otherPlayer.GetOrigin()) < minDistanceSq)
310  return;
311  }
312 
313  GetGame().GetCallqueue().Remove(TransportRequestHint);
314  ShowHint(EHint.CONFLICT_TRANSPORT_REQUEST, showMultipleTimes: true);
315  }
316 
317  //------------------------------------------------------------------------------------------------
321  {
322  SCR_CampaignFaction playerFaction = SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
323 
324  if (!playerFaction || base.GetFaction() != playerFaction)
325  return;
326 
327  if (base.GetHQRadioCoverage(playerFaction) != SCR_ECampaignHQRadioComms.RECEIVE)
328  return;
329 
330  ShowHint(EHint.CONFLICT_NO_CONNECTION);
331  }
332 
333  //------------------------------------------------------------------------------------------------
335  void OnMapOpen(MapConfiguration config)
336  {
337  if (GetGame().GetWorld().GetWorldTime() < FEATURE_HINT_DELAY)
338  return;
339 
340  SCR_MapEntity.GetOnMapOpen().Remove(OnMapOpen);
341  ShowHint(EHint.CONFLICT_GROUP_ICONS);
342  }
343 
344  //------------------------------------------------------------------------------------------------
345  protected void RefreshCurrentPopupMessage()
346  {
347  SCR_PopUpNotification popup = SCR_PopUpNotification.GetInstance();
348  SCR_PopupMessage currentMsg = popup.GetCurrentMsg();
349 
350  // Player is not currently in any base, hide any relevant displayed popups
351  if (!m_BaseWithPlayer)
352  {
353  if (currentMsg && (currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_YOU || currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY))
354  popup.HideCurrentMsg();
355  }
356  else
357  {
358  SCR_CampaignFaction baseWithPlayerCapturingFaction = SCR_CampaignFaction.Cast(m_BaseWithPlayer.GetCapturingFaction());
359 
360  if (!baseWithPlayerCapturingFaction)
361  {
362  // Player's base is currently not being seized by anyone, hide any relevant displayed popups
363  if (currentMsg && (currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_YOU || currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY))
364  popup.HideCurrentMsg();
365  }
366  else
367  {
368  // If relay tower is being reconfigured, calculate the capture duration
369  if (m_BaseWithPlayer.GetType() == SCR_ECampaignBaseType.RELAY)
371 
372  // If capture timers are invalid, hide seizing popup
373  if (m_fBaseWithPlayerCaptureStart == 0 || m_fBaseWithPlayerCaptureEnd == 0 && currentMsg && (currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_YOU || currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY))
374  {
375  popup.HideCurrentMsg();
376  }
377  else
378  {
379  if (baseWithPlayerCapturingFaction == SCR_FactionManager.SGetLocalPlayerFaction())
380  {
381  // Friendlies are seizing player's base
382  if (currentMsg && currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY)
383  popup.HideCurrentMsg();
384 
385  if (m_BaseWithPlayer.GetReconfiguredByID() != SCR_PlayerController.GetLocalPlayerId())
386  {
387  if (!currentMsg || currentMsg.m_iPriority != SCR_ECampaignSeizingMessagePrio.SEIZING_YOU)
388  popup.PopupMsg("#AR-Campaign_SeizingFriendly-UC", -1, prio: SCR_ECampaignSeizingMessagePrio.SEIZING_YOU, progressStart: m_fBaseWithPlayerCaptureStart, progressEnd: m_fBaseWithPlayerCaptureEnd, category: SCR_EPopupMsgFilter.TUTORIAL);
389  }
390  }
391  else
392  {
393  // Enemies are seizing player's base
394  if (currentMsg && currentMsg.m_iPriority == SCR_ECampaignSeizingMessagePrio.SEIZING_YOU)
395  popup.HideCurrentMsg();
396 
397  if (!currentMsg || currentMsg.m_iPriority != SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY)
398  popup.PopupMsg("#AR-Campaign_SeizingEnemy-UC", -1, prio: SCR_ECampaignSeizingMessagePrio.SEIZING_ENEMY, progressStart: m_fBaseWithPlayerCaptureStart, progressEnd: m_fBaseWithPlayerCaptureEnd, category: SCR_EPopupMsgFilter.TUTORIAL);
399  }
400  }
401  }
402  }
403  }
404 
405  //------------------------------------------------------------------------------------------------
407  void OnRespawn()
408  {
410  GetGame().GetCallqueue().CallLater(ProcessHintQueue, SCR_GameModeCampaign.UI_UPDATE_DELAY); // Delay so we show the hint after the deploy menu has closed
411 
412  if (!m_aShownHints.Contains(EHint.CONFLICT_TRANSPORT_REQUEST))
413  GetGame().GetCallqueue().CallLater(ShowHint, AFTER_RESPAWN_HINT_DELAY_MS, false, EHint.CONFLICT_TRANSPORT_REQUEST, false, false);
414 
415  if (!m_aShownHints.Contains(EHint.CONFLICT_SERVICE_DEPOTS))
416  GetGame().GetCallqueue().CallLater(ShowHint, AFTER_RESPAWN_HINT_DELAY_MS, false, EHint.CONFLICT_SERVICE_DEPOTS, false, false);
417  else if (!m_aShownHints.Contains(EHint.CONFLICT_RESPAWN))
418  GetGame().GetCallqueue().CallLater(ShowHint, AFTER_RESPAWN_HINT_DELAY_MS, false, EHint.CONFLICT_RESPAWN, false, false);
419  else if (!m_aShownHints.Contains(EHint.CONFLICT_VETERANCY))
420  GetGame().GetCallqueue().CallLater(ShowHint, AFTER_RESPAWN_HINT_DELAY_MS, false, EHint.CONFLICT_VETERANCY, false, false);
421  else if (!m_aShownHints.Contains(EHint.GAMEPLAY_WEAPON_INSPECTION))
422  GetGame().GetCallqueue().CallLater(ShowHint, AFTER_RESPAWN_HINT_DELAY_MS, false, EHint.GAMEPLAY_WEAPON_INSPECTION, false, false);
423  else if (!m_aShownHints.Contains(EHint.GAMEPLAY_VEHICLE_INVENTORY))
424  GetGame().GetCallqueue().CallLater(ShowHint, AFTER_RESPAWN_HINT_DELAY_MS, false, EHint.GAMEPLAY_VEHICLE_INVENTORY, false, false);
425  }
426 
427  //------------------------------------------------------------------------------------------------
432  void ShowHint(EHint hintID, bool showImmediately = false, bool showMultipleTimes = false)
433  {
434  if (m_Campaign.IsTutorial())
435  return;
436 
437  if (RplSession.Mode() == RplMode.Dedicated)
438  return;
439 
440  SCR_HintUIInfo info = m_HintsConfig.GetHintByEnum(hintID);
441 
442  if (!info)
443  return;
444 
445  // Currently we want no limit on the amount of times these hints can be displayed (in multiple matches)
446  bool showAlways = true;
447 
448 #ifdef WORKBENCH
449  showAlways = true;
450 #endif
451 
452  if (!showMultipleTimes && (m_aShownHints.Contains(hintID) || m_aHintQueue.Contains(hintID)))
453  return;
454 
455  float currentTime = GetGame().GetWorld().GetWorldTime();
456 
457  if (currentTime < m_fNextAllowedHintTimestamp && !showImmediately)
458  {
459  m_aHintQueue.Insert(hintID);
460  }
461  else
462  {
463  m_aShownHints.Insert(hintID);
464  SCR_HintManagerComponent.ShowHint(info, ignoreShown: showAlways);
465 
466  // Show the next hint in queue after this hint's duration expires
467  float durationMs = 1000 * info.GetDuration();
468  m_fNextAllowedHintTimestamp = currentTime + durationMs;
469  GetGame().GetCallqueue().Remove(ProcessHintQueue);
470  GetGame().GetCallqueue().CallLater(ProcessHintQueue, durationMs + DELAY_BETWEEN_HINTS_MS);
471  }
472  }
473 
474  //------------------------------------------------------------------------------------------------
475  protected void ProcessHintQueue()
476  {
477  if (m_aHintQueue.IsEmpty())
478  return;
479 
480  int hintId = m_aHintQueue[0];
481  m_aHintQueue.RemoveOrdered(0);
482 
483  ShowHint(hintId, showMultipleTimes: true);
484  }
485 
486  //------------------------------------------------------------------------------------------------
489  {
490  GetGame().GetCallqueue().Remove(ProcessHintQueue);
491  }
492 
493  //------------------------------------------------------------------------------------------------
496  void OnConsciousnessChanged(bool conscious)
497  {
498  m_bIsConscious = conscious;
499  }
500 
501  //------------------------------------------------------------------------------------------------
503  bool IsConscious()
504  {
505  return m_bIsConscious;
506  }
507 
508  //------------------------------------------------------------------------------------------------
513  void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
514  {
515  if (playerEntity != SCR_PlayerController.GetLocalControlledEntity())
516  return;
517 
518  if (m_BaseWithPlayer)
519  OnBaseLeft(m_BaseWithPlayer);
520 
521  SCR_PopUpNotification.GetInstance().HideCurrentMsg();
522  GetGame().GetCallqueue().Remove(ShowHint);
523  }
524 
525  //------------------------------------------------------------------------------------------------
528  void OnBaseFactionChanged(notnull SCR_MilitaryBaseComponent base, Faction faction)
529  {
531 
532  if (!campaignBase || campaignBase.GetType() != SCR_ECampaignBaseType.BASE)
533  return;
534 
535  if (faction == SCR_FactionManager.SGetLocalPlayerFaction() && GetGame().GetWorld().GetWorldTime() > FEATURE_HINT_DELAY)
536  {
537  SCR_MilitaryBaseSystem baseManager = SCR_MilitaryBaseSystem.GetInstance();
538  array<SCR_MilitaryBaseComponent> bases = {};
539  baseManager.GetBases(bases);
540  int friendlyBases;
541 
542  foreach (SCR_MilitaryBaseComponent currentBase : bases)
543  {
544  if (currentBase.GetOwner() != faction)
545  continue;
546 
547  friendlyBases++;
548 
549  if (friendlyBases == 3)
550  {
551  ShowHint(EHint.CONFLICT_SUPPLIES);
552  break;
553  }
554  }
555  }
556  }
557 
558  //------------------------------------------------------------------------------------------------
561  {
562  if (m_BaseWithPlayer)
563  OnBaseLeft(m_BaseWithPlayer);
564 
565  m_BaseWithPlayer = base;
566 
567  SCR_CampaignSeizingComponent seizingComponent = SCR_CampaignSeizingComponent.Cast(m_BaseWithPlayer.GetOwner().FindComponent(SCR_CampaignSeizingComponent));
568 
569  if (seizingComponent)
570  {
571  OnSeizingTimerChange(seizingComponent.GetSeizingStartTimestamp(), seizingComponent.GetSeizingEndTimestamp());
572  seizingComponent.GetOnTimerChange().Remove(OnSeizingTimerChange);
573  seizingComponent.GetOnTimerChange().Insert(OnSeizingTimerChange);
574  }
575  else
576  {
577  OnSeizingTimerChange(null, null);
578  }
579 
580  SCR_CampaignFaction playerFaction = SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
581 
582  if (m_BaseWithPlayer.GetFaction() != playerFaction)
583  {
584  // Entering an enemy base
585  if (m_BaseWithPlayer.IsHQRadioTrafficPossible(playerFaction))
586  {
587  SCR_BaseTaskExecutor executor = SCR_BaseTaskExecutor.FindTaskExecutorByID(m_PlayerController.GetPlayerId());
588 
589  if (executor)
590  {
591  SCR_CampaignBaseTask task = SCR_CampaignBaseTask.Cast(executor.GetAssignedTask());
593 
594  if (task)
595  taskBase = task.GetTargetBase();
596 
597  if (taskBase != m_BaseWithPlayer)
598  {
599  // Entering an enemy base within radio signal reach while not having its seize task assigned
600  ShowHint(EHint.CONFLICT_VOLUNTEERING);
601  }
602  }
603 
604  // Entering an enemy base within radio signal reach
605  if (m_BaseWithPlayer.GetType() == SCR_ECampaignBaseType.RELAY)
606  ShowHint(EHint.CONFLICT_TOWER_SEIZING);
607  else
608  ShowHint(EHint.CONFLICT_BASE_SEIZING);
609  }
610  }
611  else
612  {
613  // Entering a friendly base
614  ChimeraCharacter player = ChimeraCharacter.Cast(SCR_PlayerController.GetLocalControlledEntity());
615 
616  if (player && player.IsInVehicle())
617  {
618  // Entering a friendly base in a vehicle
619  if (m_BaseWithPlayer.GetType() == SCR_ECampaignBaseType.BASE && !m_BaseWithPlayer.IsHQ())
620  ShowHint(EHint.CONFLICT_SUPPLY_RUNS);
621  }
622 
623  // Entering a friendly base with an armory
624  if (GetGame().GetWorld().GetWorldTime() > SCR_GameModeCampaign.BACKEND_DELAY && m_BaseWithPlayer.GetServiceDelegateByType(SCR_EServicePointType.ARMORY))
625  {
626  ShowHint(EHint.CONFLICT_LOADOUTS);
627  ShowHint(EHint.GAMEPLAY_RADIO_RESPAWN);
628  }
629 
630  // Entering a friendly base covered by enemy radio signal
631  bool covered;
632 
633  if (SCR_FactionManager.SGetLocalPlayerFaction() == m_Campaign.GetFactionByEnum(SCR_ECampaignFaction.BLUFOR))
634  covered = base.IsHQRadioTrafficPossible(m_Campaign.GetFactionByEnum(SCR_ECampaignFaction.OPFOR));
635  else
636  covered = base.IsHQRadioTrafficPossible(m_Campaign.GetFactionByEnum(SCR_ECampaignFaction.BLUFOR));
637 
638  if (covered)
639  ShowHint(EHint.CONFLICT_DEFENDING_BASES);
640  }
641  }
642 
643  //------------------------------------------------------------------------------------------------
646  {
647  SCR_CampaignSeizingComponent seizingComponent = SCR_CampaignSeizingComponent.Cast(base.GetOwner().FindComponent(SCR_CampaignSeizingComponent));
648 
649  if (seizingComponent)
650  seizingComponent.GetOnTimerChange().Remove(OnSeizingTimerChange);
651 
652  if (m_BaseWithPlayer == base)
653  m_BaseWithPlayer = null;
654  }
655 
656  //------------------------------------------------------------------------------------------------
657  protected void OnMatchSituationChanged()
658  {
659  Faction winner = GetGame().GetFactionManager().GetFactionByIndex(m_Campaign.GetWinningFactionId());
660 
661  if (!winner || winner == SCR_FactionManager.SGetLocalPlayerFaction())
662  return;
663 
664  m_Campaign.GetOnMatchSituationChanged().Remove(OnMatchSituationChanged);
665  ShowHint(EHint.CONFLICT_LOSING);
666  }
667 
668  //------------------------------------------------------------------------------------------------
671  void OnSeizingTimerChange(WorldTimestamp start, WorldTimestamp end)
672  {
675  SCR_PopUpNotification.GetInstance().ChangeProgressBarFinish(end);
676  }
677 
678  //------------------------------------------------------------------------------------------------
683  void MobileAssemblyFeedback(SCR_EMobileAssemblyStatus msgID, int playerID, int factionID)
684  {
685  SCR_CampaignFactionManager fManager = SCR_CampaignFactionManager.Cast(GetGame().GetFactionManager());
686 
687  if (!fManager)
688  return;
689 
690  Faction localPlayerFaction = SCR_FactionManager.SGetLocalPlayerFaction();
691 
692  if (fManager.GetFactionIndex(localPlayerFaction) != factionID)
693  return;
694 
695  int duration = 6;
696  LocalizedString text;
697  LocalizedString text2;
698  string playerName = GetGame().GetPlayerManager().GetPlayerName(playerID);
699 
700  SCR_MapEntity mapEntity = SCR_MapEntity.GetMapInstance();
701 
702  if (mapEntity && mapEntity.IsOpen())
703  m_MapCampaignUI.InitMobileAssembly(localPlayerFaction.GetFactionKey(), msgID == SCR_EMobileAssemblyStatus.DEPLOYED);
704 
705  switch (msgID)
706  {
707  case SCR_EMobileAssemblyStatus.DEPLOYED:
708  {
709  text = "#AR-Campaign_MobileAssemblyDeployed-UC";
710  text2 = "#AR-Campaign_MobileAssemblyPlayerName";
711  break;
712  }
713 
714  case SCR_EMobileAssemblyStatus.DISMANTLED:
715  {
716  text = "#AR-Campaign_MobileAssemblyDismantled-UC";
717  text2 = "#AR-Campaign_MobileAssemblyPlayerName";
718  Faction reconfigurerFaction = SCR_FactionManager.SGetPlayerFaction(playerID);
719 
720  if (reconfigurerFaction && localPlayerFaction != reconfigurerFaction)
721  playerName = reconfigurerFaction.GetFactionName();
722 
723  break;
724  }
725 
726  case SCR_EMobileAssemblyStatus.DESTROYED:
727  {
728  text = "#AR-Campaign_MobileAssemblyDestroyed-UC";
729  break;
730  }
731  }
732 
733  if (text != string.Empty)
734  {
735  if (text2 != string.Empty && playerName != string.Empty)
736  SCR_PopUpNotification.GetInstance().PopupMsg(text, duration, text2: text2, text2param1: playerName, prio: SCR_ECampaignPopupPriority.MHQ);
737  else
738  SCR_PopUpNotification.GetInstance().PopupMsg(text, duration);
739  }
740  }
741 
742  //------------------------------------------------------------------------------------------------
756  void PlayRadioMsg(SCR_ERadioMsg msg, int factionId, int baseCallsign, int callerCallsignCompany, int callerCallsignPlatoon, int callerCallsignSquad, int calledCallsignCompany, int calledCallsignPlatoon, int calledCallsignSquad, int param, float seed, float quality)
757  {
758  if (m_Campaign.IsTutorial())
759  return;
760 
762 
763  if (!pc)
764  return;
765 
766  IEntity player = pc.GetMainEntity();
767 
768  if (!player)
769  return;
770 
771  SCR_CommunicationSoundComponent soundComp = SCR_CommunicationSoundComponent.Cast(player.FindComponent(SCR_CommunicationSoundComponent));
772 
773  if (!soundComp)
774  return;
775 
776  SignalsManagerComponent signalComp = SignalsManagerComponent.Cast(player.FindComponent(SignalsManagerComponent));
777 
778  if (!signalComp)
779  return;
780 
781  int signalBase = signalComp.AddOrFindSignal("Base");
782  int signalCompanyCaller = signalComp.AddOrFindSignal("CompanyCaller");
783  int signalCompanyCalled = signalComp.AddOrFindSignal("CompanyCalled");
784  int signalPlatoonCaller = signalComp.AddOrFindSignal("PlatoonCaller");
785  int signalPlatoonCalled = signalComp.AddOrFindSignal("PlatoonCalled");
786  int signalSquadCaller = signalComp.AddOrFindSignal("SquadCaller");
787  int signalSquadCalled = signalComp.AddOrFindSignal("SquadCalled");
788  int signalSeed = signalComp.AddOrFindSignal("Seed");
789  int signalQuality = signalComp.AddOrFindSignal("TransmissionQuality");
790 
791  SCR_CampaignFactionManager fManager = SCR_CampaignFactionManager.Cast(GetGame().GetFactionManager());
792  SCR_CampaignFaction faction = SCR_CampaignFaction.Cast(fManager.GetFactionByIndex(factionId));
793  SCR_CampaignMilitaryBaseComponent base = m_Campaign.GetBaseManager().FindBaseByCallsign(baseCallsign);
794 
795  if (base)
796  {
797  SCR_MilitaryBaseCallsign callsignInfo;
798 
799  if (faction == m_Campaign.GetFactionByEnum(SCR_ECampaignFaction.BLUFOR))
800  callsignInfo = faction.GetBaseCallsignByIndex(base.GetCallsign());
801  else
802  callsignInfo = faction.GetBaseCallsignByIndex(base.GetCallsign(), m_Campaign.GetCallsignOffset());
803 
804  if (callsignInfo)
805  signalComp.SetSignalValue(signalBase, callsignInfo.GetSignalIndex());
806  }
807 
808  if (callerCallsignCompany != SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX)
809  {
810  signalComp.SetSignalValue(signalCompanyCaller, callerCallsignCompany);
811  signalComp.SetSignalValue(signalPlatoonCaller, callerCallsignPlatoon);
812  signalComp.SetSignalValue(signalSquadCaller, callerCallsignSquad);
813  }
814 
815  if (calledCallsignCompany != SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX)
816  {
817  signalComp.SetSignalValue(signalCompanyCalled, calledCallsignCompany);
818  signalComp.SetSignalValue(signalPlatoonCalled, calledCallsignPlatoon);
819  signalComp.SetSignalValue(signalSquadCalled, calledCallsignSquad);
820  }
821 
822  signalComp.SetSignalValue(signalSeed, seed);
823  signalComp.SetSignalValue(signalQuality, quality);
824 
825  string msgName;
826  LocalizedString text;
827  LocalizedString text2;
828  string param1;
829  string text2param1;
830  string text2param2;
831  int duration = SCR_PopUpNotification.DEFAULT_DURATION;
833  string sound;
834 
835  switch (msg)
836  {
837  case SCR_ERadioMsg.SEIZED_MAIN:
838  {
839  msgName = SCR_SoundEvent.SOUND_HQ_MOB;
840  break;
841  }
842 
843  case SCR_ERadioMsg.SEIZED_MAJOR:
844  {
845  msgName = SCR_SoundEvent.SOUND_HQ_FOB;
846  break;
847  }
848 
849  case SCR_ERadioMsg.SEIZED_SMALL:
850  {
851  msgName = SCR_SoundEvent.SOUND_HQ_COP;
852  break;
853  }
854 
855  case SCR_ERadioMsg.DEMOTION_RENEGADE:
856  {
857  msgName = SCR_SoundEvent.SOUND_HQ_REN;
858  text = "#AR-Campaign_Demotion-UC";
859  text2 = "#AR-Rank_Renegade";
860  break;
861  }
862 
863  case SCR_ERadioMsg.DEMOTION:
864  {
865  msgName = SCR_SoundEvent.SOUND_HQ_DEM;
866  text = "#AR-Campaign_Demotion-UC";
867  SCR_CampaignFaction f = SCR_CampaignFaction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
868 
869  if (f)
870  text2 = f.GetRankNameUpperCase(param);
871 
872  break;
873  }
874 
875  case SCR_ERadioMsg.PROMOTION_PRIVATE:
876  {
877  msgName = SCR_SoundEvent.SOUND_HQ_POP;
878  text = "#AR-Campaign_Promotion-UC";
879  text2 = "#AR-Rank_WestPrivate";
880  break;
881  }
882 
883  case SCR_ERadioMsg.PROMOTION_CORPORAL:
884  {
885  msgName = SCR_SoundEvent.SOUND_HQ_POC;
886  text = "#AR-Campaign_Promotion-UC";
887  text2 = "#AR-Rank_WestCorporal";
888  break;
889  }
890 
891  case SCR_ERadioMsg.PROMOTION_SERGEANT:
892  {
893  msgName = SCR_SoundEvent.SOUND_HQ_POS;
894  text = "#AR-Campaign_Promotion-UC";
895  text2 = "#AR-Rank_WestSergeant";
896  break;
897  }
898 
899  case SCR_ERadioMsg.PROMOTION_LIEUTENANT:
900  {
901  msgName = SCR_SoundEvent.SOUND_HQ_POL;
902  text = "#AR-Campaign_Promotion-UC";
903  text2 = "#AR-Rank_WestLieutenant";
904  break;
905  }
906 
907  case SCR_ERadioMsg.PROMOTION_CAPTAIN:
908  {
909  msgName = SCR_SoundEvent.SOUND_HQ_PON;
910  text = "#AR-Campaign_Promotion-UC";
911  text2 = "#AR-Rank_WestCaptain";
912  break;
913  }
914 
915  case SCR_ERadioMsg.PROMOTION_MAJOR:
916  {
917  msgName = SCR_SoundEvent.SOUND_HQ_POM;
918  text = "#AR-Campaign_Promotion-UC";
919  text2 = "#AR-Rank_WestMajor";
920  break;
921  }
922 
923  case SCR_ERadioMsg.VICTORY:
924  {
925  SCR_CampaignFaction f = SCR_CampaignFaction.Cast(fManager.GetFactionByIndex(param));
926 
927  if (!f || f != SCR_FactionManager.SGetLocalPlayerFaction())
928  return;
929 
930  msgName = SCR_SoundEvent.SOUND_HQ_PMV;
931  break;
932  }
933 
934  case SCR_ERadioMsg.WINNING:
935  {
936  msgName = SCR_SoundEvent.SOUND_HQ_PMC;
937  break;
938  }
939 
940  case SCR_ERadioMsg.LOSING:
941  {
942  msgName = SCR_SoundEvent.SOUND_HQ_PML;
943  break;
944  }
945 
946  case SCR_ERadioMsg.DEFEAT:
947  {
948  SCR_CampaignFaction f = SCR_CampaignFaction.Cast(fManager.GetFactionByIndex(param));
949 
950  if (!f || f == SCR_FactionManager.SGetLocalPlayerFaction())
951  return;
952 
953  msgName = SCR_SoundEvent.SOUND_HQ_PMD;
954  break;
955  }
956 
957  case SCR_ERadioMsg.RELAY:
958  {
959  msgName = SCR_SoundEvent.SOUND_SL_RRD;
960  break;
961  }
962 
963  case SCR_ERadioMsg.REQUEST_EVAC:
964  {
965  msgName = SCR_SoundEvent.SOUND_SL_ERT;
966  break;
967  }
968 
969  case SCR_ERadioMsg.REQUEST_FUEL:
970  {
971  msgName = SCR_SoundEvent.SOUND_SL_RRT;
972  break;
973  }
974 
975  case SCR_ERadioMsg.SUPPLIES:
976  {
977  msgName = SCR_SoundEvent.SOUND_SL_SDD;
978  break;
979  }
980 
981  case SCR_ERadioMsg.REQUEST_REINFORCEMENTS:
982  {
983  msgName = SCR_SoundEvent.SOUND_SL_REI;
984  break;
985  }
986 
987  case SCR_ERadioMsg.REQUEST_TRANSPORT:
988  {
989  msgName = SCR_SoundEvent.SOUND_SL_TRT;
990  break;
991  }
992 
993  case SCR_ERadioMsg.CONFIRM:
994  {
995  msgName = SCR_SoundEvent.SOUND_SL_CSR;
996  break;
997  }
998 
999  case SCR_ERadioMsg.TASK_ASSIGN_SEIZE:
1000  {
1001  msgName = SCR_SoundEvent.SOUND_SL_SRT;
1002  break;
1003  }
1004 
1005  case SCR_ERadioMsg.TASK_UNASSIGN_REFUEL:
1006  {
1007  msgName = SCR_SoundEvent.SOUND_HQ_RRU;
1008  break;
1009  }
1010 
1011  case SCR_ERadioMsg.TASK_UNASSIGN_TRANSPORT:
1012  {
1013  msgName = SCR_SoundEvent.SOUND_HQ_TRU;
1014  break;
1015  }
1016 
1017  case SCR_ERadioMsg.TASK_UNASSIGN_EVAC:
1018  {
1019  msgName = SCR_SoundEvent.SOUND_HQ_ETU;
1020  break;
1021  }
1022 
1023  case SCR_ERadioMsg.TASK_CANCEL_REQUEST:
1024  {
1025  msgName = SCR_SoundEvent.SOUND_HQ_RCR;
1026  break;
1027  }
1028 
1029  case SCR_ERadioMsg.TASK_ASSIST:
1030  {
1031  msgName = SCR_SoundEvent.SOUND_SL_CHR;
1032  break;
1033  }
1034 
1035  case SCR_ERadioMsg.BASE_LOST:
1036  {
1037  msgName = SCR_SoundEvent.SOUND_HQ_BAL;
1038  break;
1039  }
1040 
1041  case SCR_ERadioMsg.RELAY_LOST:
1042  {
1043  msgName = SCR_SoundEvent.SOUND_HQ_RRL;
1044  break;
1045  }
1046 
1047  case SCR_ERadioMsg.BASE_UNDER_ATTACK:
1048  {
1049  if (!base)
1050  return;
1051 
1052  if (base.GetType() == SCR_ECampaignBaseType.BASE)
1053  msgName = SCR_SoundEvent.SOUND_HQ_BUA;
1054 
1055  text = "#AR-Campaign_BaseUnderAttack-UC";
1056 
1057  if (base.GetType() == SCR_ECampaignBaseType.RELAY)
1058  text2 = "%1";
1059  else
1060  text2 = "%1 (%2)";
1061 
1062  text2param1 = base.GetBaseName();
1063  text2param2 = base.GetCallsignDisplayName();
1064 
1065  if (m_BaseWithPlayer == base)
1066  sound = SCR_SoundEvent.SOUND_SIREN;
1067 
1068  prio = SCR_ECampaignPopupPriority.BASE_UNDER_ATTACK;
1069  duration = 11;
1070  break;
1071  }
1072 
1073  case SCR_ERadioMsg.BUILT_ARMORY:
1074  {
1075  msgName = SCR_SoundEvent.SOUND_HQ_BAA;
1076  break;
1077  }
1078 
1079  case SCR_ERadioMsg.BUILT_FUEL:
1080  {
1081  msgName = SCR_SoundEvent.SOUND_HQ_BFA;
1082  break;
1083  }
1084 
1085  case SCR_ERadioMsg.BUILT_REPAIR:
1086  {
1087  msgName = SCR_SoundEvent.SOUND_HQ_BRA;
1088  break;
1089  }
1090 
1091  case SCR_ERadioMsg.BUILT_SUPPLY:
1092  {
1093  msgName = SCR_SoundEvent.SOUND_HQ_SCB;
1094  break;
1095  }
1096 
1097  case SCR_ERadioMsg.BUILT_VEHICLES_LIGHT:
1098  {
1099  msgName = SCR_SoundEvent.SOUND_HQ_LCB;
1100  break;
1101  }
1102 
1103  case SCR_ERadioMsg.BUILT_VEHICLES_HEAVY:
1104  {
1105  msgName = SCR_SoundEvent.SOUND_HQ_VCB;
1106  break;
1107  }
1108 
1109  case SCR_ERadioMsg.BUILT_BARRACKS:
1110  {
1111  msgName = SCR_SoundEvent.SOUND_HQ_BCB;
1112  break;
1113  }
1114 
1115  case SCR_ERadioMsg.BUILT_ANTENNA:
1116  {
1117  msgName = SCR_SoundEvent.SOUND_HQ_ACB;
1118  break;
1119  }
1120 
1121  case SCR_ERadioMsg.BUILT_FIELD_HOSPITAL:
1122  {
1123  msgName = SCR_SoundEvent.SOUND_HQ_HCB;
1124  break;
1125  }
1126 
1127  case SCR_ERadioMsg.BUILT_HELIPAD:
1128  {
1129  msgName = SCR_SoundEvent.SOUND_HQ_BHA;
1130  break;
1131  }
1132 
1133  case SCR_ERadioMsg.DESTROYED_ARMORY:
1134  {
1135  if (!base)
1136  return;
1137 
1138  msgName = SCR_SoundEvent.SOUND_HQ_BAD;
1139  text = "#AR-Campaign_Building_Destroyed-UC";
1140  text2 = base.GetBaseName();
1141  param1 = "#AR-Campaign_Building_Armory-UC";
1142  duration = 5;
1143  break;
1144  }
1145 
1146  case SCR_ERadioMsg.DESTROYED_FUEL:
1147  {
1148  if (!base)
1149  return;
1150 
1151  msgName = SCR_SoundEvent.SOUND_HQ_BFD;
1152  text = "#AR-Campaign_Building_Destroyed-UC";
1153  text2 = base.GetBaseName();
1154  param1 = "#AR-Campaign_Building_FuelDepot-UC";
1155  duration = 5;
1156  break;
1157  }
1158 
1159  case SCR_ERadioMsg.DESTROYED_REPAIR:
1160  {
1161  if (!base)
1162  return;
1163 
1164  msgName = SCR_SoundEvent.SOUND_HQ_BRD;
1165  text = "#AR-Campaign_Building_Destroyed-UC";
1166  text2 = base.GetBaseName();
1167  param1 = "#AR-Campaign_Building_RepairDepot-UC";
1168  duration = 5;
1169  break;
1170  }
1171 
1172  case SCR_ERadioMsg.REPAIRED_ARMORY:
1173  {
1174  if (!base)
1175  return;
1176 
1177  msgName = SCR_SoundEvent.SOUND_HQ_BAR;
1178  text = "#AR-Campaign_Building_Available-UC";
1179  text2 = base.GetBaseName();
1180  param1 = "#AR-Campaign_Building_Armory-UC";
1181  duration = 5;
1182  break;
1183  }
1184 
1185  case SCR_ERadioMsg.REPAIRED_FUEL:
1186  {
1187  if (!base)
1188  return;
1189 
1190  msgName = SCR_SoundEvent.SOUND_HQ_BFR;
1191  text = "#AR-Campaign_Building_Available-UC";
1192  text2 = base.GetBaseName();
1193  param1 = "#AR-Campaign_Building_FuelDepot-UC";
1194  duration = 5;
1195  break;
1196  }
1197 
1198  case SCR_ERadioMsg.REPAIRED_REPAIR:
1199  {
1200  if (!base)
1201  return;
1202 
1203  msgName = SCR_SoundEvent.SOUND_HQ_BRR;
1204  text = "#AR-Campaign_Building_Available-UC";
1205  text2 = base.GetBaseName();
1206  param1 = "#AR-Campaign_Building_RepairDepot-UC";
1207  duration = 5;
1208  break;
1209  }
1210  }
1211 
1212  bool isFriendly = faction == fManager.GetPlayerFaction(pc.GetPlayerId());
1213 
1214  if (!msgName.IsEmpty())
1215  {
1216  AudioSystem.TerminateSound(m_PlayedRadio);
1217  msgName = msgName + "_" + faction.GetFactionKey();
1218  m_PlayedRadio = soundComp.SoundEvent(msgName);
1219  }
1220 
1221  if (isFriendly && (!text.IsEmpty() || !text2.IsEmpty()))
1222  SCR_PopUpNotification.GetInstance().PopupMsg(text, duration, text2: text2, prio: prio, param1: param1, sound: sound, text2param1: text2param1, text2param2: text2param2);
1223  }
1224 
1225  //------------------------------------------------------------------------------------------------
1226  protected void OnXPChanged(int totalXP, SCR_EXPRewards rewardID, int XP, bool volunteer, bool profileUsed, int skillLevel)
1227  {
1228  if (rewardID == SCR_EXPRewards.ENEMY_KILL || rewardID == SCR_EXPRewards.ENEMY_KILL_VEH)
1229  {
1230  GetGame().GetCallqueue().CallLater(ShowHint, 30000 + Math.RandomIntInclusive(0, 30000), false, EHint.CONFLICT_ELIMINATING_ENEMIES, false, false);
1231  }
1232 
1233  if (XP > 0)
1234  {
1235  if (rewardID != SCR_EXPRewards.ENEMY_KILL && rewardID != SCR_EXPRewards.ENEMY_KILL_VEH)
1236  ShowHint(EHint.CONFLICT_PROMOTIONS);
1237 
1238  if (rewardID == SCR_EXPRewards.VETERANCY)
1239  ShowHint(EHint.CONFLICT_VETERANCY);
1240  }
1241  }
1242 
1243  //------------------------------------------------------------------------------------------------
1244  protected void ProcessEvents(bool activate)
1245  {
1246  if (RplSession.Mode() == RplMode.Dedicated)
1247  return;
1248 
1249  GetGame().GetCallqueue().Remove(CheckPlayerInsideRadioRange);
1250  GetGame().GetCallqueue().Remove(RefreshCurrentPopupMessage);
1251  GetGame().GetCallqueue().Remove(GroupLeaderHint);
1252  GetGame().GetCallqueue().Remove(LoneDriverHint);
1253  GetGame().GetCallqueue().Remove(TransportRequestHint);
1254 
1255  if (activate)
1256  {
1257  GetGame().GetCallqueue().CallLater(CheckPlayerInsideRadioRange, 3000, true);
1258  GetGame().GetCallqueue().CallLater(RefreshCurrentPopupMessage, 500, true);
1259  GetGame().GetCallqueue().CallLater(GroupLeaderHint, FEATURE_HINT_DELAY, true);
1260  GetGame().GetCallqueue().CallLater(LoneDriverHint, FEATURE_HINT_DELAY, true);
1261  GetGame().GetCallqueue().CallLater(TransportRequestHint, FEATURE_HINT_DELAY, true);
1262 
1263  GetGame().GetInputManager().AddActionListener("TasksOpen", EActionTrigger.DOWN, RegisterTasksShown);
1264  SCR_UITaskManagerComponent.s_OnTaskListVisible.Insert(ShowVolunteerHint);
1265 
1266  SCR_MilitaryBaseSystem.GetInstance().GetOnBaseFactionChanged().Insert(OnBaseFactionChanged);
1267 
1268  if (m_Campaign)
1269  {
1270  m_Campaign.GetOnPlayerKilled().Insert(OnPlayerKilled);
1271  m_Campaign.GetBaseManager().GetOnLocalPlayerEnteredBase().Insert(OnBaseEntered);
1272  m_Campaign.GetBaseManager().GetOnLocalPlayerLeftBase().Insert(OnBaseLeft);
1273  m_Campaign.GetBaseManager().GetOnSignalChanged().Insert(BaseOutOfRangeHint);
1274  m_Campaign.GetOnMatchSituationChanged().Insert(OnMatchSituationChanged);
1275  }
1276 
1277  SCR_PlayerXPHandlerComponent comp = SCR_PlayerXPHandlerComponent.Cast(m_PlayerController.FindComponent(SCR_PlayerXPHandlerComponent));
1278 
1279  if (comp)
1280  comp.GetOnXPChanged().Insert(OnXPChanged);
1281 
1283 
1284  if (inventoryComp)
1285  inventoryComp.GetOnPlayerInteraction().Insert(OnPlayerSuppliesInteraction);
1286 
1287  SCR_MapEntity.GetOnMapOpen().Insert(OnMapOpen);
1288  }
1289  else
1290  {
1291  GetGame().GetInputManager().RemoveActionListener("TasksOpen", EActionTrigger.DOWN, RegisterTasksShown);
1292  SCR_UITaskManagerComponent.s_OnTaskListVisible.Remove(ShowVolunteerHint);
1293 
1294  SCR_MilitaryBaseSystem baseManager = SCR_MilitaryBaseSystem.GetInstance();
1295 
1296  if (baseManager)
1297  baseManager.GetOnBaseFactionChanged().Remove(OnBaseFactionChanged);
1298 
1299  if (m_Campaign)
1300  {
1301  m_Campaign.GetOnPlayerKilled().Remove(OnPlayerKilled);
1302  m_Campaign.GetOnMatchSituationChanged().Remove(OnMatchSituationChanged);
1303 
1304  SCR_CampaignMilitaryBaseManager campaignBaseManager = m_Campaign.GetBaseManager();
1305 
1306  if (campaignBaseManager)
1307  {
1308  campaignBaseManager.GetOnLocalPlayerEnteredBase().Remove(OnBaseEntered);
1309  campaignBaseManager.GetOnLocalPlayerLeftBase().Remove(OnBaseLeft);
1310  campaignBaseManager.GetOnSignalChanged().Remove(BaseOutOfRangeHint);
1311  }
1312  }
1313 
1314  if (m_PlayerController)
1315  {
1316  SCR_PlayerXPHandlerComponent comp = SCR_PlayerXPHandlerComponent.Cast(m_PlayerController.FindComponent(SCR_PlayerXPHandlerComponent));
1317 
1318  if (comp)
1319  comp.GetOnXPChanged().Remove(OnXPChanged);
1320 
1322 
1323  if (inventoryComp)
1324  inventoryComp.GetOnPlayerInteraction().Remove(OnPlayerSuppliesInteraction);
1325  }
1326 
1327  SCR_MapEntity.GetOnMapOpen().Remove(OnMapOpen);
1328  }
1329  }
1330 
1331  //------------------------------------------------------------------------------------------------
1334  void OnOwnershipChanged(bool changing, bool becameOwner)
1335  {
1336  if (changing)
1337  return;
1338 
1339  ProcessEvents(becameOwner);
1340  }
1341 
1342  //------------------------------------------------------------------------------------------------
1343  protected void ShowVolunteerHint()
1344  {
1345  if (GetGame().GetWorld().GetWorldTime() < FEATURE_HINT_DELAY)
1346  return;
1347 
1348  SCR_UITaskManagerComponent.s_OnTaskListVisible.Remove(ShowVolunteerHint);
1349 
1350  ShowHint(EHint.CONFLICT_VOLUNTEERING);
1351  ShowHint(EHint.CONFLICT_PRIMARY_OBJECTIVES);
1352  }
1353 
1354  //------------------------------------------------------------------------------------------------
1361  void OnPlayerSuppliesInteraction(EResourcePlayerInteractionType interactionType, PlayerController playerController, SCR_ResourceComponent resourceComponentFrom, SCR_ResourceComponent resourceComponentTo, EResourceType resourceType, float resourceValue)
1362  {
1363  if (interactionType != EResourcePlayerInteractionType.VEHICLE_UNLOAD)
1364  return;
1365 
1367 
1368  if (comp)
1369  comp.GetOnPlayerInteraction().Remove(OnPlayerSuppliesInteraction);
1370 
1371  ShowHint(EHint.CONFLICT_BUILDING);
1372  }
1373 
1374  //------------------------------------------------------------------------------------------------
1375  override void EOnInit(IEntity owner)
1376  {
1377  if (!m_PlayerController)
1378  return;
1379 
1380  m_Campaign = SCR_GameModeCampaign.GetInstance();
1381 
1382  m_PlayerController.GetOnOwnershipChangedInvoker().Insert(OnOwnershipChanged);
1383 
1384  RplComponent rpl = RplComponent.Cast(m_PlayerController.FindComponent(RplComponent));
1385 
1386  if (rpl && rpl.IsOwner())
1387  ProcessEvents(true);
1388  }
1389 
1390  //------------------------------------------------------------------------------------------------
1391  override void OnPostInit(IEntity owner)
1392  {
1393  super.OnPostInit(owner);
1394 
1395  if (!GetGame().InPlayMode())
1396  return;
1397 
1398  SetEventMask(owner, EntityEvent.INIT);
1399 
1401 
1402  if (RplSession.Mode() == RplMode.Dedicated)
1403  return;
1404 
1405  //Parse & register hints list
1406  Resource container = BaseContainerTools.LoadContainer(m_sHintsConfig);
1407  m_HintsConfig = SCR_CampaignHintStorage.Cast(BaseContainerTools.CreateInstanceFromContainer(container.GetResource().ToBaseContainer()));
1408  }
1409 
1410  //------------------------------------------------------------------------------------------------
1411  // destructor
1413  {
1414  ProcessEvents(false);
1415  }
1416 }
1417 
1420 {
1432 }
1433 
1434 enum SCR_ECampaignSeizingMessagePrio
1435 {
1436  NONE,
1437  SEIZING_YOU = 998,
1438  SEIZING_ENEMY = 999
1439 }
ChimeraWorld
Definition: ChimeraWorld.c:12
OnConsciousnessChanged
void OnConsciousnessChanged(bool conscious)
Will be called when the consciousness of the character changes.
Definition: SCR_CampaignFeedbackComponent.c:496
RELAY_DETECTED
@ RELAY_DETECTED
Definition: SCR_CampaignFeedbackComponent.c:1424
SCR_PlayerController
Definition: SCR_PlayerController.c:31
SCR_EntityHelper
Definition: SCR_EntityHelper.c:1
SCR_ECampaignFaction
SCR_ECampaignFaction
Definition: SCR_CampaignFactionManager.c:130
RESPAWN
@ RESPAWN
Definition: SCR_CampaignFeedbackComponent.c:1430
SUPPLIES_HANDLED
@ SUPPLIES_HANDLED
Definition: SCR_CampaignFeedbackComponent.c:1422
SCR_CampaignBaseTask
Definition: SCR_CampaignBaseTask.c:9
MATCH_END
@ MATCH_END
Definition: SCR_CampaignFeedbackComponent.c:1431
SetMapOpened
void SetMapOpened(bool wasOpened)
Definition: SCR_CampaignFeedbackComponent.c:138
BaseOutOfRangeHint
void BaseOutOfRangeHint(SCR_CampaignMilitaryBaseComponent base)
Definition: SCR_CampaignFeedbackComponent.c:320
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
PauseHintQueue
void PauseHintQueue()
Definition: SCR_CampaignFeedbackComponent.c:488
TASK_AVAILABLE
@ TASK_AVAILABLE
Definition: SCR_CampaignFeedbackComponent.c:1423
GetSpawnTime
TimeContainer GetSpawnTime()
Definition: SCR_CampaignFeedbackComponent.c:108
SCR_UISoundEntity
Definition: SCR_UISoundEntity.c:7
~SCR_CampaignFeedbackComponent
void ~SCR_CampaignFeedbackComponent()
Definition: SCR_CampaignFeedbackComponent.c:1412
GetInstance
SCR_TextsTaskManagerComponentClass ScriptComponentClass GetInstance()
Definition: SCR_TextsTaskManagerComponent.c:50
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SEIZING_YOU
enum SCR_ECampaignPopupPriority SEIZING_YOU
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
m_bIsPlayerInRadioRange
protected bool m_bIsPlayerInRadioRange
Definition: SCR_CampaignFeedbackComponent.c:29
SetMapCampaignUI
void SetMapCampaignUI(SCR_MapCampaignUI mapUi)
Definition: SCR_CampaignFeedbackComponent.c:89
SCR_ERadioMsg
SCR_ERadioMsg
Definition: SCR_CampaignRadioMsg.c:138
PlayRadioMsg
void PlayRadioMsg(SCR_ERadioMsg msg, int factionId, int baseCallsign, int callerCallsignCompany, int callerCallsignPlatoon, int callerCallsignSquad, int calledCallsignCompany, int calledCallsignPlatoon, int calledCallsignSquad, int param, float seed, float quality)
Definition: SCR_CampaignFeedbackComponent.c:756
DEFAULT
@ DEFAULT
Definition: SCR_CampaignFeedbackComponent.c:1421
m_bIsConscious
protected bool m_bIsConscious
Definition: SCR_CampaignFeedbackComponent.c:32
SCR_MilitaryBaseSystem
Definition: SCR_MilitaryBaseSystem.c:11
EnablePlayerSpawnHint
void EnablePlayerSpawnHint(bool enable)
Definition: SCR_CampaignFeedbackComponent.c:61
SCR_PopUpNotification
Takes care of dynamic and static onscreen popups.
Definition: SCR_PopupNotification.c:24
Attribute
SCR_CampaignFeedbackComponentClass ScriptComponentClass Attribute("{3EE26F4747B6E99D}Configs/Hints/Conflict/ConflictHints.conf")
Definition: SCR_CampaignFeedbackComponent.c:7
OnOwnershipChanged
void OnOwnershipChanged(bool changing, bool becameOwner)
Definition: SCR_CampaignFeedbackComponent.c:1334
OnBaseFactionChanged
void OnBaseFactionChanged(notnull SCR_MilitaryBaseComponent base, Faction faction)
Definition: SCR_CampaignFeedbackComponent.c:528
MobileAssemblyFeedback
void MobileAssemblyFeedback(SCR_EMobileAssemblyStatus msgID, int playerID, int factionID)
Definition: SCR_CampaignFeedbackComponent.c:683
SCR_ECampaignBaseType
SCR_ECampaignBaseType
Definition: SCR_CampaignMilitaryBaseComponent.c:2577
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
Instigator
Definition: Instigator.c:6
SetSpawnTime
void SetSpawnTime()
Definition: SCR_CampaignFeedbackComponent.c:95
OnBaseLeft
void OnBaseLeft(notnull SCR_CampaignMilitaryBaseComponent base)
Definition: SCR_CampaignFeedbackComponent.c:645
SCR_UITaskManagerComponent
void SCR_UITaskManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_UITaskManagerComponent.c:1096
m_bWasMapOpened
protected bool m_bWasMapOpened
Definition: SCR_CampaignFeedbackComponent.c:31
SCR_PopupMessage
Definition: SCR_PopupNotification.c:2
SCR_CampaignFeedbackComponentClass
Definition: SCR_CampaignFeedbackComponent.c:1
m_fBaseWithPlayerCaptureStart
protected WorldTimestamp m_fBaseWithPlayerCaptureStart
Definition: SCR_CampaignFeedbackComponent.c:36
SCR_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition: SCR_GameModeCampaign.c:1927
OnPlayerSuppliesInteraction
void OnPlayerSuppliesInteraction(EResourcePlayerInteractionType interactionType, PlayerController playerController, SCR_ResourceComponent resourceComponentFrom, SCR_ResourceComponent resourceComponentTo, EResourceType resourceType, float resourceValue)
Definition: SCR_CampaignFeedbackComponent.c:1361
m_bCanShowSpawnPosition
protected bool m_bCanShowSpawnPosition
Definition: SCR_CampaignFeedbackComponent.c:30
CheckPlayerInsideRadioRange
protected void CheckPlayerInsideRadioRange()
Definition: SCR_CampaignFeedbackComponent.c:151
CanShowPlayerSpawn
bool CanShowPlayerSpawn()
Definition: SCR_CampaignFeedbackComponent.c:116
OnBaseEntered
void OnBaseEntered(notnull SCR_CampaignMilitaryBaseComponent base)
Definition: SCR_CampaignFeedbackComponent.c:560
ProcessHintQueue
protected void ProcessHintQueue()
Definition: SCR_CampaignFeedbackComponent.c:475
SCR_HintUIInfo
Definition: SCR_HintUIInfo.c:2
OnMapOpen
void OnMapOpen(MapConfiguration config)
Definition: SCR_CampaignFeedbackComponent.c:335
OnPlayerKilled
void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
Definition: SCR_CampaignFeedbackComponent.c:513
WasMapOpened
bool WasMapOpened()
Definition: SCR_CampaignFeedbackComponent.c:130
BASE_LOST
@ BASE_LOST
Definition: SCR_CampaignFeedbackComponent.c:1427
SetIsPlayerInRadioRange
void SetIsPlayerInRadioRange(bool status)
Definition: SCR_CampaignFeedbackComponent.c:196
SCR_MapCampaignUI
Definition: SCR_MapCampaignUI.c:2
SCR_ECampaignPopupPriority
SCR_ECampaignPopupPriority
Popup message priorities sorted from lowest to highest.
Definition: SCR_CampaignFeedbackComponent.c:1419
GetPlayerSpawnPos
vector GetPlayerSpawnPos()
Returns players position after spawning.
Definition: SCR_CampaignFeedbackComponent.c:123
EResourceType
EResourceType
Definition: SCR_ResourceContainer.c:1
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_CampaignFeedbackComponent.c:1391
NONE
enum SCR_ECampaignPopupPriority NONE
ShowVolunteerHint
protected void ShowVolunteerHint()
Definition: SCR_CampaignFeedbackComponent.c:1343
MHQ
@ MHQ
Definition: SCR_CampaignFeedbackComponent.c:1428
SCR_MapEntity
Map entity.
Definition: SCR_MapEntity.c:20
OnSeizingTimerChange
void OnSeizingTimerChange(WorldTimestamp start, WorldTimestamp end)
Definition: SCR_CampaignFeedbackComponent.c:671
GetControlledEntity
SCR_EditableEntityComponent GetControlledEntity()
Returns the controlled entity or null if none.
Definition: SCR_EditablePlayerDelegateComponent.c:86
BASE_UNDER_ATTACK
@ BASE_UNDER_ATTACK
Definition: SCR_CampaignFeedbackComponent.c:1429
SCR_CampaignHintStorage
Definition: SCR_CampaignHintStorage.c:3
EOnInit
override void EOnInit(IEntity owner)
Definition: SCR_CampaignFeedbackComponent.c:1375
Faction
Definition: Faction.c:12
SCR_GroupsManagerComponent
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_GroupsManagerComponent.c:1320
SCR_BaseTaskExecutor
Definition: SCR_BaseTaskExecutor.c:7
SCR_EXPRewards
SCR_EXPRewards
Definition: SCR_XPHandlerComponent.c:403
m_aHintQueue
protected ref array< int > m_aHintQueue
Definition: SCR_CampaignFeedbackComponent.c:27
RefreshCurrentPopupMessage
protected void RefreshCurrentPopupMessage()
Definition: SCR_CampaignFeedbackComponent.c:345
m_PlayerController
SCR_CampaignNetworkComponentClass m_PlayerController
Takes care of Campaign-specific server <> client communication and requests.
ShowHint
void ShowHint(EHint hintID, bool showImmediately=false, bool showMultipleTimes=false)
Definition: SCR_CampaignFeedbackComponent.c:432
SCR_CampaignMilitaryBaseManager
Created in SCR_GameModeCampaign.
Definition: SCR_CampaignMilitaryBaseManager.c:21
GroupLeaderHint
protected void GroupLeaderHint()
Definition: SCR_CampaignFeedbackComponent.c:202
SCR_CampaignFaction
Definition: SCR_CampaignFaction.c:2
GetBaseWithPlayer
SCR_CampaignMilitaryBaseComponent GetBaseWithPlayer()
Definition: SCR_CampaignFeedbackComponent.c:145
SCR_AIGroup
Definition: SCR_AIGroup.c:68
SCR_EPopupMsgFilter
SCR_EPopupMsgFilter
Definition: SCR_PopupNotification.c:486
m_fNextAllowedHintTimestamp
protected float m_fNextAllowedHintTimestamp
Definition: SCR_CampaignFeedbackComponent.c:34
SCR_EMobileAssemblyStatus
SCR_EMobileAssemblyStatus
Definition: SCR_CampaignMobileAssemblyComponent.c:437
SCR_ResourcePlayerControllerInventoryComponent
Definition: SCR_ResourcePlayerControllerInventoryComponent.c:20
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
OnMatchSituationChanged
protected void OnMatchSituationChanged()
Definition: SCR_CampaignFeedbackComponent.c:657
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
OnXPChanged
protected void OnXPChanged(int totalXP, SCR_EXPRewards rewardID, int XP, bool volunteer, bool profileUsed, int skillLevel)
Definition: SCR_CampaignFeedbackComponent.c:1226
RegisterTasksShown
protected void RegisterTasksShown()
Definition: SCR_CampaignFeedbackComponent.c:188
EResourcePlayerInteractionType
EResourcePlayerInteractionType
Definition: SCR_ResourcePlayerControllerInventoryComponent.c:1
TASK_PROGRESS
@ TASK_PROGRESS
Definition: SCR_CampaignFeedbackComponent.c:1425
LocalizedString
Definition: LocalizedString.c:21
TransportRequestHint
protected void TransportRequestHint()
Definition: SCR_CampaignFeedbackComponent.c:255
SCR_EServicePointType
SCR_EServicePointType
Definition: SCR_ServicePointComponent.c:180
EHint
EHint
Definition: EHint.c:10
m_fBaseWithPlayerCaptureEnd
protected WorldTimestamp m_fBaseWithPlayerCaptureEnd
Definition: SCR_CampaignFeedbackComponent.c:37
ProcessEvents
protected void ProcessEvents(bool activate)
Definition: SCR_CampaignFeedbackComponent.c:1244
LoneDriverHint
protected void LoneDriverHint()
Definition: SCR_CampaignFeedbackComponent.c:224
IsConscious
bool IsConscious()
Definition: SCR_CampaignFeedbackComponent.c:503
OnRespawn
void OnRespawn()
Hints are displayed with a delay after respawn so player has time to find their bearings.
Definition: SCR_CampaignFeedbackComponent.c:407
SCR_CampaignMilitaryBaseComponent
Definition: SCR_CampaignMilitaryBaseComponent.c:38
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
TASK_DONE
@ TASK_DONE
Definition: SCR_CampaignFeedbackComponent.c:1426