Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CampaignTutorialComponentArland.c
Go to the documentation of this file.
2 {
3 }
4 
5 class SCR_CampaignTutorialArlandComponent : SCR_BaseGameModeComponent
6 {
7  [Attribute("", UIWidgets.ResourceNamePicker, "", "conf")]
8  ResourceName m_sStagesConfigAdvanced;
9 
10  [Attribute(defvalue: "0", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(SCR_ETutorialArlandStageMasters))]
12 
13  protected static const int TARGETS_SEARCH_DISTANCE = 1500;
14  protected static const int INVALID_STANCE = -1;
15  protected static const vector BACK_DOOR_OFFSET = { 0, -0.7, 0 };
16  protected static float WAYPOINT_FADE_THRESHOLD = 20;
17  protected static float WAYPOINT_MINIMUM_OPACITY = 0.2;
18  protected static float WAYPOINT_DISTANCE_INDICATOR_FADE_START = 100;
19  protected static float WAYPOINT_DISTANCE_INDICATOR_FADE_END = 50;
20  protected static const float SPAWN_STAGE_DISTANCE = 10;
21  protected static const float FADE_DURATION = 1;
22  protected static const float FADE_SPEED = 0.4;
23  protected static const int NUMBER_OF_TUTORIALS = 10;
24  static string VEHICLE_MAINTENANCE_PREFAB = "{543C31BC05F032B6}PrefabsEditable/Auto/Compositions/Slotted/SlotFlatSmall/E_VehicleMaintenance_S_US_01.et";
25  static string HELICOPTER_PREFAB = "{70BAEEFC2D3FEE64}Prefabs/Vehicles/Helicopters/UH1H/UH1H.et";
26  static string HUMMER_PREFAB = "{751AFEEA19DDFB04}Prefabs/Vehicles/Wheeled/M998/M998_covered_long_MERDC.et";
27  static string JEEP_PREFAB = "{94DE32169691AC34}Prefabs/Vehicles/Wheeled/M151A2/M151A2_transport_MERDC.et";
28  static string TRUCK_PREFAB = "{C8656AECF5DF41D9}Prefabs/Vehicles/Wheeled/M923A1/M923A1_repair_MERDC.et";
29  static string DRIVING_RANGE_PREFAB = "{B6F5006CBD24E9A1}Prefabs/TutorialDrivingRange.et";
30 
31  protected ref array<ref SCR_CampaignTutorialArlandStageInfo> m_aStageInfos = {};
32  protected ref array<ref SCR_CampaignTutorialArlandStages> m_aStageConfigs = {};
33  protected int m_iActiveStage;
35  protected ImageWidget m_wFadeOut;
37  protected bool m_bPlayerSpawned;
40  protected ChimeraCharacter m_Player;
41  protected int m_iStagesCnt;
42  protected ref array<Widget> m_aWaypoints = {};
43  protected bool m_bFirstStageSet;
44  protected ref array<SCR_FiringRangeTarget> m_aFiringRangeTargets = {};
46  protected int m_iCountOfHits;
48  protected BaseRadioComponent m_Radio;
49  protected bool m_bIsMapOpen = false;
50  protected bool m_bUsed3PV = false;
51  protected ECharacterStance m_ePlayerStance = INVALID_STANCE;
52  protected bool m_bCheckIsDeployed = false;
53  protected bool m_bCheckIsDeployedBipod = false;
54  protected bool m_bCheckLeaning = false;
55  protected SCR_CampaignMobileAssemblyComponent m_MobileAssemblyComponent;
56  protected bool m_bMovedOutOfVehicleByScript = false;
57  protected bool m_fDelayedControlSchemeChangeRunning = false;
58  protected bool m_bIsUsingGamepad;
60  protected float m_fStageTimestamp;
62  protected ResourceName m_WaypointWidget = "{B80E30D68492B2AE}UI/Imagesets/TutorialHud/TutorialHUD.imageset";
63  protected static ref ScriptInvoker m_OnStructureBuilt = new ScriptInvoker();
64  protected ref array<IEntity> m_aPlacedCompositions = {};
65  protected IEntity m_PreviewBunker;
67  protected bool m_bIsFirstRun = false;
68  protected Vehicle m_RepairTruck;
69  protected Vehicle m_Helicopter;
70  protected Vehicle m_Hummer;
71  protected Vehicle m_Jeep;
72  protected Vehicle m_HummerRepairable;
73  protected IEntity m_DrivingRange;
74  protected bool m_bStagesComplete = false;
75  protected ref array<bool> m_aTutorialBool = {};
77 
78  //------------------------------------------------------------------------------------------------
79  void HideSubtitles(Widget widgeter)
80  {
81  widgeter.SetVisible(false);
82  }
83 
84  //------------------------------------------------------------------------------------------------
85  protected void SetupVoiceSystem()
86  {
87  if (!m_VoiceoverSystem)
88  m_VoiceoverSystem = SCR_VoiceoverSystem.GetInstance();
89 
90  if (!m_ActiveConfig)
91  return;
92 
93  ResourceName voiceDataConfig = m_ActiveConfig.GetVoiceOverDataConfig();
94  if (voiceDataConfig.IsEmpty())
95  return;
96 
97  m_VoiceoverSystem.SetData(voiceDataConfig);
98  }
99 
100  //------------------------------------------------------------------------------------------------
102  {
103  return m_VoiceoverSystem;
104  }
105 
106  //------------------------------------------------------------------------------------------------
107  protected void RemovePlayerMapMarkers()
108  {
109  SCR_MapMarkerManagerComponent mapMarkerManager = SCR_MapMarkerManagerComponent.Cast(GetGame().GetGameMode().FindComponent(SCR_MapMarkerManagerComponent));
110  if (!mapMarkerManager)
111  return;
112 
113  array <ref SCR_MapMarkerBase> markerArray = {};
114  markerArray = mapMarkerManager.GetStaticMarkers();
115  for (int index = markerArray.Count()-1; index >= 0; index--)
116  {
117  mapMarkerManager.RemoveStaticMarker(markerArray[index]);
118  }
119  }
120 
121  //------------------------------------------------------------------------------------------------
124  {
125  /* Achievement SWEAT_SAVES_BLOOD */
126  if (m_bStagesComplete)
127  {
129  if (!playerController)
130  return;
131 
132  SCR_AchievementsHandler handler = SCR_AchievementsHandler.Cast(playerController.FindComponent(SCR_AchievementsHandler));
133  if (!handler)
134  return;
135 
136  handler.UnlockAchievement(AchievementId.SWEAT_SAVES_BLOOD);
137  }
138  }
139 
140  //------------------------------------------------------------------------------------------------
143  void SetStagesComplete(int tutorialNumber, bool completed)
144  {
145  if (m_aTutorialBool.IsIndexValid(tutorialNumber))
146  m_aTutorialBool[tutorialNumber] = completed;
147  else
148  return;
149 
150  m_bStagesComplete = true;
151  foreach (bool value : m_aTutorialBool)
152  {
153  if (!value)
154  {
155  m_bStagesComplete = false;
156  break;
157  }
158 
159  }
160  }
161 
162  //------------------------------------------------------------------------------------------------
165  {
166  m_Helicopter = Vehicle.Cast(SpawnAsset("UH1COURSE", HELICOPTER_PREFAB));
167  if (!m_Helicopter)
168  return;
169 
170  //general helicopter damage check
172  if (damageManager)
173  damageManager.GetOnDamageStateChanged().Insert(OnHelicopterDamaged);
174 
175  //Drowned periodical check
176  GetGame().GetCallqueue().CallLater(HelicopterDrownedCheck, 1000, true);
177 
178  //Rotor damage check
179  SlotManagerComponent slotManager = SlotManagerComponent.Cast(m_Helicopter.FindComponent(SlotManagerComponent));
180  if (!slotManager)
181  return;
182 
183  IEntity rotor;
184  EntitySlotInfo slot = slotManager.GetSlotByName("RotorMain");
185  if (slot)
186  {
187  rotor = slot.GetAttachedEntity();
188  SCR_RotorDamageManagerComponent rotorDmgComp = SCR_RotorDamageManagerComponent.Cast(rotor.FindComponent(SCR_RotorDamageManagerComponent));
189  rotorDmgComp.GetOnDamageStateChanged().Insert(OnHelicopterDamaged);
190  }
191  }
192 
193  //------------------------------------------------------------------------------------------------
194  protected void HelicopterDrownedCheck()
195  {
196  if (!m_Helicopter)
197  return;
198 
199  VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_Helicopter.FindComponent(VehicleControllerComponent_SA));
200  if (!vehicleController)
201  return;
202 
203  if (!vehicleController.GetEngineDrowned())
204  return;
205 
207  }
208 
209  //------------------------------------------------------------------------------------------------
212  {
213  if (!m_Helicopter)
214  return;
215 
216  //General damage invoker
217  SCR_VehicleDamageManagerComponent heliDamageManager = SCR_VehicleDamageManagerComponent.Cast(m_Helicopter.GetDamageManager());
218  if (heliDamageManager)
219  heliDamageManager.GetOnDamageStateChanged().Remove(OnHelicopterDamaged);
220 
221  //Drowned periodical check
222  GetGame().GetCallqueue().Remove(HelicopterDrownedCheck);
223 
224  //Rotor damage invoker
225  SlotManagerComponent slotManager = SlotManagerComponent.Cast(m_Helicopter.FindComponent(SlotManagerComponent));
226  if (!slotManager)
227  return;
228 
229  EntitySlotInfo slot = slotManager.GetSlotByName("RotorMain");
230  if (slot)
231  {
232  IEntity rotor = slot.GetAttachedEntity();
233  if (!rotor)
234  return;
235 
236  SCR_RotorDamageManagerComponent rotorDmgComp = SCR_RotorDamageManagerComponent.Cast(rotor.FindComponent(SCR_RotorDamageManagerComponent));
237  if (!rotorDmgComp)
238  return;
239 
240  rotorDmgComp.GetOnDamageStateChanged().Remove(OnHelicopterDamaged);
241  }
242 
243  }
244 
245  //------------------------------------------------------------------------------------------------
246  protected void OnHelicopterDamaged(EDamageState state)
247  {
248  if (state == EDamageState.UNDAMAGED)
249  return;
250 
252  }
253 
254  //------------------------------------------------------------------------------------------------
255  protected void OnVehicleDamaged(EDamageState state)
256  {
257  if (state == EDamageState.UNDAMAGED)
258  return;
259 
260  if (m_Jeep)
261  {
262  SCR_VehicleDamageManagerComponent damageManager = SCR_VehicleDamageManagerComponent.Cast(m_Jeep.GetDamageManager());
263  if (damageManager)
264  {
265  damageManager.GetOnDamageStateChanged().Remove(OnVehicleDamaged);
266 
267  SCR_HitZone engine = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Engine_01"));
268 
269  if (engine)
270  engine.GetOnDamageStateChanged().Remove(OnVehicleDamaged);
271 
272  SCR_HitZone gearbox = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Gearbox_01"));
273 
274  if (gearbox)
275  gearbox.GetOnDamageStateChanged().Remove(OnVehicleDamaged);
276  }
277  }
278 
280  }
281 
282  //------------------------------------------------------------------------------------------------
283  protected void OnEngineStoppedJeep()
284  {
285  if (!m_Jeep)
286  return;
287 
288  VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_Jeep.FindComponent(VehicleControllerComponent_SA));
289  if (!vehicleController || !vehicleController.GetEngineDrowned())
290  return;
291 
292  vehicleController.GetOnEngineStop().Remove(OnEngineStoppedJeep);
294  }
295 
296  //------------------------------------------------------------------------------------------------
297  protected void OnEngineStoppedHmw()
298  {
299  if (!m_Hummer)
300  return;
301 
302  VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_Hummer.FindComponent(VehicleControllerComponent_SA));
303  if (!vehicleController || !vehicleController.GetEngineDrowned())
304  return;
305 
306  vehicleController.GetOnEngineStop().Remove(OnEngineStoppedHmw);
308  }
309 
310  //------------------------------------------------------------------------------------------------
311  protected void OnEngineStoppedTruck()
312  {
313  if (!m_RepairTruck)
314  return;
315 
316  VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_RepairTruck.FindComponent(VehicleControllerComponent_SA));
317  if (!vehicleController || !vehicleController.GetEngineDrowned())
318  return;
319 
320  vehicleController.GetOnEngineStop().Remove(OnEngineStoppedTruck);
322  }
323 
324  //------------------------------------------------------------------------------------------------
325  protected void OnTruckDamaged(EDamageState state)
326  {
327  if (state == EDamageState.UNDAMAGED)
328  return;
329 
330  if (m_RepairTruck)
331  {
333  if (damageManager)
334  {
335  damageManager.GetOnDamageStateChanged().Remove(OnTruckDamaged);
336 
337  SCR_HitZone engine = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Engine_01"));
338 
339  if (engine)
340  engine.GetOnDamageStateChanged().Remove(OnTruckDamaged);
341 
342  SCR_HitZone gearbox = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Gearbox_01"));
343 
344  if (gearbox)
345  gearbox.GetOnDamageStateChanged().Remove(OnTruckDamaged);
346 
347  }
348  }
349 
351  }
352 
353  //------------------------------------------------------------------------------------------------
354  protected void OnHmwDamaged(EDamageState state)
355  {
356  if (state == EDamageState.UNDAMAGED)
357  return;
358 
359  if (m_Hummer)
360  {
361  SCR_VehicleDamageManagerComponent damageManager = SCR_VehicleDamageManagerComponent.Cast(m_Hummer.GetDamageManager());
362  if (damageManager)
363  {
364  damageManager.GetOnDamageStateChanged().Remove(OnHmwDamaged);
365 
366  SCR_HitZone engine = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Engine_01"));
367 
368  if (engine)
369  engine.GetOnDamageStateChanged().Remove(OnHmwDamaged);
370 
371  SCR_HitZone gearbox = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Gearbox_01"));
372 
373  if (gearbox)
374  gearbox.GetOnDamageStateChanged().Remove(OnHmwDamaged);
375  }
376  }
377 
379  }
380 
381  //------------------------------------------------------------------------------------------------
385  IEntity FindBuiltComposition(string prefabName)
386  {
388  return null;
389 
390  foreach (IEntity composition : m_aPlacedCompositions)
391  {
392  if (composition && composition.GetPrefabData().GetPrefabName() == prefabName)
393  return composition;
394  }
395 
396  return null;
397  }
398 
399  //------------------------------------------------------------------------------------------------
402  {
403  return m_iActiveStage;
404  }
405 
406  //------------------------------------------------------------------------------------------------
408  void SetActiveStage(int i)
409  {
410  m_iActiveStage = i;
411  }
412 
413  //------------------------------------------------------------------------------------------------
417  void ShowMapDescriptor(string descriptorOwnerName, bool enable)
418  {
419  IEntity ent = IEntity.Cast(GetGame().GetWorld().FindEntityByName(descriptorOwnerName));
420  if (!ent)
421  return;
422 
423  SCR_MapDescriptorComponent descr = SCR_MapDescriptorComponent.Cast(ent.FindComponent(SCR_MapDescriptorComponent));
424  if (!descr)
425  return;
426 
427  descr.Item().SetVisible(enable);
428  }
429 
430  //------------------------------------------------------------------------------------------------
434  // ToDo - replace with proper Math.MapAngle usage
435  bool IsMyAngleInRange(float angle, float range)
436  {
437  float cameraAngle = Math.RAD2DEG * m_Player.GetCharacterController().GetInputContext().GetAimingAngles()[0];
438  return (cameraAngle > angle - range) && (cameraAngle < angle+range);
439  }
440 
441  //------------------------------------------------------------------------------------------------
444  float GetEntityCompassAngle(notnull IEntity ent)
445  {
446  if (!m_Player)
447  return 0;
448 
449  vector direction = ent.GetOrigin() - m_Player.GetOrigin();
450  direction.Normalize();
451 
452  float angle = Math.Atan2(direction[0], direction[2]) * Math.RAD2DEG;
453 
454  return Math.Round(angle);
455  }
456 
457  //------------------------------------------------------------------------------------------------
459  void SetPreviewBunker(IEntity ent)
460  {
461  m_PreviewBunker = ent;
462  }
463 
464  //------------------------------------------------------------------------------------------------
467  {
468  return m_PreviewBunker;
469  }
470 
471  //------------------------------------------------------------------------------------------------
474  {
475  if (modeEntity.GetModeType() != EEditorMode.BUILDING)
476  return;
477 
479  if (!m_PlacingComponent)
480  return;
481 
482  m_PlacingComponent.GetOnPlaceEntityServer().Insert(OnPlacedPreview);
483  }
484 
485  //------------------------------------------------------------------------------------------------
488  {
490  if (!core)
491  return;
492 
493  SCR_EditorManagerEntity editorManager = core.GetEditorManager();
494  if (!editorManager)
495  return;
496 
497  editorManager.GetOnModeAdd().Insert(OnModeAdded);
498  }
499 
500  //------------------------------------------------------------------------------------------------
503  {
504  return m_PlacingComponent;
505  }
506 
507  //------------------------------------------------------------------------------------------------
508  protected void OnPlacedPreview(int prefabID, SCR_EditableEntityComponent ent)
509  {
510  if (!ent)
511  return;
512 
513  m_aPlacedCompositions.Insert(ent.GetOwner());
514  }
515 
516  //------------------------------------------------------------------------------------------------
517  protected void OnObjectDestroyed(EDamageState state)
518  {
519  if (state == EDamageState.DESTROYED)
521  }
522 
523  //------------------------------------------------------------------------------------------------
525  static ScriptInvoker GetOnStructureBuilt()
526  {
527  return m_OnStructureBuilt;
528  }
529 
530  //------------------------------------------------------------------------------------------------
531  override void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
532  {
533  super.OnPlayerKilled(playerId, playerEntity, killerEntity);
534 
535  delete(m_Stage);
536  PlayerController playerController = GetGame().GetPlayerManager().GetPlayerController(playerId);
537 
538  if (!playerController)
539  return;
540 
541  array<SCR_SpawnPoint> availableSpawnpoints = SCR_SpawnPoint.GetSpawnPointsForFaction(m_CampaignGamemode.GetFactionKeyByEnum(SCR_ECampaignFaction.BLUFOR));
542 
543  if (availableSpawnpoints.Count() < 2)
544  return;
545 
546  TrySpawnPlayer(playerController, availableSpawnpoints[1]);
547  }
548 
549  //------------------------------------------------------------------------------------------------
550  protected void OnInputDeviceIsGamepad(bool isGamepad)
551  {
552  if (!SCR_HintManagerComponent.GetInstance())
553  return;
554 
555  if (!SCR_HintManagerComponent.GetInstance().IsShown())
556  return;
557 
558  m_bIsUsingGamepad = isGamepad;
559 
561  return;
562 
564  GetGame().GetCallqueue().CallLater(OnInputDeviceChangedDelayed, 250);
565  }
566 
567  //------------------------------------------------------------------------------------------------
569  {
571  bool switchedToKeyboard = !m_bIsUsingGamepad;
572  m_Stage.OnInputDeviceChanged(switchedToKeyboard);
573  }
574 
575  //------------------------------------------------------------------------------------------------
577  ChimeraCharacter GetPlayer()
578  {
579  return m_Player;
580  }
581 
582  //------------------------------------------------------------------------------------------------
585  void FadeToBlack(bool fadeOut)
586  {
588  fade.FadeOutEffect(fadeOut, FADE_DURATION);
589  }
590 
591  //------------------------------------------------------------------------------------------------
593  {
594  if (!m_ActiveConfig)
595  return;
596 
597  ChimeraWorld world = GetGame().GetWorld();
598  if (!world)
599  return;
600 
601  TimeAndWeatherManagerEntity tmwManager = world.GetTimeAndWeatherManager();
602  if (!tmwManager)
603  return;
604 
605  string weatherName;
606  switch (m_ActiveConfig.GetWeatherOverride())
607  {
608  case SCR_EWeatherStates.CLEAR:
609  weatherName = "Clear";
610  break;
611 
612  case SCR_EWeatherStates.RAINY:
613  weatherName = "Rainy";
614  break;
615 
616  case SCR_EWeatherStates.CLOUDY:
617  weatherName = "Cloudy";
618  break;
619 
620  case SCR_EWeatherStates.OVERCAST:
621  weatherName = "Overcast";
622  break;
623  }
624 
625  tmwManager.ForceWeatherTo(m_ActiveConfig.ShouldWeatherLoop(), weatherName);
626  tmwManager.SetTimeOfTheDay(m_ActiveConfig.GetTime());
627  }
628 
629  //------------------------------------------------------------------------------------------------
632  {
634 
635  if (m_ActiveConfig && m_ActiveConfig.GetConfigClassName() == SCR_ETutorialArlandStageMasters.HELICOPTERS)
637 
639  {
640  if(configs.GetStagesFromConfig() == config)
641  {
642  m_ActiveConfig = configs;
643  m_ActiveConfig.GetStages(m_aStageInfos);
644  if (m_Stage)
645  m_Stage.FlushWaypoints();
646  FlushWaypoints();
647  delete m_Stage;
648  m_iActiveStage = 0;
649  SetStage(m_aStageInfos[0].GetIndex(), m_aStageInfos[m_aStageInfos.Count()-1].GetIndex());
651 
654  }
655 
656  }
657 
659  }
660 
661  //------------------------------------------------------------------------------------------------
664  {
665  typename stages = SCR_ECampaignTutorialArlandStage;
666  IEntity shootingRangePos = GetGame().GetWorld().FindEntityByName(string.Format("PP_%1", stages.GetVariableName(SCR_ECampaignTutorialArlandStage.WEAPON_PICK)));
667  IEntity baseBeauregard = GetGame().GetWorld().FindEntityByName("TownBaseBeauregard");
668 
669  if (shootingRangePos)
670  GetGame().GetWorld().QueryEntitiesBySphere(shootingRangePos.GetOrigin(), TARGETS_SEARCH_DISTANCE, CollectAllTargets, null, EQueryEntitiesFlags.ALL);
671 
672  if (baseBeauregard)
673  GetGame().GetWorld().QueryEntitiesBySphere(baseBeauregard.GetOrigin(), 50, CollectAllTargets, null, EQueryEntitiesFlags.ALL);
674  }
675 
676  //------------------------------------------------------------------------------------------------
679  {
680  IEntity mHQ = GetGame().GetWorld().FindEntityByName("MobileHQ");
681 
682  if (!mHQ)
683  return;
684 
685  SCR_CampaignFaction f = m_CampaignGamemode.GetFactionByEnum(SCR_ECampaignFaction.BLUFOR);
686 
687  if (!f)
688  return;
689 
690  BaseRadioComponent radioComponent = BaseRadioComponent.Cast(mHQ.FindComponent(BaseRadioComponent));
691 
692  if (radioComponent && radioComponent.TransceiversCount() > 0)
693  {
694  radioComponent.SetPower(false);
695  radioComponent.GetTransceiver(0).SetFrequency(f.GetFactionRadioFrequency());
696  radioComponent.SetEncryptionKey(f.GetFactionRadioEncryptionKey());
697  }
698 
699  SlotManagerComponent slotManager = SlotManagerComponent.Cast(mHQ.FindComponent(SlotManagerComponent));
700 
701  if (!slotManager)
702  return;
703 
704  array<EntitySlotInfo> slots = {};
705  slotManager.GetSlotInfos(slots);
706 
707  foreach (EntitySlotInfo slot: slots)
708  {
709  if (!slot)
710  continue;
711 
712  IEntity truckBed = slot.GetAttachedEntity();
713 
714  if (!truckBed)
715  continue;
716 
717  m_MobileAssemblyComponent = SCR_CampaignMobileAssemblyComponent.Cast(truckBed.FindComponent(SCR_CampaignMobileAssemblyComponent));
718 
720  {
721  m_MobileAssemblyComponent.SetParentFactionID(GetGame().GetFactionManager().GetFactionIndex(f));
722  break;
723  }
724  }
725  }
726 
727  //------------------------------------------------------------------------------------------------
730  {
731  IEntity supplyTruck = GetGame().GetWorld().FindEntityByName("BuildingSupplyTruck");
732 
733  if (!supplyTruck)
734  return;
735 
736  SlotManagerComponent slotManager = SlotManagerComponent.Cast(supplyTruck.FindComponent(SlotManagerComponent));
737 
738  if (!slotManager)
739  return;
740 
741  array<EntitySlotInfo> slots = {};
742  slotManager.GetSlotInfos(slots);
743 
744  foreach (EntitySlotInfo slot: slots)
745  {
746  if (!slot)
747  continue;
748 
749  IEntity truckBed = slot.GetAttachedEntity();
750 
751  if (!truckBed)
752  continue;
753 
754  SCR_CampaignSuppliesComponent suppliesComponent = SCR_CampaignSuppliesComponent.Cast(truckBed.FindComponent(SCR_CampaignSuppliesComponent));
755 
756  if (suppliesComponent)
757  {
758  m_SupplyTruckComponent = suppliesComponent;
759  break;
760  }
761  }
762  }
763 
764  //------------------------------------------------------------------------------------------------
767  {
768  SpawnAsset("M16", "{3E413771E1834D2F}Prefabs/Weapons/Rifles/M16/Rifle_M16A2.et");
769  SpawnAsset("M21", "{81EB948E6414BD6F}Prefabs/Weapons/Rifles/M14/Rifle_M21_ARTII.et");
770  SpawnAsset("M249", "{D2B48DEBEF38D7D7}Prefabs/Weapons/MachineGuns/M249/MG_M249.et");
771  }
772 
773  //------------------------------------------------------------------------------------------------
776  void StageReset_MoveInJeep(IEntity position = null)
777  {
778  SpawnAsset("Jeep", "{5168FEA3054D6D15}Prefabs/Vehicles/Wheeled/M151A2/M151A2_M2HB_MERDC.et", position);
779  MoveInVehicle("Jeep", ECompartmentType.Pilot);
780  }
781 
782  //------------------------------------------------------------------------------------------------
785  void StageReset_SpawnTruck(IEntity position = null)
786  {
787  SpawnAsset("SupplyTruck", "{F37113A988304565}Prefabs/MP/Campaign/Assets/CampaignSupplyTruckWest.et", position);
788  SupplyTruckInit();
789  }
790 
791  //------------------------------------------------------------------------------------------------
794  {
795  //m_SupplyTruckComponent.AddSupplies(1000);
796  MoveInVehicle("SupplyTruck", ECompartmentType.Pilot);
798 
799  if (accessComp)
800  {
801  accessComp.GetOnCompartmentLeft().Remove(OnSupplyTruckLeft);
802  accessComp.GetOnCompartmentLeft().Insert(OnSupplyTruckLeft);
803  }
804  }
805 
806 // //------------------------------------------------------------------------------------------------
807 // //!
808 // void StageReset_PrepareFarm()
809 // {
810 // m_SupplyTruckComponent.AddSupplies(500);
811 // SCR_CampaignMilitaryBaseComponent baseFarm = SCR_CampaignMilitaryBaseComponent.Cast(GetGame().GetWorld().FindEntityByName("TownBaseFarm").FindComponent(SCR_CampaignMilitaryBaseComponent));
812 //
813 // if (baseFarm && baseFarm.GetSupplies() < 950)
814 // baseFarm.AddSupplies(950 - baseFarm.GetSupplies());
815 // }
816 
817  //------------------------------------------------------------------------------------------------
820  {
821  if (m_DrivingRange)
822  SCR_EntityHelper.DeleteEntityAndChildren(m_DrivingRange);
823 
824  SCR_CampaignMilitaryBaseComponent baseBeauregard = SCR_CampaignMilitaryBaseComponent.Cast(GetGame().GetWorld().FindEntityByName("TownBaseBeauregard").FindComponent(SCR_CampaignMilitaryBaseComponent));
825  if (baseBeauregard)
826  {
827  baseBeauregard.SetFaction(m_CampaignGamemode.GetFactionByEnum(SCR_ECampaignFaction.OPFOR));
828  baseBeauregard.RefreshTasks();
829  }
830 
832  if (baseMossHill)
833  {
834  baseMossHill.SetFaction(m_CampaignGamemode.GetFactionByEnum(SCR_ECampaignFaction.OPFOR));
835  baseMossHill.RefreshTasks();
836  }
837 
838  SpawnAsset("Seizing_Car", "{6B24D5AFD884D64C}Prefabs/Vehicles/Wheeled/M998/M998_MERDC.et");
839  SpawnAsset("Seizing_Seizing_Car_Pub", "{6B24D5AFD884D64C}Prefabs/Vehicles/Wheeled/M998/M998_MERDC.et");
840  IEntity mhq = SpawnAsset("MobileHQ", "{9CB496688A3BCC3E}Prefabs/MP/Campaign/Assets/CampaignMobileAssemblyWest.et");
841  if (!mhq)
842  return;
843 
844  SCR_ArsenalComponent arsenalComp = SCR_ArsenalComponent.FindArsenalComponent(mhq);
845  if (!arsenalComp)
846  return;
847 
848  SCR_ResourceComponent resourceComp = SCR_ResourceComponent.FindResourceComponent(arsenalComp.GetOwner());
849  if (resourceComp)
850  resourceComp.SetResourceTypeEnabled(false);
851 
852  SCR_CampaignFaction bluforFaction = m_CampaignGamemode.GetFactionByEnum(SCR_ECampaignFaction.BLUFOR);
853  if (!bluforFaction)
854  return;
855 
856  BaseRadioComponent radioComponent = BaseRadioComponent.Cast(mhq.FindComponent(BaseRadioComponent));
857  if (radioComponent && radioComponent.TransceiversCount() > 0)
858  {
859  radioComponent.SetPower(false);
860  radioComponent.GetTransceiver(0).SetFrequency(bluforFaction.GetFactionRadioFrequency());
861  radioComponent.SetEncryptionKey(bluforFaction.GetFactionRadioEncryptionKey());
862  }
863 
864  SlotManagerComponent slotManager = SlotManagerComponent.Cast(mhq.FindComponent(SlotManagerComponent));
865  if (!slotManager)
866  return;
867 
868  array<EntitySlotInfo> slots = {};
869  slotManager.GetSlotInfos(slots);
870 
871  foreach (EntitySlotInfo slot : slots)
872  {
873  IEntity truckBed = slot.GetAttachedEntity();
874 
875  if (!truckBed)
876  continue;
877 
878  SCR_CampaignMobileAssemblyComponent mobileAssemblyComponent = SCR_CampaignMobileAssemblyComponent.Cast(truckBed.FindComponent(SCR_CampaignMobileAssemblyComponent));
879  if (mobileAssemblyComponent)
880  {
881  mobileAssemblyComponent.SetParentFactionID(GetGame().GetFactionManager().GetFactionIndex(bluforFaction));
882  break;
883  }
884  }
885 
886  }
887 
888  //------------------------------------------------------------------------------------------------
891  {
893  {
894  m_MobileAssemblyComponent.UpdateRadioCoverage();
895  m_MobileAssemblyComponent.Deploy(true);
896  }
897  }
898 
899  //------------------------------------------------------------------------------------------------
900  protected bool PrepareMedicalAmbulance()
901  {
902  IEntity ambulance = SpawnAsset("Ambulance", "{3B1EB924602C7A07}Prefabs/Vehicles/Wheeled/M998/M997_maxi_ambulance_MERDC.et");
903  if (!ambulance)
904  return false;
905 
907  if (!vehicleDamageManager)
908  return false;
909 
910  vehicleDamageManager.GetOnDamageStateChanged().Insert(OnObjectDestroyed);
911 
912  return true;
913  }
914 
915  //------------------------------------------------------------------------------------------------
916  protected bool PrepareAccidentArea()
917  {
918  IEntity victim = SpawnAsset("Victim", "{2F912ED6E399FF47}Prefabs/Characters/Factions/BLUFOR/US_Army/Character_US_Unarmed.et");
919  if (!victim)
920  return false;
921 
923  if (!damageComp)
924  return false;
925 
926  IEntity vehicle = SpawnAsset("AccidentJeep", "{86D830868F026D54}Prefabs/Vehicles/Wheeled/M151A2/M151A2_MERDC.et");
927  if (!vehicle)
928  return false;
929 
931  if (!compartmentAccess)
932  return false;
933 
934  if (!compartmentAccess.MoveInVehicle(vehicle, ECompartmentType.Pilot))
935  return false;
936 
937  //prepare injuries on victim
938  damageComp.AddParticularBleeding("LThigh");
939  damageComp.AddParticularBleeding("Chest");
940  damageComp.GetHitZoneByName("LThigh").SetHealth(0);
941  damageComp.GetHitZoneByName("Chest").SetHealth(0);
942  damageComp.ForceUnconsciousness();
943  damageComp.UpdateBloodClothes();
944  damageComp.GetOnDamageStateChanged().Insert(OnObjectDestroyed);
945 
946  GetGame().GetCallqueue().Remove(RefreshVictimBloodLevel);
947  GetGame().GetCallqueue().Remove(RefreshVictimResilience);
948  GetGame().GetCallqueue().CallLater(RefreshVictimBloodLevel, 1000, true);
949  GetGame().GetCallqueue().CallLater(RefreshVictimResilience, 1000, true);
950 
951  //Lock jeep to prevent players from driving away with it. However, this behavior cannot break any stages.
952  SCR_VehicleSpawnProtectionComponent spawnProtectionComponent = SCR_VehicleSpawnProtectionComponent.Cast(vehicle.FindComponent(SCR_VehicleSpawnProtectionComponent));
953  if (spawnProtectionComponent)
954  {
955  spawnProtectionComponent.SetProtectOnlyDriverSeat(false);
956  spawnProtectionComponent.SetReasonText("#AR-Campaign_Action_BuildBlocked-UC");
957  spawnProtectionComponent.SetVehicleOwner(-2);
958  }
959 
960  //Disable damage handling on jeep to prevent players or uncanny physics from accidentally destroying it
962  if (vehicleDamageManager)
963  vehicleDamageManager.EnableDamageHandling(false);
964 
965  return true;
966  }
967 
968  //------------------------------------------------------------------------------------------------
971  {
972  //Return back to HUB should stage preparation fail
975 
976  if (!PrepareAccidentArea())
978 
979  SpawnAsset("Backpack", "{4805E67E2AE30F8D}Prefabs/Items/Equipment/Backpacks/Backpack_Medical_M5.et");
980  }
981 
982  //------------------------------------------------------------------------------------------------
985  {
986  m_Jeep = Vehicle.Cast(SpawnAsset("SmallJeep", JEEP_PREFAB));
987  if (!m_Jeep)
988  return;
989 
990  SCR_VehicleDamageManagerComponent damageManager = SCR_VehicleDamageManagerComponent.Cast(m_Jeep.GetDamageManager());
991  if (damageManager)
992  {
993  damageManager.GetOnDamageStateChanged().Insert(OnVehicleDamaged);
994 
995  SCR_HitZone engine = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Engine_01"));
996 
997  if (engine)
998  engine.GetOnDamageStateChanged().Insert(OnVehicleDamaged);
999 
1000  SCR_HitZone gearbox = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Gearbox_01"));
1001 
1002  if (gearbox)
1003  gearbox.GetOnDamageStateChanged().Insert(OnVehicleDamaged);
1004  }
1005 
1006  VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_Jeep.FindComponent(VehicleControllerComponent_SA));
1007  if (vehicleController)
1008  vehicleController.GetOnEngineStop().Insert(OnEngineStoppedJeep);
1009 
1010  m_DrivingRange = SpawnAsset("TutorialDrivingRange", DRIVING_RANGE_PREFAB);
1011  if (!m_DrivingRange)
1012  return;
1013  }
1014 
1015  //------------------------------------------------------------------------------------------------
1018  {
1019  m_RepairTruck = Vehicle.Cast(SpawnAsset("Truck",TRUCK_PREFAB ));
1020  if (!m_RepairTruck)
1021  return;
1022 
1023  m_Hummer = Vehicle.Cast(SpawnAsset("Hummer", HUMMER_PREFAB));
1024  if (!m_Hummer)
1025  return;
1026 
1027  m_HummerRepairable = Vehicle.Cast(SpawnAsset("Hummer2", HUMMER_PREFAB));
1028  if (!m_HummerRepairable)
1029  return;
1030 
1031  SCR_DamageManagerComponent damageManagerBroken = SCR_DamageManagerComponent.GetDamageManager(m_HummerRepairable);
1032 
1033  if (damageManagerBroken)
1034  {
1035  HitZone engineHitZone = damageManagerBroken.GetHitZoneByName("Engine_01");
1036 
1037  if (engineHitZone)
1038  {
1039  // This will work only if hitzone belongs to this damage manager
1040  vector transform[3];
1041  transform[0] = m_HummerRepairable.GetOrigin();
1042  transform[1] = vector.Forward;
1043  transform[2] = vector.Up;
1044 
1045  DamageManagerComponent engineDamageManager = DamageManagerComponent.Cast(engineHitZone.GetHitZoneContainer());
1046  if (engineDamageManager)
1047  {
1048  SCR_DamageContext damageContext1 = new SCR_DamageContext(EDamageType.TRUE, engineHitZone.GetMaxHealth(), transform, engineDamageManager.GetOwner(), engineHitZone, Instigator.CreateInstigator(null), null, -1, -1);
1049  SCR_DamageContext damageContext2 = new SCR_DamageContext(EDamageType.INCENDIARY, 50, transform, engineDamageManager.GetOwner(), engineHitZone, Instigator.CreateInstigator(null), null, -1, -1);
1050 
1051  engineDamageManager.HandleDamage(damageContext1);
1052  engineDamageManager.HandleDamage(damageContext2);
1053  }
1054  }
1055  }
1056 
1058  if (damageManager)
1059  {
1060  damageManager.GetOnDamageStateChanged().Insert(OnTruckDamaged);
1061 
1062  SCR_HitZone engine = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Engine_01"));
1063 
1064  if (engine)
1065  engine.GetOnDamageStateChanged().Insert(OnTruckDamaged);
1066 
1067  SCR_HitZone gearbox = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Gearbox_01"));
1068 
1069  if (gearbox)
1070  gearbox.GetOnDamageStateChanged().Insert(OnTruckDamaged);
1071  }
1072 
1073  VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(m_RepairTruck.FindComponent(VehicleControllerComponent_SA));
1074  if (vehicleController)
1075  vehicleController.GetOnEngineStop().Insert(OnEngineStoppedTruck);
1076 
1077  damageManager = SCR_VehicleDamageManagerComponent.Cast(m_Hummer.GetDamageManager());
1078  if (damageManager)
1079  {
1080  damageManager.GetOnDamageStateChanged().Insert(OnHmwDamaged);
1081 
1082  SCR_HitZone engine = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Engine_01"));
1083 
1084  if (engine)
1085  engine.GetOnDamageStateChanged().Insert(OnHmwDamaged);
1086 
1087  SCR_HitZone gearbox = SCR_HitZone.Cast(damageManager.GetHitZoneByName("Gearbox_01"));
1088 
1089  if (gearbox)
1090  gearbox.GetOnDamageStateChanged().Insert(OnHmwDamaged);
1091  }
1092 
1093  vehicleController = VehicleControllerComponent_SA.Cast(m_Hummer.FindComponent(VehicleControllerComponent_SA));
1094  if (vehicleController)
1095  vehicleController.GetOnEngineStop().Insert(OnEngineStoppedHmw);
1096  }
1097 
1098  //------------------------------------------------------------------------------------------------
1101  {
1102  IEntity m16 = SpawnAsset("M16", "{3E413771E1834D2F}Prefabs/Weapons/Rifles/M16/Rifle_M16A2.et");
1103  if (!m16)
1104  return;
1105 
1106  IEntity m249 = SpawnAsset("M249", "{D2B48DEBEF38D7D7}Prefabs/Weapons/MachineGuns/M249/MG_M249.et");
1107  if (!m249)
1108  return;
1109 
1110  IEntity m21 = SpawnAsset("M21", "{81EB948E6414BD6F}Prefabs/Weapons/Rifles/M14/Rifle_M21_ARTII.et");
1111  if (!m21)
1112  return;
1113  }
1114 
1115  //------------------------------------------------------------------------------------------------
1118  {
1119  //Delete built compositions.
1120  foreach (IEntity ent : m_aPlacedCompositions)
1121  {
1122  SCR_EntityHelper.DeleteEntityAndChildren(ent);
1123  }
1124  }
1125 
1126  //------------------------------------------------------------------------------------------------
1129  {
1130  IEntity victim = GetGame().GetWorld().FindEntityByName("Victim");
1131  if (!victim)
1132  return;
1133 
1135  if (!damageComp)
1136  return;
1137 
1138  damageComp.GetResilienceHitZone().SetHealth(0);
1139  }
1140 
1141  //------------------------------------------------------------------------------------------------
1144  {
1145  IEntity victim = GetGame().GetWorld().FindEntityByName("Victim");
1146  if (!victim)
1147  return;
1148 
1150  if (!damageComp)
1151  return;
1152 
1153  damageComp.GetBloodHitZone().SetHealth(2000);
1154  }
1155 
1156  //------------------------------------------------------------------------------------------------
1159  {
1160  IEntity victim = GetGame().GetWorld().FindEntityByName("Victim");
1161  if (!victim)
1162  return null;
1163 
1165  }
1166 
1167  //------------------------------------------------------------------------------------------------
1170  void ResetStage(bool forcePlayerReset = false)
1171  {
1172  if (!m_Player.IsInVehicle() || forcePlayerReset)
1174 
1175  if (m_Stage)
1176  m_Stage.Reset();
1177  }
1178 
1179  //------------------------------------------------------------------------------------------------
1181  Vehicle GetHummer()
1182  {
1183  return m_HummerRepairable;
1184  }
1185 
1186  //------------------------------------------------------------------------------------------------
1188  Vehicle GetRepairTruck()
1189  {
1190  return m_RepairTruck;
1191  }
1192 
1193  //------------------------------------------------------------------------------------------------
1199  IEntity SpawnAsset(string name, ResourceName type, IEntity spawnpoint = null)
1200  {
1201  string posName;
1202 
1203  if (!spawnpoint)
1204  spawnpoint = GetGame().GetWorld().FindEntityByName(string.Format("SpawnPos_%1", name));
1205 
1206  if (!spawnpoint)
1207  return null;
1208 
1209  IEntity oldEntity = GetGame().GetWorld().FindEntityByName(name);
1210 
1211  if (oldEntity)
1212  SCR_EntityHelper.DeleteEntityAndChildren(oldEntity);
1213 
1214  EntitySpawnParams params = EntitySpawnParams();
1215  params.TransformMode = ETransformMode.WORLD;
1216  spawnpoint.GetWorldTransform(params.Transform);
1217  Resource res = Resource.Load(type);
1218 
1219  if (!res)
1220  return null;
1221 
1222  IEntity newEntity = GetGame().SpawnEntityPrefab(res, null, params);
1223  newEntity.SetName(name);
1224 
1225  Vehicle veh = Vehicle.Cast(newEntity);
1226 
1227  if (veh)
1228  {
1229  vector pos = veh.GetOrigin();
1230  pos[1] = pos[1] + 1;
1231 
1232  Physics physicsComponent = veh.GetPhysics();
1233 
1234  if (physicsComponent)
1235  {
1236  veh.SetOrigin(pos);
1237  physicsComponent.SetVelocity("0 -1 0");
1238  }
1239  }
1240 
1241  return newEntity;
1242  }
1243 
1244  //------------------------------------------------------------------------------------------------
1247  void DeleteVehicleWhenEmpty(Vehicle veh)
1248  {
1250 
1251  if (!compartmentAccessComponent)
1252  {
1253  delete veh;
1254  GetGame().GetCallqueue().Remove(DeleteVehicleWhenEmpty);
1255  }
1256 
1257  if (compartmentAccessComponent.GetVehicle() != veh)
1258  {
1259  delete veh;
1260  GetGame().GetCallqueue().Remove(DeleteVehicleWhenEmpty);
1261  }
1262  }
1263 
1264  //------------------------------------------------------------------------------------------------
1265  protected bool CollectAllTargets(IEntity ent)
1266  {
1267  SCR_FiringRangeTarget target = SCR_FiringRangeTarget.Cast(ent);
1268  if (!target)
1269  return true;
1270 
1271  target.SetState(ETargetState.TARGET_DOWN);
1272  m_aFiringRangeTargets.Insert(target);
1273  return true;
1274  }
1275 
1276  //------------------------------------------------------------------------------------------------
1278  array<SCR_FiringRangeTarget> GetAllTargets()
1279  {
1280  return m_aFiringRangeTargets;
1281  }
1282 
1283  //------------------------------------------------------------------------------------------------
1286  {
1287  return m_iCountOfHits;
1288  }
1289 
1290  //------------------------------------------------------------------------------------------------
1292  void SetCheckLeaning(bool check)
1293  {
1294  m_bCheckLeaning = check;
1295  }
1296 
1297  //------------------------------------------------------------------------------------------------
1300  {
1301  m_ePlayerStance = stance;
1302  }
1303 
1304  //------------------------------------------------------------------------------------------------
1306  void SetPlayerDeployedCheck(bool check)
1307  {
1308  m_bCheckIsDeployed = check;
1309  }
1310 
1311  //------------------------------------------------------------------------------------------------
1314  {
1315  m_bCheckIsDeployedBipod = check;
1316  }
1317 
1318  //------------------------------------------------------------------------------------------------
1321  {
1322  return m_ePlayerStance;
1323  }
1324 
1325  //------------------------------------------------------------------------------------------------
1330  {
1331  if (state != ETargetState.TARGET_DOWN)
1332  return;
1333 
1334  CharacterControllerComponent comp = CharacterControllerComponent.Cast(m_Player.FindComponent(CharacterControllerComponent));
1335  if (!comp)
1336  return;
1337 
1338  if (GetPlayerStanceToCheck() != INVALID_STANCE && comp.GetStance() != GetPlayerStanceToCheck())
1339  return;
1340 
1341  if (m_bCheckIsDeployed && !comp.GetIsWeaponDeployed())
1342  return;
1343 
1344  if (m_bCheckIsDeployedBipod && !comp.GetIsWeaponDeployedBipod())
1345  return;
1346 
1347  // Leaning doesn't matter or is wrong.
1349  return;
1350 
1351  target.SetAutoResetTarget(false);
1352  target.Event_TargetChangeState.Remove(CountTargetHit);
1353  m_iCountOfHits ++;
1354  }
1355 
1356  //------------------------------------------------------------------------------------------------
1359  {
1360  m_eWaypointTruckPosition = mode;
1361  }
1362 
1363  //------------------------------------------------------------------------------------------------
1364  override void OnPlayerRegistered(int playerId)
1365  {
1366  super.OnPlayerRegistered(playerId);
1367 
1368  BaseWorld world = GetGame().GetWorld();
1369  SCR_CampaignMilitaryBaseComponent.Cast(world.FindEntityByName("MainBaseHQ").FindComponent(SCR_CampaignMilitaryBaseComponent)).SetCallsignIndex(0);
1370  SCR_CampaignMilitaryBaseComponent.Cast(world.FindEntityByName("TownBaseFarm").FindComponent(SCR_CampaignMilitaryBaseComponent)).SetCallsignIndex(1);
1371  SCR_CampaignMilitaryBaseComponent.Cast(world.FindEntityByName("TownBaseBeauregard").FindComponent(SCR_CampaignMilitaryBaseComponent)).SetCallsignIndex(2);
1372  SCR_CampaignMilitaryBaseComponent.Cast(world.FindEntityByName("MainBaseMossHill").FindComponent(SCR_CampaignMilitaryBaseComponent)).SetCallsignIndex(4);
1373 
1374  // Attempt to spawn the player automatically, cease after spawn is successful in OnPlayerSpawned
1375  PlayerController playerController = GetGame().GetPlayerManager().GetPlayerController(playerId);
1376  ForcePlayerFaction(playerController);
1377 
1378  while (m_aTutorialBool.Count() < NUMBER_OF_TUTORIALS)
1379  {
1380  m_aTutorialBool.Insert(false);
1381  }
1382  }
1383 
1384  //------------------------------------------------------------------------------------------------
1387  void ForcePlayerFaction(notnull PlayerController pc)
1388  {
1389  if (!m_CampaignGamemode)
1390  return;
1391 
1392  int playerId = pc.GetPlayerId();
1393 
1394  // Skip faction and spawnpoint selection
1395  SCR_RespawnSystemComponent respawnSystem = m_CampaignGamemode.GetRespawnSystemComponent();
1396 
1397  if (!respawnSystem)
1398  return;
1399 
1400  FactionManager factionManager = GetGame().GetFactionManager();
1401 
1402  if (!factionManager)
1403  return;
1404 
1405  Faction factionUS = m_CampaignGamemode.GetFactionByEnum(SCR_ECampaignFaction.BLUFOR);
1406  if (!factionUS)
1407  return;
1408 
1409  SCR_BasePlayerLoadout loadout = GetGame().GetLoadoutManager().GetRandomFactionLoadout(factionUS);
1410  if (!loadout)
1411  return;
1412 
1413  array<SCR_SpawnPoint> availableSpawnpoints = SCR_SpawnPoint.GetSpawnPointsForFaction(m_CampaignGamemode.GetFactionKeyByEnum(SCR_ECampaignFaction.BLUFOR));
1414 
1415  if (availableSpawnpoints.Count() < 1)
1416  return;
1417 
1418  if (!pc)
1419  return;
1420 
1423  SCR_RespawnComponent respawnComp = SCR_RespawnComponent.Cast(pc.FindComponent(SCR_RespawnComponent));
1424 
1425  playerFactionAffiliation.GetOnPlayerFactionResponseInvoker_S().Insert(OnPlayerFactionResponse);
1426  playerLoadout.GetOnPlayerLoadoutResponseInvoker_S().Insert(OnPlayerLoadoutResponse);
1427  respawnComp.GetOnRespawnResponseInvoker_S().Insert(OnPlayerSpawnResponse);
1428 
1429  TrySetPlayerFaction(pc, factionUS);
1431  TrySpawnPlayer(pc, availableSpawnpoints[0]);
1432  }
1433 
1434  //------------------------------------------------------------------------------------------------
1435  protected void OnPlayerFactionResponse(SCR_PlayerFactionAffiliationComponent component, int factionIndex, bool response)
1436  {
1437  PlayerController controller = PlayerController.Cast(component.GetOwner());
1438  FactionManager factionManager = GetGame().GetFactionManager();
1439 
1440  if (!factionManager)
1441  return;
1442 
1443  Faction factionUS = factionManager.GetFactionByIndex(factionIndex);
1444 
1445  if (!factionUS)
1446  return;
1447 
1448  if(!response)
1449  TrySetPlayerFaction(controller, factionUS);
1450  else
1451  component.GetOnPlayerFactionResponseInvoker_S().Remove(OnPlayerFactionResponse);
1452  }
1453 
1454  //------------------------------------------------------------------------------------------------
1455  protected void OnPlayerLoadoutResponse(SCR_PlayerLoadoutComponent component, int loadoutIndex, bool response)
1456  {
1457  PlayerController controller = PlayerController.Cast(component.GetOwner());
1458  SCR_BasePlayerLoadout loadout = GetGame().GetLoadoutManager().GetLoadoutByIndex(loadoutIndex);
1459 
1460  if(!response)
1461  TrySetPlayerLoadout(controller, loadout);
1462  else
1463  component.GetOnPlayerLoadoutResponseInvoker_S().Remove(OnPlayerLoadoutResponse);
1464  }
1465 
1466  //------------------------------------------------------------------------------------------------
1467  protected void OnPlayerSpawnResponse(SCR_SpawnRequestComponent requestComponent, SCR_ESpawnResult response)
1468  {
1469  PlayerController controller = PlayerController.Cast(requestComponent.GetOwner());
1470  array<SCR_SpawnPoint> availableSpawnpoints = SCR_SpawnPoint.GetSpawnPointsForFaction(m_CampaignGamemode.GetFactionKeyByEnum(SCR_ECampaignFaction.BLUFOR));
1471  SCR_RespawnComponent respawnComp = SCR_RespawnComponent.Cast(controller.FindComponent(SCR_RespawnComponent));
1472 
1473  if(response != SCR_ESpawnResult.OK)
1474  TrySpawnPlayer(controller, availableSpawnpoints[1]);
1475  else
1476  respawnComp.GetOnRespawnResponseInvoker_S().Remove(OnPlayerSpawnResponse);
1477  }
1478 
1479  //------------------------------------------------------------------------------------------------
1480  protected void TrySetPlayerFaction(notnull PlayerController playerController, Faction faction)
1481  {
1482 
1483  SCR_PlayerFactionAffiliationComponent playerFactionAffiliation = SCR_PlayerFactionAffiliationComponent.Cast(playerController.FindComponent(SCR_PlayerFactionAffiliationComponent));
1484  if (!playerFactionAffiliation.RequestFaction(faction))
1485  {
1486  // Request not sent, failed locally
1487  return;
1488  }
1489 
1490  // Request sent, await response.
1491  // Response delivered via SCR_PlayerFactionAffiliationComponent.GetOnCanPlayerFactionResponseInvoker..., explained above.
1492  }
1493 
1494  //------------------------------------------------------------------------------------------------
1495  protected void TrySetPlayerLoadout(notnull PlayerController playerController, SCR_BasePlayerLoadout loadout)
1496  {
1497 
1498  SCR_PlayerLoadoutComponent playerLoadoutComponent = SCR_PlayerLoadoutComponent.Cast(playerController.FindComponent(SCR_PlayerLoadoutComponent));
1499  if (!playerLoadoutComponent.RequestLoadout(loadout))
1500  {
1501  // Request not sent, failed locally
1502  return;
1503  }
1504 
1505  // Request sent, await response.
1506  // Response delivered via SCR_PlayerLoadoutComponent.GetOnPlayerLoadoutResponseInvoker...(), explained above.
1507  }
1508 
1509  //------------------------------------------------------------------------------------------------
1510  protected void TrySpawnPlayer(notnull PlayerController playerController, notnull SCR_SpawnPoint spawnPoint)
1511  {
1512  SCR_RespawnComponent spawnComponent = SCR_RespawnComponent.Cast(playerController.FindComponent(SCR_RespawnComponent));
1513  SCR_PlayerLoadoutComponent loadoutComponent = SCR_PlayerLoadoutComponent.Cast(playerController.FindComponent(SCR_PlayerLoadoutComponent));
1514 
1515  // Retrieve loadout the user had stored prior to this request; this is synchronized as an ask/response
1516  SCR_BasePlayerLoadout loadout = loadoutComponent.GetAssignedLoadout();
1517  ResourceName loadoutResource = loadout.GetLoadoutResource();
1518  SCR_SpawnData spawnData = new SCR_SpawnPointSpawnData(loadoutResource, spawnPoint.GetRplId());
1519  if (!spawnComponent.RequestSpawn(spawnData))
1520  {
1521  // Request not sent, failed locally
1522  return;
1523  }
1524 
1525  // Request sent, await response.
1526  // Response delivered via SCR_RespawnComponent.GetOnRespawnResponseInvoker...(), explained above.
1527  }
1528 
1529  //------------------------------------------------------------------------------------------------
1531  void OnMapOpen(MapConfiguration config)
1532  {
1533  m_bIsMapOpen = true;
1534  }
1535 
1536  //------------------------------------------------------------------------------------------------
1538  void OnMapClose(MapConfiguration config)
1539  {
1540  m_bIsMapOpen = false;
1541  }
1542 
1543  //------------------------------------------------------------------------------------------------
1546  {
1547  return m_bIsMapOpen;
1548  }
1549 
1550  //------------------------------------------------------------------------------------------------
1552  BaseRadioComponent GetPlayerRadio()
1553  {
1554  return m_Radio;
1555  }
1556 
1557  //------------------------------------------------------------------------------------------------
1563  void UpdateSupplyTruckWaypoint(IEntity waypoint, bool useTruck, string contextName, vector offset = vector.Zero)
1564  {
1565  if (contextName.IsEmpty() || !m_SupplyTruckComponent)
1566  return;
1567 
1568  IEntity ent = m_SupplyTruckComponent.GetOwner();
1569 
1570  if (useTruck)
1571  ent = ent.GetParent();
1572 
1573  ActionsManagerComponent amc = ActionsManagerComponent.Cast(ent.FindComponent(ActionsManagerComponent));
1574  if (!amc)
1575  return;
1576 
1577  UserActionContext context = amc.GetContext(contextName);
1578  if (!context)
1579  return;
1580 
1581  vector pos = context.GetOrigin();
1582  pos = pos + offset;
1583  waypoint.SetOrigin(pos);
1584  }
1585 
1586  //------------------------------------------------------------------------------------------------
1590  void CheckRadioPickup(IEntity item, BaseInventoryStorageComponent storageOwner)
1591  {
1592  m_Radio = BaseRadioComponent.Cast(item.FindComponent(BaseRadioComponent));
1593  }
1594 
1595  //------------------------------------------------------------------------------------------------
1599  bool CheckCharacterStance(ECharacterCommandIDs command)
1600  {
1601  CharacterAnimationComponent comp = CharacterAnimationComponent.Cast(m_Player.FindComponent(CharacterAnimationComponent));
1602  bool ret = false;
1603 
1604  if (!comp)
1605  return false;
1606 
1608  comp.GetMovementState(mState);
1609 
1610  if (mState)
1611  ret = mState.m_CommandTypeId == command;
1612 
1613  delete mState;
1614  return ret;
1615  }
1616 
1617  //------------------------------------------------------------------------------------------------
1620  {
1621  return m_bIsFirstRun;
1622  }
1623 
1624  //------------------------------------------------------------------------------------------------
1626  void SetFirstRun(bool firstRun)
1627  {
1628  m_bIsFirstRun = firstRun;
1629  }
1630 
1631  //------------------------------------------------------------------------------------------------
1635  {
1637  if (!comp)
1638  return false;
1639 
1640  return comp.IsLeaning();
1641  }
1642 
1643  //------------------------------------------------------------------------------------------------
1646  {
1647  if (!m_Player)
1648  return;
1649 
1650  CameraHandlerComponent comp = CameraHandlerComponent.Cast(m_Player.FindComponent(CameraHandlerComponent));
1651  if (!comp)
1652  return;
1653 
1654  if (comp.IsInThirdPerson())
1655  {
1656  m_bUsed3PV = true;
1657  GetGame().GetCallqueue().Remove(Check3rdPersonViewUsed);
1658 
1660  GetGame().GetCallqueue().Remove(DelayedPopup);
1661  }
1662  }
1663 
1664  //------------------------------------------------------------------------------------------------
1667  {
1668  return m_bUsed3PV;
1669  }
1670 
1671  //------------------------------------------------------------------------------------------------
1675  void MoveInVehicle(string vehName, ECompartmentType seat)
1676  {
1677  Vehicle veh = Vehicle.Cast(GetGame().GetWorld().FindEntityByName(vehName));
1678 
1679  if (!veh)
1680  return;
1681 
1683 
1684  if (!compartmentAccessComponent)
1685  return;
1686 
1687  if (compartmentAccessComponent.GetVehicle())
1688  GetGame().GetCallqueue().CallLater(MoveInVehicle, 100, false, vehName, seat);
1689  else
1690  {
1691  if (m_wFadeOut)
1692  {
1693  m_wFadeOut.SetOpacity(1);
1694  AnimateWidget.Opacity(m_wFadeOut, 0, 0.8);
1695  }
1696 
1698  compartmentAccessComponent.MoveInVehicle(veh, seat);
1699  }
1700  }
1701 
1702  //------------------------------------------------------------------------------------------------
1707  {
1708  CompartmentAccessComponent compartmentAccessComponent = CompartmentAccessComponent.Cast(m_Player.FindComponent(CompartmentAccessComponent));
1709 
1710  if (!compartmentAccessComponent)
1711  return false;
1712 
1713  BaseCompartmentSlot compartmentSlot = compartmentAccessComponent.GetCompartment();
1714 
1715  if (!compartmentSlot)
1716  return false;
1717 
1718  return compartmentSlot.GetType() == seat;
1719  }
1720 
1721  //------------------------------------------------------------------------------------------------
1723  void OnSupplyTruckLeft(IEntity vehicle)
1724  {
1726  return;
1727 
1728  if (!m_Player)
1729  return;
1730 
1731  CharacterControllerComponent charController = CharacterControllerComponent.Cast(m_Player.FindComponent(CharacterControllerComponent));
1732 
1733  if (!charController)
1734  return;
1735 
1736  if (charController.IsDead())
1737  return;
1738 
1739  SCR_PopUpNotification.GetInstance().HideCurrentMsg();
1741 
1742  if (accessComp)
1743  accessComp.GetOnCompartmentLeft().Remove(OnSupplyTruckLeft);
1744 
1745  FinishStage(m_Stage, SCR_ECampaignTutorialArlandStage.CONFLICT_UNLOADING_SUPPLIES);
1746  m_iActiveStage = 17;
1747  ResetStage(true);
1748  }
1749 
1750  //------------------------------------------------------------------------------------------------
1754  void MovePlayer(notnull IEntity newPos, ResourceName loadoutResourceName)
1755  {
1756  GetGame().GetCallqueue().CallLater(ResetPlayerCharacter, FADE_SPEED*100, false, newPos, loadoutResourceName);
1757 
1758  if (m_wFadeOut)
1759  AnimateWidget.Opacity(m_wFadeOut, 0, FADE_SPEED);
1760  }
1761 
1762  //------------------------------------------------------------------------------------------------
1763  protected void ResetPlayerCharacter(IEntity newPos, ResourceName loadoutResourceName)
1764  {
1765  EntitySpawnParams params = EntitySpawnParams();
1766  params.TransformMode = ETransformMode.WORLD;
1767  newPos.GetWorldTransform(params.Transform);
1768 
1769  Resource res = Resource.Load(loadoutResourceName);
1770  if (!res.IsValid())
1771  return;
1772 
1774  if (!playerController)
1775  return;
1776 
1777  IEntity oldCharacter = playerController.GetControlledEntity();
1778  if (!oldCharacter)
1779  {
1780  Print("SCR_CampaignTutorialArlandComponent:: No playercontrolled entity found!", LogLevel.WARNING);
1781  return;
1782  }
1783 
1784  //Save old identity to keep same face
1785  Identity oldIdentity;
1786  SCR_CharacterIdentityComponent identityComp = SCR_CharacterIdentityComponent.Cast(oldCharacter.FindComponent(SCR_CharacterIdentityComponent));
1787  if (identityComp)
1788  oldIdentity = identityComp.GetIdentity();
1789 
1790  IEntity newCharacter = GetGame().SpawnEntityPrefab(res, null, params);
1791  if (!newCharacter)
1792  return;
1793 
1794  identityComp = SCR_CharacterIdentityComponent.Cast(newCharacter.FindComponent(SCR_CharacterIdentityComponent));
1795  if (identityComp && oldIdentity)
1796  identityComp.SetIdentity(oldIdentity);
1797 
1798  m_Player = ChimeraCharacter.Cast(newCharacter);
1799  playerController.SetControlledEntity(newCharacter);
1800 
1801  SCR_EntityHelper.DeleteEntityAndChildren(oldCharacter);
1802 
1803  if (!m_Stage)
1804  return;
1805 
1806  m_Stage.SetPlayer(m_Player);
1807  }
1808 
1809  //------------------------------------------------------------------------------------------------
1818  void DelayedPopup(string text = "", string subtitle = "", float duration = SCR_PopUpNotification.DEFAULT_DURATION, string param1 = "", string param2 = "", string subtitleParam1 = "", string subtitleParam2 = "")
1819  {
1820  SCR_PopUpNotification.GetInstance().PopupMsg(text, duration, text2: subtitle, param1: param1, param2: param2, text2param1: subtitleParam1, text2param2: subtitleParam2, category: SCR_EPopupMsgFilter.TUTORIAL);
1821  }
1822 
1823  //------------------------------------------------------------------------------------------------
1827  {
1828  if (m_Stage)
1829  m_Stage.OnStructureBuilt(base, structure);
1830  }
1831 
1832  //------------------------------------------------------------------------------------------------
1833  override void OnPlayerSpawnFinalize_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
1834  {
1835  m_bPlayerSpawned = true;
1836  m_Player = ChimeraCharacter.Cast(entity);
1837 
1838  if (m_Stage)
1839  m_Stage.SetPlayer(m_Player);
1840 
1841  if (!m_bFirstStageSet)
1842  {
1843  if (m_CampaignGamemode.IsTutorial())
1844  {
1845  SCR_HUDManagerComponent hudManager = GetGame().GetHUDManager();
1846 
1847  if (hudManager)
1848  {
1849  SCR_XPInfoDisplay display = SCR_XPInfoDisplay.Cast(hudManager.FindInfoDisplay(SCR_XPInfoDisplay));
1850 
1851  if (display)
1852  display.AllowShowingInfo(false);
1853  }
1854  }
1855 
1856  m_bFirstStageSet = true;
1858  m_HQUS.AlterSupplyIncomeTimer(9999999);
1859  FiringRangeInit();
1860  MobileHQInit();
1861  IEntity WP_cottage = GetGame().GetWorld().FindEntityByName("WP_CONFLICT_COMPAS_MOVE");
1862  IEntity WP_mobileHQ = GetGame().GetWorld().FindEntityByName("WP_CONFLICT_MAP_MOVE");
1863  SCR_MapDescriptorComponent cottageDescr = SCR_MapDescriptorComponent.Cast(WP_cottage.FindComponent(SCR_MapDescriptorComponent));
1864  SCR_MapDescriptorComponent mobileTruckDescr = SCR_MapDescriptorComponent.Cast(WP_mobileHQ.FindComponent(SCR_MapDescriptorComponent));
1865  cottageDescr.Item().SetVisible(false);
1866  mobileTruckDescr.Item().SetVisible(false);
1867 
1868  m_wFadeOut = ImageWidget.Cast(GetGame().GetHUDManager().CreateLayout("{265245C299401BF6}UI/layouts/Menus/ContentBrowser/DownloadManager/ScrollBackground.layout", EHudLayers.OVERLAY));
1869  m_wFadeOut.SetOpacity(1);
1870  int stage = m_eStage;
1871  SetActiveConfig(0);
1872 #ifdef WORKBENCH
1873  stage = m_eStartingStage;
1874 #endif
1875  //TODO: @yuri pls fix for the future, very dirty indeed.
1876  GetGame().GetCallqueue().CallLater(Check3rdPersonViewUsed, 500, true);
1877 
1878 #ifdef ENABLE_DIAG
1879  SetEventMask(m_CampaignGamemode, EntityEvent.FRAME);
1880 #endif
1881  }
1882  else
1883  SetStage(m_eStage);
1884 
1885  ResetStage();
1886  }
1887 
1888  //------------------------------------------------------------------------------------------------
1891  {
1892  Widget waypointFrame = GetGame().GetHUDManager().CreateLayout("{825C6D728AC3E029}UI/layouts/Tutorial/TutorialWaypointEdited.layout", EHudLayers.BACKGROUND);
1893  m_aWaypoints.Insert(waypointFrame.FindAnyWidget("RootTutorialHud"));
1894 
1895  //setup base image
1896  ImageWidget image = ImageWidget.Cast(waypointFrame.FindAnyWidget("Icon"));
1897  image.SetOpacity(0);
1898  image.LoadImageFromSet(0, m_WaypointWidget, "MISC");
1899  image.SetColor(Color.FromInt(Color.YELLOW));
1900 
1901  //setup distance
1902  RichTextWidget text = RichTextWidget.Cast(waypointFrame.FindAnyWidget("Distance"));
1903  text.SetOpacity(0);
1904  text.SetColor(Color.FromInt(Color.YELLOW));
1905 
1906  //setup misc
1907  image = ImageWidget.Cast(waypointFrame.FindAnyWidget("IconExtra"));
1908  image.SetOpacity(0);
1909  image.SetVisible(false);
1910  image.LoadImageFromSet(0, m_WaypointWidget, "CUSTOM");
1911  image.SetColor(Color.FromInt(Color.YELLOW));
1912  }
1913 
1914  //------------------------------------------------------------------------------------------------
1917  {
1918  foreach (Widget waypoints : m_aWaypoints)
1919  {
1920  waypoints.RemoveFromHierarchy();
1921  }
1922 
1923  m_aWaypoints.Clear();
1924  }
1925 
1926  //------------------------------------------------------------------------------------------------
1930  void SetWaypointMiscImage(string imageName, bool visible, int index = 0)
1931  {
1932  ImageWidget waypointMisc;
1933 
1934  if (m_aWaypoints.IsIndexValid(index))
1935  {
1936  waypointMisc = ImageWidget.Cast(m_aWaypoints[index].FindAnyWidget("IconExtra"));
1937  waypointMisc.LoadImageFromSet(0, m_WaypointWidget, imageName);
1938  waypointMisc.SetVisible(visible);
1939  }
1940  }
1941 
1942  //------------------------------------------------------------------------------------------------
1945  {
1946  IEntity playerPos;
1947  typename stages = SCR_ECampaignTutorialArlandStage;
1948 
1949  while (!playerPos && stage > 0)
1950  {
1951  playerPos = GetGame().GetWorld().FindEntityByName(string.Format("PP_%1", stages.GetVariableName(stage)));
1952 
1953  if (playerPos)
1954  {
1955  m_eStage = stage;
1956  return;
1957  }
1958 
1959  stage--;
1960  }
1961  }
1962 
1963  //------------------------------------------------------------------------------------------------
1966  {
1967  return m_eStage;
1968  }
1969 
1970  //------------------------------------------------------------------------------------------------
1973  {
1974  return GetGame().GetWorld().GetWorldTime() - m_fStageTimestamp;
1975  }
1976 
1977  //------------------------------------------------------------------------------------------------
1982  {
1984  m_iCountOfHits = 0;
1985  m_bCheckLeaning = false;
1987 
1988  if (GetStage() == SCR_ECampaignTutorialArlandStage.END_STAGE)
1989  {
1991  SCR_GameModeEndData endData = SCR_GameModeEndData.CreateSimple(EGameOverTypes.ENDREASON_SCORELIMIT, winnerFactionId: 1);
1992  gamemode.EndGameMode(endData)
1993  }
1994 
1995  FlushWaypoints();
1996  stage.FlushWaypoints();
1997 
1998  delete stage;
1999  if (nextStage == -1)
2000  {
2001  m_iActiveStage++;
2002  if(m_aStageInfos.IsIndexValid(m_iActiveStage))
2003  SetStage(m_aStageInfos[m_iActiveStage].GetIndex());
2004  else
2005  SetActiveConfig(0);
2006  }
2007  else
2008  {
2009  SetStage(nextStage);
2010  }
2011  }
2012 
2013  //------------------------------------------------------------------------------------------------
2017  {
2018  m_eStage = stage;
2019  if(lastStage != 0)
2020  m_eLastStage = lastStage;
2021 
2022 #ifdef ENABLE_DIAG
2023  DiagMenu.SetValue(SCR_DebugMenuID.DEBUGUI_TUTORIAL_STAGE, m_eStage);
2024 #endif
2025 
2026  if (!m_Player)
2027  return;
2028 
2029  // Run the next stage
2030  if(!m_aStageInfos)
2031  {
2032  SetActiveConfig(0);
2033  return;
2034  }
2035 
2037  {
2038  if (stageInfo.GetIndex() == m_eStage)
2039  {
2040  m_fStageTimestamp = GetGame().GetWorld().GetWorldTime();
2041  m_Stage = SCR_BaseCampaignTutorialArlandStage.Cast(GetGame().SpawnEntity(stageInfo.GetClassName().ToType()));
2042  break;
2043  }
2044  }
2045  }
2046 
2047  //------------------------------------------------------------------------------------------------
2050  {
2051  IEntity playerPos;
2052  typename stages = SCR_ECampaignTutorialArlandStage;
2053  int stage = m_eStage;
2054 
2055  // If the current stage does not have its starting location set, use the previous one
2056  while (!playerPos && stage >= 0)
2057  {
2058  playerPos = GetGame().GetWorld().FindEntityByName(string.Format("PP_%1", stages.GetVariableName(stage)));
2059  stage--;
2060  }
2061 
2062  if (playerPos)
2063  {
2064  if (m_wFadeOut)
2065  {
2066  //m_wFadeOut.SetOpacity(1);
2067  AnimateWidget.Opacity(m_wFadeOut, 1, 4);
2068  }
2069 
2070  GetGame().GetCallqueue().CallLater(MovePlayer, 500, false, playerPos, m_ActiveConfig.GetPlayerLoadout());
2071  }
2072 
2073  }
2074 
2075  //------------------------------------------------------------------------------------------------
2078  void ToggleWaypoints(bool hide)
2079  {
2080  foreach(Widget waypoint: m_aWaypoints)
2081  {
2082  waypoint.SetVisible(hide);
2083  }
2084  }
2085 
2086  //------------------------------------------------------------------------------------------------
2090  void UpdateWaypoints(array<IEntity> waypoints, float heightOffset)
2091  {
2092  int x = 0;
2093  if (waypoints.IsEmpty())
2094  return;
2095 
2096  foreach (IEntity waypoint : waypoints)
2097  {
2098  if (!waypoint)
2099  continue;
2100 
2101  vector WPPos = waypoint.GetOrigin();
2102  ImageWidget markerPos;
2103  ImageWidget markerExtra;
2104  RichTextWidget markerDistance;
2105  WPPos[1] = WPPos[1] + heightOffset;
2106  vector pos = GetGame().GetWorkspace().ProjWorldToScreen(WPPos, GetGame().GetWorld());
2107  int dist = vector.Distance(m_Player.GetOrigin(), WPPos);
2108 
2109  // Handle off-screen coords
2110  WorkspaceWidget workspace = GetGame().GetWorkspace();
2111  int winX = workspace.GetWidth();
2112  int winY = workspace.GetHeight();
2113  int posX = workspace.DPIScale(pos[0]);
2114  int posY = workspace.DPIScale(pos[1]);
2115 
2116  if (posX < 0)
2117  pos[0] = 0;
2118  else if (posX > winX)
2119  pos[0] = workspace.DPIUnscale(winX);
2120 
2121  if (posY < 0)
2122  pos[1] = 0;
2123  else if (posY > winY || pos[2] < 0)
2124  pos[1] = workspace.DPIUnscale(winY);
2125 
2126  FrameSlot.SetPos(m_aWaypoints[x], pos[0], pos[1]);
2127 
2128  int distShown = dist;
2129 
2130  if (dist > 1000)
2131  {
2132  distShown = dist - (dist % 1000);
2133  }
2134  else if (dist > 100)
2135  {
2136  distShown = dist - (dist % 100);
2137  }
2138  else if (dist > 50)
2139  {
2140  distShown = dist - (dist % 50);
2141  }
2142 
2143  float opacity = 1;
2144  float distanceOpacity = 1;
2145 
2146  if (dist < WAYPOINT_FADE_THRESHOLD)
2147  opacity = Math.Lerp(WAYPOINT_MINIMUM_OPACITY, 1, dist / WAYPOINT_FADE_THRESHOLD);
2148 
2149  if (dist >= WAYPOINT_DISTANCE_INDICATOR_FADE_START)
2150  {
2151  distanceOpacity = 1;
2152  }
2153  else if (dist <= WAYPOINT_DISTANCE_INDICATOR_FADE_END)
2154  {
2155  distanceOpacity = 0;
2156  }
2157  else
2158  {
2159  distanceOpacity = Math.InverseLerp(WAYPOINT_DISTANCE_INDICATOR_FADE_END, WAYPOINT_DISTANCE_INDICATOR_FADE_START, dist);
2160  }
2161 
2162  markerPos = ImageWidget.Cast(m_aWaypoints[x].FindAnyWidget("Icon"));
2163  markerExtra = ImageWidget.Cast(m_aWaypoints[x].FindAnyWidget("IconExtra"));
2164  markerDistance = RichTextWidget.Cast(m_aWaypoints[x].FindAnyWidget("Distance"));
2165 
2166  markerPos.SetOpacity(opacity);
2167  markerExtra.SetOpacity(opacity);
2168  markerDistance.SetOpacity(distanceOpacity);
2169  markerDistance.SetTextFormat("#AR-Tutorial_WaypointUnits_meters", distShown);
2170  x++;
2171  }
2172  }
2173 
2174  //------------------------------------------------------------------------------------------------
2177  {
2178  return m_SupplyTruckComponent;
2179  }
2180 
2181  //------------------------------------------------------------------------------------------------
2185  bool FindSupplyTruck(IEntity ent)
2186  {
2187  SCR_CampaignSuppliesComponent supplyTruckComponent = SCR_CampaignSuppliesComponent.Cast(ent.FindComponent(SCR_CampaignSuppliesComponent));
2188 
2189  if (!supplyTruckComponent)
2190  return true;
2191 
2192  Vehicle truck = Vehicle.Cast(ent.GetParent());
2193 
2194  if (!truck)
2195  return true;
2196 
2197  m_SupplyTruckComponent = supplyTruckComponent;
2198  truck.SetName("BuildingSupplyTruck");
2199  return false;
2200  }
2201 
2202  //------------------------------------------------------------------------------------------------
2203  protected void SetupStageCounts(int stage = 0)
2204  {
2205  array<ref SCR_CampaignTutorialArlandStageInfo> stagelist = {};
2206 
2207  m_ActiveConfig.GetStages(stagelist);
2208  m_iStagesCnt = stagelist.Count();
2209 
2210 #ifdef ENABLE_DIAG
2211  if (m_eStage > m_iStagesCnt - 1)
2212  {
2213  int diff = m_eStage - m_iStagesCnt - 1;
2214  int numStage = m_eStage - diff;
2215  }
2216 
2217  DiagMenu.RegisterRange(SCR_DebugMenuID.DEBUGUI_TUTORIAL_STAGE, "", "Stage", "Tutorial", string.Format("0 %1 0 1", m_iStagesCnt - 1));
2218 #endif
2219  }
2220 
2221  //------------------------------------------------------------------------------------------------
2222  protected override void OnPostInit(IEntity owner)
2223  {
2224  if (!GetGame().InPlayMode())
2225  return;
2226 
2227  m_CampaignGamemode = SCR_GameModeCampaign.GetInstance();
2228 
2229  if (!m_CampaignGamemode)
2230  return;
2231 
2232  m_CampaignGamemode.SetIsTutorial(true);
2233  GetGame().OnInputDeviceIsGamepadInvoker().Insert(OnInputDeviceIsGamepad);
2234  ChimeraWorld world = GetGame().GetWorld();
2235 
2236  if (world)
2237  {
2238  MusicManager musicMan = world.GetMusicManager();
2239 
2240  if (musicMan)
2241  {
2242  array<int> musicCategories = {};
2243  SCR_Enum.GetEnumValues(MusicCategory, musicCategories);
2244 
2245  foreach (int category : musicCategories)
2246  {
2247  musicMan.MuteCategory(category, true, true);
2248  }
2249  }
2250  }
2251 
2252 #ifdef ENABLE_DIAG
2253  DiagMenu.RegisterMenu(SCR_DebugMenuID.DEBUGUI_TUTORIAL_MENU, "Tutorial", "");
2254  DiagMenu.RegisterItem(SCR_DebugMenuID.DEBUGUI_TUTORIAL_CONFIG, "", "Config", "Tutorial", "Hub,Movement,Weapons,ConflictSimple,ConflictSige,Driving");
2255  DiagMenu.RegisterRange(SCR_DebugMenuID.DEBUGUI_TUTORIAL_STAGE, "", "Stage", "Tutorial", string.Format("0 %1 0 1", m_iStagesCnt - 1));
2256  DiagMenu.SetValue(SCR_DebugMenuID.DEBUGUI_TUTORIAL_STAGE, m_eStage);
2257 #endif
2258 
2259  Resource holder = BaseContainerTools.LoadContainer(m_sStagesConfigAdvanced);
2260  if (!holder)
2261  return;
2262 
2263  BaseContainer container = holder.GetResource().ToBaseContainer();
2264  if (!container)
2265  return;
2266 
2267  SCR_CampaignTutorialArlandStagesConfig configsConf = SCR_CampaignTutorialArlandStagesConfig.Cast(BaseContainerTools.CreateInstanceFromContainer(container));
2268  if (!configsConf)
2269  return;
2270 
2271  configsConf.GetConfigs(m_aStageConfigs);
2272 
2274  if (!core)
2275  return;
2276 
2277  core.Event_OnEditorManagerCreatedServer.Insert(SetupEditorModeListener);
2278  }
2279 
2280  //------------------------------------------------------------------------------------------------
2281  override void EOnFrame(IEntity owner, float timeSlice)
2282  {
2283  if (DiagMenu.GetValue(SCR_DebugMenuID.DEBUGUI_TUTORIAL_STAGE) != m_eStage && m_Stage)
2284  {
2285  FinishStage(m_Stage, DiagMenu.GetValue(SCR_DebugMenuID.DEBUGUI_TUTORIAL_STAGE));
2286  ResetStage();
2287  }
2288  }
2289 
2290  //------------------------------------------------------------------------------------------------
2293  {
2294  if (m_aWaypoints.IsEmpty())
2295  return;
2296 
2297  foreach (Widget waypoint : m_aWaypoints)
2298  {
2299  if (!waypoint)
2300  continue;
2301 
2302  waypoint.RemoveFromHierarchy();
2303  }
2304  }
2305 
2306  //------------------------------------------------------------------------------------------------
2307  // destructor
2309  {
2310  if (m_wFadeOut)
2311  m_wFadeOut.RemoveFromHierarchy();
2312 
2313  CleanUpWaypoints();
2314 
2315  GetGame().OnInputDeviceIsGamepadInvoker().Remove(OnInputDeviceIsGamepad);
2316  }
2317 }
SetResumeStage
void SetResumeStage(SCR_ECampaignTutorialArlandStage stage)
Definition: SCR_CampaignTutorialComponentArland.c:1944
StageReset_MoveInJeep
void StageReset_MoveInJeep(IEntity position=null)
Definition: SCR_CampaignTutorialComponentArland.c:776
OnInputDeviceIsGamepad
protected void OnInputDeviceIsGamepad(bool isGamepad)
Definition: SCR_CampaignTutorialComponentArland.c:550
SCR_PlayerLoadoutComponent
Definition: SCR_PlayerLoadoutComponent.c:16
SCR_CampaignTutorialArlandStagesConfig
Definition: SCR_CampaignTutorialArlandStagesConfig.c:2
HandleAchievement
void HandleAchievement()
Definition: SCR_CampaignTutorialComponentArland.c:123
ChimeraWorld
Definition: ChimeraWorld.c:12
SCR_BaseGameMode
Definition: SCR_BaseGameMode.c:137
SCR_HUDManagerComponent
Definition: SCR_HUDManagerComponent.c:23
StageReset_RifleRespawn
void StageReset_RifleRespawn()
Definition: SCR_CampaignTutorialComponentArland.c:766
SpawnEntity
protected IEntity SpawnEntity(ResourceName entityResourceName, notnull IEntity slotOwner)
Definition: SCR_CatalogEntitySpawnerComponent.c:1008
direction
vector direction
Definition: SCR_DestructibleTreeV2.c:31
Identity
Definition: Identity.c:12
GetIsMapOpen
bool GetIsMapOpen()
Definition: SCR_CampaignTutorialComponentArland.c:1545
PrepareMedicalAmbulance
protected bool PrepareMedicalAmbulance()
Definition: SCR_CampaignTutorialComponentArland.c:900
ResetPlayerPosition
void ResetPlayerPosition()
Definition: SCR_CampaignTutorialComponentArland.c:2049
SCR_BaseCampaignTutorialArlandStage
Definition: SCR_BaseCampaignTutorialArlandStage.c:7
GetVictimDamageManager
SCR_CharacterDamageManagerComponent GetVictimDamageManager()
Definition: SCR_CampaignTutorialComponentArland.c:1158
ShowMapDescriptor
void ShowMapDescriptor(string descriptorOwnerName, bool enable)
Definition: SCR_CampaignTutorialComponentArland.c:417
RemoveHelicopterInvokers
void RemoveHelicopterInvokers()
Definition: SCR_CampaignTutorialComponentArland.c:211
SCR_RespawnComponent
void SCR_RespawnComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_RespawnComponent.c:576
HideSubtitles
void HideSubtitles(Widget widgeter)
Definition: SCR_CampaignTutorialComponentArland.c:79
SCR_PlayerController
Definition: SCR_PlayerController.c:31
GetFirstRun
bool GetFirstRun()
Definition: SCR_CampaignTutorialComponentArland.c:1619
IsMyAngleInRange
bool IsMyAngleInRange(float angle, float range)
Definition: SCR_CampaignTutorialComponentArland.c:435
m_bIsUsingGamepad
protected bool m_bIsUsingGamepad
Definition: SCR_CampaignTutorialComponentArland.c:58
HelicopterDrownedCheck
protected void HelicopterDrownedCheck()
Definition: SCR_CampaignTutorialComponentArland.c:194
SCR_EntityHelper
Definition: SCR_EntityHelper.c:1
SetWaypointMiscImage
void SetWaypointMiscImage(string imageName, bool visible, int index=0)
Definition: SCR_CampaignTutorialComponentArland.c:1930
SCR_Enum
Definition: SCR_Enum.c:1
SCR_ECampaignFaction
SCR_ECampaignFaction
Definition: SCR_CampaignFactionManager.c:130
SCR_CompartmentAccessComponent
Definition: SCR_CompartmentAccessComponent.c:15
SCR_ESpawnResult
SCR_ESpawnResult
Definition: SCR_ESpawnResult.c:8
SetActiveConfig
void SetActiveConfig(SCR_ETutorialArlandStageMasters config)
Definition: SCR_CampaignTutorialComponentArland.c:631
m_HummerRepairable
protected Vehicle m_HummerRepairable
Definition: SCR_CampaignTutorialComponentArland.c:72
m_SupplyTruckComponent
protected SCR_CampaignSuppliesComponent m_SupplyTruckComponent
Definition: SCR_CampaignTutorialComponentArland.c:45
SCR_EWeatherStates
SCR_EWeatherStates
Definition: SCR_EWeatherStates.c:1
m_VoiceoverSystem
protected SCR_VoiceoverSystem m_VoiceoverSystem
Definition: SCR_CampaignTutorialComponentArland.c:76
CleanUpWaypoints
void CleanUpWaypoints()
Definition: SCR_CampaignTutorialComponentArland.c:2292
OnStructureBuilt
void OnStructureBuilt(SCR_CampaignMilitaryBaseComponent base, IEntity structure)
Definition: SCR_CampaignTutorialComponentArland.c:1826
SCR_FiringRangeTarget
Definition: SCR_FiringRangeTarget.c:19
SCR_FadeInOutEffect
Definition: SCR_FadeInOutEffect.c:1
HitZone
Definition: HitZone.c:12
ForcePlayerFaction
void ForcePlayerFaction(notnull PlayerController pc)
Definition: SCR_CampaignTutorialComponentArland.c:1387
ResetStage_VehiclesSimple
void ResetStage_VehiclesSimple()
Definition: SCR_CampaignTutorialComponentArland.c:984
SCR_CampaignTutorialArlandComponentClass
Definition: SCR_CampaignTutorialComponentArland.c:1
m_Hummer
protected Vehicle m_Hummer
Definition: SCR_CampaignTutorialComponentArland.c:70
CheckCharacterStance
bool CheckCharacterStance(ECharacterCommandIDs command)
Definition: SCR_CampaignTutorialComponentArland.c:1599
TrySetPlayerFaction
protected void TrySetPlayerFaction(notnull PlayerController playerController, Faction faction)
Definition: SCR_CampaignTutorialComponentArland.c:1480
RefreshVictimBloodLevel
void RefreshVictimBloodLevel()
Definition: SCR_CampaignTutorialComponentArland.c:1143
ResetStage_Medical
void ResetStage_Medical()
Definition: SCR_CampaignTutorialComponentArland.c:970
MusicCategory
MusicCategory
Definition: MusicCategory.c:12
GetTargetHits
int GetTargetHits()
Definition: SCR_CampaignTutorialComponentArland.c:1285
m_DrivingRange
protected IEntity m_DrivingRange
Definition: SCR_CampaignTutorialComponentArland.c:73
m_HQUS
protected SCR_CampaignMilitaryBaseComponent m_HQUS
Definition: SCR_CampaignTutorialComponentArland.c:47
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetFactionIndex
int GetFactionIndex()
Definition: SCR_EditableFactionComponent.c:57
Attribute
SCR_CampaignTutorialArlandComponentClass SCR_BaseGameModeComponentClass Attribute("", UIWidgets.ResourceNamePicker, "", "conf")] ResourceName m_sStagesConfigAdvanced
OnHelicopterDamaged
protected void OnHelicopterDamaged(EDamageState state)
Definition: SCR_CampaignTutorialComponentArland.c:246
MobileHQInit
void MobileHQInit()
Definition: SCR_CampaignTutorialComponentArland.c:678
SetupEditorModeListener
void SetupEditorModeListener()
Definition: SCR_CampaignTutorialComponentArland.c:487
StageReset_SpawnTruck
void StageReset_SpawnTruck(IEntity position=null)
Definition: SCR_CampaignTutorialComponentArland.c:785
OnPlayerFactionResponse
protected void OnPlayerFactionResponse(SCR_PlayerFactionAffiliationComponent component, int factionIndex, bool response)
Definition: SCR_CampaignTutorialComponentArland.c:1435
TrySetPlayerLoadout
protected void TrySetPlayerLoadout(notnull PlayerController playerController, SCR_BasePlayerLoadout loadout)
Definition: SCR_CampaignTutorialComponentArland.c:1495
SCR_ETutorialArlandStageMasters
SCR_ETutorialArlandStageMasters
Definition: SCR_ETutorialArlandStageMasters.c:1
SCR_VehicleDamageManagerComponent
void SCR_VehicleDamageManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_VehicleDamageManagerComponent.c:1720
StageReset_ProcessTruck
void StageReset_ProcessTruck()
Definition: SCR_CampaignTutorialComponentArland.c:793
ECompartmentType
ECompartmentType
Definition: ECompartmentType.c:7
loadout
string loadout
Definition: SCR_ArsenalManagerComponent.c:2
EDamageState
EDamageState
Definition: EDamageState.c:12
SetupVoiceSystem
protected void SetupVoiceSystem()
Definition: SCR_CampaignTutorialComponentArland.c:85
m_Helicopter
protected Vehicle m_Helicopter
Definition: SCR_CampaignTutorialComponentArland.c:69
CharacterMovementState
Definition: CharacterMovementState.c:15
SetPreviewBunker
void SetPreviewBunker(IEntity ent)
Definition: SCR_CampaignTutorialComponentArland.c:459
SCR_EditorModeEntity
Definition: SCR_EditorModeEntity.c:22
SCR_CampaignTutorialArlandStages
Definition: SCR_CampaignTutorialArlandStages.c:2
SCR_CampaignTutorialArlandStageInfo
Definition: SCR_CampaignTutorialArlandStageInfo.c:2
SCR_SpawnPoint
Spawn point entity defines positions on which players can possibly spawn.
Definition: SCR_SpawnPoint.c:27
SCR_PopUpNotification
Takes care of dynamic and static onscreen popups.
Definition: SCR_PopupNotification.c:24
FindEntityByName
IEntity FindEntityByName(string name)
Definition: SCR_ScenarioFrameworkActionsGetters.c:40
RefreshVictimResilience
void RefreshVictimResilience()
Definition: SCR_CampaignTutorialComponentArland.c:1128
m_PreviewBunker
protected IEntity m_PreviewBunker
Definition: SCR_CampaignTutorialComponentArland.c:65
m_ePlayerStance
protected ECharacterStance m_ePlayerStance
Definition: SCR_CampaignTutorialComponentArland.c:51
m_aPlacedCompositions
protected ref array< IEntity > m_aPlacedCompositions
Definition: SCR_CampaignTutorialComponentArland.c:64
ResetStage
void ResetStage(bool forcePlayerReset=false)
Definition: SCR_CampaignTutorialComponentArland.c:1170
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
m_bUsed3PV
protected bool m_bUsed3PV
Definition: SCR_CampaignTutorialComponentArland.c:50
GetPreviewBunker
IEntity GetPreviewBunker()
Definition: SCR_CampaignTutorialComponentArland.c:466
m_aStageConfigs
protected ref array< ref SCR_CampaignTutorialArlandStages > m_aStageConfigs
Definition: SCR_CampaignTutorialComponentArland.c:32
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
Instigator
Definition: Instigator.c:6
m_aStageInfos
protected ref array< ref SCR_CampaignTutorialArlandStageInfo > m_aStageInfos
Definition: SCR_CampaignTutorialComponentArland.c:31
GetPlayerStanceToCheck
ECharacterStance GetPlayerStanceToCheck()
Definition: SCR_CampaignTutorialComponentArland.c:1320
ETargetState
ETargetState
Definition: SCR_FiringRangeTarget.c:7
m_bCheckIsDeployed
protected bool m_bCheckIsDeployed
Definition: SCR_CampaignTutorialComponentArland.c:52
EntitySlotInfo
Adds ability to attach an object to a slot.
Definition: EntitySlotInfo.c:8
GetEntityCompassAngle
float GetEntityCompassAngle(notnull IEntity ent)
Definition: SCR_CampaignTutorialComponentArland.c:444
GetStageDuration
float GetStageDuration()
Definition: SCR_CampaignTutorialComponentArland.c:1972
CheckCharacterInVehicle
bool CheckCharacterInVehicle(ECompartmentType seat)
Definition: SCR_CampaignTutorialComponentArland.c:1706
SupplyTruckInit
void SupplyTruckInit()
Definition: SCR_CampaignTutorialComponentArland.c:729
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition: SCR_BaseGameModeComponent.c:15
AchievementId
AchievementId
Definition: AchievementId.c:12
SCR_CampaignSuppliesComponent
void SCR_CampaignSuppliesComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_CampaignSuppliesComponent.c:327
SCR_SpawnData
Definition: SCR_SpawnData.c:9
SCR_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition: SCR_GameModeCampaign.c:1927
EHudLayers
EHudLayers
Definition: SCR_HUDManagerComponent.c:5
SetPlayerStanceToCheck
void SetPlayerStanceToCheck(ECharacterStance stance)
Definition: SCR_CampaignTutorialComponentArland.c:1299
GetStage
SCR_ECampaignTutorialArlandStage GetStage()
Definition: SCR_CampaignTutorialComponentArland.c:1965
SetPlayerDeployedCheck
void SetPlayerDeployedCheck(bool check)
Definition: SCR_CampaignTutorialComponentArland.c:1306
EGameOverTypes
EGameOverTypes
Definition: EGameOverTypes.c:1
PrepareAccidentArea
protected bool PrepareAccidentArea()
Definition: SCR_CampaignTutorialComponentArland.c:916
CheckRadioPickup
void CheckRadioPickup(IEntity item, BaseInventoryStorageComponent storageOwner)
Definition: SCR_CampaignTutorialComponentArland.c:1590
SetupStageCounts
protected void SetupStageCounts(int stage=0)
Definition: SCR_CampaignTutorialComponentArland.c:2203
m_Player
protected ChimeraCharacter m_Player
Definition: SCR_CampaignTutorialComponentArland.c:40
SCR_XPInfoDisplay
Definition: SCR_XPInfoDisplay.c:2
OnPlayerRegistered
override void OnPlayerRegistered(int playerId)
Register provided client's respawn timer.
Definition: SCR_CampaignTutorialComponentArland.c:1364
SCR_CharacterDamageManagerComponent
Definition: SCR_CharacterDamageManagerComponent.c:18
m_bCheckLeaning
protected bool m_bCheckLeaning
Definition: SCR_CampaignTutorialComponentArland.c:54
SCR_EditorManagerCore
Core component to manage SCR_EditorManagerEntity.
Definition: SCR_EditorManagerCore.c:5
OnPlayerKilled
override void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
Definition: SCR_CampaignTutorialComponentArland.c:531
m_eWaypointTruckPosition
protected SCR_ETutorialArlandSupplyTruckWaypointMode m_eWaypointTruckPosition
Definition: SCR_CampaignTutorialComponentArland.c:59
CountTargetHit
void CountTargetHit(ETargetState state, SCR_FiringRangeTarget target)
Definition: SCR_CampaignTutorialComponentArland.c:1329
SCR_GameModeEndData
Definition: SCR_GameModeEndData.c:4
SetPlayerDeployedBipodCheck
void SetPlayerDeployedBipodCheck(bool check)
Definition: SCR_CampaignTutorialComponentArland.c:1313
m_aWaypoints
protected ref array< Widget > m_aWaypoints
Definition: SCR_CampaignTutorialComponentArland.c:42
m_CampaignGamemode
protected SCR_GameModeCampaign m_CampaignGamemode
Definition: SCR_CampaignTutorialComponentArland.c:36
SCR_SpawnPointSpawnData
Definition: SCR_SpawnPointSpawnData.c:2
RemovePlayerMapMarkers
protected void RemovePlayerMapMarkers()
Definition: SCR_CampaignTutorialComponentArland.c:107
StageReset_DeployMHQ
void StageReset_DeployMHQ()
Definition: SCR_CampaignTutorialComponentArland.c:890
m_bCheckIsDeployedBipod
protected bool m_bCheckIsDeployedBipod
Definition: SCR_CampaignTutorialComponentArland.c:53
m_RepairTruck
protected Vehicle m_RepairTruck
Definition: SCR_CampaignTutorialComponentArland.c:68
m_pGameMode
SCR_BaseGameModeComponentClass m_pGameMode
The game mode entity this component is attached to.
ResetPlayerCharacter
protected void ResetPlayerCharacter(IEntity newPos, ResourceName loadoutResourceName)
Definition: SCR_CampaignTutorialComponentArland.c:1763
OnPostInit
protected override void OnPostInit(IEntity owner)
Editable Mine.
Definition: SCR_CampaignTutorialComponentArland.c:2222
m_bIsFirstRun
protected bool m_bIsFirstRun
Definition: SCR_CampaignTutorialComponentArland.c:67
m_Stage
protected SCR_BaseCampaignTutorialArlandStage m_Stage
Definition: SCR_CampaignTutorialComponentArland.c:34
StageReset_Helicopter
void StageReset_Helicopter()
Definition: SCR_CampaignTutorialComponentArland.c:164
ResetStage_CampaignBuilding
void ResetStage_CampaignBuilding()
Definition: SCR_CampaignTutorialComponentArland.c:1117
OnPlayerSpawnResponse
protected void OnPlayerSpawnResponse(SCR_SpawnRequestComponent requestComponent, SCR_ESpawnResult response)
Definition: SCR_CampaignTutorialComponentArland.c:1467
GetPlayer
ChimeraCharacter GetPlayer()
Definition: SCR_CampaignTutorialComponentArland.c:577
m_eStartingStage
protected SCR_ETutorialArlandStageMasters m_eStartingStage
Definition: SCR_CampaignTutorialComponentArland.c:11
m_iCountOfHits
protected int m_iCountOfHits
Definition: SCR_CampaignTutorialComponentArland.c:46
FlushWaypoints
void FlushWaypoints()
Definition: SCR_CampaignTutorialComponentArland.c:1916
GetPlacingComponent
SCR_PlacingEditorComponent GetPlacingComponent()
Definition: SCR_CampaignTutorialComponentArland.c:502
m_MobileAssemblyComponent
protected SCR_CampaignMobileAssemblyComponent m_MobileAssemblyComponent
Definition: SCR_CampaignTutorialComponentArland.c:55
GetPlayerRadio
BaseRadioComponent GetPlayerRadio()
Definition: SCR_CampaignTutorialComponentArland.c:1552
m_Jeep
protected Vehicle m_Jeep
Definition: SCR_CampaignTutorialComponentArland.c:71
StageReset_ResetSeizing
void StageReset_ResetSeizing()
Definition: SCR_CampaignTutorialComponentArland.c:819
OnSupplyTruckLeft
void OnSupplyTruckLeft(IEntity vehicle)
Definition: SCR_CampaignTutorialComponentArland.c:1723
OnModeAdded
void OnModeAdded(SCR_EditorModeEntity modeEntity)
Definition: SCR_CampaignTutorialComponentArland.c:473
m_bIsMapOpen
protected bool m_bIsMapOpen
Definition: SCR_CampaignTutorialComponentArland.c:49
m_PlacingComponent
protected SCR_PlacingEditorComponent m_PlacingComponent
Definition: SCR_CampaignTutorialComponentArland.c:66
OnPlacedPreview
protected void OnPlacedPreview(int prefabID, SCR_EditableEntityComponent ent)
Definition: SCR_CampaignTutorialComponentArland.c:508
OnTruckDamaged
protected void OnTruckDamaged(EDamageState state)
Definition: SCR_CampaignTutorialComponentArland.c:325
SCR_ECampaignTutorialArlandStage
SCR_ECampaignTutorialArlandStage
Definition: SCR_ECampaignTutorialArlandStage.c:1
MoveInVehicle
void MoveInVehicle(string vehName, ECompartmentType seat)
Definition: SCR_CampaignTutorialComponentArland.c:1675
GetHummer
Vehicle GetHummer()
Definition: SCR_CampaignTutorialComponentArland.c:1181
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
GetRepairTruck
Vehicle GetRepairTruck()
Definition: SCR_CampaignTutorialComponentArland.c:1188
GetWas3rdPersonViewUsed
bool GetWas3rdPersonViewUsed()
Definition: SCR_CampaignTutorialComponentArland.c:1666
EEditorMode
EEditorMode
Editor mode that defines overall functionality.
Definition: EEditorMode.c:5
OnHmwDamaged
protected void OnHmwDamaged(EDamageState state)
Definition: SCR_CampaignTutorialComponentArland.c:354
Faction
Definition: Faction.c:12
GetAllTargets
array< SCR_FiringRangeTarget > GetAllTargets()
Definition: SCR_CampaignTutorialComponentArland.c:1278
OnPlayerSpawnFinalize_S
override void OnPlayerSpawnFinalize_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
Definition: SCR_CampaignTutorialComponentArland.c:1833
m_eLastStage
protected SCR_ECampaignTutorialArlandStage m_eLastStage
Definition: SCR_CampaignTutorialComponentArland.c:39
m_wFadeOut
protected ImageWidget m_wFadeOut
Definition: SCR_CampaignTutorialComponentArland.c:35
SCR_PlayerFactionAffiliationComponent
Definition: SCR_PlayerFactionAffiliationComponent.c:16
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
m_iStagesCnt
protected int m_iStagesCnt
Definition: SCR_CampaignTutorialComponentArland.c:41
SCR_HitZone
Definition: SCR_HitZone.c:1
SCR_DamageContext
Definition: SCR_DamageContext.c:7
GetSupplyTruckComponent
SCR_CampaignSuppliesComponent GetSupplyTruckComponent()
Definition: SCR_CampaignTutorialComponentArland.c:2176
FindBuiltComposition
IEntity FindBuiltComposition(string prefabName)
Definition: SCR_CampaignTutorialComponentArland.c:385
GetHUDManager
SCR_HUDManagerComponent GetHUDManager()
Definition: game.c:1196
OnPlayerLoadoutResponse
protected void OnPlayerLoadoutResponse(SCR_PlayerLoadoutComponent component, int loadoutIndex, bool response)
Definition: SCR_CampaignTutorialComponentArland.c:1455
ResetStage_VehiclesHeavy
void ResetStage_VehiclesHeavy()
Definition: SCR_CampaignTutorialComponentArland.c:1017
SetActiveStage
void SetActiveStage(int i)
Definition: SCR_CampaignTutorialComponentArland.c:408
SCR_VoiceoverSystem
Definition: SCR_VoiceoverSystem.c:2
SetWaypointTruckPosition
void SetWaypointTruckPosition(SCR_ETutorialArlandSupplyTruckWaypointMode mode)
Definition: SCR_CampaignTutorialComponentArland.c:1358
Check3rdPersonViewUsed
void Check3rdPersonViewUsed()
Definition: SCR_CampaignTutorialComponentArland.c:1645
m_Radio
protected BaseRadioComponent m_Radio
Definition: SCR_CampaignTutorialComponentArland.c:48
SCR_CampaignFaction
Definition: SCR_CampaignFaction.c:2
DelayedPopup
void DelayedPopup(string text="", string subtitle="", float duration=SCR_PopUpNotification.DEFAULT_DURATION, string param1="", string param2="", string subtitleParam1="", string subtitleParam2="")
Definition: SCR_CampaignTutorialComponentArland.c:1818
SCR_EPopupMsgFilter
SCR_EPopupMsgFilter
Definition: SCR_PopupNotification.c:486
~SCR_CampaignTutorialArlandComponent
void ~SCR_CampaignTutorialArlandComponent()
Definition: SCR_CampaignTutorialComponentArland.c:2308
m_aFiringRangeTargets
protected ref array< SCR_FiringRangeTarget > m_aFiringRangeTargets
Definition: SCR_CampaignTutorialComponentArland.c:44
SetStagesComplete
void SetStagesComplete(int tutorialNumber, bool completed)
Definition: SCR_CampaignTutorialComponentArland.c:143
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
CollectAllTargets
protected bool CollectAllTargets(IEntity ent)
Definition: SCR_CampaignTutorialComponentArland.c:1265
EDamageType
EDamageType
Definition: EDamageType.c:12
m_ActiveConfig
protected SCR_CampaignTutorialArlandStages m_ActiveConfig
Definition: SCR_CampaignTutorialComponentArland.c:61
TrySpawnPlayer
protected void TrySpawnPlayer(notnull PlayerController playerController, notnull SCR_SpawnPoint spawnPoint)
Definition: SCR_CampaignTutorialComponentArland.c:1510
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
SCR_ETutorialArlandSupplyTruckWaypointMode
SCR_ETutorialArlandSupplyTruckWaypointMode
Definition: SCR_ETutorialArlandSupplyTruckWaypointMode.c:1
FinishStage
void FinishStage(SCR_BaseCampaignTutorialArlandStage stage, SCR_ECampaignTutorialArlandStage nextStage=-1)
Definition: SCR_CampaignTutorialComponentArland.c:1981
m_iActiveStage
protected int m_iActiveStage
Definition: SCR_CampaignTutorialComponentArland.c:33
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
SetConfigEnvironmentOverride
void SetConfigEnvironmentOverride()
Definition: SCR_CampaignTutorialComponentArland.c:592
ToggleWaypoints
void ToggleWaypoints(bool hide)
Definition: SCR_CampaignTutorialComponentArland.c:2078
OnMapOpen
void OnMapOpen(MapConfiguration config)
Definition: SCR_CampaignTutorialComponentArland.c:1531
SetCheckLeaning
void SetCheckLeaning(bool check)
Definition: SCR_CampaignTutorialComponentArland.c:1292
MovePlayer
void MovePlayer(notnull IEntity newPos, ResourceName loadoutResourceName)
Definition: SCR_CampaignTutorialComponentArland.c:1754
SpawnAsset
IEntity SpawnAsset(string name, ResourceName type, IEntity spawnpoint=null)
Definition: SCR_CampaignTutorialComponentArland.c:1199
FiringRangeInit
void FiringRangeInit()
Definition: SCR_CampaignTutorialComponentArland.c:663
OnVehicleDamaged
protected void OnVehicleDamaged(EDamageState state)
Definition: SCR_CampaignTutorialComponentArland.c:255
m_bMovedOutOfVehicleByScript
protected bool m_bMovedOutOfVehicleByScript
Definition: SCR_CampaignTutorialComponentArland.c:56
SetStage
void SetStage(SCR_ECampaignTutorialArlandStage stage, SCR_ECampaignTutorialArlandStage lastStage=0)
Definition: SCR_CampaignTutorialComponentArland.c:2016
DamageManagerComponent
Definition: DamageManagerComponent.c:12
OnEngineStoppedHmw
protected void OnEngineStoppedHmw()
Definition: SCR_CampaignTutorialComponentArland.c:297
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition: DebugMenuID.c:3
OnEngineStoppedTruck
protected void OnEngineStoppedTruck()
Definition: SCR_CampaignTutorialComponentArland.c:311
SCR_PlacingEditorComponent
Definition: SCR_PlacingEditorComponent.c:118
OnMapClose
void OnMapClose(MapConfiguration config)
Definition: SCR_CampaignTutorialComponentArland.c:1538
m_fDelayedControlSchemeChangeRunning
protected bool m_fDelayedControlSchemeChangeRunning
Definition: SCR_CampaignTutorialComponentArland.c:57
SCR_ArsenalComponent
Definition: SCR_ArsenalComponent.c:9
m_bPlayerSpawned
protected bool m_bPlayerSpawned
Definition: SCR_CampaignTutorialComponentArland.c:37
position
vector position
Definition: SCR_DestructibleTreeV2.c:30
m_aTutorialBool
protected ref array< bool > m_aTutorialBool
Definition: SCR_CampaignTutorialComponentArland.c:75
GetVoiceSystem
SCR_VoiceoverSystem GetVoiceSystem()
Definition: SCR_CampaignTutorialComponentArland.c:101
m_eStage
protected SCR_ECampaignTutorialArlandStage m_eStage
Definition: SCR_CampaignTutorialComponentArland.c:38
SCR_BasePlayerLoadout
Definition: SCR_BasePlayerLoadout.c:2
UserActionContext
Definition: UserActionContext.c:15
OnObjectDestroyed
protected void OnObjectDestroyed(EDamageState state)
Definition: SCR_CampaignTutorialComponentArland.c:517
ResetStage_ShootingRange
void ResetStage_ShootingRange()
Definition: SCR_CampaignTutorialComponentArland.c:1100
m_fStageTimestamp
protected float m_fStageTimestamp
Definition: SCR_CampaignTutorialComponentArland.c:60
SCR_BaseGameModeComponentClass
Definition: SCR_BaseGameModeComponent.c:2
FindSupplyTruck
bool FindSupplyTruck(IEntity ent)
Definition: SCR_CampaignTutorialComponentArland.c:2185
OnEngineStoppedJeep
protected void OnEngineStoppedJeep()
Definition: SCR_CampaignTutorialComponentArland.c:283
m_WaypointWidget
protected ResourceName m_WaypointWidget
Definition: SCR_CampaignTutorialComponentArland.c:62
m_bStagesComplete
protected bool m_bStagesComplete
Definition: SCR_CampaignTutorialComponentArland.c:74
GetActiveStage
int GetActiveStage()
Definition: SCR_CampaignTutorialComponentArland.c:401
UpdateSupplyTruckWaypoint
void UpdateSupplyTruckWaypoint(IEntity waypoint, bool useTruck, string contextName, vector offset=vector.Zero)
Definition: SCR_CampaignTutorialComponentArland.c:1563
SetFirstRun
void SetFirstRun(bool firstRun)
Definition: SCR_CampaignTutorialComponentArland.c:1626
DeleteVehicleWhenEmpty
void DeleteVehicleWhenEmpty(Vehicle veh)
Definition: SCR_CampaignTutorialComponentArland.c:1247
UpdateWaypoints
void UpdateWaypoints(array< IEntity > waypoints, float heightOffset)
Definition: SCR_CampaignTutorialComponentArland.c:2090
CreateWaypoint
void CreateWaypoint()
Definition: SCR_CampaignTutorialComponentArland.c:1890
IsCharacterLeaning
bool IsCharacterLeaning()
Definition: SCR_CampaignTutorialComponentArland.c:1634
OnInputDeviceChangedDelayed
void OnInputDeviceChangedDelayed()
Definition: SCR_CampaignTutorialComponentArland.c:568
EOnFrame
override void EOnFrame(IEntity owner, float timeSlice)
Definition: SCR_CampaignTutorialComponentArland.c:2281
SCR_CampaignMilitaryBaseComponent
Definition: SCR_CampaignMilitaryBaseComponent.c:38
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
SCR_BaseGameModeComponent
void SCR_BaseGameModeComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_BaseGameModeComponent.c:199
SCR_EditorManagerEntity
Definition: SCR_EditorManagerEntity.c:26
FadeToBlack
void FadeToBlack(bool fadeOut)
Definition: SCR_CampaignTutorialComponentArland.c:585
m_bFirstStageSet
protected bool m_bFirstStageSet
Definition: SCR_CampaignTutorialComponentArland.c:43