Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ScenarioFrameworkActionQRFDispacher.c
Go to the documentation of this file.
2 {
3  DEAD_UNITS = 0,
6 }
7 
9 class SCR_ScenarioFrameworkActionQRFDispacher : SCR_ScenarioFrameworkActionBase
10 {
11  [Attribute("X_QRF", UIWidgets.Auto, "Name of the QRF layer that contains pool of spawn points")]
12  protected string m_sQRFLayerName;
13 
14  [Attribute(SCR_EQRFThresholdType.DEAD_UNITS.ToString(), UIWidgets.ComboBox, desc: "Type of the threshold threshold that will be used to determine if it should spawn QRF", "", ParamEnumArray.FromEnum(SCR_EQRFThresholdType))]
15  protected SCR_EQRFThresholdType m_eThresholdType;// <= REMAINING_UNITS, DEAD_UNITS, PROC_LOST_UNITS
16 
17  [Attribute("5", UIWidgets.Auto, "Numeric value which interpretation depends on the m_eThresholdType f.e. if Threshold Type == REMAINING_UNITS then if Threshold >= (number of units alive) then send QRF")]
18  protected int m_iThreshold;
19 
20  [Attribute("5", UIWidgets.Auto, "How many times this Area can send QRF where -1 == unlimited")]
21  protected int m_iNumberOfAvailableQRFWaves;// - even if we have more QRF groups but we are out of waves then there wont be new QRF sent
22 
23  [Attribute("1", UIWidgets.Auto, "How much threat level has to be increased each time that threshold is reached")]
24  protected float m_fThreatLevelEscalation;
25 
26  [Attribute("0", UIWidgets.Auto, "How long (in seconds) game should wait when threshold is reached before spawning QRF where 0 == imminently", "0 inf 1")]
27  protected float m_fQRFSpawnDelay;
28 
29  [Attribute("300", UIWidgets.Auto, "How long (in seconds) game should wait until next QRF will be possible to be requested where 0 == no delay", "0 inf 1")]
30  protected float m_fQRFNextWaveDelay;
31 
32  [Attribute(desc: "List of possible QRF groups to spawn")]
33  protected ref array<ref SCR_QRFGroupConfig> m_aGroupList;
34 
35  [Attribute(desc: "List defining maximal distance for QRF unit of given type")]
36  protected ref array<ref SCR_QRFTypeMaxDistance> m_aQRFMaxDistanceConfig;
37 
38  [Attribute(desc: "List of waypoints for QRF that will be applied in order (to aplicable group type)")]
39  protected ref array<ref SCR_QRFWaypointConfig> m_aWPConfig;
40 
41  [Attribute(desc: "Sound event name that will be played on dead soldier entity when QRF is requested")]
42  protected string m_sQRFRequestedSoundEventName;
43 
44  [Attribute(desc: "Sound event name that will be played on dead soldier entity when QRF is spawned")]
45  protected string m_sQRFSentSoundEventName;
46 
47  [Attribute(desc: "'*.acp' file which contains desired sound events", params: "acp")]
48  protected ResourceName m_sSoundProjectFile;
49 
50  protected ref array<SCR_ScenarioFrameworkQRFSlotAI> m_aQRFSpawnPoints = {};
51  protected SCR_ScenarioFrameworkArea m_AreaFramework;
52  protected SCR_ScenarioFrameworkLayerBase m_QRFLayer;
53  protected int m_iNumberOfSoldiersInTheArea;
54  protected int m_iRemovedSoldier;
55  protected float m_fNextWaveDelayClock;
56  protected float m_fThreatLevel = 1;
57  protected int m_iSpawnTickets;
58  protected bool m_bWaitingForDelayedSpawn;
59  protected bool m_bWaitingForNextWave;
60  protected vector m_vTargetPosition;
61  protected ref array<ref SCR_QRFVehicleSpawnConfig> m_aVehicleSpawnQueueConfig = {};
62 
63  //------------------------------------------------------------------------------------------------
66  protected bool WatchAIGroup(IEntity entities)
67  {
68  return WatchAIGroup({entities});
69  }
70 
71  //------------------------------------------------------------------------------------------------
74  protected bool WatchAIGroup(array<IEntity> entities)
75  {
76  if (!entities)
77  return false;
78 
79  bool result;
80  SCR_AIGroup aiGroup;
81  foreach (IEntity entity : entities)
82  {
83  aiGroup = GetAIGroup(entity);
84  if (!aiGroup)
85  continue;
86 
87  aiGroup.GetOnAgentRemoved().Remove(OnGroupCompositionChanged);
88  aiGroup.GetOnAgentRemoved().Insert(OnGroupCompositionChanged);
89  aiGroup.GetOnAllDelayedEntitySpawned().Remove(OnDelayedGroupMembersSpawned);
90  aiGroup.GetOnAllDelayedEntitySpawned().Insert(OnDelayedGroupMembersSpawned);
91  if (aiGroup.GetAgentsCount() == 0)
92  m_iNumberOfSoldiersInTheArea++;
93  else
94  m_iNumberOfSoldiersInTheArea += aiGroup.GetAgentsCount();
95 
96  result = true;
97  }
98 
99  return result;
100  }
101 
102  //------------------------------------------------------------------------------------------------
104  SCR_AIGroup GetAIGroup(IEntity entity)
105  {
106  if (!entity)
107  return null;
108 
109  SCR_AIGroup aiGroup = SCR_AIGroup.Cast(entity);
110  if (aiGroup)
111  return aiGroup;
112 
113  AIAgent agent = AIAgent.Cast(entity);
114  if (agent)
115  return SCR_AIGroup.Cast(agent.GetParentGroup());
116 
117  if (!SCR_ChimeraCharacter.Cast(entity))
118  return null;
119 
120  AIControlComponent control = AIControlComponent.Cast(entity.FindComponent(AIControlComponent));
121  if (!control)
122  return null;
123 
124  agent = control.GetControlAIAgent();
125  if (!agent)
126  return null;
127 
128  return SCR_AIGroup.Cast(agent.GetParentGroup());
129  }
130 
131  //------------------------------------------------------------------------------------------------
132  protected void OnDelayedGroupMembersSpawned(SCR_AIGroup group)
133  {
134  m_iNumberOfSoldiersInTheArea++;
135  }
136 
137  //------------------------------------------------------------------------------------------------
138  protected void OnGroupCompositionChanged(SCR_AIGroup group, AIAgent agent)
139  {
140  if (!agent)
141  return;
142 
143  if (!agent.GetControlledEntity())
144  return;
145 
146  SCR_ChimeraCharacter char = SCR_ChimeraCharacter.Cast(agent.GetControlledEntity());
147  if (!char)
148  return;
149 
151  if (!controller || controller.GetLifeState() != ECharacterLifeState.DEAD)
152  return;
153 
154  vector tmpVec = agent.GetControlledEntity().GetOrigin();
155  if (m_vTargetPosition == vector.Zero)
156  m_vTargetPosition = tmpVec;
157  else
158  m_vTargetPosition = vector.Lerp(m_vTargetPosition, tmpVec, 0.95);
159 
160  m_iRemovedSoldier++;
161  ThresholdValidation(char)
162  }
163 
164  //------------------------------------------------------------------------------------------------
165  protected void ThresholdValidation(IEntity killedEntity = null)
166  {
167  bool startQRFProcedure;
168  switch (m_eThresholdType)
169  {
170  case SCR_EQRFThresholdType.DEAD_UNITS :
171  {
172  if (m_iRemovedSoldier >= m_iThreshold)
173  startQRFProcedure = true;
174 
175  } break;
176 
177  case SCR_EQRFThresholdType.REMAINING_UNITS :
178  {
179  if (m_iNumberOfSoldiersInTheArea - m_iRemovedSoldier <= m_iThreshold)
180  startQRFProcedure = true;
181 
182  } break;
183 
184  case SCR_EQRFThresholdType.PROC_LOST_UNITS :
185  {
186  if (m_iNumberOfSoldiersInTheArea > 0 && (m_iNumberOfSoldiersInTheArea - m_iRemovedSoldier) * 100 / m_iNumberOfSoldiersInTheArea <= m_iThreshold)
187  startQRFProcedure = true;
188 
189  } break;
190  }
191 
192  if (!startQRFProcedure)
193  return;
194 
195  if (m_bWaitingForDelayedSpawn)
196  {
197  if (!m_bWaitingForNextWave && m_iNumberOfAvailableQRFWaves - 1 > 0 && m_fQRFSpawnDelay > 0)
198  {
199  float callTime = m_fNextWaveDelayClock - GetGame().GetWorld().GetWorldTime();
200  if (callTime < 0)
201  callTime = 0;
202 
203  m_bWaitingForNextWave = true;
204  GetGame().GetCallqueue().CallLater(StartQRFProcedure, callTime, param1: killedEntity);
205  }
206  return;
207  }
208 
209  if (m_bWaitingForNextWave)
210  return;
211 
212  StartQRFProcedure(killedEntity);
213  }
214 
215  //------------------------------------------------------------------------------------------------
216  protected void ThresholdHandling()
217  {
218  switch (m_eThresholdType)
219  {
220  case SCR_EQRFThresholdType.DEAD_UNITS :
221  {
222  m_iRemovedSoldier = 0;
223  } break;
224 
225  case SCR_EQRFThresholdType.REMAINING_UNITS :
226  {
227  m_iNumberOfSoldiersInTheArea -= m_iRemovedSoldier;
228  } break;
229  }
230  }
231 
232  //------------------------------------------------------------------------------------------------
233  protected void StartQRFProcedure(IEntity killedEntity)
234  {
235  if (m_iNumberOfAvailableQRFWaves == 0)
236  return;
237 
238  float time = GetGame().GetWorld().GetWorldTime();
239  if (m_fNextWaveDelayClock > time && !m_bWaitingForDelayedSpawn && !m_bWaitingForNextWave)
240  return;
241 
242  if (m_fQRFSpawnDelay > 0)
243  {
244  if (!m_bWaitingForDelayedSpawn)
245  {
246  if (m_bWaitingForNextWave)
247  m_bWaitingForNextWave = false;
248 
249  ThresholdHandling();
250  m_fNextWaveDelayClock = time + m_fQRFNextWaveDelay * 1000;
251  m_bWaitingForDelayedSpawn = true;
252  GetGame().GetCallqueue().CallLater(StartQRFProcedure, m_fQRFSpawnDelay * 1000, param1: killedEntity);
253  if (killedEntity)
254  DoPlaySoundOnEntityPosition(killedEntity, m_sSoundProjectFile, m_sQRFRequestedSoundEventName);
255 
256  return;
257  }
258  else
259  {
260  m_bWaitingForDelayedSpawn = false;
261  }
262  }
263  else
264  {
265  ThresholdHandling();
266  m_fNextWaveDelayClock = time + m_fQRFNextWaveDelay * 1000;
267  }
268 
269  if (killedEntity)
270  DoPlaySoundOnEntityPosition(killedEntity, m_sSoundProjectFile, m_sQRFSentSoundEventName);
271 
272  m_iNumberOfSoldiersInTheArea -= m_iRemovedSoldier;
273  m_iSpawnTickets += m_fThreatLevel;
274  m_fThreatLevel += m_fThreatLevelEscalation;
275  if (m_aQRFSpawnPoints.IsEmpty())
276  return;
277 
278  while (m_iSpawnTickets > 0)
279  {
280  SCR_QRFGroupConfig selectedGroup = SelectRandomGroup(m_iSpawnTickets);
281  if (!selectedGroup)
282  {
283  m_iSpawnTickets--;
284  continue;
285  }
286 
287  m_iSpawnTickets -= selectedGroup.GetSpawnCost();
288  SCR_ScenarioFrameworkQRFSlotAI selectedSpawnPoint = SelectRandomSpawnpoint(m_aQRFSpawnPoints, selectedGroup.GetGroupType());
289  if (!selectedSpawnPoint)
290  {
291  m_iSpawnTickets--;
292  continue;
293  }
294 
295  if (selectedGroup.GetNumberOfAvailableGroups() > 0)
296  selectedGroup.SetNumberOfAvailableGroups(selectedGroup.GetNumberOfAvailableGroups() - 1);
297 
298  selectedSpawnPoint.SetObjectToSpawn(selectedGroup.GetGroupPrefabName());
299  selectedSpawnPoint.SetEnableRepeatedSpawn(true);
300  selectedSpawnPoint.SetIsTerminated(false);
301  if (selectedSpawnPoint.GetNumberOfExistingWaypoints())
302  selectedSpawnPoint.ClearWaypoints();
303 
304  selectedSpawnPoint.Init(m_AreaFramework, SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT);
305  IEntity spawnedEntity = selectedSpawnPoint.GetSpawnedEntity();
306  SCR_AIGroup aiGroup = GetAIGroup(spawnedEntity);
307  if (aiGroup)
308  {
309  if (WatchAIGroup(aiGroup))
310  {
311  vector wpPosition;
312  foreach (SCR_QRFWaypointConfig wp : m_aWPConfig)
313  {
314  if (wp.GetOrderType() != SCR_EQRFGroupOrderType.ANY && wp.GetOrderType() != selectedGroup.GetGroupType())
315  continue;
316 
317  if (wp.GetDistanceOffsetToTargetLocation())
318  wpPosition = SCR_Math3D.MoveTowards(m_vTargetPosition, selectedSpawnPoint.GetOwner().GetOrigin(), wp.GetDistanceOffsetToTargetLocation());
319  else
320  wpPosition = m_vTargetPosition;
321 
322  if (float.AlmostEqual(vector.DistanceXZ(wpPosition, selectedSpawnPoint.GetOwner().GetOrigin()), 0, 1))
323  continue;
324 
325  wpPosition[1] = GetGame().GetWorld().GetSurfaceY(wpPosition[0], wpPosition[2]);
326  AIWaypoint aiWP = selectedSpawnPoint.CreateWaypoint(wpPosition, wp.GetWaypointPrefabName());
327  if (aiWP)
328  aiGroup.AddWaypoint(aiWP);
329  }
330  }
331  }
332  else
333  {
334  if (Vehicle.Cast(spawnedEntity))
335  {
336  SCR_BaseCompartmentManagerComponent compartmentManager = SCR_BaseCompartmentManagerComponent.Cast(spawnedEntity.FindComponent(SCR_BaseCompartmentManagerComponent));
337  if (compartmentManager)
338  {
339  compartmentManager.GetOnDoneSpawningDefaultOccupants().Insert(OnFinishedSpawningVehicleOccupants);
340  array<ECompartmentType> compartmentTypes = {ECompartmentType.Pilot, ECompartmentType.Turret};
341  if (selectedGroup.GetGroupType() == SCR_EQRFGroupType.MOUNTED_INFANTRY)
342  compartmentTypes.Insert(ECompartmentType.Cargo);
343 
344  m_aVehicleSpawnQueueConfig.Insert(new SCR_QRFVehicleSpawnConfig(compartmentManager, selectedGroup.GetGroupType(), m_vTargetPosition, selectedSpawnPoint));
345  compartmentManager.SpawnDefaultOccupants(compartmentTypes);
346  }
347  }
348  }
349  }
350  if (m_iNumberOfAvailableQRFWaves > 0)
351  m_iNumberOfAvailableQRFWaves--;
352 
353  m_vTargetPosition = vector.Zero;
354  }
355 
356  //------------------------------------------------------------------------------------------------
357  protected SCR_QRFGroupConfig SelectRandomGroup(int maxCost)
358  {
359  //first check if there even are groups that we can afford
360  bool availableGroupAtFullPrice;
361  array<SCR_QRFGroupConfig> verifiedList = {};
362  foreach (SCR_QRFGroupConfig group : m_aGroupList)
363  {
364  if (!group)
365  continue;
366 
367  if (group.GetNumberOfAvailableGroups() == -1 || group.GetNumberOfAvailableGroups() > 0)
368  {
369  if (group.GetSpawnCost() == maxCost)
370  {
371  if (!availableGroupAtFullPrice)
372  {
373  availableGroupAtFullPrice = true;
374  verifiedList.Clear();
375  }
376  verifiedList.Insert(group);
377  }
378  else if (group.GetSpawnCost() < maxCost && !availableGroupAtFullPrice)
379  {
380  verifiedList.Insert(group);
381  }
382  }
383  }
384 
385  if (availableGroupAtFullPrice)
386  return verifiedList.GetRandomElement();
387 
388  SCR_QRFGroupConfig returnedGroup;
389  if (!verifiedList.IsEmpty())
390  {
391  int i, numOfTries, count = verifiedList.Count();
392  while (numOfTries < 10)
393  {
394  i = Math.RandomInt(0, count);
395  if (!returnedGroup || returnedGroup && returnedGroup.GetSpawnCost() < verifiedList[i].GetSpawnCost())
396  returnedGroup = verifiedList[i];
397 
398  numOfTries++;
399  }
400  }
401 
402  return returnedGroup;
403  }
404 
405  //------------------------------------------------------------------------------------------------
406  protected SCR_ScenarioFrameworkQRFSlotAI SelectRandomSpawnpoint(array<SCR_ScenarioFrameworkQRFSlotAI> aListOfSpawnPoints, SCR_EQRFGroupType searchedType)
407  {
408  float maxSpawnDistance = GetMaxDistanceForUnitType(searchedType);
409  array<SCR_ScenarioFrameworkQRFSlotAI> verifiedList = {};
410  foreach (SCR_ScenarioFrameworkQRFSlotAI spawn : aListOfSpawnPoints)
411  {
412  if (spawn.GetGroupType() ~& searchedType)
413  continue;
414 
415  if (!CheckSpawnPointSafeZones(spawn.GetOwner().GetOrigin(), spawn.GetSpawnSafeZones(), searchedType))
416  continue;
417 
418  if (maxSpawnDistance > -1 && vector.Distance(m_vTargetPosition, spawn.GetOwner().GetOrigin()) > maxSpawnDistance)
419  continue;
420 
421  verifiedList.Insert(spawn);
422  }
423 
424  int index = -1;
425  if (verifiedList.Count() > 0)
426  return verifiedList.GetRandomElement();
427 
428  float distanceToTarget, cloasestPosDistance = float.MAX;
429  foreach (int i, SCR_ScenarioFrameworkQRFSlotAI spawn : aListOfSpawnPoints) //int i = aListOfSpawnPoints.Count() - 1; i >= 0; i--)
430  {
431  if (spawn.GetGroupType() ~& searchedType)
432  continue;
433 
434  if (!CheckSpawnPointSafeZones(spawn.GetOwner().GetOrigin(), spawn.GetSpawnSafeZones(), searchedType))
435  continue;
436 
437  distanceToTarget = vector.Distance(m_vTargetPosition, spawn.GetOwner().GetOrigin());
438  if (distanceToTarget < cloasestPosDistance)
439  {
440  cloasestPosDistance = distanceToTarget;
441  index = i;
442  }
443  }
444 
445  if (index == -1)
446  return null;
447 
448  return aListOfSpawnPoints[index];
449  }
450 
451  //------------------------------------------------------------------------------------------------
453  protected bool CheckSpawnPointSafeZones(vector spawnPointPosition, array<ref SCR_QRFSpawnSafeZone> spawnSafeZones, SCR_EQRFGroupType searchedType)
454  {
455  if (spawnSafeZones.IsEmpty())
456  return true;
457 
458  array<vector> aObserversPositions = {};
459  array<int> playerIds = {};
460  PlayerManager playerManager = GetGame().GetPlayerManager();
461  IEntity player;
462  SCR_DamageManagerComponent damageManager;
463  playerManager.GetPlayers(playerIds);
464 
465  foreach (int playerId : playerIds)
466  {
467  player = playerManager.GetPlayerControlledEntity(playerId);
468  if (!player)
469  continue;
470 
471  damageManager = SCR_DamageManagerComponent.GetDamageManager(player);
472  if (damageManager && damageManager.GetState() != EDamageState.DESTROYED)
473  aObserversPositions.Insert(player.GetOrigin());
474  }
475 
476  foreach (SCR_QRFSpawnSafeZone safeZone : spawnSafeZones)
477  {
478  if (safeZone.GetGroupType() != searchedType)
479  continue;
480 
481  foreach (vector observerPos : aObserversPositions)
482  {
483  if (vector.Distance(observerPos, spawnPointPosition) < safeZone.GetMinDistanceToClosestObserver())
484  return false;
485  }
486  }
487 
488  return true;
489  }
490 
491  //------------------------------------------------------------------------------------------------
492  protected float GetMaxDistanceForUnitType(SCR_EQRFGroupType unitType)
493  {
494  foreach (SCR_QRFTypeMaxDistance conf : m_aQRFMaxDistanceConfig)
495  {
496  if (conf.GetGroupType() == unitType)
497  return conf.GetMaxSpawnDistance();
498  }
499  return -1;
500  }
501 
502  //------------------------------------------------------------------------------------------------
504  protected void OnFinishedSpawningVehicleOccupants(SCR_BaseCompartmentManagerComponent compartmentManager, array<IEntity> occupants, bool wasCanceled)
505  {
506  compartmentManager.GetOnDoneSpawningDefaultOccupants().Remove(OnFinishedSpawningVehicleOccupants);
507  if (wasCanceled)
508  return;
509 
510  if (occupants.IsEmpty())
511  return;
512 
513  SCR_ChimeraCharacter occupant = SCR_ChimeraCharacter.Cast(occupants[0]);
514  if (!occupant)
515  return;
516 
517  AIControlComponent control = AIControlComponent.Cast(occupant.FindComponent(AIControlComponent));
518  if (!control)
519  return;
520 
521  AIAgent agent = control.GetControlAIAgent();
522  if (!agent)
523  return;
524 
525  SCR_AIGroup aiGroup = SCR_AIGroup.Cast(agent.GetParentGroup());
526  if (!aiGroup)
527  return;
528 
529  if (!WatchAIGroup(aiGroup))
530  return;
531 
532  vector wpPosition;
533  for (int i, count = m_aVehicleSpawnQueueConfig.Count(); i < count; i++)
534  {
535  if (m_aVehicleSpawnQueueConfig[i].m_VehicleCompartmentMGR != compartmentManager)
536  continue;
537 
538  foreach (SCR_QRFWaypointConfig wp : m_aWPConfig)
539  {
540  if (wp.GetOrderType() != SCR_EQRFGroupOrderType.ANY && wp.GetOrderType() != m_aVehicleSpawnQueueConfig[i].m_eGroupType)
541  continue;
542 
543  if (wp.GetDistanceOffsetToTargetLocation())
544  wpPosition = SCR_Math3D.MoveTowards(m_aVehicleSpawnQueueConfig[i].m_vTargetPosition, occupant.GetOrigin(), wp.GetDistanceOffsetToTargetLocation());
545  else
546  wpPosition = m_aVehicleSpawnQueueConfig[i].m_vTargetPosition;
547 
548  if (float.AlmostEqual(vector.DistanceXZ(wpPosition, occupant.GetOrigin()), 0, 1))
549  continue;
550 
551  AIWaypoint aiWP = m_aVehicleSpawnQueueConfig[i].m_Slot.CreateWaypoint(wpPosition, wp.GetWaypointPrefabName());
552  if (aiWP)
553  aiGroup.AddWaypoint(aiWP);
554  }
555  m_aVehicleSpawnQueueConfig.Remove(i);
556  break;
557  }
558  }
559 
560  //------------------------------------------------------------------------------------------------
562  protected void DoPlaySoundOnEntityPosition(IEntity entity, string soundFileName, string soundEventName)
563  {
564  if (!entity)
565  return;
566 
567  if (SCR_StringHelper.IsEmptyOrWhiteSpace(soundFileName))
568  return;
569 
570  if (SCR_StringHelper.IsEmptyOrWhiteSpace(soundEventName))
571  return;
572 
573  SCR_GameModeSFManager sfManager = SCR_GameModeSFManager.Cast(GetGame().GetGameMode().FindComponent(SCR_GameModeSFManager));
574  if (!sfManager)
575  return;
576 
577  SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.Cast(entity.FindComponent(SCR_GadgetManagerComponent));
578  if (!gadgetManager)
579  return;
580 
581  if (!gadgetManager.GetGadgetByType(EGadgetType.RADIO))
582  return;
583 
584  sfManager.PlaySoundOnEntityPosition(entity, soundFileName, soundEventName);
585  }
586 
587  //------------------------------------------------------------------------------------------------
588  override void Init(IEntity entity)
589  {
591  if (!thisLayer)
592  return;
593 
594  m_AreaFramework = thisLayer.GetParentArea();
595  if (!m_AreaFramework)
596  return;
597 
598  super.Init(entity);
599  }
600 
601  //------------------------------------------------------------------------------------------------
602  override void OnActivate(IEntity object)
603  {
604  if (!CanActivate())
605  return;
606 
607  array<SCR_ScenarioFrameworkLayerBase> childLayers = m_AreaFramework.GetChildrenEntities();
608  if (childLayers.IsEmpty())
609  {
610  IEntity child = m_AreaFramework.GetOwner().GetChildren();
612  while (child)
613  {
614  layer = SCR_ScenarioFrameworkLayerBase.Cast(child.FindComponent(SCR_ScenarioFrameworkLayerBase));
615  if (layer)
616  childLayers.Insert(layer);
617 
618  child = child.GetSibling();
619  }
620  if (childLayers.IsEmpty())
621  return;
622  }
623 
624  m_iNumberOfSoldiersInTheArea = 0;
625  foreach (SCR_ScenarioFrameworkLayerBase layer : childLayers)
626  {
627  if (!layer)
628  continue;
629 
630  if (layer.GetName() == m_sQRFLayerName)
631  {
632  m_QRFLayer = layer;
633  IEntity child = layer.GetOwner().GetChildren();
634  SCR_ScenarioFrameworkQRFSlotAI qrfSlot;
635  while (child)
636  {
637  qrfSlot = SCR_ScenarioFrameworkQRFSlotAI.Cast(child.FindComponent(SCR_ScenarioFrameworkQRFSlotAI));
638  if (qrfSlot && !m_aQRFSpawnPoints.Contains(qrfSlot))
639  m_aQRFSpawnPoints.Insert(qrfSlot);
640 
641  child = child.GetSibling();
642  }
643  continue;
644  }
645  }
646 
647  CheckForAIToWatch(m_AreaFramework.GetOwner());
648  }
649 
650  //------------------------------------------------------------------------------------------------
652  protected void CheckForAIToWatch(IEntity entity)
653  {
654  IEntity child = entity.GetChildren();
656  while (child)
657  {
658  layer = SCR_ScenarioFrameworkLayerBase.Cast(child.FindComponent(SCR_ScenarioFrameworkLayerBase));
659  if (SCR_ScenarioFrameworkSlotAI.Cast(layer) || SCR_ScenarioFrameworkSlotTaskAI.Cast(layer))
660  WatchAIGroup(layer.GetSpawnedEntities());
661  else if (layer && layer.GetName() != m_sQRFLayerName)
662  CheckForAIToWatch(child);
663 
664  child = child.GetSibling();
665  }
666  }
667 }
SCR_QRFTypeMaxDistance
Definition: SCR_QRFTypeMaxDistance.c:1
GetCharacterController
protected SCR_CharacterControllerComponent GetCharacterController(IEntity from)
Definition: SCR_ItemPlacementComponent.c:50
SCR_QRFWaypointConfig
void SCR_QRFWaypointConfig(ResourceName wpPrefab, SCR_EQRFGroupOrderType groupType=SCR_EQRFGroupOrderType.ANY, int distanceOffset=0, vector wpPosition=vector.Zero)
Definition: SCR_QRFWaypointConfig.c:50
REMAINING_UNITS
REMAINING_UNITS
Definition: SCR_ScenarioFrameworkActionQRFDispacher.c:3
ECharacterLifeState
ECharacterLifeState
Definition: ECharacterLifeState.c:12
GetAIGroup
override SCR_EditableEntityComponent GetAIGroup()
Definition: SCR_EditableCharacterComponent.c:526
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_GadgetManagerComponent
Definition: SCR_GadgetManagerComponent.c:138
SCR_EQRFGroupOrderType
SCR_EQRFGroupOrderType
Extension to allow for comparing orders with type of a group to which it should apply with option to ...
Definition: SCR_QRFWaypointConfig.c:2
SCR_StringHelper
Definition: SCR_StringHelper.c:1
ECompartmentType
ECompartmentType
Definition: ECompartmentType.c:7
EDamageState
EDamageState
Definition: EDamageState.c:12
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
conf
Configs ServerBrowser KickDialogs conf
Definition: SCR_NotificationSenderComponent.c:23
Init
void Init(IEntity entity=null, vector worldPos=vector.Zero, float timestamp=0.0, EAITargetInfoCategory category=0)
Definition: SCR_AITargetInfo.c:27
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
SCR_Math3D
Contains various scripted 3D math functions.
Definition: SCR_Math3D.c:2
BaseContainerProps
enum SCR_EQRFThresholdType BaseContainerProps()
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition: SCR_BaseGameModeComponent.c:15
OnActivate
override void OnActivate()
Definition: SCR_CharacterCommandLoiter.c:23
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ContainerActionTitle
SCR_ContainerActionTitle BaseContainerCustomTitle SCR_ContainerActionTitle()] class SCR_ScenarioFrameworkActionBase
Definition: SCR_ScenarioFrameworkActions.c:43
SCR_ScenarioFrameworkArea
Definition: SCR_ScenarioFrameworkArea.c:24
SCR_EQRFThresholdType
SCR_EQRFThresholdType
Definition: SCR_ScenarioFrameworkActionQRFDispacher.c:1
SCR_ScenarioFrameworkSlotAI
void SCR_ScenarioFrameworkSlotAI(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_ScenarioFrameworkSlotAI.c:558
PROC_LOST_UNITS
PROC_LOST_UNITS
Definition: SCR_ScenarioFrameworkActionQRFDispacher.c:4
SCR_QRFSpawnSafeZone
Definition: SCR_QRFSpawnSafeZone.c:1
SCR_EQRFGroupType
SCR_EQRFGroupType
Definition: SCR_QRFGroupConfig.c:1
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
DEAD_UNITS
DEAD_UNITS
Definition: SCR_ScenarioFrameworkActionQRFDispacher.c:2
SCR_AIGroup
Definition: SCR_AIGroup.c:68
SCR_ScenarioFrameworkLayerBase
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_ScenarioFrameworkLayerBase.c:875
SCR_QRFVehicleSpawnConfig
Definition: SCR_QRFVehicleSpawnConfig.c:1
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
PlayerManager
Definition: PlayerManager.c:12